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

chore: update polygon and base contract addresses #330

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions v1/data/addresses.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"ccm": {
"base_testnet": {
Copy link
Member

@Mfigueira Mfigueira Aug 16, 2024

Choose a reason for hiding this comment

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

Should this be updated to base_sepolia?

Suggested change
"base_testnet": {
"base_sepolia": {

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a legacy file that hasn't been updated in ages. This file as well as address.tools.ts and some other files are just there, because they may have been used by the protocol contracts deploy scripts.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated files are addresses.mainnet.json and addresses.testnet.json.

Copy link
Member

Choose a reason for hiding this comment

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

Got it, just wondering about this file being updated in this PR, we can ignore this

"connector": "0xc0B74d761ef4EC9e9473f65687d36B9F13DB0dCc",
"erc20Custody": "0x3A1f7b35EF57543B4e86c384eF6a368Ed811a36E",
"immutableCreate2Factory": "0x095a03c6a68137fE9a566bBc3e552F299d8b886d",
"tss": "0x8531a5aB847ff5B22D855633C25ED1DA3255247e",
"tssUpdater": "0xdE3fb63723f0EEed8967ff9124e1c3bA89871b03",
"zetaToken": "0xf4e63991E7475b659bd97Bba85f32a7259239D5d",
"zetaTokenConsumerUniV2": "",
"zetaTokenConsumerUniV3": ""
},
"bsc_mainnet": {
"connector": "0x000063A6e758D9e2f438d430108377564cf4077D",
"erc20Custody": "0x00000fF8fA992424957F97688015814e707A0115",
Expand Down Expand Up @@ -81,16 +91,6 @@
"zetaToken": "0x5F0b1a82749cb4E2278EC87F8BF6B618dC71a8bf",
"zetaTokenConsumerUniV2": "",
"zetaTokenConsumerUniV3": ""
},
"base_testnet": {
"connector": "0xc0B74d761ef4EC9e9473f65687d36B9F13DB0dCc",
"immutableCreate2Factory": "0x095a03c6a68137fE9a566bBc3e552F299d8b886d",
"erc20Custody": "0x3A1f7b35EF57543B4e86c384eF6a368Ed811a36E",
"tss": "0x8531a5aB847ff5B22D855633C25ED1DA3255247e",
"tssUpdater": "0xdE3fb63723f0EEed8967ff9124e1c3bA89871b03",
"zetaToken": "0xf4e63991E7475b659bd97Bba85f32a7259239D5d",
"zetaTokenConsumerUniV2": "",
"zetaTokenConsumerUniV3": ""
}
},
"non_zeta": {
Expand Down
26 changes: 26 additions & 0 deletions v1/data/addresses.mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,32 @@
"symbol": "ETH.ETH",
"type": "zrc20"
},
{
"address": "0xdbfF6471a79E5374d771922F2194eccc42210B9F",
"asset": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
"category": "omnichain",
"chain_id": 7000,
"chain_name": "zeta_mainnet",
"coin_type": "erc20",
"decimals": 18,
"description": "ZetaChain ZRC20 USDT on POL",
"foreign_chain_id": "137",
"symbol": "USDT.POL",
"type": "zrc20"
},
{
"address": "0xfC9201f4116aE6b054722E10b98D904829b469c3",
"asset": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
"category": "omnichain",
"chain_id": 7000,
"chain_name": "zeta_mainnet",
"coin_type": "erc20",
"decimals": 18,
"description": "ZetaChain ZRC20 USDC on POL",
"foreign_chain_id": "137",
"symbol": "USDC.POL",
"type": "zrc20"
},
{
"address": "bc1qm24wp577nk8aacckv8np465z3dvmu7ry45el6y",
"category": "omnichain",
Expand Down
90 changes: 55 additions & 35 deletions v1/data/addresses.testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,19 @@
"symbol": "gETH",
"type": "zrc20"
},
{
"address": "0x236b0DE675cC8F46AE186897fCCeFe3370C9eDeD",
"asset": "",
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"coin_type": "gas",
"decimals": 18,
"description": "ZetaChain ZRC20 Base Sepolia ETH-base_sepolia",
"foreign_chain_id": "84532",
"symbol": "ETH.BASESEPOLIA",
"type": "zrc20"
},
{
"address": "0x48f80608B672DC30DC7e3dbBd0343c5F02C738Eb",
"asset": "",
Expand Down Expand Up @@ -311,6 +324,48 @@
"chain_name": "amoy_testnet",
"type": "zetaToken"
},
{
"address": "0xc0B74d761ef4EC9e9473f65687d36B9F13DB0dCc",
"category": "messaging",
"chain_id": 84532,
"chain_name": "base_sepolia",
"type": "connector"
},
{
"address": "0x3A1f7b35EF57543B4e86c384eF6a368Ed811a36E",
"category": "omnichain",
"chain_id": 84532,
"chain_name": "base_sepolia",
"type": "erc20Custody"
},
{
"address": "0xdE3fb63723f0EEed8967ff9124e1c3bA89871b03",
"category": "messaging",
"chain_id": 84532,
"chain_name": "base_sepolia",
"type": "pauser"
},
{
"address": "0x8531a5aB847ff5B22D855633C25ED1DA3255247e",
"category": "omnichain",
"chain_id": 84532,
"chain_name": "base_sepolia",
"type": "tss"
},
{
"address": "0xdE3fb63723f0EEed8967ff9124e1c3bA89871b03",
"category": "omnichain",
"chain_id": 84532,
"chain_name": "base_sepolia",
"type": "tssUpdater"
},
{
"address": "0xf4e63991E7475b659bd97Bba85f32a7259239D5d",
"category": "messaging",
"chain_id": 84532,
"chain_name": "base_sepolia",
"type": "zetaToken"
},
{
"address": "0x3963341dad121c9CD33046089395D66eBF20Fb03",
"category": "messaging",
Expand Down Expand Up @@ -380,40 +435,5 @@
"chain_id": 11155111,
"chain_name": "sepolia_testnet",
"type": "zetaTokenConsumerUniV3"
},
{
"address": "0x8531a5aB847ff5B22D855633C25ED1DA3255247e",
"category": "omnichain",
"chain_id": 84532,
"chain_name": "base_testnet",
"type": "tss"
},
{
"address": "0xdE3fb63723f0EEed8967ff9124e1c3bA89871b03",
"category": "omnichain",
"chain_id": 84532,
"chain_name": "base_testnet",
"type": "tssUpdater"
},
{
"address": "0xf4e63991E7475b659bd97Bba85f32a7259239D5d",
"category": "messaging",
"chain_id": 84532,
"chain_name": "base_testnet",
"type": "zetaToken"
},
{
"address": "0x3A1f7b35EF57543B4e86c384eF6a368Ed811a36E",
"category": "omnichain",
"chain_id": 84532,
"chain_name": "base_testnet",
"type": "erc20Custody"
},
{
"address": "0xc0B74d761ef4EC9e9473f65687d36B9F13DB0dCc",
"category": "messaging",
"chain_id": 84532,
"chain_name": "base_testnet",
"type": "connector"
}
]
43 changes: 3 additions & 40 deletions v1/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,4 @@
import { ZetaProtocolNetwork } from "./address.tools";
export type ParamSymbol = "USDC.BSC" | "USDC.ETH" | "BTC.BTC" | "PEPE.ETH" | "BNB.BSC" | "SHIB.ETH" | "USDT.ETH" | "USDT.BSC" | "POL.POLYGON" | "DAI.ETH" | "ETH.ETH" | "USDT.POL" | "USDC.POL" | "sETH.SEPOLIA" | "USDC" | "gETH" | "ETH.BASESEPOLIA" | "tMATIC" | "tBTC" | "MATIC.AMOY" | "USDC.SEPOLIA" | "tBNB";
export type ParamChainName = "eth_mainnet" | "bsc_mainnet" | "polygon_mainnet" | "zeta_mainnet" | "btc_mainnet" | "bsc_testnet" | "zeta_testnet" | "btc_testnet" | "amoy_testnet" | "base_sepolia" | "sepolia_testnet";
export type ParamType = "connector" | "erc20Custody" | "pauser" | "tss" | "tssUpdater" | "uniswapV2Factory" | "uniswapV2Router02" | "uniswapV3Factory" | "uniswapV3Router" | "weth9" | "zetaToken" | "fungibleModule" | "systemContract" | "zrc20" | "zetaTokenConsumerUniV3";

export type ParamSymbol =
| "BNB.BSC"
| "BTC.BTC"
| "DAI.ETH"
| "ETH.ETH"
| "gETH"
| "MATIC.AMOY"
| "PEPE.ETH"
| "POL.POLYGON"
| "sETH.SEPOLIA"
| "SHIB.ETH"
| "tBNB"
| "tBTC"
| "tMATIC"
| "USDC.BSC"
| "USDC.ETH"
| "USDC.SEPOLIA"
| "USDC"
| "USDT.BSC"
| "USDT.ETH";

export type ParamChainName = ZetaProtocolNetwork;

Copy link
Member

Choose a reason for hiding this comment

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

Can we update ZetaProtocolNetwork directly and leave this 1:1 type? We are using this on Hub. Also this already includes base_testnet if this is the only change for this type.

Screenshot 2024-08-15 at 15 57 20

Copy link
Member Author

Choose a reason for hiding this comment

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

On chain it's stored as base_sepolia, in the networks package it's base_testnet. I don't expect we change what's on chain, so I propose we change what's in the networks.

https://github.com/zeta-chain/networks/blob/cff04701454b30f401d4b3a12e2ff5ba840c8766/data/networks.json#L57

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I see, is it too much effort to rename all base_testnet instances in favor of base_sepolia in both repositories? I think we should have only one, and agree we should match what's already on chain

Copy link
Member Author

Choose a reason for hiding this comment

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

PR to update the networks package to "base_sepolia" is above.

This PR updates the types in this repo to "base_sepolia". No effort at all.

Copy link
Member

@Mfigueira Mfigueira Aug 15, 2024

Choose a reason for hiding this comment

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

Amazing! Hadn't seen the comment above with the other PR due to a github sync delay.

My original suggestion still applies with a further update then. We should keep ParamChainName = ZetaProtocolNetwork and update base_testnet to base_sepolia in address.tools.ts.

Copy link
Member Author

Choose a reason for hiding this comment

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

types.ts is generated automatically from the addresses JSON. address.tools.ts is a legacy types file maintained manually. Consider switching to types.ts as it ensures that types actually reflect the values that are in the addresses JSON. Let me know if something's missing from types.ts.

Copy link
Member

Choose a reason for hiding this comment

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

That makes sense. We can definitively switch to use that types.ts file directly. Do you think we can remove the address.tools.ts to avoid duplication?

Copy link
Member

@Mfigueira Mfigueira Aug 16, 2024

Choose a reason for hiding this comment

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

I'm taking a look and seems some constants from address.tools.ts are being used in other places from this repo. Maybe we can make a new issue/PR to refactor this separately.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think anyone's going to be refactoring v1 contracts as they're all being replaced by v2.

export type ParamType =
| "connector"
| "erc20Custody"
| "fungibleModule"
| "pauser"
| "systemContract"
| "tss"
| "tssUpdater"
| "uniswapV2Factory"
| "uniswapV2Router02"
| "uniswapV3Factory"
| "uniswapV3Router"
| "weth9"
| "zetaToken"
| "zetaTokenConsumerUniV3"
| "zrc20";
6 changes: 4 additions & 2 deletions v1/tasks/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ const fetchTSSUpdater = async (chains: any, addresses: any) => {
})?.address;
if (erc20Custody) {
if (["18332", "8332"].includes(chain.chain_id)) return;
const rpc = getEndpoints("evm", chain.chain_name)[0]?.url;
const chainName = chain.chain_name === "base_sepolia" ? "base_testnet" : chain.chain_name;
const rpc = getEndpoints("evm", chainName)[0]?.url;
const provider = new ethers.providers.JsonRpcProvider(rpc);
const custody = ERC20Custody__factory.connect(erc20Custody, provider);
return custody.TSSAddressUpdater().then((address: string) => {
Expand All @@ -232,7 +233,8 @@ const fetchPauser = async (chains: any, addresses: any) => {
})?.address;
if (erc20Custody) {
if (["18332", "8332", "7001", "7000"].includes(chain.chain_id)) return;
const rpc = getEndpoints("evm", chain.chain_name)[0]?.url;
const chainName = chain.chain_name === "base_sepolia" ? "base_testnet" : chain.chain_name;
const rpc = getEndpoints("evm", chainName)[0]?.url;
const provider = new ethers.providers.JsonRpcProvider(rpc);
const connector = ZetaConnectorBase__factory.connect(erc20Custody, provider);
return connector.pauserAddress().then((address: string) => {
Expand Down
Loading