Skip to content

Commit

Permalink
Add goerli beta-to zksync js (#2262)
Browse files Browse the repository at this point in the history
Signed-off-by: deniallugo <[email protected]>
  • Loading branch information
Deniallugo committed Jul 29, 2022
1 parent c1b3375 commit 1efce85
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 8 deletions.
1 change: 1 addition & 0 deletions contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ localConfig.SECURITY_COUNCIL_THRESHOLD = process.env.MISC_SECURITY_COUNCIL_THRES
localConfig.EASY_EXODUS = process.env.CONTRACTS_TEST_EASY_EXODUS === 'true';

const contractDefs = {
goerli: testnetConfig,
rinkeby: testnetConfig,
ropsten: testnetConfig,
mainnet: prodConfig,
Expand Down
5 changes: 5 additions & 0 deletions core/lib/types/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ pub enum Network {
/// Ethereum Rinkeby testnet.
Rinkeby,
/// Ethereum Ropsten testnet.
Goerli,
/// Ethereum Goerli testnet.
Ropsten,
/// Self-hosted Ethereum & zkSync networks.
Localhost,
Expand All @@ -38,6 +40,7 @@ impl FromStr for Network {
"mainnet" => Self::Mainnet,
"rinkeby" => Self::Rinkeby,
"ropsten" => Self::Ropsten,
"goerli" => Self::Goerli,
"localhost" => Self::Localhost,
"test" => Self::Test,
another => return Err(another.to_owned()),
Expand All @@ -52,6 +55,7 @@ impl fmt::Display for Network {
Self::Rinkeby => write!(f, "rinkeby"),
Self::Ropsten => write!(f, "ropsten"),
Self::Localhost => write!(f, "localhost"),
Network::Goerli => write!(f, "goerli"),
Self::Unknown => write!(f, "unknown"),
Self::Test => write!(f, "test"),
}
Expand All @@ -65,6 +69,7 @@ impl Network {
Network::Mainnet => 1,
Network::Ropsten => 3,
Network::Rinkeby => 4,
Network::Goerli => 5,
Network::Localhost => 9,
Network::Unknown => panic!("Unknown chain ID"),
Network::Test => panic!("Test chain ID"),
Expand Down
26 changes: 26 additions & 0 deletions etc/tokens/goerli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"name": "ChainLink Token (goerli)",
"symbol": "LINK",
"decimals": 18,
"address": "0x63bfb2118771bd0da7A6936667A7BB705A06c1bA"
},
{
"name": "wBTC",
"symbol": "wBTC",
"decimals": 8,
"address": "0xCA063A2AB07491eE991dCecb456D1265f842b568"
},
{
"name": "USD Coin (goerli)",
"symbol": "USDC",
"decimals": 6,
"address": "0xd35CCeEAD182dcee0F148EbaC9447DA2c4D449c4"
},
{
"name": "DAI",
"symbol": "DAI",
"decimals": 18,
"address": "0x5C221E77624690fff6dd741493D735a17716c26B"
}
]
1 change: 1 addition & 0 deletions sdk/zksync-rs/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub fn get_rpc_addr(network: Network) -> &'static str {
Network::Localhost => "http://127.0.0.1:3030",
Network::Unknown => panic!("Attempt to create a provider from an unknown network"),
Network::Test => panic!("Attempt to create a provider from an test network"),
Network::Goerli => "https://goerli-api.zksync.io/jsrpc",
}
}

Expand Down
6 changes: 3 additions & 3 deletions sdk/zksync.js/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ export async function getDefaultProvider(
network
);
}
} else if (network === 'ropsten-beta') {
} else if (network === 'goerli-beta') {
if (transport === 'WS') {
return await Provider.newWebsocketProvider('wss://ropsten-beta-api.zksync.io/jsrpc-ws', network);
return await Provider.newWebsocketProvider('wss://goerli-beta-api.zksync.io/jsrpc-ws', network);
} else if (transport === 'HTTP') {
return await Provider.newHttpProvider(
'https://ropsten-beta-api.zksync.io/jsrpc',
'https://goerli-beta-api.zksync.io/jsrpc',
pollIntervalMilliSecs,
network
);
Expand Down
4 changes: 2 additions & 2 deletions sdk/zksync.js/src/rest-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export async function getDefaultRestProvider(
return await RestProvider.newProvider('https://ropsten-api.zksync.io/api/v0.2', pollIntervalMilliSecs, network);
} else if (network === 'rinkeby') {
return await RestProvider.newProvider('https://rinkeby-api.zksync.io/api/v0.2', pollIntervalMilliSecs, network);
} else if (network === 'ropsten-beta') {
} else if (network === 'goerli-beta') {
return await RestProvider.newProvider(
'https://ropsten-beta-api.zksync.io/api/v0.2',
'https://goerli-beta-api.zksync.io/api/v0.2',
pollIntervalMilliSecs,
network
);
Expand Down
8 changes: 6 additions & 2 deletions sdk/zksync.js/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,24 @@ export type TotalFee = Map<TokenLike, BigNumber>;

export type Nonce = number | 'committed';

export type Network = 'localhost' | 'rinkeby' | 'ropsten' | 'mainnet' | 'rinkeby-beta' | 'ropsten-beta';
export type Network = 'localhost' | 'rinkeby' | 'ropsten' | 'mainnet' | 'rinkeby-beta' | 'goerli-beta';

const MAINNET_NETWORK_CHAIN_ID = 1;
const ROPSTEN_NETWORK_CHAIN_ID = 3;
const RINKEBY_NETWORK_CHAIN_ID = 4;
const GOERLI_NETWORK_CHAIN_ID = 5;
const LOCALHOST_NETWORK_CHAIN_ID = 9;

export function l1ChainId(network?: Network): number {
if (network === 'rinkeby' || network === 'rinkeby-beta') {
return RINKEBY_NETWORK_CHAIN_ID;
}
if (network === 'ropsten' || network === 'ropsten-beta') {
if (network === 'ropsten') {
return ROPSTEN_NETWORK_CHAIN_ID;
}
if (network === 'goerli-beta') {
return GOERLI_NETWORK_CHAIN_ID;
}
if (network === 'mainnet') {
return MAINNET_NETWORK_CHAIN_ID;
}
Expand Down
3 changes: 2 additions & 1 deletion sdk/zksync.js/src/withdraw-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ function getMulticallAddressByNetwork(network: Network) {
case 'rinkeby-beta':
return '0x42ad527de7d4e9d9d011ac45b31d8551f8fe9821';
case 'ropsten':
case 'ropsten-beta':
return '0x53c43764255c17bd724f74c4ef150724ac50a3ed';
case 'goerli-beta':
return '0x77dca2c955b15e9de4dbbcf1246b4b85b651e50e';
case 'mainnet':
return '0xeefba1e63905ef1d7acba5a8513c70307c1ce441';
default:
Expand Down

0 comments on commit 1efce85

Please sign in to comment.