-
Notifications
You must be signed in to change notification settings - Fork 4
[NONEVM-3185] [OnRamp] Replace Withdrawable with WithdrawFeeTokens #448
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
[NONEVM-3185] [OnRamp] Replace Withdrawable with WithdrawFeeTokens #448
Conversation
c96b00d to
1fa99df
Compare
efec888 to
bcea881
Compare
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 PR implements a new withdrawFeeTokens function for the OnRamp contract that uses the feeAggregator address to collect fees. The implementation replaces the previous withdrawable pattern with a permissionless function that validates token types and enforces balance reserves.
Key changes:
- Added
reservefield toDynamicConfigto specify minimum balance that must remain on contract - Replaced
Withdrawable_Withdrawmessage withOnRamp_WithdrawFeeTokensmessage - Added validation for empty fee tokens list and new error codes
UnknownTokenandInsufficientValue
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/ccip/bindings/onramp/onramp.go | Updated DynamicConfig struct to include Reserve field and added WithdrawFeeTokens struct with validation |
| pkg/ccip/bindings/onramp/onramp_test.go | Added Reserve field to test configuration |
| pkg/ccip/bindings/onramp/exitcode_string.go | Updated exit code mappings for new error types |
| deployment/ccip/sequence/deploy_ccip.go | Added reserve field parsing for OnRamp deployment |
| deployment/ccip/cs_test_helpers.go | Added Reserve value to test helper configuration |
| deployment/ccip/config/deploy.go | Added Reserve field to OnRampParams |
| contracts/wrappers/ccip/OnRamp.ts | Implemented withdrawFeeTokens message codec and updated DynamicConfig type |
| contracts/tests/ccip/router/Router.Setup.ts | Added reserve field to OnRamp deployment setup |
| contracts/tests/ccip/onramp/OnRamp.withdrawFeeToken.spec.ts | Added comprehensive test coverage for withdrawFeeTokens functionality |
| contracts/tests/ccip/onramp/OnRamp.spec.ts | Removed Withdrawable tests and updated deployment helper usage |
| contracts/tests/ccip/onramp/OnRamp.setDynamicConfig.spec.ts | Added reserve field to dynamic config tests |
| contracts/tests/ccip/onramp/OnRamp.send.spec.ts | Updated to use new setup function signature |
| contracts/tests/ccip/onramp/OnRamp.getFee.spec.ts | Updated to use new setup function signature |
| contracts/tests/ccip/onramp/OnRamp.generateMessageID.spec.ts | Updated to use new setup function signature |
| contracts/tests/ccip/onramp/OnRamp.executorExited.spec.ts | Updated to use new setup function signature |
| contracts/tests/ccip/onramp/OnRamp.applyDestChainConfigUpdates.spec.ts | Updated to use new setup function signature |
| contracts/tests/ccip/onramp/OnRamp.Setup.ts | Modified deployOnRampContract to return config object and updated setup function |
| contracts/contracts/ccip/onramp/types.tolk | Added reserve field to DynamicConfig struct |
| contracts/contracts/ccip/onramp/messages.tolk | Added OnRamp_WithdrawFeeTokens message and associated cost calculation |
| contracts/contracts/ccip/onramp/errors.tolk | Added UnknownToken and InsufficientValue error types |
| contracts/contracts/ccip/onramp/contract.tolk | Implemented onWithdrawFeetokens handler with reserve validation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| struct (0x7052dc75) OnRamp_WithdrawFeeTokens { | ||
| feeTokens: SnakedCell<address>; |
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.
We would also need amounts.
As this is an async env best option is the sender checks balances off-chain, sends amounts and we try to transfer to fee aggregator.
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.
I wrote this taking only addresses to match EVM interface. However, Jetton wallets don't have onchain amount getters. We could keep a balance counter here, or accept amount as an argument
577e79a to
a05f9d5
Compare
This reverts commit 897a04f.
NONEVM-3185