-
Notifications
You must be signed in to change notification settings - Fork 55
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
feat: hardhat task to test chain adapter token bridging #669
Conversation
This has some limitations around USDC native/bridged coincidence, but should otherwise be useful for testing chain adapters for new deployments (where CCTP is very unlikely to be enabled anyway).
|
||
task("testChainAdapter", "Verify a chain adapter") | ||
.addParam("chain", "chain ID of the adapter being tested") | ||
.addParam("token", "Token to bridge to the destination chain") |
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.
Should probably addParam("amount", ...)
here to allow the user to specify the amount to bridge.
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.
tasks/testChainAdapter.ts
Outdated
|
||
const erc20 = (await ethers.getContractFactory("ExpandedERC20")).attach(tokenAddress); | ||
const amount = 1_000_000; | ||
let txn = await erc20.connect(signer).transfer(adapterAddress, amount); |
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.
It's probably worth adding a warning here, since this transfer can be rugged by any third party who happens to call relayTokens
first.
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.
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 do think adding an amount to send is nice, but otherwise, LGTM
This has some limitations around USDC native/bridged coincidence, but should otherwise be useful for testing chain adapters for new deployments (where CCTP is very unlikely to be enabled anyway).
This has some limitations around USDC native/bridged coincidence, but should otherwise be useful for testing chain adapters for new deployments (where CCTP is very unlikely to be enabled anyway).