-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add totalSupply util method & script
- Loading branch information
1 parent
5cb0a4d
commit 4fdd973
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import "EVM" | ||
|
||
import "EVMUtils" | ||
import "FlowEVMBridgeUtils" | ||
|
||
/// Retrieves the total supply of the ERC20 contract at the given EVM contract address. Reverts on EVM call failure. | ||
/// | ||
/// @param evmContractAddress: The EVM contract address to retrieve the total supply from | ||
/// | ||
/// @return the total supply of the ERC20 | ||
/// | ||
access(all) fun main(evmContractAddressHex: String): UInt256 { | ||
let evmContractAddress = EVMUtils.getEVMAddressFromHexString(address: evmContractAddressHex) | ||
?? panic("Invalid EVM contract address hex: ".concat(evmContractAddressHex)) | ||
return FlowEVMBridgeUtils.totalSupply(evmContractAddress: evmContractAddress) | ||
} |