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

ICTT Deployment Fixes #2227

Merged
merged 7 commits into from
Oct 8, 2024
Merged

ICTT Deployment Fixes #2227

merged 7 commits into from
Oct 8, 2024

Conversation

michaelkaplan13
Copy link
Collaborator

@michaelkaplan13 michaelkaplan13 commented Oct 8, 2024

Why this should be merged

  • Fixes a bug where homeKey was left uninitialized prior to use when using an existing TokenHome contract and deploying a new NativeTokenRemote
  • Fixes a bug in balance displays for ERC20 tokens with a decimal count other than 18
  • Fixes a bug where the collateral provided to a TokenHome contract was previously in the remote denomination. Now it uses the correct amount in the home denomination, as reported by the home contract.
  • Adds additional logging

How this works

  • ERC20 balances are now displayed using their specific decimals() count if useGwei is false.
  • The amount of collateral to be added is fetched from the token home rather than using the remote supply.
  • Always prompts for the key to use on the home chain for deployment or collateralization.

How this was tested

Going through the flow of running avalanche ictt deploy --deploy-native-remote for a Fuji L1, and deploying a NativeTokenRemote connected to the existing USDC TokenHome contract on the C-Chain

How is this documented

N/A

@michaelkaplan13 michaelkaplan13 requested a review from a team as a code owner October 8, 2024 18:45
@michaelkaplan13 michaelkaplan13 merged commit 3ec8d93 into main Oct 8, 2024
33 checks passed
@michaelkaplan13 michaelkaplan13 deleted the ictt-home-deployer-key-fix branch October 8, 2024 21:09
@@ -458,6 +459,7 @@ func TokenHomeAddCollateral(
remoteAddress common.Address,
amount *big.Int,
) error {
ux.Logger.PrintToUser("Collateralizing remote contract on the home chain")
Copy link
Collaborator

@felipemadero felipemadero Oct 8, 2024

Choose a reason for hiding this comment

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

should we add action description logs to this lib? besides this, should we pass the logger as an arg?

rpcURL string,
privateKey string,
remoteAddress common.Address,
) error {
ux.Logger.PrintToUser("Registering remote contract with home contract")
Copy link
Collaborator

Choose a reason for hiding this comment

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

same comment on logs

// Get the decimal count for the token to format the balance.
// Note: decimals() is not officially part of the IERC20 interface, but is a common extension.
decimals, err := token.Decimals(nil)
if err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we default to some standard decimal in case of error for not being official?

homeKeyAddress = crypto.PubkeyToAddress(pk.PublicKey).Hex()
// Get the key to be used to deploy the token home contract and collateralize the remote
// in the case that it is a native token remote.
homeKey, homeKeyAddress, err := getHomeKeyAndAddress(app, network, flags.homeFlags)
Copy link
Collaborator

Choose a reason for hiding this comment

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

previously the bug was not asking for it when needed, but now it may also ask for it when not needed,
as in the case the home preexists and there is no collateralization needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants