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

fix: supply decimals and CCTP domain in custom token adapter #690

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bmzig
Copy link
Contributor

@bmzig bmzig commented Oct 24, 2024

Three changes needed to be made:

  1. The Arbitrum "default ERC20 bridge" contract does not have a nativeTokenDecimals function we can call, so we instead define the decimals of the native token it in the constructor. We do not resolve this dynamically since decimals is not required to implement ERC20, so we can't rely on IERC20 to call decimals().
  2. We need to swap the CCTP domain ID from Arbitrum to some arbitrary number, which can be defined in the constructor.
  3. When calling createRetryableTicket to bridge the native gas token, l2CallValue must actually be the amount of the native gas token to send, not zero. This is because l2CallValue is with respect to the L2's native token, not ETH.

deploy/consts.ts Outdated
@@ -48,6 +51,9 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
zoraStandardBridge: "0x3e2Ea9B92B7E48A52296fD261dc26fd995284631",
worldChainCrossDomainMessenger: "0xf931a81D18B1766d15695ffc7c1920a62b7e710a",
worldChainStandardBridge: "0x470458C91978D2d929704489Ad730DC3E3001113",
l1AlephZeroInbox: "0x56D8EC76a421063e1907503aDd3794c395256AEb",
l1AlephZeroERC20GatewayRouter: "0xeBb17f398ed30d02F2e8733e7c1e5cf566e17812",
donationBox: "0x5e40a88E302Da80089Dd13178b8DD6b15534419c",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needs to be swapped out once we deploy an official adapter.

Signed-off-by: bennett <[email protected]>
@bmzig bmzig marked this pull request as ready for review October 24, 2024 20:09
Copy link

socket-security bot commented Oct 24, 2024

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSourceCI
Critical CVE npm/[email protected] ⚠︎

View full report↗︎

Next steps

What is a critical CVE?

Contains a Critical Common Vulnerability and Exposure (CVE).

Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

const { deployer } = await hre.getNamedAccounts();

// @note if deploying this contract on a chain like Linea that only supports up to
// solc 0.8.19, the hardhat.config solc version needs to be overridden and this
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is outdated - Linea supports later versions of solidity but the evm version must be set to london. See https://docs.linea.build/developers/quickstart/ethereum-differences#evm-opcodes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't know this. Nice. 8e20183

@bmzig bmzig requested review from nicholaspai, mrice32 and pxrl and removed request for nicholaspai and mrice32 October 24, 2024 20:20
Signed-off-by: bennett <[email protected]>
Copy link

Report too large to display inline

View full report↗︎

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