-
Notifications
You must be signed in to change notification settings - Fork 107
Digital cash grand refactor + FungiblePayment #2274
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
Conversation
|
Contract comparison - from d68598c to 42349d9
|
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.
Pull request overview
This pull request implements a comprehensive refactoring of the digital cash contract, modernizing its architecture and improving the fee management system. The changes introduce a new FungiblePayment type to the framework and completely redesign how deposits and fees are handled in the digital cash contract.
Changes:
- Introduced
FungiblePayment<M>type in the framework for handling fungible tokens (tokens with nonce = 0) - Completely refactored the digital cash contract's fee system from whitelist/blacklist to a flexible base fee configuration with global toggle
- Replaced time-based expiration (rounds) with timestamp-based expiration (milliseconds)
- Migrated from
ManagedAddressdeposit keys toDepositKey(ED25519 public keys) for cryptographic check functionality - Renamed endpoints for clarity (e.g.,
withdraw→withdrawExpired,whitelistFeeToken→setFee)
Reviewed changes
Copilot reviewed 36 out of 37 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| framework/derive/src/preprocessing/substitution_list.rs | Adds FungiblePayment to managed types list for code generation |
| framework/base/src/types/managed/wrapped/token/payment.rs | Adds fungible_or_panic conversion method and manual TypeAbi impl |
| framework/base/src/types/managed/wrapped/token/fungible_payment.rs | New FungiblePayment type for fungible-only tokens |
| framework/base/src/types/managed/wrapped/token.rs | Exports new FungiblePayment type |
| framework/base/src/err_msg.rs | Renames error message constant for consistency |
| framework/base/src/contract_base/wrappers/call_value_wrapper.rs | Updates to use renamed error constant |
| contracts/examples/order-book/pair/src/*.rs | Renames local FungiblePayment to OrderBookFungiblePayment to avoid conflict |
| contracts/examples/digital-cash/wasm/src/lib.rs | Updates exported endpoint list (11→10 endpoints) |
| contracts/examples/digital-cash/tests/*.rs | Reorders tests alphabetically |
| contracts/examples/digital-cash/src/storage.rs | Completely redesigned storage model with new DepositInfo and fee structures |
| contracts/examples/digital-cash/src/signature_operations.rs | Refactored withdraw/claim/forward logic with improved documentation |
| contracts/examples/digital-cash/src/pay_fee_and_fund.rs | Simplified fee payment logic using new fee system |
| contracts/examples/digital-cash/src/digital_cash_deposit.rs | New module for deposit validation and fee management |
| contracts/examples/digital-cash/src/digital_cash.rs | Updated init and endpoints for new fee system |
| contracts/examples/digital-cash/src/digital_cash_proxy.rs | Updated proxy with comprehensive documentation |
| contracts/examples/digital-cash/scenarios/*.scen.json | Updated all scenarios for new API and EGLD-000000 migration |
| contracts/examples/digital-cash/README.md | Updated documentation with new contract behavior |
| contracts/examples/digital-cash/Cargo.toml | Minor formatting fix |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Pull request overview
This pull request implements a comprehensive refactoring of the digital cash contract, modernizing its architecture and improving the fee management system. The changes introduce a new
FungiblePaymenttype to the framework and completely redesign how deposits and fees are handled in the digital cash contract.Acknowledgement
Many thanks to @alyn509 for his sizeable contribution to this PR!
Changes:
FungiblePayment<M>type in the framework for handling fungible tokens (tokens with nonce = 0)ManagedAddressdeposit keys toDepositKey(ED25519 public keys) for cryptographic check functionalitywithdraw→withdrawExpired,whitelistFeeToken→setFee)