|
| 1 | +import { ethers } from "ethers"; |
| 2 | +import fs from "fs"; |
| 3 | +import dotenv from "dotenv"; |
| 4 | + |
| 5 | +dotenv.config(); |
| 6 | + |
| 7 | +const provider = new ethers.JsonRpcProvider(process.env.RONIN_MAINNET_RPC); |
| 8 | +const wallet = new ethers.Wallet(process.env.RONIN_MAINNET_PK, provider); |
| 9 | +const renewList = JSON.parse(fs.readFileSync("renew-list.json", "utf8")); |
| 10 | +// Verify: https://app.roninchain.com/address/0xcd245263eddee593a5a66f93f74c58c544957339 |
| 11 | +const rnsOperation = "0xcd245263eddee593a5a66f93f74c58c544957339"; |
| 12 | +const abi = ["function bulkOverrideRenewalFees(string[] calldata labels, uint256[] calldata yearlyUSDPrices) external"]; |
| 13 | +// 0 if we want to bulk renew all labels |
| 14 | +// 5 if we want to reset renewal fee back to 5 usd |
| 15 | +const defaultFee = 0; |
| 16 | +const fees = renewList.map((_) => defaultFee); |
| 17 | +const account = "0x4BFEc2a63B72c67e6c3f599fCc40E1d42AE519ff"; |
| 18 | + |
| 19 | +console.log({ fees }); |
| 20 | + |
| 21 | +const contract = new ethers.Contract(rnsOperation, abi, provider); |
| 22 | +const shouldSimulate = true; |
| 23 | + |
| 24 | +if (shouldSimulate) { |
| 25 | + try { |
| 26 | + await contract.bulkOverrideRenewalFees.staticCall(renewList, fees, { |
| 27 | + from: account, |
| 28 | + }); |
| 29 | + } catch (error) { |
| 30 | + console.error("Failed to simulate bulk override renewal fees", error); |
| 31 | + } |
| 32 | + console.log("Simulate Bulk override renewal fees success"); |
| 33 | +} else { |
| 34 | + try { |
| 35 | + const tx = await contract.connect(wallet).bulkOverrideRenewalFees(renewList, fees); |
| 36 | + await tx.wait(); |
| 37 | + } catch (error) { |
| 38 | + console.error("Failed to bulk override renewal fees", error); |
| 39 | + } |
| 40 | + |
| 41 | + console.log("Bulk override renewal fees success"); |
| 42 | +} |
0 commit comments