Skip to content
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

Merged
merged 5 commits into from
Oct 28, 2024

Conversation

pxrl
Copy link
Contributor

@pxrl pxrl commented Oct 16, 2024

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).
@pxrl pxrl requested a review from bmzig October 16, 2024 22:43
tasks/testChainAdapter.ts Outdated Show resolved Hide resolved
tasks/testChainAdapter.ts Outdated Show resolved Hide resolved

task("testChainAdapter", "Verify a chain adapter")
.addParam("chain", "chain ID of the adapter being tested")
.addParam("token", "Token to bridge to the destination chain")
Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


const erc20 = (await ethers.getContractFactory("ExpandedERC20")).attach(tokenAddress);
const amount = 1_000_000;
let txn = await erc20.connect(signer).transfer(adapterAddress, amount);
Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added: 4f903f5 fa55d2a

Copy link
Contributor

@bmzig bmzig left a 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

@pxrl pxrl requested a review from bmzig October 24, 2024 19:24
@pxrl pxrl merged commit feb717a into master Oct 28, 2024
9 checks passed
@pxrl pxrl deleted the pxrl/adapterTest branch October 28, 2024 16:40
pxrl added a commit that referenced this pull request Oct 28, 2024
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).
pxrl added a commit that referenced this pull request Oct 28, 2024
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants