-
Notifications
You must be signed in to change notification settings - Fork 68
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
[STABLE-2112]: add example script #5
Conversation
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.
Looks good! Just a few minor comments.
examples/index.js
Outdated
const avaxMessageTransmitterContract = new ethers.Contract(AVAX_MESSAGE_TRANSMITTER_CONTRACT_ADDRESS, messageTransmitterAbi, signer); | ||
|
||
// AVAX destination address | ||
const mintRecipient = "<YOUR_AVAX_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.
can this be paramaterized?
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.
You mean as a env variable. I don't think we can do that with html script
examples/index.js
Outdated
// const approveTx = await usdcEthContract.approve(TOKEN_MESSENGER_CONTRACT_ADDRESS, 500000) // 0.5 USDC | ||
// console.log(`ApproveTx: ${approveTx.hash}`) | ||
|
||
// Wait for transaction to complete | ||
// const approveTxReceipt = await provider.waitForTransaction(approveTx.hash) | ||
// console.log(`ApproveTxReceipt: ${approveTxReceipt}`) |
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.
Metamask ask before burn tx even if we approve
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.
🔥
docs/README.md
Outdated
The script has 5 steps: | ||
1. First step approves `ETH_TOKEN_MESSENGER_CONTRACT_ADDRESS` to withrdraw USDC from our eth address. | ||
```js | ||
const approveTx = await usdcEthContract.methods.approve(ETH_TOKEN_MESSENGER_CONTRACT_ADDRESS, amount+1).send({gas: approveTxGas}) |
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.
Why amount + 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.
Should we also show the usdcEthContract
instantiation here in the steps? Or just leave it for the actual script?
And other contract instantiations below
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.
Why amount + 1?
no reason. As long as the approve amount >= withdraw amount it should be good. I'll remove the +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.
Should we also show the usdcEthContract instantiation here in the steps? Or just leave it for the actual script?
And other contract instantiations below
Just to keep it minimal and not be repetitive, I am just describing the actual function that gets in README. wdyt?
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 think that's fine. Can you add a note at the top then saying these are snippets and link to the fully functioning code?
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.
Looks awesome, couple small things!
docs/README.md
Outdated
The script has 5 steps: | ||
1. First step approves `ETH_TOKEN_MESSENGER_CONTRACT_ADDRESS` to withrdraw USDC from our eth address. | ||
```js | ||
const approveTx = await usdcEthContract.methods.approve(ETH_TOKEN_MESSENGER_CONTRACT_ADDRESS, amount+1).send({gas: approveTxGas}) |
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 we also show the usdcEthContract
instantiation here in the steps? Or just leave it for the actual script?
And other contract instantiations below
Summary
Add a example script to get started with CCTP. The script use web3.js transfer USDC from eth testnet address to avax testnet address.