Digital cash grand refactor + FungiblePayment#2274
Merged
andrei-marinica merged 34 commits intomasterfrom Jan 31, 2026
Merged
Conversation
|
Contract comparison - from d68598c to 42349d9
|
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)