Skip to content

Instantly share code, notes, and snippets.

@ericlee42
ericlee42 / 00-token_read.mjs
Last active December 1, 2023 00:15
Metis Stardust WebSocket issue test scripts
// node --experimental-json-modules read.mjs
// node 17 only
import { ethers } from "ethers";
import { readFile } from "fs/promises";
import ERC20ABI from "./ERC20.json" assert { type: "json" };
const privateKey = await readFile("key.txt", { encoding: "utf-8" });
const rpcclient = new ethers.providers.WebSocketProvider(
"wss://stardust-ws.metis.io/"
@ericlee42
ericlee42 / metis-contract-verify-guide.md
Last active April 23, 2024 08:05
Use `hardhat-verify` and `hardhat-deploy` to verify your contracts on Metis
@ericlee42
ericlee42 / openzeppelin-hardhat-upgrade-support.md
Last active April 15, 2023 09:10
Metis Explorers support `@openzeppelin/hardhat-upgrades` plugin now

Deploy

$ npx hardhat run --network metisGoerli scripts/deploy.ts                            
No need to generate any newer typings.
upgradeable contract deployed to address: 0xa15f9245d1E8c25598dE2605871A2b5854371cF2

Verify

@ericlee42
ericlee42 / addresses.json
Last active October 12, 2023 12:02
goerli-testnet-2
{
"BondManager": "0x93f766F5a8641123EA79E2298fB0DfDBA92ED152",
"CanonicalTransactionChain": "0xCBc9fc3Ac4878925f7f63b0FA2681Bb0769DDFbb",
"ChainStorageContainer-CTC-batches": "0x23ac2fEd119dAD4fcE4A7a439440627d31e10F9E",
"ChainStorageContainer-CTC-queue": "0x01Af3B22741408d8fEfEFD82ba80472442975fD8",
"ChainStorageContainer-SCC-batches": "0x25B0ec6eF307272bd197E5b2743B142A3293ef2C",
"L1StandardBridge_for_verification_only": "0x18EBB7f9bfDe9C119A7dddAEAE3a86d9e20d0412",
"AddressManager": "0x45c2a2A7a3070Aea165c79342e6A8Ac74445e559",
"MVM_CanonicalTransaction_for_verification_only": "0x909bB9Aa5BBdE51766ec7c5cFdf28a058Fd69268",
"MVM_DiscountOracle": "0x185514cCBb65a4a1d98779D42a80A80fA696f7e6",
@ericlee42
ericlee42 / 00-withdraw.mjs
Last active December 1, 2023 00:17
Metis bridge example
import { ethers } from "ethers";
import { readFile } from "fs/promises";
import IL2StandardBridge from "./IL2StandardBridge.json" assert { type: "json" };
import OVM_GasPriceOracle from "./OVM_GasPriceOracle.json" assert { type: "json" };
import IERC20 from "./IERC20.json.json" assert { type: "json" };
const privateKey = await readFile("key.txt", { encoding: "utf-8" });
const rpcClient = new ethers.JsonRpcProvider(
"https://andromeda.metis.io"