Description
In vault_factory::_create_single_rwa_vault, the share_decimals field of InitParams is hardcoded to 6u32 with the comment // USDC convention. If a vault is created with a non-USDC asset (e.g., a token with 18 decimals like a wrapped ETH, or 8 decimals like BTC-pegged tokens), the share/asset ratio will be silently miscalculated by orders of magnitude.
Requirements
- Add a
share_decimals: u32 field to CreateVaultParams / BatchVaultParams
- Pass it through to
InitParams instead of hardcoding 6
- In
create_single_rwa_vault (simple variant), default to 7u32 (SEP-41 convention) or require the caller to specify it as an additional parameter
- Document the relationship between asset decimals and share decimals
Key Files
Definition of Done
Description
In
vault_factory::_create_single_rwa_vault, theshare_decimalsfield ofInitParamsis hardcoded to6u32with the comment// USDC convention. If a vault is created with a non-USDC asset (e.g., a token with 18 decimals like a wrapped ETH, or 8 decimals like BTC-pegged tokens), the share/asset ratio will be silently miscalculated by orders of magnitude.Requirements
share_decimals: u32field toCreateVaultParams/BatchVaultParamsInitParamsinstead of hardcoding6create_single_rwa_vault(simple variant), default to7u32(SEP-41 convention) or require the caller to specify it as an additional parameterKey Files
_create_single_rwa_vault(~L370)BatchVaultParams,CreateVaultParamsDefinition of Done
share_decimalsis configurable per vault6u32remainsCreateVaultParamsandBatchVaultParamsinclude the new field