-
Notifications
You must be signed in to change notification settings - Fork 30
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
Gho ccip bridge (#7) #347
base: main
Are you sure you want to change the base?
Gho ccip bridge (#7) #347
Conversation
Can you clarify why all issues are considered resolved, although the code is not updated and does not compile with current versions? We just don't understand a little, if the changes are in another PR, can you send a link? |
@pavelvm5 maybe you should run |
the problem is not yarn, it's that the new version has a You either need to set the commit in the solidity-utils library to the old one in foundry.toml config, or write an implementation for the new version. I recommend doing the second version, solidity-utils will not be updated anytime soon. The same goes for the chainlink dependency, which now requires 9 arguments instead of 6. And the same about guardians, their addresses exist in address-book for now. |
Can you try after run chainlink packages updated and this updates only applied for testnet. so we should use prev persion and I configured this on package.json correctly now. |
eebbcd2
to
83f6ab5
Compare
Not following Solidity style guide conventions for functions order. I d suggest to fix the order in interfaces and contracts. |
// https://etherscan.io/address/0x06179f7C1be40863405f374E7f5F8806c728660A | ||
ILockReleaseTokenPool ghoPool = ILockReleaseTokenPool( | ||
0x06179f7C1be40863405f374E7f5F8806c728660A | ||
); | ||
(uint128 limit, , , , ) = ghoPool.getCurrentInboundRateLimiterState(ARBITRUM_CHAIN_SELECTOR); |
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.
imo better to create constant variables in the contract and create a fn helper for this
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.
sorry I don't understand, so should I add a function to get current rate limit on bridge contract or can you elaborate more on this?
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.
yes, separate internal function for this and use contract-level contracts rather than hardcoding addresses
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've added rate limit checking functionality on contract. and moved quote/bridge tests from mock test to fork test
we can't test it on mock environment because we can't make mock contracts for all of ccip contracts - (router, onRamp, TokenPool and so on)
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 was referring to tests specifically. The rate limit check on the contract is a good addition, but more a design choice (e.g. whether to revert in the helper contract or in ccip).
btw, why you cannot mock ccip contracts?
@@ -134,6 +134,41 @@ contract BridgeToken is AaveCcipGhoBridgeTestBase { | |||
vm.stopPrank(); | |||
} | |||
|
|||
function test_success_ReturnNativeFee() external { |
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.
can we add also a test where GHO is used as feeToken but also ETH is sent, so ETH gets refunded?
is there a case where funds are sent but none of them are needed because the bridge already has enough funds to cover the transfer?
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.
yeah. I added such test also
https://github.com/bgd-labs/aave-helpers/pull/347/files#diff-d26e53943e6fc573eecd41f6e4f12bb05bfaea6e368642c0c5ae382835386d43R197
you can check this
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.
link does not work, can you provide file pemalink pls?
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.
Please check again BridgeTest/QuoteTest of fork tests
ITokenPool tokenPool = ITokenPool( | ||
IOnRampClient(onRamp).getPoolBySourceToken(_destinationChainSelector, GHO) | ||
); | ||
if (block.chainid == 1) { |
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.
what's the rationale here? we can only check outbound rate limit when bridging
interface IOnRampClient { | ||
/// @notice Get the pool for a specific token | ||
function getPoolBySourceToken( | ||
uint64 destChainSelector, | ||
address sourceToken | ||
) external view returns (address); | ||
} | ||
|
||
interface ITokenPool { |
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 d suggest to move these out of this file
|
||
vm.selectFork(mainnetFork); | ||
uint256 fee = mainnetBridge.quoteBridge(ARBITRUM_CHAIN_SELECTOR, amountToSend, 0, feeToken); | ||
deal(AaveV3EthereumAssets.GHO_UNDERLYING, alice, amountToSend + fee); |
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.
can we add a case where the bridge has already enough GHO funds? so bridge does not spend GHO/ETH funds from the user
AaveCcipGhoBridge Smart Contract
Overview
The
AaveCcipGhoBridge
smart contract facilitates the secure bridging of GHO tokens across different blockchain networks using Chainlink's Cross-Chain Interoperability Protocol (CCIP). By leveraging Chainlink's decentralized infrastructure, it ensures reliable and transparent cross-chain token transfers while using GHO tokens exclusively for fees.Key Components
Router and GHO Addresses:
ROUTER
: The Chainlink CCIP router address for cross-chain communication.GHO
: Address of the GHO token, which the contract bridges across chains.Bridges Mapping:
Main Functionalities
Token Transfers:
checkDestination
modifier ensures that the destination chain and bridge are properly configured before any transfer.Fee Payment:
Cross-Chain Message Handling:
_ccipReceive
function.Quote Transfer:
quoteTransfer
function allows users to estimate the GHO fee required for a transfer without executing the transfer.Setting Destination Bridges:
setDestinationBridge
function.Security Features
Role-Based Access Control:
Uses
AccessControl
to manage permissions:DEFAULT_ADMIN_ROLE
: Grants administrative rights.BRIDGER_ROLE
: Restricts who can initiate bridging operations.This ensures that only authorized users can perform critical functions.
Destination Validation:
The
checkDestination
modifier ensures that the destination chain and bridge address are properly configured before executing transfers.Token Approval Management:
Securely handles GHO token approvals for the router, mitigating over-approval risks.
Rescue Functionality:
Implements a
Rescuable
mechanism, allowing theEXECUTOR
to rescue funds in emergencies while maintaining security boundaries.CCIP Sender and Receiver Validation:
Events
Error Handling
Deployed Addresses
Mainnet: 0x5648f519b2064ff30385828e76fefda749749ac2, Arbitrum: 0x03f589a825ee129c5c6d2f6ef5c259870019567b
Confirmed Bridges:
Conclusion
The
AaveCcipGhoBridge
smart contract provides a robust mechanism for bridging GHO tokens across multiple chains via Chainlink's CCIP. It offers flexibility in fee payments, supports secure cross-chain transfers, and allows for easy configuration of destination bridges.