Description
Some payment tokens migrate to new decimals. Provide a controlled migration path that re-scales stored amounts and updates metadata under issuer authorization.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
src/lib.rs
- Migration must be idempotent per (offering_id, from_decimals, to_decimals)
Suggested execution
- Fork the repo and create a branch
git checkout -b feat/denom-migration
- Implement changes
- Add
migrate_denomination(offering_id, from_dec, to_dec)
- Re-scale stored amounts with checked arithmetic
- Emit
denom_migrated event
- Validate security and correctness assumptions
Test and commit
- Run tests
- Cover edge cases
- Downscale that would round to zero for smallest balances
- Include test output and security notes
Example commit message
feat: add denomination migration path
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
Some payment tokens migrate to new decimals. Provide a controlled migration path that re-scales stored amounts and updates metadata under issuer authorization.
Requirements and context
src/lib.rsSuggested execution
git checkout -b feat/denom-migrationmigrate_denomination(offering_id, from_dec, to_dec)denom_migratedeventTest and commit
cargo test --allExample commit message
feat: add denomination migration pathGuidelines