Skip to content

Hardcoded share_decimals: 6 in Factory Ignores Asset's Actual Decimals #66

@Jayy4rl

Description

@Jayy4rl

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

  • share_decimals is configurable per vault
  • No hardcoded 6u32 remains
  • CreateVaultParams and BatchVaultParams include the new field
  • Existing simple creation function uses a documented default

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions