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

update CRO contract for testnet #7

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
57 changes: 0 additions & 57 deletions ethereum/contracts/dev-contracts/Cronos.sol

This file was deleted.

22 changes: 22 additions & 0 deletions ethereum/contracts/dev-contracts/CronosTestnet.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: Apache-2.0

pragma solidity 0.8.20;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract CronosTestnet is ERC20, Ownable {
uint8 private _decimals = 18;

constructor() ERC20("Cronos Testnet", "TCRO"){
}

function mint(address dest, uint wad) public onlyOwner returns (bool) {
_mint(dest, wad);
return true;
}

function decimals() public view override returns (uint8) {
return _decimals;
}
}
4 changes: 2 additions & 2 deletions ethereum/scripts/deploy-erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
token.implementation = token.implementation || DEFAULT_ERC20;
const tokenFactory = await hardhat.ethers.getContractFactory(token.implementation, wallet);
let args = token.implementation !== "WETH9" ? [token.name, token.symbol, token.decimals] : [];
if (token.implementation == "Cronos") {
args = [wallet.address];
if (token.implementation == "CronosTestnet") {
args = [];

Check failure on line 33 in ethereum/scripts/deploy-erc20.ts

View workflow job for this annotation

GitHub Actions / lint-l1

Delete `·`
}
const erc20 = await tokenFactory.deploy(...args, { gasLimit: 5000000 });
await erc20.deployTransaction.wait();
Expand Down
6 changes: 3 additions & 3 deletions ethereum/scripts/initialize-bridges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import * as fs from "fs";
import * as path from "path";
import { Cronos, CronosFactory } from '../typechain';
import { CronosTestnet, CronosTestnetFactory } from '../typechain';

Check failure on line 16 in ethereum/scripts/initialize-bridges.ts

View workflow job for this annotation

GitHub Actions / lint-l1

Import "CronosTestnet" is only used as types

Check failure on line 16 in ethereum/scripts/initialize-bridges.ts

View workflow job for this annotation

GitHub Actions / lint-l1

Replace `'../typechain'` with `"../typechain"`

Check failure on line 16 in ethereum/scripts/initialize-bridges.ts

View workflow job for this annotation

GitHub Actions / lint-l1

Strings must use doublequote

const provider = web3Provider();
const testConfigPath = path.join(process.env.ZKSYNC_HOME as string, "etc/test_config/constant");
Expand Down Expand Up @@ -52,8 +52,8 @@
const L2_ERC20_BRIDGE_INTERFACE = readInterface(l2BridgeArtifactsPath, "L2ERC20Bridge");
const DEPLOY_L2_BRIDGE_COUNTERPART_GAS_LIMIT = getNumberFromEnv("CONTRACTS_DEPLOY_L2_BRIDGE_COUNTERPART_GAS_LIMIT");


Check failure on line 55 in ethereum/scripts/initialize-bridges.ts

View workflow job for this annotation

GitHub Actions / lint-l1

Delete `⏎`
async function approveSpendingGasToken(cro: Cronos, wallet: Wallet, spender: string, amount: ethers.BigNumber) {
async function approveSpendingGasToken(cro: CronosTestnet, wallet: Wallet, spender: string, amount: ethers.BigNumber) {
cro = cro.connect(wallet);
const approveTx = await cro.approve(spender, amount, {
gasLimit: 210000,
Expand Down Expand Up @@ -102,7 +102,7 @@
const croTokenAddress = deployer.addresses.CroToken;
console.log(croTokenAddress);

let cro = CronosFactory.connect(croTokenAddress, deploy2Wallet)
let cro = CronosTestnetFactory.connect(croTokenAddress, deploy2Wallet)
// mint for deployer wallet
const tx = await cro.mint(deployWallet.address, ethers.utils.parseEther('10000000000'), {
gasLimit: 210000,
Expand Down
5 changes: 2 additions & 3 deletions ethereum/scripts/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ async function main() {
process.env.MNEMONIC ? process.env.MNEMONIC : ethTestConfig.mnemonic,
"m/44'/60'/0'/0/1"
).connect(provider);
const cro = verifyPromise(addresses.CroToken, [
deployWallet.address
]);
const cro = verifyPromise(addresses.CroToken);
promises.push(cro);

// TODO: Restore after switching to hardhat tasks (SMA-1711).
Expand All @@ -72,6 +70,7 @@ async function main() {

// Bridges
const promise = verifyPromise(addresses.Bridges.ERC20BridgeImplementation, [
addresses.CroToken,
addresses.ZkSync.DiamondProxy,
addresses.AllowList,
]);
Expand Down
2 changes: 1 addition & 1 deletion ethereum/src.ts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export interface DeployerConfig {

export function deployedAddressesFromEnv(): DeployedAddresses {
const tokens = getTokens(process.env.CHAIN_ETH_NETWORK || "localhost");
const croToken = tokens.find((token: { symbol: string }) => token.symbol == "CRO")!.address;
const croToken = tokens.find((token: { symbol: string }) => token.symbol == "TCRO")!.address;
return {
ZkSync: {
MailboxFacet: getAddressFromEnv("CONTRACTS_MAILBOX_FACET_ADDR"),
Expand Down
Loading