Skip to content

Commit

Permalink
add support for custom gas token
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-nguy committed Dec 4, 2023
1 parent 5994aae commit e024af2
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 13 deletions.
6 changes: 4 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[submodule "etc/system-contracts"]
path = etc/system-contracts
url = https://github.com/matter-labs/era-system-contracts.git
url = https://github.com/cronos-labs/era-system-contracts.git
branch = testnet
[submodule "contracts"]
path = contracts
url = https://github.com/matter-labs/era-contracts.git
url = https://github.com/cronos-labs/era-contracts.git
branch = custom-gas-token
2 changes: 1 addition & 1 deletion contracts
Submodule contracts updated 27 files
+15 −11 ethereum/contracts/bridge/L1ERC20Bridge.sol
+5 −6 ethereum/contracts/bridge/L1WethBridge.sol
+2 −1 ethereum/contracts/bridge/interfaces/IL1Bridge.sol
+4 −6 ethereum/contracts/bridge/libraries/BridgeInitializationHelper.sol
+22 −0 ethereum/contracts/dev-contracts/CronosTestnet.sol
+1 −1 ethereum/contracts/dev-contracts/test/L1ERC20BridgeTest.sol
+2 −0 ethereum/contracts/zksync/DiamondInit.sol
+2 −0 ethereum/contracts/zksync/Storage.sol
+55 −35 ethereum/contracts/zksync/facets/Mailbox.sol
+7 −5 ethereum/contracts/zksync/interfaces/IMailbox.sol
+12 −0 ethereum/contracts/zksync/libraries/L2Transaction.sol
+7 −10 ethereum/contracts/zksync/upgrade-initializers/DIamondUpgradeInit2.sol
+4 −5 ethereum/contracts/zksync/upgrade-initializers/DiamondUpgradeInit1.sol
+7 −10 ethereum/contracts/zksync/upgrade-initializers/DiamondUpgradeInit4.sol
+7 −10 ethereum/contracts/zksync/upgrade-initializers/DiamondUpgradeInit5.sol
+7 −10 ethereum/contracts/zksync/upgrade-initializers/DiamondUpgradeInit6.sol
+4 −1 ethereum/scripts/deploy-erc20.ts
+11 −7 ethereum/scripts/deploy.ts
+72 −13 ethereum/scripts/initialize-bridges.ts
+5 −5 ethereum/scripts/initialize-governance.ts
+22 −10 ethereum/scripts/initialize-l2-weth-token.ts
+16 −0 ethereum/scripts/verify.ts
+6 −1 ethereum/src.ts/deploy.ts
+1 −1 zksync/hardhat.config.ts
+7 −4 zksync/src/publish-bridge-preimages.ts
+10 −6 zksync/src/upgradeL2BridgeImpl.ts
+12 −5 zksync/src/utils.ts
2 changes: 1 addition & 1 deletion etc/contracts-test-data/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import '@matterlabs/hardhat-zksync-solc';

export default {
zksolc: {
version: '1.3.7',
version: '1.3.16',
compilerSource: 'binary',
settings: {
isSystem: true
Expand Down
2 changes: 1 addition & 1 deletion etc/system-contracts
3 changes: 2 additions & 1 deletion infrastructure/zk/src/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ export async function deployL1(args: any[]) {
'CONTRACTS_L1_WETH_BRIDGE_IMPL_ADDR',
'CONTRACTS_L1_WETH_BRIDGE_PROXY_ADDR',
'CONTRACTS_L1_ALLOW_LIST_ADDR',
'CONTRACTS_L1_MULTICALL3_ADDR'
'CONTRACTS_L1_MULTICALL3_ADDR',
'CONTRACTS_L1_CRO_TOKEN_ADDR'
];
const updatedContracts = updateContractsEnv(deployLog, envVars);

Expand Down
7 changes: 3 additions & 4 deletions infrastructure/zk/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ export async function init(initArgs: InitArgs = DEFAULT_ARGS) {
await announced(
'Initializing governance',
contract.initializeGovernance([
...governorPrivateKeyArgs,
!deployerL2ContractInput.includeL2WETH ? ['--skip-weth-bridge'] : []
...governorPrivateKeyArgs
])
);
}
Expand Down Expand Up @@ -167,7 +166,7 @@ const DEFAULT_ARGS: InitArgs = {
skipEnvSetup: false,
skipPlonkStep: false,
governorPrivateKeyArgs: [],
deployerL2ContractInput: { args: [], includePaymaster: true, includeL2WETH: true },
deployerL2ContractInput: { args: [], includePaymaster: true, includeL2WETH: false },
testTokens: { deploy: true, args: [] }
};

Expand All @@ -181,7 +180,7 @@ export const initCommand = new Command('init')
skipEnvSetup: cmd.skipEnvSetup,
skipPlonkStep: false,
governorPrivateKeyArgs: [],
deployerL2ContractInput: { args: [], includePaymaster: true, includeL2WETH: true },
deployerL2ContractInput: { args: [], includePaymaster: true, includeL2WETH: false },
testTokens: { deploy: true, args: [] }
};
await init(initArgs);
Expand Down
6 changes: 3 additions & 3 deletions infrastructure/zk/src/run/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ export async function deployERC20(
{ "name": "BATL", "symbol": "BATW", "decimals": 18 },
{ "name": "GNTL", "symbol": "GNTW", "decimals": 18 },
{ "name": "MLTTL", "symbol": "MLTTW", "decimals": 18 },
{ "name": "Wrapped Ether", "symbol": "WETH", "decimals": 18, "implementation": "WETH9"}
{ "name": "CronosTestnet", "symbol": "TCRO", "decimals": 18, "implementation": "CronosTestnet"}
]' ${args.join(' ')} > ./etc/tokens/${destinationFile}.json`);
const WETH = getTokens(destinationFile).find((token) => token.symbol === 'WETH')!;
env.modify('CONTRACTS_L1_WETH_TOKEN_ADDR', `CONTRACTS_L1_WETH_TOKEN_ADDR=${WETH.address}`);
const CRO = getTokens(destinationFile).find((token) => token.symbol === 'TCRO')!;
env.modify('CONTRACTS_L1_CRO_TOKEN_ADDR', `CONTRACTS_L1_CRO_TOKEN_ADDR=${CRO.address}`);
} else if (command == 'new') {
await utils.spawn(
`yarn --silent --cwd contracts/ethereum deploy-erc20 add --token-name ${name} --symbol ${symbol} --decimals ${decimals}`
Expand Down

0 comments on commit e024af2

Please sign in to comment.