Merge bf5a2c572c
into dc28b89d6a
This commit is contained in:
commit
c597216905
14
README.md
14
README.md
|
@ -1,3 +1,5 @@
|
||||||
|
[![codecov](https://codecov.io/gh/logos-co/optimism-bridge-snt/graph/badge.svg?token=T28C0VOKJC)](https://codecov.io/gh/logos-co/optimism-bridge-snt)
|
||||||
|
|
||||||
# Bridging SNT with the Optimism SDK
|
# Bridging SNT with the Optimism SDK
|
||||||
|
|
||||||
This repository contains code to deploy SNT in Ethereum and bridge it to optimism.
|
This repository contains code to deploy SNT in Ethereum and bridge it to optimism.
|
||||||
|
@ -34,13 +36,7 @@ The MiniMeToken used in this repository is a fork of [the original](https://gith
|
||||||
the differences between the fork and the upstream repository, head over to its
|
the differences between the fork and the upstream repository, head over to its
|
||||||
[documentation](https://github.com/vacp2p/minime#readme).
|
[documentation](https://github.com/vacp2p/minime#readme).
|
||||||
|
|
||||||
1. There are 2 functions to mint/burn, one is mint() & generateTokens(), and other is burn() & destroyTokens(). One come
|
1. MiniMeToken uses generateTokens and destroyTokens operated by controller for mint and burn.
|
||||||
from MiniMeToken inheritance, and other comes from IOptimismMintableERC20 inheritance. See more on point 2.
|
OptimismMintableMiniMeToken uses mint and burn operated by bridge.
|
||||||
2. MiniMeToken controller (SNTPlaceHolder) is also deployed on Optimism, and it _could_ be replaced by another
|
2. MiniMeToken `version()` had to be renamed to `token_version()` due a conflict on inheritance and requirements of
|
||||||
controller that _could_ call generateToken function, potentially breaking the bridge, however, if we don't do this
|
|
||||||
change, than it should be fine.
|
|
||||||
3. MiniMeTokenFactory used in createCloneToken create new MiniMeTokens that are one inheritance down from
|
|
||||||
OptimismMintableMiniMeToken, this is fine, just strange, but it couldnt be different, as clone tokens are not
|
|
||||||
suppoused to be minted by bridge. This function is not even used by us.
|
|
||||||
4. MiniMeToken `version()` had to be renamed to `token_version()` due a conflict on inheritance and requirements of
|
|
||||||
Optimism. Semver inheritance uses version() and this seems a requirement for Optimism.
|
Optimism. Semver inheritance uses version() and this seems a requirement for Optimism.
|
||||||
|
|
260
index.js
260
index.js
|
@ -1,48 +1,43 @@
|
||||||
const contracts = require("./contracts.json");
|
const contracts = require("./contracts.json");
|
||||||
const ethers = require("ethers")
|
const ethers = require("ethers");
|
||||||
const optimismSDK = require("@eth-optimism/sdk")
|
const optimismSDK = require("@eth-optimism/sdk");
|
||||||
require('dotenv').config()
|
require("dotenv").config();
|
||||||
|
|
||||||
|
const l1Url = `https://eth-goerli.g.alchemy.com/v2/${process.env.GOERLI_ALCHEMY_KEY}`;
|
||||||
|
const l2Url = `https://opt-goerli.g.alchemy.com/v2/${process.env.GOERLI_OPT_ALCHEMY_KEY}`;
|
||||||
|
const mnemonic = process.env.GOERLI_MNEMONIC;
|
||||||
|
|
||||||
const l1Url = `https://eth-goerli.g.alchemy.com/v2/${process.env.GOERLI_ALCHEMY_KEY}`
|
const words = mnemonic.match(/[a-zA-Z]+/g).length;
|
||||||
const l2Url = `https://opt-goerli.g.alchemy.com/v2/${process.env.GOERLI_OPT_ALCHEMY_KEY}`
|
validLength = [12, 15, 18, 24];
|
||||||
const mnemonic = process.env.GOERLI_MNEMONIC
|
|
||||||
|
|
||||||
const words = mnemonic.match(/[a-zA-Z]+/g).length
|
|
||||||
validLength = [12, 15, 18, 24]
|
|
||||||
if (!validLength.includes(words)) {
|
if (!validLength.includes(words)) {
|
||||||
console.log(`The mnemonic (${mnemonic}) is the wrong number of words`)
|
console.log(`The mnemonic (${mnemonic}) is the wrong number of words`);
|
||||||
process.exit(-1)
|
process.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const erc20Addrs = {
|
const erc20Addrs = {
|
||||||
l1Addr: contracts.goerli.l1.token,
|
l1Addr: contracts.goerli.l1.token,
|
||||||
l2Addr: contracts.goerli.l2.token
|
l2Addr: contracts.goerli.l2.token,
|
||||||
}
|
};
|
||||||
const faucetAddr = contracts.goerli.l2.controller;
|
const faucetAddr = contracts.goerli.l2.controller;
|
||||||
|
|
||||||
|
let crossChainMessenger;
|
||||||
let crossChainMessenger
|
let l1ERC20, l2ERC20; // OUTb contracts to show ERC-20
|
||||||
let l1ERC20, l2ERC20 // OUTb contracts to show ERC-20
|
let faucet;
|
||||||
let faucet
|
let ourAddr; // The address of the signer we use.
|
||||||
let ourAddr // The address of the signer we use.
|
|
||||||
|
|
||||||
|
|
||||||
// Get signers on L1 and L2 (for the same address). Note that
|
// Get signers on L1 and L2 (for the same address). Note that
|
||||||
// this address needs to have ETH on it, both on Optimism and
|
// this address needs to have ETH on it, both on Optimism and
|
||||||
// Optimism Georli
|
// Optimism Georli
|
||||||
const getSigners = async () => {
|
const getSigners = async () => {
|
||||||
const l1RpcProvider = new ethers.providers.JsonRpcProvider(l1Url)
|
const l1RpcProvider = new ethers.providers.JsonRpcProvider(l1Url);
|
||||||
const l2RpcProvider = new ethers.providers.JsonRpcProvider(l2Url)
|
const l2RpcProvider = new ethers.providers.JsonRpcProvider(l2Url);
|
||||||
const hdNode = ethers.utils.HDNode.fromMnemonic(mnemonic)
|
const hdNode = ethers.utils.HDNode.fromMnemonic(mnemonic);
|
||||||
const privateKey = hdNode.derivePath(ethers.utils.defaultPath).privateKey
|
const privateKey = hdNode.derivePath(ethers.utils.defaultPath).privateKey;
|
||||||
const l1Wallet = new ethers.Wallet(privateKey, l1RpcProvider)
|
const l1Wallet = new ethers.Wallet(privateKey, l1RpcProvider);
|
||||||
const l2Wallet = new ethers.Wallet(privateKey, l2RpcProvider)
|
const l2Wallet = new ethers.Wallet(privateKey, l2RpcProvider);
|
||||||
|
|
||||||
return [l1Wallet, l2Wallet]
|
|
||||||
} // getSigners
|
|
||||||
|
|
||||||
|
|
||||||
|
return [l1Wallet, l2Wallet];
|
||||||
|
}; // getSigners
|
||||||
|
|
||||||
// The ABI fragment for the contract. We only need to know how to do two things:
|
// The ABI fragment for the contract. We only need to know how to do two things:
|
||||||
// 1. Get an account's balance
|
// 1. Get an account's balance
|
||||||
|
@ -56,145 +51,122 @@ const erc20ABI = [
|
||||||
name: "balanceOf",
|
name: "balanceOf",
|
||||||
outputs: [{ name: "balance", type: "uint256" }],
|
outputs: [{ name: "balance", type: "uint256" }],
|
||||||
type: "function",
|
type: "function",
|
||||||
}
|
},
|
||||||
]; // erc20ABI
|
]; // erc20ABI
|
||||||
const faucetABI = [
|
const faucetABI = [
|
||||||
// faucet
|
// faucet
|
||||||
{
|
{
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
internalType: "uint256",
|
internalType: "uint256",
|
||||||
name: "_amount",
|
name: "_amount",
|
||||||
type: "uint256"
|
type: "uint256",
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
name: "mint",
|
name: "mint",
|
||||||
outputs: [],
|
outputs: [],
|
||||||
stateMutability: "nonpayable",
|
stateMutability: "nonpayable",
|
||||||
type: "function"
|
type: "function",
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const setup = async () => {
|
||||||
const setup = async() => {
|
const [l1Signer, l2Signer] = await getSigners();
|
||||||
const [l1Signer, l2Signer] = await getSigners()
|
ourAddr = l1Signer.address;
|
||||||
ourAddr = l1Signer.address
|
|
||||||
crossChainMessenger = new optimismSDK.CrossChainMessenger({
|
crossChainMessenger = new optimismSDK.CrossChainMessenger({
|
||||||
l1ChainId: 5, // Goerli value, 1 for mainnet
|
l1ChainId: 5, // Goerli value, 1 for mainnet
|
||||||
l2ChainId: 420, // Goerli value, 10 for mainnet
|
l2ChainId: 420, // Goerli value, 10 for mainnet
|
||||||
l1SignerOrProvider: l1Signer,
|
l1SignerOrProvider: l1Signer,
|
||||||
l2SignerOrProvider: l2Signer,
|
l2SignerOrProvider: l2Signer,
|
||||||
})
|
});
|
||||||
l1ERC20 = new ethers.Contract(erc20Addrs.l1Addr, erc20ABI, l1Signer)
|
l1ERC20 = new ethers.Contract(erc20Addrs.l1Addr, erc20ABI, l1Signer);
|
||||||
l2ERC20 = new ethers.Contract(erc20Addrs.l2Addr, erc20ABI, l2Signer)
|
l2ERC20 = new ethers.Contract(erc20Addrs.l2Addr, erc20ABI, l2Signer);
|
||||||
faucet = new ethers.Contract(faucetAddr, faucetABI, l1Signer)
|
faucet = new ethers.Contract(faucetAddr, faucetABI, l1Signer);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const reportERC20Balances = async () => {
|
const reportERC20Balances = async () => {
|
||||||
const l1Balance = (await l1ERC20.balanceOf(ourAddr)).toString().slice(0,-18)
|
const l1Balance = (await l1ERC20.balanceOf(ourAddr)).toString().slice(0, -18);
|
||||||
const l2Balance = (await l2ERC20.balanceOf(ourAddr)).toString().slice(0,-18)
|
const l2Balance = (await l2ERC20.balanceOf(ourAddr)).toString().slice(0, -18);
|
||||||
console.log(`OUTb on L1:${l1Balance} OUTb on L2:${l2Balance}`)
|
console.log(`OUTb on L1:${l1Balance} OUTb on L2:${l2Balance}`);
|
||||||
|
|
||||||
if (l1Balance != 0) {
|
if (l1Balance != 0) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`You don't have enough OUTb on L1. Let's call the faucet to fix that`)
|
console.log(`You don't have enough OUTb on L1. Let's call the faucet to fix that`);
|
||||||
const tx = (await faucet.mint("10000000000000000000000"))
|
const tx = await faucet.mint("10000000000000000000000");
|
||||||
console.log(`Faucet tx: ${tx.hash}`)
|
console.log(`Faucet tx: ${tx.hash}`);
|
||||||
console.log(`\tMore info: https://goerli.etherscan.io/tx/${tx.hash}`)
|
console.log(`\tMore info: https://goerli.etherscan.io/tx/${tx.hash}`);
|
||||||
await tx.wait()
|
await tx.wait();
|
||||||
const newBalance = (await l1ERC20.balanceOf(ourAddr)).toString().slice(0,-18)
|
const newBalance = (await l1ERC20.balanceOf(ourAddr)).toString().slice(0, -18);
|
||||||
console.log(`New L1 OUTb balance: ${newBalance}`)
|
console.log(`New L1 OUTb balance: ${newBalance}`);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const oneToken = BigInt(1e18)
|
|
||||||
|
|
||||||
|
const oneToken = BigInt(1e18);
|
||||||
|
|
||||||
const depositERC20 = async () => {
|
const depositERC20 = async () => {
|
||||||
|
console.log("Deposit ERC20");
|
||||||
console.log("Deposit ERC20")
|
await reportERC20Balances();
|
||||||
await reportERC20Balances()
|
const start = new Date();
|
||||||
const start = new Date()
|
|
||||||
|
|
||||||
// Need the l2 address to know which bridge is responsible
|
// Need the l2 address to know which bridge is responsible
|
||||||
const allowanceResponse = await crossChainMessenger.approveERC20(
|
const allowanceResponse = await crossChainMessenger.approveERC20(erc20Addrs.l1Addr, erc20Addrs.l2Addr, oneToken);
|
||||||
erc20Addrs.l1Addr, erc20Addrs.l2Addr, oneToken)
|
await allowanceResponse.wait();
|
||||||
await allowanceResponse.wait()
|
console.log(`Allowance given by tx ${allowanceResponse.hash}`);
|
||||||
console.log(`Allowance given by tx ${allowanceResponse.hash}`)
|
console.log(`\tMore info: https://goerli.etherscan.io/tx/${allowanceResponse.hash}`);
|
||||||
console.log(`\tMore info: https://goerli.etherscan.io/tx/${allowanceResponse.hash}`)
|
console.log(`Time so far ${(new Date() - start) / 1000} seconds`);
|
||||||
console.log(`Time so far ${(new Date()-start)/1000} seconds`)
|
|
||||||
|
|
||||||
const response = await crossChainMessenger.depositERC20(
|
|
||||||
erc20Addrs.l1Addr, erc20Addrs.l2Addr, oneToken)
|
|
||||||
console.log(`Deposit transaction hash (on L1): ${response.hash}`)
|
|
||||||
console.log(`\tMore info: https://goerli.etherscan.io/tx/${response.hash}`)
|
|
||||||
await response.wait()
|
|
||||||
console.log("Waiting for status to change to RELAYED")
|
|
||||||
console.log(`Time so far ${(new Date()-start)/1000} seconds`)
|
|
||||||
await crossChainMessenger.waitForMessageStatus(response.hash,
|
|
||||||
optimismSDK.MessageStatus.RELAYED)
|
|
||||||
|
|
||||||
await reportERC20Balances()
|
|
||||||
console.log(`depositERC20 took ${(new Date()-start)/1000} seconds\n\n`)
|
|
||||||
} // depositERC20()
|
|
||||||
|
|
||||||
|
const response = await crossChainMessenger.depositERC20(erc20Addrs.l1Addr, erc20Addrs.l2Addr, oneToken);
|
||||||
|
console.log(`Deposit transaction hash (on L1): ${response.hash}`);
|
||||||
|
console.log(`\tMore info: https://goerli.etherscan.io/tx/${response.hash}`);
|
||||||
|
await response.wait();
|
||||||
|
console.log("Waiting for status to change to RELAYED");
|
||||||
|
console.log(`Time so far ${(new Date() - start) / 1000} seconds`);
|
||||||
|
await crossChainMessenger.waitForMessageStatus(response.hash, optimismSDK.MessageStatus.RELAYED);
|
||||||
|
|
||||||
|
await reportERC20Balances();
|
||||||
|
console.log(`depositERC20 took ${(new Date() - start) / 1000} seconds\n\n`);
|
||||||
|
}; // depositERC20()
|
||||||
|
|
||||||
const withdrawERC20 = async () => {
|
const withdrawERC20 = async () => {
|
||||||
|
console.log("Withdraw ERC20");
|
||||||
|
const start = new Date();
|
||||||
|
await reportERC20Balances();
|
||||||
|
|
||||||
console.log("Withdraw ERC20")
|
const response = await crossChainMessenger.withdrawERC20(erc20Addrs.l1Addr, erc20Addrs.l2Addr, oneToken);
|
||||||
const start = new Date()
|
console.log(`Transaction hash (on L2): ${response.hash}`);
|
||||||
await reportERC20Balances()
|
console.log(`\tFor more information: https://goerli-optimism.etherscan.io/tx/${response.hash}`);
|
||||||
|
await response.wait();
|
||||||
const response = await crossChainMessenger.withdrawERC20(
|
|
||||||
erc20Addrs.l1Addr, erc20Addrs.l2Addr, oneToken)
|
|
||||||
console.log(`Transaction hash (on L2): ${response.hash}`)
|
|
||||||
console.log(`\tFor more information: https://goerli-optimism.etherscan.io/tx/${response.hash}`)
|
|
||||||
await response.wait()
|
|
||||||
|
|
||||||
console.log("Waiting for status to be READY_TO_PROVE")
|
|
||||||
console.log(`Time so far ${(new Date()-start)/1000} seconds`)
|
|
||||||
await crossChainMessenger.waitForMessageStatus(response.hash,
|
|
||||||
optimismSDK.MessageStatus.READY_TO_PROVE)
|
|
||||||
console.log(`Time so far ${(new Date()-start)/1000} seconds`)
|
|
||||||
await crossChainMessenger.proveMessage(response.hash)
|
|
||||||
|
|
||||||
|
|
||||||
console.log("In the challenge period, waiting for status READY_FOR_RELAY")
|
|
||||||
console.log(`Time so far ${(new Date()-start)/1000} seconds`)
|
|
||||||
await crossChainMessenger.waitForMessageStatus(response.hash,
|
|
||||||
optimismSDK.MessageStatus.READY_FOR_RELAY)
|
|
||||||
console.log("Ready for relay, finalizing message now")
|
|
||||||
console.log(`Time so far ${(new Date()-start)/1000} seconds`)
|
|
||||||
await crossChainMessenger.finalizeMessage(response.hash)
|
|
||||||
|
|
||||||
console.log("Waiting for status to change to RELAYED")
|
|
||||||
console.log(`Time so far ${(new Date()-start)/1000} seconds`)
|
|
||||||
await crossChainMessenger.waitForMessageStatus(response,
|
|
||||||
optimismSDK.MessageStatus.RELAYED)
|
|
||||||
await reportERC20Balances()
|
|
||||||
console.log(`withdrawERC20 took ${(new Date()-start)/1000} seconds\n\n\n`)
|
|
||||||
} // withdrawERC20()
|
|
||||||
|
|
||||||
|
console.log("Waiting for status to be READY_TO_PROVE");
|
||||||
|
console.log(`Time so far ${(new Date() - start) / 1000} seconds`);
|
||||||
|
await crossChainMessenger.waitForMessageStatus(response.hash, optimismSDK.MessageStatus.READY_TO_PROVE);
|
||||||
|
console.log(`Time so far ${(new Date() - start) / 1000} seconds`);
|
||||||
|
await crossChainMessenger.proveMessage(response.hash);
|
||||||
|
|
||||||
|
console.log("In the challenge period, waiting for status READY_FOR_RELAY");
|
||||||
|
console.log(`Time so far ${(new Date() - start) / 1000} seconds`);
|
||||||
|
await crossChainMessenger.waitForMessageStatus(response.hash, optimismSDK.MessageStatus.READY_FOR_RELAY);
|
||||||
|
console.log("Ready for relay, finalizing message now");
|
||||||
|
console.log(`Time so far ${(new Date() - start) / 1000} seconds`);
|
||||||
|
await crossChainMessenger.finalizeMessage(response.hash);
|
||||||
|
|
||||||
|
console.log("Waiting for status to change to RELAYED");
|
||||||
|
console.log(`Time so far ${(new Date() - start) / 1000} seconds`);
|
||||||
|
await crossChainMessenger.waitForMessageStatus(response, optimismSDK.MessageStatus.RELAYED);
|
||||||
|
await reportERC20Balances();
|
||||||
|
console.log(`withdrawERC20 took ${(new Date() - start) / 1000} seconds\n\n\n`);
|
||||||
|
}; // withdrawERC20()
|
||||||
|
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
await setup()
|
await setup();
|
||||||
await depositERC20()
|
await depositERC20();
|
||||||
await withdrawERC20()
|
await withdrawERC20();
|
||||||
} // main
|
}; // main
|
||||||
|
|
||||||
|
main()
|
||||||
|
.then(() => process.exit(0))
|
||||||
main().then(() => process.exit(0))
|
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error)
|
console.error(error);
|
||||||
process.exit(1)
|
process.exit(1);
|
||||||
})
|
});
|
||||||
|
|
|
@ -1,20 +1,26 @@
|
||||||
const hre = require("hardhat");
|
const hre = require("hardhat");
|
||||||
require('dotenv').config()
|
require("dotenv").config();
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const mainnet = network.config.chainId == 10;
|
const mainnet = network.config.chainId == 10;
|
||||||
const bridgeAddress = "0x4200000000000000000000000000000000000010";//standard bridge
|
const bridgeAddress = "0x4200000000000000000000000000000000000010"; //standard bridge
|
||||||
const remoteToken = mainnet ? process.env.MAINNET_L1_ADDRESS : "0xd55245e63bDafAabac2530F70074A36D7899Ed72";
|
const remoteToken = mainnet ? process.env.MAINNET_L1_ADDRESS : "0xd55245e63bDafAabac2530F70074A36D7899Ed72";
|
||||||
|
|
||||||
const [deployer] = await ethers.getSigners();
|
const [deployer] = await ethers.getSigners();
|
||||||
console.log(`Deploying contracts to ${network.name} (${network.config.chainId}) with the account: ${deployer.address}`);
|
console.log(
|
||||||
|
`Deploying contracts to ${network.name} (${network.config.chainId}) with the account: ${deployer.address}`,
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
const miniMeTokenFactory = await (await ethers.getContractFactory("MiniMeTokenFactory")).attach("0x86e5c5c884740894644dad30021aaaade2b7babd") /*ethers.deployContract("MiniMeTokenFactory");
|
const miniMeTokenFactory = await (
|
||||||
|
await ethers.getContractFactory("MiniMeTokenFactory")
|
||||||
|
).attach("0x86e5c5c884740894644dad30021aaaade2b7babd"); /*ethers.deployContract("MiniMeTokenFactory");
|
||||||
await miniMeTokenFactory.waitForDeployment();*/
|
await miniMeTokenFactory.waitForDeployment();*/
|
||||||
|
|
||||||
//0x2b3845b982b147a0436e3766eae06936f4e271a0
|
//0x2b3845b982b147a0436e3766eae06936f4e271a0
|
||||||
const miniMeToken = await (await ethers.getContractFactory("OptimismMintableMiniMeToken")).attach("0x2b3845b982b147a0436e3766eae06936f4e271a0");/*ethers.deployContract(
|
const miniMeToken = await (
|
||||||
|
await ethers.getContractFactory("OptimismMintableMiniMeToken")
|
||||||
|
).attach("0x2b3845b982b147a0436e3766eae06936f4e271a0"); /*ethers.deployContract(
|
||||||
"OptimismMintableMiniMeToken", [
|
"OptimismMintableMiniMeToken", [
|
||||||
bridgeAddress,
|
bridgeAddress,
|
||||||
remoteToken,
|
remoteToken,
|
||||||
|
@ -29,7 +35,9 @@ async function main() {
|
||||||
await miniMeToken.waitForDeployment();*/
|
await miniMeToken.waitForDeployment();*/
|
||||||
|
|
||||||
//
|
//
|
||||||
const tokenController = await (await ethers.getContractFactory("SNTPlaceHolder")).attach("0x4Ef81bDfcbb003442869B53Bf81168c12e1746A8")/*ethers.deployContract(
|
const tokenController = await (
|
||||||
|
await ethers.getContractFactory("SNTPlaceHolder")
|
||||||
|
).attach("0x4Ef81bDfcbb003442869B53Bf81168c12e1746A8"); /*ethers.deployContract(
|
||||||
"SNTPlaceHolder", //we should never mint STT on optimism, that should be done by bridge only
|
"SNTPlaceHolder", //we should never mint STT on optimism, that should be done by bridge only
|
||||||
[
|
[
|
||||||
deployer.address,
|
deployer.address,
|
||||||
|
@ -38,22 +46,16 @@ async function main() {
|
||||||
);
|
);
|
||||||
await tokenController.waitForDeployment();*/
|
await tokenController.waitForDeployment();*/
|
||||||
await miniMeToken.changeController(tokenController.target);
|
await miniMeToken.changeController(tokenController.target);
|
||||||
|
console.log(`npx hardhat verify ${miniMeTokenFactory.target} `);
|
||||||
console.log(
|
console.log(
|
||||||
`npx hardhat verify ${miniMeTokenFactory.target} `
|
`npx hardhat verify ${miniMeToken.target} ${bridgeAddress} ${remoteToken} ${miniMeTokenFactory.target} ${
|
||||||
)
|
ethers.ZeroAddress
|
||||||
console.log(
|
} ${0} ${mainnet ? "Status Network Token" : "Status Test Token"} ${18} ${mainnet ? "SNT" : "STT"} ${true}`,
|
||||||
`npx hardhat verify ${miniMeToken.target} ${bridgeAddress} ${remoteToken} ${miniMeTokenFactory.target} ${ethers.ZeroAddress} ${0} ${mainnet ? "Status Network Token" : "Status Test Token"} ${18} ${mainnet ? "SNT" : "STT"} ${true}`
|
);
|
||||||
)
|
console.log(`npx hardhat verify ${tokenController.target} ${deployer.address} ${miniMeToken.target} `);
|
||||||
console.log(
|
|
||||||
`npx hardhat verify ${tokenController.target} ${deployer.address} ${miniMeToken.target} `
|
|
||||||
)
|
|
||||||
|
|
||||||
console.log(
|
console.log(`${mainnet ? "SNT" : "STT"} ${miniMeToken.target} controlled by ${await miniMeToken.controller()}`);
|
||||||
`${mainnet ? "SNT" : "STT"} ${miniMeToken.target} controlled by ${await miniMeToken.controller()}`
|
console.log(`SNTPlaceHolder ${tokenController.target} owned by ${await tokenController.owner()}`);
|
||||||
);
|
|
||||||
console.log(
|
|
||||||
`SNTPlaceHolder ${tokenController.target} owned by ${await tokenController.owner()}`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We recommend this pattern to be able to use async/await everywhere
|
// We recommend this pattern to be able to use async/await everywhere
|
||||||
|
|
|
@ -7,38 +7,37 @@
|
||||||
const hre = require("hardhat");
|
const hre = require("hardhat");
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const mainnet = network.config.chainId == 1
|
const mainnet = network.config.chainId == 1;
|
||||||
|
|
||||||
const [deployer] = await ethers.getSigners();
|
const [deployer] = await ethers.getSigners();
|
||||||
console.log(`Deploying contracts to ${network.name} (${network.config.chainId}) with the account: ${deployer.address}`);
|
console.log(
|
||||||
|
`Deploying contracts to ${network.name} (${network.config.chainId}) with the account: ${deployer.address}`,
|
||||||
|
);
|
||||||
const miniMeTokenFactory = await ethers.deployContract("MiniMeTokenFactory");
|
const miniMeTokenFactory = await ethers.deployContract("MiniMeTokenFactory");
|
||||||
await miniMeTokenFactory.waitForDeployment();
|
await miniMeTokenFactory.waitForDeployment();
|
||||||
const miniMeToken = await ethers.deployContract(
|
const miniMeToken = await ethers.deployContract(
|
||||||
optimism ? "MintableMiniMeTokenOptimism" : "MiniMeToken", (optimism ? [] : []).concat([
|
optimism ? "MintableMiniMeTokenOptimism" : "MiniMeToken",
|
||||||
|
(optimism ? [] : []).concat([
|
||||||
miniMeTokenFactory.target,
|
miniMeTokenFactory.target,
|
||||||
ethers.ZeroAddress,
|
ethers.ZeroAddress,
|
||||||
0,
|
0,
|
||||||
mainnet ? "Status Network Token" : "Status Test Token",
|
mainnet ? "Status Network Token" : "Status Test Token",
|
||||||
18,
|
18,
|
||||||
mainnet ? "SNT" : "STT",
|
mainnet ? "SNT" : "STT",
|
||||||
true
|
true,
|
||||||
]));
|
]),
|
||||||
await miniMeToken.waitForDeployment();
|
|
||||||
const tokenController = await ethers.deployContract(
|
|
||||||
mainnet ? "SNTPlaceHolder" : "SNTFaucet",
|
|
||||||
[
|
|
||||||
deployer.address,
|
|
||||||
miniMeToken.target
|
|
||||||
]
|
|
||||||
);
|
);
|
||||||
|
await miniMeToken.waitForDeployment();
|
||||||
|
const tokenController = await ethers.deployContract(mainnet ? "SNTPlaceHolder" : "SNTFaucet", [
|
||||||
|
deployer.address,
|
||||||
|
miniMeToken.target,
|
||||||
|
]);
|
||||||
await tokenController.waitForDeployment();
|
await tokenController.waitForDeployment();
|
||||||
await miniMeToken.changeController(tokenController.target);
|
await miniMeToken.changeController(tokenController.target);
|
||||||
|
|
||||||
|
console.log(`${mainnet ? "SNT" : "STT"} ${miniMeToken.target} controlled by ${await miniMeToken.controller()}`);
|
||||||
console.log(
|
console.log(
|
||||||
`${mainnet ? "SNT" : "STT"} ${miniMeToken.target} controlled by ${await miniMeToken.controller()}`
|
`${mainnet ? "SNTPlaceHolder" : "SNTFaucet"} ${tokenController.target} owned by ${await tokenController.owner()}`,
|
||||||
);
|
|
||||||
console.log(
|
|
||||||
`${mainnet ? "SNTPlaceHolder" : "SNTFaucet"} ${tokenController.target} owned by ${await tokenController.owner()}`
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue