-
Notifications
You must be signed in to change notification settings - Fork 66
feat: Make share_decimals configurable per vault #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -51,12 +51,26 @@ pub struct SingleRwaVaultInitParams { | |||||||||
| } | ||||||||||
|
|
||||||||||
| /// Parameters for batch vault creation (mirrors BatchVaultParams in Solidity). | ||||||||||
| /// | ||||||||||
| /// # Share Decimals | ||||||||||
| /// `share_decimals` determines the decimal precision of the vault's share token. | ||||||||||
| /// This is independent of the underlying asset's decimals. Common conventions: | ||||||||||
| /// - 6: USDC convention (matching USDC/USDT) | ||||||||||
| /// - 7: SEP-41 convention (Stellar ecosystem standard for asset-anchored tokens) | ||||||||||
| /// - 8: BTC-pegged tokens convention | ||||||||||
| /// - 18: ETH/ERC-20 convention (for compatibility with ETH-based systems) | ||||||||||
| /// | ||||||||||
| /// The share/asset ratio is calculated based on these decimals, so using the | ||||||||||
| /// wrong value will result in incorrect share pricing. | ||||||||||
| #[contracttype] | ||||||||||
| #[derive(Clone, Debug)] | ||||||||||
| pub struct BatchVaultParams { | ||||||||||
| pub asset: Address, | ||||||||||
| pub name: String, | ||||||||||
| pub symbol: String, | ||||||||||
| /// Number of decimal places for the vault's share token. | ||||||||||
| /// Default: 7u32 (SEP-41 convention). Set to 6u32 for USDC-aligned assets. | ||||||||||
|
||||||||||
| /// Default: 7u32 (SEP-41 convention). Set to 6u32 for USDC-aligned assets. | |
| /// Recommended: 7u32 (SEP-41 convention, used by the factory's simple | |
| /// creation flows). Set to 6u32 for USDC-aligned assets, or another value | |
| /// as appropriate for the asset. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description states "no breaking changes", but adding a required
share_decimalsfield toCreateVaultParams/BatchVaultParamschanges the XDR shape of arguments forcreate_single_rwa_vault_full/create_single_rwa_vault_batch/batch_create_vaults. Existing off-chain callers will need to update their generated bindings / param construction. Please either (a) update the PR description/release notes to reflect the breaking API change, or (b) preserve backward compatibility by keeping the old entrypoints/types and adding new ones that includeshare_decimals(or making the field optional with an explicit default).