From afdab1cd644275427fe20944de69f1f57856fe9a Mon Sep 17 00:00:00 2001 From: Moon Date: Sun, 20 Aug 2023 15:23:22 -0400 Subject: [PATCH] rm built stuff --- .gitignore | 1 + dist/index.js | 47 ----------------------------------------------- 2 files changed, 1 insertion(+), 47 deletions(-) delete mode 100644 dist/index.js diff --git a/.gitignore b/.gitignore index 9b89446..d079441 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules .env .env.* +dist diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 0823ede..0000000 --- a/dist/index.js +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-License-Identifier: MIT -import optimismSDK from "@eth-optimism/sdk"; -import ethers from "ethers"; -import fs from "fs/promises"; -import dotenv from "dotenv"; -const env = process.env.NODE_ENV || "local"; -dotenv.config({ path: `../10grans-ng/.env.${env}` }); -const ABI = ["function balanceOf(address owner) view returns (uint)"]; -const wei = process.argv[2]; -const l1Addr = (await fs.readFile(`../10grans-ng/.l1-token-address.${env}`, "utf-8")).trim(); -const l2Addr = (await fs.readFile(`../10grans-ng/.l2-token-address.${env}`, "utf-8")).trim(); -const l1ApiUrl = process.env.L1_RPC_URL; -const l1RpcProvider = new ethers.providers.JsonRpcProvider(l1ApiUrl); -const l1ChainId = (await l1RpcProvider.getNetwork()).chainId; -const l1PrivateKey = ethers.utils.HDNode.fromMnemonic(process.env.MNEMONIC).derivePath(ethers.utils.defaultPath).privateKey; -const l1Wallet = new ethers.Wallet(l1PrivateKey, l1RpcProvider); -const l1Artifacts = JSON.parse(await fs.readFile("../10grans-ng/artifacts/contracts/L1Token.sol/L1Token.json", "utf-8")); -const l1Token = new ethers.Contract(l1Addr, ABI, l1RpcProvider); -const l2ApiUrl = process.env.L2_RPC_URL; -const l2RpcProvider = new ethers.providers.JsonRpcProvider(l2ApiUrl); -const l2ChainId = (await l2RpcProvider.getNetwork()).chainId; -const l2Wallet = new ethers.Wallet(l1PrivateKey, l2RpcProvider); -const l2Artifacts = JSON.parse(await fs.readFile("../10grans-ng/artifacts/contracts/L2Token.sol/L2Token.json", "utf-8")); -const l2Token = new ethers.Contract(l2Addr, ABI, l2RpcProvider); -let l1Balance = await l1Token.balanceOf(l1Wallet.address); -console.log(`BEFORE L1 wallet balance: ${l1Balance}`); -let l2Balance = await l2Token.balanceOf(l1Wallet.address); -console.log(`BEFORE L2 wallet balance: ${l2Balance}`); -const crossChainMessenger = new optimismSDK.CrossChainMessenger({ - l1ChainId: l1ChainId, - l2ChainId: l2ChainId, - l1SignerOrProvider: l1Wallet, - l2SignerOrProvider: l2Wallet -}); -console.log("Approving transfer..."); -const depositTx1 = await crossChainMessenger.approveERC20(l1Token.address, l2Addr, wei); -await depositTx1.wait(); -const blockNumber = await l2RpcProvider.getBlockNumber(); -console.log("Depositing..."); -const depositTx2 = await crossChainMessenger.depositERC20(l1Token.address, l2Addr, wei); -await depositTx2.wait(); -console.log("Waiting for response, could take a while..."); -await crossChainMessenger.waitForMessageStatus(depositTx2.hash, optimismSDK.MessageStatus.RELAYED, { fromBlockOrBlockHash: blockNumber }); -l1Balance = await l1Token.balanceOf(l1Wallet.address); -console.log(`AFTER L1 wallet balance: ${l1Balance}`); -l2Balance = await l2Token.balanceOf(l1Wallet.address); -console.log(`AFTER L2 wallet balance: ${l2Balance}`);