diff --git a/test/0.8.9/withdrawalQueue.erc721.test.ts b/test/0.8.9/withdrawalQueue.erc721.test.ts deleted file mode 100644 index 59c7902a2..000000000 --- a/test/0.8.9/withdrawalQueue.erc721.test.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { ethers } from "hardhat"; - -import { ether } from "lib"; - -import { testERC721Compliance } from "../common/erc721.test"; - -testERC721Compliance({ - tokenName: "WithdrawalQueue NFT", - deploy: async () => { - const signers = await ethers.getSigners(); - const holder = signers[signers.length - 1]; - - const initialTotalSupply = ether("1.0"); - const holderSteth = ether("99.0"); - - const steth = await ethers.deployContract("StETHPermitMock", { value: initialTotalSupply }); - await steth.mintSteth(holder, { value: holderSteth }); - - const stethAddress = await steth.getAddress(); - const wsteth = await ethers.deployContract("WstETHMock", [stethAddress]); - - const name = "Lido: Withdrawal Request NFT"; - const symbol = "unstETH"; - - const token = await ethers.deployContract("WithdrawalQueueERC721", [await wsteth.getAddress(), name, symbol]); - - await steth.connect(holder).approve(await token.getAddress(), holderSteth); - await token.connect(holder).requestWithdrawals([holderSteth], holder); - - const holderTokenId = await token.getLastRequestId(); - - return { - token, - name, - symbol, - holder, - holderTokenId, - }; - }, -}); diff --git a/test/0.8.9/withdrawalQueue/deploy.ts b/test/0.8.9/withdrawalQueue/deploy.ts new file mode 100644 index 000000000..32c7d4882 --- /dev/null +++ b/test/0.8.9/withdrawalQueue/deploy.ts @@ -0,0 +1,49 @@ +import { ethers } from "hardhat"; + +import { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; + +import { ether } from "lib"; + +const QUEUE_NAME = "Lido: Withdrawal Request NFT"; +const QUEUE_SYMBOL = "unstETH"; + +interface MinimumWithdrawalQueueDeploymentParams { + owner: HardhatEthersSigner; + name?: string; + symbol?: string; +} + +export default async function deployMinimumWithdrawalQueue({ + owner, + name = QUEUE_NAME, + symbol = QUEUE_SYMBOL, +}: MinimumWithdrawalQueueDeploymentParams) { + const initialTotalSupply = ether("1.0"); + const holderStEth = ether("99.0"); + + const stEth = await ethers.deployContract("StETHPermitMock", { + value: initialTotalSupply, + }); + + await stEth.mintSteth(owner, { value: holderStEth }); + + const stEthAddress = await stEth.getAddress(); + const wstEth = await ethers.deployContract("WstETHMock", [stEthAddress]); + + const wstEthAddress = await wstEth.getAddress(); + + const token = await ethers.deployContract("WithdrawalQueueERC721", [wstEthAddress, name, symbol]); + + await stEth.connect(owner).approve(await token.getAddress(), holderStEth); + await token.connect(owner).requestWithdrawals([holderStEth], owner); + + const ownerTokenId = await token.getLastRequestId(); + + return { + token, + name, + symbol, + owner, + ownerTokenId, + }; +} diff --git a/test/0.8.9/withdrawalQueue/withdrawalQueue.erc721.test.ts b/test/0.8.9/withdrawalQueue/withdrawalQueue.erc721.test.ts new file mode 100644 index 000000000..f442f1659 --- /dev/null +++ b/test/0.8.9/withdrawalQueue/withdrawalQueue.erc721.test.ts @@ -0,0 +1,23 @@ +import { ethers } from "hardhat"; + +import { testERC721Compliance } from "../../common/erc721.test"; + +import deployMinimumWithdrawalQueue from "./deploy"; + +testERC721Compliance({ + tokenName: "WithdrawalQueue NFT", + deploy: async () => { + const signers = await ethers.getSigners(); + const owner = signers[signers.length - 1]; + + const deployed = await deployMinimumWithdrawalQueue({ owner }); + + return { + token: deployed.token, + name: deployed.name, + symbol: deployed.symbol, + holder: deployed.owner, + holderTokenId: deployed.ownerTokenId, + }; + }, +}); diff --git a/test/0.8.9/withdrawalQueue/withdrawalQueue.versioned.test.ts b/test/0.8.9/withdrawalQueue/withdrawalQueue.versioned.test.ts new file mode 100644 index 000000000..d2c159bf6 --- /dev/null +++ b/test/0.8.9/withdrawalQueue/withdrawalQueue.versioned.test.ts @@ -0,0 +1,25 @@ +import { ethers } from "hardhat"; + +import { WithdrawalQueueERC721__factory } from "typechain-types"; + +import { randomAddress } from "lib"; + +import { testVersionedCompliance } from "../../common/versioned.test"; + +import deployMinimumWithdrawalQueue from "./deploy"; + +testVersionedCompliance({ + name: "WithdrawalQueue Versioned", + deploy: async () => { + const signers = await ethers.getSigners(); + const owner = signers[signers.length - 1]; + const deployed = await deployMinimumWithdrawalQueue({ owner }); + return deployed.token; + }, + updates: [ + { + call: WithdrawalQueueERC721__factory.createInterface().encodeFunctionData("initialize", [randomAddress()]), + version: 1n, + }, + ], +});