|
| 1 | +import {EstforConstants} from "@paintswap/estfor-definitions"; |
| 2 | +import {ethers} from "hardhat"; |
| 3 | +import {ITEM_NFT_ADDRESS, QUESTS_ADDRESS} from "./contractAddresses"; |
| 4 | +import {allItems} from "./data/items"; |
| 5 | +import {getSafeUpgradeTransaction, initialiseSafe, sendTransactionSetToSafe} from "./utils"; |
| 6 | +import {ItemNFT__factory, Quests__factory} from "../typechain-types"; |
| 7 | +import {OperationType, MetaTransactionData} from "@safe-global/types-kit"; |
| 8 | + |
| 9 | +async function main() { |
| 10 | + const [owner, , proposer] = await ethers.getSigners(); // 0 is old deployer, 2 is proposer for Safe (new deployer) |
| 11 | + const network = await ethers.provider.getNetwork(); |
| 12 | + const {useSafe, apiKit, protocolKit} = await initialiseSafe(network); |
| 13 | + console.log(`Removing items using account: ${proposer.address} on chain id ${network.chainId}, useSafe: ${useSafe}`); |
| 14 | + |
| 15 | + const quests = await ethers.getContractAt("Quests", QUESTS_ADDRESS); |
| 16 | + |
| 17 | + const itemsToDelete = EstforConstants.QUEST_PURSE_STRINGS; |
| 18 | + |
| 19 | + if (useSafe) { |
| 20 | + const transactionSet: MetaTransactionData[] = []; |
| 21 | + const iface = Quests__factory.createInterface(); |
| 22 | + |
| 23 | + transactionSet.push({ |
| 24 | + to: ethers.getAddress(QUESTS_ADDRESS), |
| 25 | + value: "0", |
| 26 | + data: iface.encodeFunctionData("removeQuest", [itemsToDelete]), |
| 27 | + operation: OperationType.Call, |
| 28 | + }); |
| 29 | + await sendTransactionSetToSafe(network, protocolKit, apiKit, transactionSet, proposer); |
| 30 | + } else { |
| 31 | + await quests.removeQuest(itemsToDelete); |
| 32 | + } |
| 33 | +} |
| 34 | + |
| 35 | +main().catch((error) => { |
| 36 | + console.error(error); |
| 37 | + process.exitCode = 1; |
| 38 | +}); |
0 commit comments