Closed fadeev closed 4 months ago
We also probably need a convention to label tokens from different chains. For example, when using the swap example you want swap USDC for gETH on Goerli:
px hardhat interact --contract ADDRESS --amount 0.05 --denom usdc --target-token eth --network goerli_testnet --recipient ADDRESS --destination mumbai_testnet
If there is no denom (usdc
) we can default to native gas token.
If we ever need to specify both a chain and a token, we can do something like goerli_testnet:usdc
.
Should we do something like:
"zevm": {
"goerli_testnet": {
"zrc20": [
{
"symbol": "gETH",
"zrc20_contract_address": "0x13A0c5930C028511Dc02665E7285134B6d11A5f4"
},
{
"symbol": "USDC",
"zrc20_contract_address": "0x0cbe0dF132a6c6B4a2974Fa1b7Fb953CF0Cc798a"
}
]
},
}
Using the structure from the foreign coins API for consistency.
@andresaiello @lucas-janon I really think we should start thinking about a new structure for addresses.json
. USDC addresses are currently missing from the JSON and this forces people to get addresses directly from chain's API.
How about simplifying the structure:
[
{
"chain": "goerli_testnet",
"type": "zetaToken",
"address": "0x5b1869D9A4C187F2EAa108f3062412ecf0526b24",
"category": "messaging"
},
{
"chain": "goerli_testnet",
"type": "tss",
"address": "0x5b1869D9A4C187F2EAa108f3062412ecf0526b24",
"category": "omnichain"
},
{
"chain": "zeta_testnet",
"type": "zrc20",
"symbol": "USDC",
"address": "0x5b1869D9A4C187F2EAa108f3062412ecf0526b24",
"category": "omnichain"
},
{
"chain": "zeta_testnet",
"type": "zrc20",
"symbol": "gETH",
"address": "0x5b1869D9A4C187F2EAa108f3062412ecf0526b24",
"category": "omnichain"
}
]
A flat array structure will let us add more metadata to addresses if needed.
getAddress(chain, type, symbol = null)
Symbol is optional, this way the function is backwards compatible.
getAddress("mumbai_tesnet", "tss")
getAddress("zeta_tesnet", "zrc20", "usdc")
The following will throw an error and we can make the error very discriptive by listing all valid options calculated automatically from the JSON:
getAddress("zeta_tesnet", "zrc20")
Error: please, specify symbol (for example, "usdc", "geth", "tmatic", "tbnb", "tbsc")
We can also run a script to validate the JSON and generate the types from it as well.
@lucas-janon @andresaiello please, provide feedback on this! We still don't have USDC in our JSON ‼️
I think we can have two models, tokens and non tokens. For tokens I like
{
"zrc20_contract_address": "0x91d4F0D54090Df2D81e834c3c8CE71C6c865e79F",
"asset": "0x9999f7fea5938fd3b1e26a12c3f2fb024e194f97",
"foreign_chain_id": "80001",
"decimals": 6,
"name": "USDC-mumbai_testnet",
"symbol": "USDC",
"coin_type": "ERC20",
"gas_limit": "100000",
"paused": false
},
but for non tokens has a lot of extra info that will be always empty (like for tss etc) and for those we can use the simplify model
@andresaiello but they will still be in a single array like so, right?
{
"chain": "goerli_testnet",
"type": "tss",
"address": "0x5b1869D9A4C187F2EAa108f3062412ecf0526b24",
"category": "omnichain"
},
{
"zrc20_contract_address": "0x91d4F0D54090Df2D81e834c3c8CE71C6c865e79F",
"asset": "0x9999f7fea5938fd3b1e26a12c3f2fb024e194f97",
"foreign_chain_id": "80001",
"decimals": 6,
"name": "USDC-mumbai_testnet",
"symbol": "USDC",
"coin_type": "ERC20",
"gas_limit": "100000",
"paused": false
},
I've updated the script and now it generates addresses in the updated format:
https://github.com/zeta-chain/protocol-contracts/pull/10#issuecomment-1884748662
Currently we have only 1 ZRC-20 per chain:
https://github.com/zeta-chain/protocol-contracts/blob/6005f2247c787ead18857f81717b844c086c9af4/data/addresses.json#L121-L137
On chain "foreign coins":
Source: https://zetachain-athens.blockpi.network/lcd/v1/public/zeta-chain/zetacore/fungible/foreign_coins
cc @lucas-janon @andresaiello