Integrate merchant accounts and fee events#159
Open
chigozirim007 wants to merge 1 commit intoShadeProtocol:mainfrom
Open
Integrate merchant accounts and fee events#159chigozirim007 wants to merge 1 commit intoShadeProtocol:mainfrom
chigozirim007 wants to merge 1 commit intoShadeProtocol:mainfrom
Conversation
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.
PR Description
Summary
This PR completes the assigned issues by wiring merchant account deployment into registration, adding a fee collected event with breakdown, implementing time-locked fee updates, and introducing a simple volume-based fee discount system. It also updates the test suite to cover the new behaviors.
Linked Issues
Key Changes
Merchant account deployment and registration
initializenow accepts an account WASM hash and stores it in contract storage.register_merchantdeploys a MerchantAccount contract and stores the account address in the Merchant record and viaget_merchant_account.account: Addressfield.Fee collection event + breakdown
fee_collected_eventwith fieldsfee,token, andmerchant_account.Time-locked fee updates
get_feeapplies pending fee once activation time has passed.Fee discount system
>= 1,000,000total volume: fee is halved>= 10,000,000total volume: fee is quarteredBehavior Notes / Breaking Changes
initializesignature changed toinitialize(env, admin, account_wasm_hash).accountfield; tests and callers updated accordingly.Files Touched (Highlights)
contracts/shade/src/shade.rscontracts/shade/src/interface.rscontracts/shade/src/types.rscontracts/shade/src/components/merchant.rscontracts/shade/src/components/account_factory.rscontracts/shade/src/components/admin.rscontracts/shade/src/components/invoice.rscontracts/shade/src/components/subscription.rscontracts/shade/src/events.rscontracts/shade/src/tests/test_account_factory.rscontracts/shade/src/tests/test_payment.rscontracts/shade/src/tests/test_fees.rsTesting
Migration / Usage Notes