-
Notifications
You must be signed in to change notification settings - Fork 70
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
ICTT Deployment Fixes #2227
Changes from all commits
841c566
6d318fc
5798dd8
0256a8f
5655572
b7a4461
ed97180
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -558,28 +558,44 @@ func getEvmBasedChainAddrInfo( | |
if err != nil { | ||
return addressInfos, err | ||
} | ||
|
||
// Ignore contract address access errors as those may depend on network | ||
tokenSymbol, err := token.Symbol(nil) | ||
if err == nil { | ||
// just ignore contract address access errors as those may depend on network | ||
balance, err := token.BalanceOf(nil, common.HexToAddress(cChainAddr)) | ||
if err != nil { | ||
return addressInfos, err | ||
} | ||
formattedBalance, err := formatCChainBalance(balance) | ||
if err != nil { | ||
return addressInfos, err | ||
} | ||
info := addressInfo{ | ||
kind: kind, | ||
name: name, | ||
chain: chainName, | ||
token: fmt.Sprintf("%s (%s.)", tokenSymbol, tokenAddress[:6]), | ||
address: cChainAddr, | ||
balance: formattedBalance, | ||
network: network.Name(), | ||
} | ||
addressInfos = append(addressInfos, info) | ||
if err != nil { | ||
continue | ||
} | ||
|
||
// Get the raw balance for the given token. | ||
balance, err := token.BalanceOf(nil, common.HexToAddress(cChainAddr)) | ||
if err != nil { | ||
return addressInfos, err | ||
} | ||
|
||
// 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 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
return addressInfos, err | ||
} | ||
|
||
// Format the balance to a human-readable string. | ||
var formattedBalance string | ||
if useGwei { | ||
formattedBalance = fmt.Sprintf("%d", balance) | ||
} else { | ||
formattedBalance = utils.FormatAmount(balance, decimals) | ||
} | ||
|
||
info := addressInfo{ | ||
kind: kind, | ||
name: name, | ||
chain: chainName, | ||
token: fmt.Sprintf("%s (%s.)", tokenSymbol, tokenAddress[:6]), | ||
address: cChainAddr, | ||
balance: formattedBalance, | ||
network: network.Name(), | ||
} | ||
addressInfos = append(addressInfos, info) | ||
} | ||
} | ||
return addressInfos, nil | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ import ( | |
|
||
"github.com/ava-labs/avalanche-cli/pkg/contract" | ||
"github.com/ava-labs/avalanche-cli/pkg/utils" | ||
"github.com/ava-labs/avalanche-cli/pkg/ux" | ||
"github.com/ethereum/go-ethereum/common" | ||
) | ||
|
||
|
@@ -26,11 +27,12 @@ type TokenRemoteSettings struct { | |
TokenHomeDecimals uint8 | ||
} | ||
|
||
func RegisterERC20Remote( | ||
func RegisterRemote( | ||
rpcURL string, | ||
privateKey string, | ||
remoteAddress common.Address, | ||
) error { | ||
ux.Logger.PrintToUser("Registering remote contract with home contract") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment on logs |
||
feeInfo := TeleporterFeeInfo{ | ||
Amount: big.NewInt(0), | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ import ( | |
"math/big" | ||
|
||
"github.com/ava-labs/avalanche-cli/pkg/contract" | ||
"github.com/ava-labs/avalanche-cli/pkg/ux" | ||
"github.com/ava-labs/avalanchego/ids" | ||
"github.com/ethereum/go-ethereum/common" | ||
) | ||
|
@@ -458,6 +459,7 @@ func TokenHomeAddCollateral( | |
remoteAddress common.Address, | ||
amount *big.Int, | ||
) error { | ||
ux.Logger.PrintToUser("Collateralizing remote contract on the home chain") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
endpointKind, err := GetEndpointKind( | ||
rpcURL, | ||
homeAddress, | ||
|
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.
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.