From a711af9a799c4bae152b7199af124889e1ce597f Mon Sep 17 00:00:00 2001 From: nicholaspai Date: Thu, 26 Sep 2024 11:07:23 -0400 Subject: [PATCH 1/4] improve(unwrapWeth): Add Redstone to unwrap weth script --- scripts/unwrapWeth.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/unwrapWeth.ts b/scripts/unwrapWeth.ts index f1b710dd1..d14d96d19 100644 --- a/scripts/unwrapWeth.ts +++ b/scripts/unwrapWeth.ts @@ -23,6 +23,7 @@ const WETH_ADDRESSES = { 288: "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000", 324: "0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91", 8453: "0x4200000000000000000000000000000000000006", + 7777777: "0x4200000000000000000000000000000000000006" }; export async function run(): Promise { From 7bde93ba6221ffecf4468c9d6774e2a2a4aa364f Mon Sep 17 00:00:00 2001 From: nicholaspai Date: Thu, 26 Sep 2024 11:08:15 -0400 Subject: [PATCH 2/4] Update unwrapWeth.ts --- scripts/unwrapWeth.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/unwrapWeth.ts b/scripts/unwrapWeth.ts index d14d96d19..fe7f16514 100644 --- a/scripts/unwrapWeth.ts +++ b/scripts/unwrapWeth.ts @@ -23,7 +23,7 @@ const WETH_ADDRESSES = { 288: "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000", 324: "0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91", 8453: "0x4200000000000000000000000000000000000006", - 7777777: "0x4200000000000000000000000000000000000006" + 7777777: "0x4200000000000000000000000000000000000006", }; export async function run(): Promise { From 5ed63f17c308ecf2107172a447a7c432da0775f0 Mon Sep 17 00:00:00 2001 From: nicholaspai Date: Fri, 27 Sep 2024 19:34:05 -0400 Subject: [PATCH 3/4] Update unwrapWeth.ts --- scripts/unwrapWeth.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/unwrapWeth.ts b/scripts/unwrapWeth.ts index fe7f16514..297fbb7c6 100644 --- a/scripts/unwrapWeth.ts +++ b/scripts/unwrapWeth.ts @@ -1,4 +1,13 @@ -import { ethers, retrieveSignerFromCLIArgs, getProvider, WETH9, toBN, isKeyOf, getNetworkName } from "../src/utils"; +import { + ethers, + retrieveSignerFromCLIArgs, + getProvider, + WETH9, + toBN, + isKeyOf, + getNetworkName, + TOKEN_SYMBOLS_MAP, +} from "../src/utils"; import { askYesNoQuestion } from "./utils"; import minimist from "minimist"; @@ -37,10 +46,10 @@ export async function run(): Promise { const signerAddr = await baseSigner.getAddress(); const chainId = Number(args.chainId); const connectedSigner = baseSigner.connect(await getProvider(chainId)); - if (!isKeyOf(chainId, WETH_ADDRESSES)) { + if (!TOKEN_SYMBOLS_MAP.WETH.addresses[chainId]) { throw new Error("chainId does not have a defined WETH address"); } - const token = WETH_ADDRESSES[chainId]; + const token = TOKEN_SYMBOLS_MAP.WETH.addresses[chainId]; const weth = new ethers.Contract(token, WETH9.abi, connectedSigner); const decimals = 18; const amountFromWei = ethers.utils.formatUnits(args.amount, decimals); From 4d74822b881196a2ba27f67010a9168b3f700b34 Mon Sep 17 00:00:00 2001 From: nicholaspai Date: Fri, 27 Sep 2024 19:34:56 -0400 Subject: [PATCH 4/4] Update unwrapWeth.ts --- scripts/unwrapWeth.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/scripts/unwrapWeth.ts b/scripts/unwrapWeth.ts index 297fbb7c6..e258940e4 100644 --- a/scripts/unwrapWeth.ts +++ b/scripts/unwrapWeth.ts @@ -4,7 +4,6 @@ import { getProvider, WETH9, toBN, - isKeyOf, getNetworkName, TOKEN_SYMBOLS_MAP, } from "../src/utils"; @@ -24,17 +23,6 @@ const args = minimist(process.argv.slice(2), { // \ --wallet gckms // \ --keys bot1 -const WETH_ADDRESSES = { - 1: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - 10: "0x4200000000000000000000000000000000000006", - 42161: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1", - 137: "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619", - 288: "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000", - 324: "0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91", - 8453: "0x4200000000000000000000000000000000000006", - 7777777: "0x4200000000000000000000000000000000000006", -}; - export async function run(): Promise { if (!Object.keys(args).includes("chainId")) { throw new Error("Define `chainId` as the chain you want to connect on");