From f5c27e5d87d415afa85223a7c4343e099d8af3d5 Mon Sep 17 00:00:00 2001 From: Andres Adjimann Date: Thu, 21 Sep 2023 13:49:02 -0300 Subject: [PATCH 1/3] feat: use ethers v6 in the instant-giveaway pacakge --- packages/giveaway/package.json | 50 +- packages/giveaway/test/fixtures.ts | 84 ++- packages/giveaway/test/signature.ts | 118 ++-- packages/giveaway/test/signedMultiGiveaway.ts | 640 ++++++++++-------- 4 files changed, 476 insertions(+), 416 deletions(-) diff --git a/packages/giveaway/package.json b/packages/giveaway/package.json index 341a16538d..9c3fcb004e 100644 --- a/packages/giveaway/package.json +++ b/packages/giveaway/package.json @@ -55,44 +55,40 @@ } }, "dependencies": { - "@openzeppelin/contracts-upgradeable": "^4.9.0" + "@openzeppelin/contracts-upgradeable": "^4.9.3" }, "devDependencies": { - "@dlsl/hardhat-markup": "^1.0.0-rc.11", - "@ethersproject/abi": "^5.7.0", - "@ethersproject/providers": "^5.7.2", - "@nomicfoundation/hardhat-chai-matchers": "1", - "@nomicfoundation/hardhat-network-helpers": "^1.0.8", - "@nomicfoundation/hardhat-toolbox": "^2.0.2", - "@nomiclabs/hardhat-ethers": "^2.2.3", - "@nomiclabs/hardhat-etherscan": "^3.1.7", - "@openzeppelin/contracts-upgradeable": "^4.9.0", + "@dlsl/hardhat-markup": "^1.0.0-rc.14", + "@nomicfoundation/hardhat-chai-matchers": "^2.0.2", + "@nomicfoundation/hardhat-ethers": "^3.0.4", + "@nomicfoundation/hardhat-network-helpers": "^1.0.9", + "@nomicfoundation/hardhat-toolbox": "^3.0.0", + "@nomicfoundation/hardhat-verify": "^1.1.1", "@release-it/keep-a-changelog": "^4.0.0", - "@typechain/ethers-v5": "^10.1.0", - "@typechain/hardhat": "^6.1.2", - "@types/chai": "^4.3.5", + "@typechain/ethers-v6": "^0.5.0", + "@typechain/hardhat": "^9.0.0", + "@types/chai": "^4.3.6", "@types/mocha": "^10.0.1", - "@types/node": "^20.2.5", - "@typescript-eslint/eslint-plugin": "^5.59.8", - "@typescript-eslint/parser": "^5.59.8", - "chai": "^4.3.7", - "dotenv": "^16.1.3", - "eslint": "^8.41.0", - "eslint-config-prettier": "^8.8.0", + "@types/node": "^20.6.3", + "@typescript-eslint/eslint-plugin": "^6.7.2", + "@typescript-eslint/parser": "^6.7.2", + "chai": "^4.3.8", + "dotenv": "^16.3.1", + "eslint": "^8.49.0", + "eslint-config-prettier": "^9.0.0", "eslint-plugin-mocha": "^10.1.0", "eslint-plugin-prettier": "^4.2.1", - "eth-sig-util": "^3.0.1", - "ethers": "^5.0.0", - "hardhat": "^2.14.1", + "ethers": "^6.7.1", + "hardhat": "^2.17.3", "hardhat-gas-reporter": "^1.0.9", "prettier": "^2.8.8", "prettier-plugin-solidity": "^1.1.3", "release-it": "^16.1.5", - "solhint": "^3.4.1", + "solhint": "^3.6.2", "solhint-plugin-prettier": "^0.0.5", - "solidity-coverage": "^0.8.2", + "solidity-coverage": "^0.8.4", "ts-node": "^10.9.1", - "typechain": "^8.2.0", - "typescript": "5.0.4" + "typechain": "^8.3.1", + "typescript": "^5.2.2" } } diff --git a/packages/giveaway/test/fixtures.ts b/packages/giveaway/test/fixtures.ts index 89fd525742..ab0edcc7a0 100644 --- a/packages/giveaway/test/fixtures.ts +++ b/packages/giveaway/test/fixtures.ts @@ -1,4 +1,3 @@ -import {BigNumber, BigNumberish, Contract, Signer} from 'ethers'; import { Claim, compareClaim, @@ -11,6 +10,7 @@ import { } from './signature'; import {ethers} from 'hardhat'; import {expect} from 'chai'; +import {Contract, Signer} from 'ethers'; export async function deploy( name: string, @@ -18,7 +18,7 @@ export async function deploy( ): Promise { const Contract = await ethers.getContractFactory(name); const contract = await Contract.deploy(); - await contract.deployed(); + await contract.waitForDeployment(); const ret = []; for (const s of users) { ret.push(await contract.connect(s)); @@ -35,14 +35,14 @@ export async function deployWithProxy( const Proxy = await ethers.getContractFactory('FakeProxy'); // This uses signers[0] - const proxy = await Proxy.deploy(contract[0].address); - await proxy.deployed(); + const proxy = await Proxy.deploy(await contract[0].getAddress()); + await proxy.waitForDeployment(); const ret = []; for (let i = 0; i < contract.length; i++) { - ret[i] = await contract[i].attach(proxy.address); + ret[i] = await contract[i].attach(await proxy.getAddress()); } // add implementation contract - ret.push(contract[0]); + ret.push(contract[contract.length - 1]); return ret; } @@ -80,12 +80,18 @@ export async function setupSignedMultiGiveaway() { ]); // Initialize - await contractAsDeployer.initialize(trustedForwarder.address, admin.address); + await contractAsDeployer.initialize( + await trustedForwarder.getAddress(), + await admin.getAddress() + ); // Grant roles. const signerRole = await contractAsAdmin.SIGNER_ROLE(); - await contractAsAdmin.grantRole(signerRole, signer.address); + await contractAsAdmin.grantRole(signerRole, await signer.getAddress()); const backofficeRole = await contractAsAdmin.BACKOFFICE_ROLE(); - await contractAsAdmin.grantRole(backofficeRole, backofficeAdmin.address); + await contractAsAdmin.grantRole( + backofficeRole, + await backofficeAdmin.getAddress() + ); interface ERC721Balance { tokenType: TokenType.ERC721 | TokenType.ERC721_SAFE; @@ -111,7 +117,7 @@ export async function setupSignedMultiGiveaway() { claims: Claim[] ) { const pos = await balances(source, claims); - const postDest = await balances(dest.address, claims); + const postDest = await balances(await dest.getAddress(), claims); for (const [idx, c] of claims.entries()) { switch (c.tokenType) { case TokenType.ERC20: @@ -121,20 +127,16 @@ export async function setupSignedMultiGiveaway() { const rDest = preDest[idx] as ERC20Claim; const s = pos[idx] as ERC20Claim; const sDest = postDest[idx] as ERC20Claim; - expect(s.amount).to.be.equal( - BigNumber.from(r.amount).sub(c.amount) - ); - expect(sDest.amount).to.be.equal( - BigNumber.from(rDest.amount).add(c.amount) - ); + expect(s.amount).to.be.equal(r.amount - c.amount); + expect(sDest.amount).to.be.equal(rDest.amount + c.amount); } break; case TokenType.ERC721: { const r = pre[idx] as ERC721Balance; const s = pos[idx] as ERC721Balance; - expect(r.owner).to.be.equal(contract.address); - expect(s.owner).to.be.equal(dest.address); + expect(r.owner).to.be.equal(await contract.getAddress()); + expect(s.owner).to.be.equal(await dest.getAddress()); } break; } @@ -203,12 +205,22 @@ export async function setupSignedMultiGiveaway() { } break; case TokenType.ERC1155: - await c.token.mint(address, c.tokenId, c.amount, c.data); + await c.token.mint( + address, + c.tokenId, + c.amount, + ethers.getBytes(c.data) + ); break; case TokenType.ERC1155_BATCH: { for (const [idx, tokenId] of c.tokenIds.entries()) { - await c.token.mint(address, tokenId, c.amounts[idx], c.data); + await c.token.mint( + address, + tokenId, + c.amounts[idx], + ethers.getBytes(c.data) + ); } } break; @@ -223,42 +235,42 @@ export async function setupSignedMultiGiveaway() { balances, checkBalances, signAndClaim: async ( - claimIds: BigNumberish[], + claimIds: bigint[], claims: Claim[], signerUser = signer, expiration = 0 ) => { - await mintToContract(contract.address, claims); - const pre = await balances(contract.address, claims); - const preDest = await balances(dest.address, claims); + await mintToContract(await contract.getAddress(), claims); + const pre = await balances(await contract.getAddress(), claims); + const preDest = await balances(await dest.getAddress(), claims); const {v, r, s} = await signedMultiGiveawaySignature( contract, - signerUser.address, + signerUser, claimIds, expiration, - contract.address, - dest.address, - getClaimEntires(claims) + await contract.getAddress(), + await dest.getAddress(), + await getClaimEntires(claims) ); await expect( contract.claim( [{v, r, s}], claimIds, expiration, - contract.address, - dest.address, - getClaimEntires(claims) + await contract.getAddress(), + await dest.getAddress(), + await getClaimEntires(claims) ) ) .to.emit(contract, 'Claimed') .withArgs( claimIds, - contract.address, - dest.address, - compareClaim(claims), - other.address + await contract.getAddress(), + await dest.getAddress(), + compareClaim(await getClaimEntires(claims)), + await other.getAddress() ); - await checkBalances(contract.address, pre, preDest, claims); + await checkBalances(await contract.getAddress(), pre, preDest, claims); }, signedGiveaway, contract, diff --git a/packages/giveaway/test/signature.ts b/packages/giveaway/test/signature.ts index 044f4ba7d6..0c88db5ade 100644 --- a/packages/giveaway/test/signature.ts +++ b/packages/giveaway/test/signature.ts @@ -1,8 +1,7 @@ -import {BigNumberish, Contract} from 'ethers'; +import {AbiCoder, Contract, Signer} from 'ethers'; import {Signature} from '@ethersproject/bytes'; import {ethers} from 'hardhat'; -import {signTypedData_v4} from 'eth-sig-util'; -import {BytesLike, Hexable} from '@ethersproject/bytes/src.ts/index'; +import {BytesLike} from '@ethersproject/bytes/src.ts/index'; export enum TokenType { INVALID, @@ -21,13 +20,25 @@ export type ClaimEntry = { data: string; }; -export function compareClaim(a: Claim[]): (b: ClaimEntry[]) => boolean { +export async function getClaimEntires(claims: Claim[]): Promise { + const ret: ClaimEntry[] = []; + for (const c of claims) { + ret.push({ + tokenType: c.tokenType, + tokenAddress: await c.token.getAddress(), + data: getClaimData(c), + }); + } + return ret; +} + +export function compareClaim(a: ClaimEntry[]): (b: ClaimEntry[]) => boolean { return (b: ClaimEntry[]) => a.every( (x, idx) => - x.tokenType === b[idx].tokenType && - x.token.address === b[idx].tokenAddress && - getClaimData(x) === b[idx].data + x.tokenType == b[idx].tokenType && + x.tokenAddress === b[idx].tokenAddress && + x.data === b[idx].data ); } @@ -44,31 +55,31 @@ export interface InvalidClaim extends ClaimEntryWithContract { export interface ERC20Claim extends ClaimEntryWithContract { tokenType: TokenType.ERC20; - amount: BigNumberish; + amount: bigint; } export interface ERC721Claim extends ClaimEntryWithContract { tokenType: TokenType.ERC721 | TokenType.ERC721_SAFE; - tokenId: BigNumberish; + tokenId: bigint; } export interface ERC721BatchClaim extends ClaimEntryWithContract { tokenType: TokenType.ERC721_BATCH | TokenType.ERC721_SAFE_BATCH; - tokenIds: BigNumberish[]; + tokenIds: bigint[]; } export interface ERC1155Claim extends ClaimEntryWithContract { tokenType: TokenType.ERC1155; - amount: BigNumberish; - tokenId: BigNumberish; - data: BytesLike | Hexable | number; + amount: bigint; + tokenId: bigint; + data: BytesLike; } export interface ERC1155BatchClaim extends ClaimEntryWithContract { tokenType: TokenType.ERC1155_BATCH; - amounts: BigNumberish[]; - tokenIds: BigNumberish[]; - data: BytesLike | Hexable | number; + amounts: bigint[]; + tokenIds: bigint[]; + data: BytesLike; } export type Claim = @@ -81,75 +92,43 @@ export type Claim = export const getClaimData = function (claim: Claim): string { switch (claim.tokenType) { case TokenType.ERC20: - return ethers.utils.defaultAbiCoder.encode(['uint256'], [claim.amount]); + return AbiCoder.defaultAbiCoder().encode(['uint256'], [claim.amount]); case TokenType.ERC721: case TokenType.ERC721_SAFE: - return ethers.utils.defaultAbiCoder.encode(['uint256'], [claim.tokenId]); + return AbiCoder.defaultAbiCoder().encode(['uint256'], [claim.tokenId]); case TokenType.ERC721_BATCH: case TokenType.ERC721_SAFE_BATCH: - return ethers.utils.defaultAbiCoder.encode( - ['uint256[]'], - [claim.tokenIds] - ); + return AbiCoder.defaultAbiCoder().encode(['uint256[]'], [claim.tokenIds]); case TokenType.ERC1155: - return ethers.utils.defaultAbiCoder.encode( + return AbiCoder.defaultAbiCoder().encode( ['uint256', 'uint256', 'bytes'], - [ - claim.tokenId, - claim.amount.toString(), - ethers.utils.arrayify(claim.data), - ] + [claim.tokenId, claim.amount.toString(), ethers.getBytes(claim.data)] ); case TokenType.ERC1155_BATCH: - return ethers.utils.defaultAbiCoder.encode( + return AbiCoder.defaultAbiCoder().encode( ['uint256[]', 'uint256[]', 'bytes'], - [claim.tokenIds, claim.amounts, ethers.utils.arrayify(claim.data)] + [claim.tokenIds, claim.amounts, ethers.getBytes(claim.data)] ); default: throw new Error('Invalid type:' + (claim as Claim).tokenType); } }; -export function getClaimEntires(claims: Claim[]): ClaimEntry[] { - return claims.map((x) => ({ - tokenType: x.tokenType, - tokenAddress: x.token.address, - data: getClaimData(x), - })); -} - export const signedMultiGiveawaySignature = async function ( contract: Contract, - signer: string, - claimIds: BigNumberish[], + signer: Signer, + claimIds: bigint[], expiration: number, from: string, to: string, claims: ClaimEntry[], privateKey = '' ): Promise { - const chainId = (await contract.provider.getNetwork()).chainId; + const n = await contract.runner?.provider?.getNetwork(); + const chainId = n.chainId; const data = { types: { - EIP712Domain: [ - { - name: 'name', - type: 'string', - }, - { - name: 'version', - type: 'string', - }, - { - name: 'chainId', - type: 'uint256', - }, - { - name: 'verifyingContract', - type: 'address', - }, - ], ClaimEntry: [ {name: 'tokenType', type: 'uint256'}, {name: 'tokenAddress', type: 'address'}, @@ -168,7 +147,7 @@ export const signedMultiGiveawaySignature = async function ( name: 'Sandbox SignedMultiGiveaway', version: '1.0', chainId: chainId.toString(), - verifyingContract: contract.address, + verifyingContract: await contract.getAddress(), }, message: { claimIds: claimIds.map((x) => x.toString()), @@ -177,18 +156,15 @@ export const signedMultiGiveawaySignature = async function ( to, claims, }, - } as never; + }; - let signature; if (privateKey) { - signature = signTypedData_v4(ethers.utils.arrayify(privateKey) as Buffer, { - data, - }); - } else { - signature = await ethers.provider.send('eth_signTypedData_v4', [ - signer, - data, - ]); + signer = new ethers.Wallet(privateKey); } - return ethers.utils.splitSignature(signature); + const signature = await signer.signTypedData( + data.domain, + data.types, + data.message + ); + return ethers.Signature.from(signature); }; diff --git a/packages/giveaway/test/signedMultiGiveaway.ts b/packages/giveaway/test/signedMultiGiveaway.ts index 5f06b92282..6f8e51fb8b 100644 --- a/packages/giveaway/test/signedMultiGiveaway.ts +++ b/packages/giveaway/test/signedMultiGiveaway.ts @@ -1,11 +1,4 @@ import {ethers} from 'hardhat'; -import { - defaultAbiCoder, - keccak256, - solidityPack, - toUtf8Bytes, -} from 'ethers/lib/utils'; -import {BigNumber, constants} from 'ethers'; import { Claim, ClaimEntry, @@ -16,6 +9,7 @@ import { import {expect} from 'chai'; import {loadFixture, time} from '@nomicfoundation/hardhat-network-helpers'; import {deploySignedMultiGiveaway, setupSignedMultiGiveaway} from './fixtures'; +import {AbiCoder} from 'ethers'; describe('SignedMultiGiveaway.sol', function () { describe('initialization', function () { @@ -23,7 +17,10 @@ describe('SignedMultiGiveaway.sol', function () { const {implementation} = await loadFixture(deploySignedMultiGiveaway); const [, , trustedForwarder, admin] = await ethers.getSigners(); await expect( - implementation.initialize(trustedForwarder.address, admin.address) + implementation.initialize( + await trustedForwarder.getAddress(), + await admin.getAddress() + ) ).to.revertedWith('Initializable: contract is already initialized'); }); @@ -34,17 +31,24 @@ describe('SignedMultiGiveaway.sol', function () { const defaultAdminRole = await contract.DEFAULT_ADMIN_ROLE(); // Initialize - const tx = contract.initialize(trustedForwarder.address, admin.address); + const tx = contract.initialize( + await trustedForwarder.getAddress(), + await admin.getAddress() + ); await expect(tx) .to.emit(contract, 'TrustedForwarderSet') .withArgs( - constants.AddressZero, - trustedForwarder.address, - deployer.address + ethers.ZeroAddress, + await trustedForwarder.getAddress(), + await deployer.getAddress() ); await expect(tx) .to.emit(contract, 'RoleGranted') - .withArgs(defaultAdminRole, admin.address, deployer.address); + .withArgs( + defaultAdminRole, + await admin.getAddress(), + await deployer.getAddress() + ); }); it('interfaces', async function () { @@ -73,7 +77,7 @@ describe('SignedMultiGiveaway.sol', function () { expect( await fixtures.contract.hasRole( defaultAdminRole, - fixtures.admin.address + await fixtures.admin.getAddress() ) ).to.be.true; }); @@ -83,12 +87,15 @@ describe('SignedMultiGiveaway.sol', function () { const backofficeRole = await fixtures.contract.BACKOFFICE_ROLE(); expect( - await fixtures.contract.hasRole(backofficeRole, fixtures.admin.address) + await fixtures.contract.hasRole( + backofficeRole, + await fixtures.admin.getAddress() + ) ).to.be.true; expect( await fixtures.contract.hasRole( backofficeRole, - fixtures.backofficeAdmin.address + await fixtures.backofficeAdmin.getAddress() ) ).to.be.true; }); @@ -98,7 +105,10 @@ describe('SignedMultiGiveaway.sol', function () { const signerRole = await fixtures.contract.SIGNER_ROLE(); expect( - await fixtures.contract.hasRole(signerRole, fixtures.signer.address) + await fixtures.contract.hasRole( + signerRole, + await fixtures.signer.getAddress() + ) ).to.be.true; }); }); @@ -107,8 +117,8 @@ describe('SignedMultiGiveaway.sol', function () { it('should be able to claim', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); - const amount = ethers.utils.parseEther('5'); + const claimId = 0x123n; + const amount = ethers.parseEther('5'); const claims: Claim[] = [ { tokenType: TokenType.ERC20, @@ -141,57 +151,57 @@ describe('SignedMultiGiveaway.sol', function () { '0xaBe4FF8922a4476E94d3A8960021e4d3C7127721', signer ); - const claimIds = [0x123]; + const claimIds = [0x123n]; const claims: Claim[] = [ { tokenType: TokenType.ERC20, token, - amount: '0x123', + amount: 0x123n, }, { tokenType: TokenType.ERC721, token, - tokenId: '0x123', + tokenId: 0x123n, }, { tokenType: TokenType.ERC721_BATCH, token, - tokenIds: ['0x123', '0x124'], + tokenIds: [0x123n, 0x124n], }, { tokenType: TokenType.ERC1155, token, - tokenId: '0x123', - amount: '0x123', - data: [], + tokenId: 0x123n, + amount: 0x123n, + data: '0x', }, { tokenType: TokenType.ERC1155_BATCH, token, - tokenIds: ['0x123', '0x124'], - amounts: ['0x123', '0x124'], - data: [], + tokenIds: [0x123n, 0x124n], + amounts: [0x123n, 0x124n], + data: '0x', }, ]; const expiration = 0; - const from = contract.address; + const from = await contract.getAddress(); const {v, r, s} = await signedMultiGiveawaySignature( contract, - signer.address, + await signer.getAddress(), claimIds, expiration, from, to, - getClaimEntires(claims), + await getClaimEntires(claims), pk ); - const ret = await contract.populateTransaction.claim( + const ret = await contract.claim.populateTransaction( [{v, r, s}], claimIds, expiration, from, to, - getClaimEntires(claims) + await getClaimEntires(claims) ); console.log(ret); }); @@ -199,8 +209,8 @@ describe('SignedMultiGiveaway.sol', function () { it('should be able to claim multiple tokens', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); - const amount = ethers.utils.parseEther('5'); + const claimId = 0x123n; + const amount = ethers.parseEther('5'); const claims: Claim[] = [ { tokenType: TokenType.ERC20, @@ -210,36 +220,36 @@ describe('SignedMultiGiveaway.sol', function () { { tokenType: TokenType.ERC721, token: fixtures.landToken, - tokenId: 123, + tokenId: 123n, }, { tokenType: TokenType.ERC721_SAFE, token: fixtures.landToken, - tokenId: 124, + tokenId: 124n, }, { tokenType: TokenType.ERC721_BATCH, token: fixtures.landToken, - tokenIds: [125, 126], + tokenIds: [125n, 126n], }, { tokenType: TokenType.ERC721_SAFE_BATCH, token: fixtures.landToken, - tokenIds: [127, 128], + tokenIds: [127n, 128n], }, { tokenType: TokenType.ERC1155, token: fixtures.assetToken, - tokenId: 456, + tokenId: 456n, amount, - data: [], + data: '0x', }, { tokenType: TokenType.ERC1155_BATCH, token: fixtures.assetToken, - tokenIds: [457, 458], - amounts: [12, 13], - data: [], + tokenIds: [457n, 458n], + amounts: [12n, 13n], + data: '0x', }, ]; await fixtures.contractAsAdmin.setMaxClaimEntries(claims.length); @@ -249,8 +259,8 @@ describe('SignedMultiGiveaway.sol', function () { it('should be able to claim with approve', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); - const amount = ethers.utils.parseEther('5'); + const claimId = 0x123n; + const amount = ethers.parseEther('5'); const claims: Claim[] = [ { tokenType: TokenType.ERC20, @@ -258,32 +268,38 @@ describe('SignedMultiGiveaway.sol', function () { amount, }, ]; - await fixtures.sandToken.mint(fixtures.other.address, amount); + await fixtures.sandToken.mint(await fixtures.other.getAddress(), amount); await fixtures.sandTokenAsOther.approve( - fixtures.contract.address, + await fixtures.contract.getAddress(), amount ); - const pre = await fixtures.balances(fixtures.other.address, claims); - const preDest = await fixtures.balances(fixtures.dest.address, claims); + const pre = await fixtures.balances( + await fixtures.other.getAddress(), + claims + ); + const preDest = await fixtures.balances( + await fixtures.dest.getAddress(), + claims + ); const sig = await signedMultiGiveawaySignature( fixtures.contract, - fixtures.signer.address, + fixtures.signer, [claimId], 0, - fixtures.other.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.other.getAddress(), + await fixtures.dest.getAddress(), + await await getClaimEntires(claims) ); await fixtures.contract.claim( [sig], [claimId], 0, - fixtures.other.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.other.getAddress(), + await fixtures.dest.getAddress(), + await await getClaimEntires(claims) ); await fixtures.checkBalances( - fixtures.other.address, + await fixtures.other.getAddress(), pre, preDest, claims @@ -294,8 +310,8 @@ describe('SignedMultiGiveaway.sol', function () { it('should be able to claim with N signatures', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); - const amount = ethers.utils.parseEther('5'); + const claimId = 0x123n; + const amount = ethers.parseEther('5'); const claims: Claim[] = [ { tokenType: TokenType.ERC20, @@ -303,43 +319,52 @@ describe('SignedMultiGiveaway.sol', function () { amount, }, ]; - await fixtures.mintToContract(fixtures.contract.address, claims); - const pre = await fixtures.balances(fixtures.contract.address, claims); - const preDest = await fixtures.balances(fixtures.dest.address, claims); + await fixtures.mintToContract( + await fixtures.contract.getAddress(), + claims + ); + const pre = await fixtures.balances( + await fixtures.contract.getAddress(), + claims + ); + const preDest = await fixtures.balances( + await fixtures.dest.getAddress(), + claims + ); const sig1 = await signedMultiGiveawaySignature( fixtures.contract, - fixtures.signer.address, + fixtures.signer, [claimId], 0, - fixtures.contract.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), + await await getClaimEntires(claims) ); const signerRole = await fixtures.contractAsAdmin.SIGNER_ROLE(); await fixtures.contractAsAdmin.grantRole( signerRole, - fixtures.other.address + await fixtures.other.getAddress() ); const sig2 = await signedMultiGiveawaySignature( fixtures.contract, - fixtures.other.address, + fixtures.other, [claimId], 0, - fixtures.contract.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), + await await getClaimEntires(claims) ); await fixtures.contractAsAdmin.setNumberOfSignaturesNeeded(2); await fixtures.contract.claim( [sig1, sig2], [claimId], 0, - fixtures.contract.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), + await await getClaimEntires(claims) ); await fixtures.checkBalances( - fixtures.contract.address, + await fixtures.contract.getAddress(), pre, preDest, claims @@ -349,8 +374,8 @@ describe('SignedMultiGiveaway.sol', function () { it('signatures must be in order other < signer', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); - const amount = ethers.utils.parseEther('5'); + const claimId = 0x123n; + const amount = ethers.parseEther('5'); const claims: Claim[] = [ { tokenType: TokenType.ERC20, @@ -358,29 +383,32 @@ describe('SignedMultiGiveaway.sol', function () { amount, }, ]; - await fixtures.mintToContract(fixtures.contract.address, claims); + await fixtures.mintToContract( + await fixtures.contract.getAddress(), + claims + ); const sig1 = await signedMultiGiveawaySignature( fixtures.contract, - fixtures.signer.address, + fixtures.signer, [claimId], 0, - fixtures.contract.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), + await await getClaimEntires(claims) ); const signerRole = await fixtures.contractAsAdmin.SIGNER_ROLE(); await fixtures.contractAsAdmin.grantRole( signerRole, - fixtures.other.address + await fixtures.other.getAddress() ); const sig2 = await signedMultiGiveawaySignature( fixtures.contract, - fixtures.other.address, + fixtures.other, [claimId], 0, - fixtures.contract.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), + await await getClaimEntires(claims) ); await fixtures.contractAsAdmin.setNumberOfSignaturesNeeded(2); @@ -390,9 +418,9 @@ describe('SignedMultiGiveaway.sol', function () { [sig2, sig1], [claimId], 0, - fixtures.contract.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), + await getClaimEntires(claims) ) ).to.revertedWith('invalid order'); }); @@ -401,8 +429,8 @@ describe('SignedMultiGiveaway.sol', function () { it('should fail to claim if amount is zero', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); - const amount = 0; + const claimId = 0x123n; + const amount = 0n; const claims: Claim[] = [ { tokenType: TokenType.ERC20, @@ -418,7 +446,7 @@ describe('SignedMultiGiveaway.sol', function () { it('should be fail to claim ERC1155 in batch if wrong len', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); + const claimId = 0x123n; await expect( fixtures.signAndClaim( [claimId], @@ -428,7 +456,7 @@ describe('SignedMultiGiveaway.sol', function () { token: fixtures.assetToken, tokenIds: [], amounts: [], - data: [], + data: '0x', }, ] ) @@ -437,28 +465,28 @@ describe('SignedMultiGiveaway.sol', function () { { tokenType: TokenType.ERC1155_BATCH, token: fixtures.assetToken, - tokenIds: [12], + tokenIds: [12n], amounts: [], - data: [], + data: '0x', }, ]; const {v, r, s} = await signedMultiGiveawaySignature( fixtures.contract, - fixtures.signer.address, + fixtures.signer, [claimId], 0, - fixtures.contract.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), + await getClaimEntires(claims) ); await expect( fixtures.contract.claim( [{v, r, s}], [claimId], 0, - fixtures.contract.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), + await getClaimEntires(claims) ) ).to.revertedWith('invalid data'); }); @@ -466,12 +494,12 @@ describe('SignedMultiGiveaway.sol', function () { it('should fail to claim the same id twice', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); + const claimId = 0x123n; const claims: Claim[] = [ { tokenType: TokenType.ERC20, token: fixtures.sandToken, - amount: ethers.utils.parseEther('5'), + amount: ethers.parseEther('5'), }, ]; await fixtures.signAndClaim([1, 2, 3, claimId], claims); @@ -483,32 +511,35 @@ describe('SignedMultiGiveaway.sol', function () { it('should fail to claim if the signature is wrong', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); + const claimId = 0x123n; const claims: Claim[] = [ { tokenType: TokenType.ERC20, token: fixtures.sandToken, - amount: ethers.utils.parseEther('5'), + amount: ethers.parseEther('5'), }, ]; - await fixtures.mintToContract(fixtures.contract.address, claims); + await fixtures.mintToContract( + await fixtures.contract.getAddress(), + claims + ); const {v, r, s} = await signedMultiGiveawaySignature( fixtures.contract, - fixtures.signer.address, - [claimId.add(1)], + fixtures.signer, + [claimId + 1n], 0, - fixtures.contract.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), + await getClaimEntires(claims) ); await expect( fixtures.contract.claim( [{v, r, s}], [claimId], 0, - fixtures.contract.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), + await getClaimEntires(claims) ) ).to.be.revertedWith('invalid signer'); }); @@ -516,12 +547,12 @@ describe('SignedMultiGiveaway.sol', function () { it('should fail to mint if the signer is invalid', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); + const claimId = 0x123n; const claims: Claim[] = [ { tokenType: TokenType.ERC20, token: fixtures.sandToken, - amount: ethers.utils.parseEther('5'), + amount: ethers.parseEther('5'), }, ]; await expect( @@ -532,8 +563,8 @@ describe('SignedMultiGiveaway.sol', function () { it('claim with metaTX trusted forwarder', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); - const amount = ethers.utils.parseEther('5'); + const claimId = 0x123n; + const amount = ethers.parseEther('5'); const claims: Claim[] = [ { tokenType: TokenType.ERC20, @@ -541,38 +572,47 @@ describe('SignedMultiGiveaway.sol', function () { amount, }, ]; - await fixtures.mintToContract(fixtures.contract.address, claims); - const pre = await fixtures.balances(fixtures.contract.address, claims); - const preDest = await fixtures.balances(fixtures.dest.address, claims); + await fixtures.mintToContract( + await fixtures.contract.getAddress(), + claims + ); + const pre = await fixtures.balances( + await fixtures.contract.getAddress(), + claims + ); + const preDest = await fixtures.balances( + await fixtures.dest.getAddress(), + claims + ); const {v, r, s} = await signedMultiGiveawaySignature( fixtures.contract, - fixtures.signer.address, + fixtures.signer, [claimId], 0, - fixtures.contract.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), + await getClaimEntires(claims) ); const contractAsTrustedForwarder = await fixtures.signedGiveaway.connect( fixtures.trustedForwarder ); - const txData = await contractAsTrustedForwarder.populateTransaction.claim( + const txData = await contractAsTrustedForwarder.claim.populateTransaction( [{v, r, s}], [claimId], 0, - fixtures.contract.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), + await getClaimEntires(claims) ); // The msg.sender goes at the end. - txData.data = solidityPack( + txData.data = ethers.solidityPacked( ['bytes', 'address'], - [txData.data, fixtures.other.address] + [txData.data, await fixtures.other.getAddress()] ); - await contractAsTrustedForwarder.signer.sendTransaction(txData); + await contractAsTrustedForwarder.runner.sendTransaction(txData); await fixtures.checkBalances( - fixtures.contract.address, + await fixtures.contract.getAddress(), pre, preDest, claims @@ -582,8 +622,8 @@ describe('SignedMultiGiveaway.sol', function () { it('should be able to batch claim', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const baseClaimId = BigNumber.from(0x123); - const amount = ethers.utils.parseEther('5'); + const baseClaimId = 0x123n; + const amount = ethers.parseEther('5'); const claims: Claim[] = [ { tokenType: TokenType.ERC20, @@ -593,43 +633,52 @@ describe('SignedMultiGiveaway.sol', function () { { tokenType: TokenType.ERC721, token: fixtures.landToken, - tokenId: 123, + tokenId: 123n, }, { tokenType: TokenType.ERC1155, token: fixtures.assetToken, - tokenId: 456, + tokenId: 456n, amount, - data: [], + data: '0x', }, ]; - await fixtures.mintToContract(fixtures.contract.address, claims); - const pre = await fixtures.balances(fixtures.contract.address, claims); - const preDest = await fixtures.balances(fixtures.dest.address, claims); + await fixtures.mintToContract( + await fixtures.contract.getAddress(), + claims + ); + const pre = await fixtures.balances( + await fixtures.contract.getAddress(), + claims + ); + const preDest = await fixtures.balances( + await fixtures.dest.getAddress(), + claims + ); const args = []; for (const [i, c] of claims.entries()) { - const claimId = baseClaimId.add(i); + const claimId = baseClaimId + BigInt(i); const {v, r, s} = await signedMultiGiveawaySignature( fixtures.contract, - fixtures.signer.address, + fixtures.signer, [claimId], 0, - fixtures.contract.address, - fixtures.dest.address, - getClaimEntires([c]) + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), + await getClaimEntires([c]) ); args.push({ sigs: [{v, r, s}], claimIds: [claimId], expiration: 0, - from: fixtures.contract.address, - to: fixtures.dest.address, - claims: getClaimEntires([c]), + from: await fixtures.contract.getAddress(), + to: await fixtures.dest.getAddress(), + claims: await getClaimEntires([c]), }); } await fixtures.contract.batchClaim(args); await fixtures.checkBalances( - fixtures.contract.address, + await fixtures.contract.getAddress(), pre, preDest, claims @@ -641,7 +690,7 @@ describe('SignedMultiGiveaway.sol', function () { it('admin should be able to recover assets', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const amount = ethers.utils.parseEther('5'); + const amount = ethers.parseEther('5'); const claims: Claim[] = [ { tokenType: TokenType.ERC20, @@ -649,18 +698,21 @@ describe('SignedMultiGiveaway.sol', function () { amount, }, ]; - await fixtures.mintToContract(fixtures.contract.address, claims); - const pre = BigNumber.from( - await fixtures.sandToken.balanceOf(fixtures.contract.address) + await fixtures.mintToContract( + await fixtures.contract.getAddress(), + claims + ); + const pre = await fixtures.sandToken.balanceOf( + await fixtures.contract.getAddress() ); await fixtures.contractAsAdmin.recoverAssets( - fixtures.other.address, - getClaimEntires(claims) + await fixtures.other.getAddress(), + await getClaimEntires(claims) ); - const pos = BigNumber.from( - await fixtures.sandToken.balanceOf(fixtures.contract.address) + const pos = await fixtures.sandToken.balanceOf( + await fixtures.contract.getAddress() ); - expect(pos).to.be.equal(pre.sub(amount)); + expect(pos).to.be.equal(pre - amount); }); it('should fail to recover assets if not admin', async function () { @@ -670,20 +722,23 @@ describe('SignedMultiGiveaway.sol', function () { { tokenType: TokenType.ERC20, token: fixtures.sandToken, - amount: ethers.utils.parseEther('5'), + amount: ethers.parseEther('5'), }, ]; - await fixtures.mintToContract(fixtures.contract.address, claims); + await fixtures.mintToContract( + await fixtures.contract.getAddress(), + claims + ); await expect( fixtures.contract.recoverAssets( - fixtures.other.address, - getClaimEntires(claims) + await fixtures.other.getAddress(), + await getClaimEntires(claims) ) ).to.be.revertedWith('only admin'); await expect( fixtures.contractAsBackofficeAdmin.recoverAssets( - fixtures.other.address, - getClaimEntires(claims) + await fixtures.other.getAddress(), + await getClaimEntires(claims) ) ).to.be.revertedWith('only admin'); }); @@ -693,7 +748,7 @@ describe('SignedMultiGiveaway.sol', function () { it('should fail to revoke if not admin', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); + const claimId = 0x123n; await expect( fixtures.contract.revokeClaims([claimId]) ).to.be.revertedWith('only backoffice'); @@ -702,12 +757,12 @@ describe('SignedMultiGiveaway.sol', function () { it('should fail to claim if the id was revoked', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); + const claimId = 0x123n; const claims: Claim[] = [ { tokenType: TokenType.ERC20, token: fixtures.sandToken, - amount: ethers.utils.parseEther('5'), + amount: ethers.parseEther('5'), }, ]; await fixtures.contractAsBackofficeAdmin.revokeClaims([claimId]); @@ -738,12 +793,12 @@ describe('SignedMultiGiveaway.sol', function () { it('should fail to claim if paused by backoffice admin', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); + const claimId = 0x123n; const claims: Claim[] = [ { tokenType: TokenType.ERC20, token: fixtures.sandToken, - amount: ethers.utils.parseEther('5'), + amount: ethers.parseEther('5'), }, ]; await fixtures.contractAsBackofficeAdmin.pause(); @@ -754,8 +809,8 @@ describe('SignedMultiGiveaway.sol', function () { it('should fail to batchClaim if paused by backoffice admin', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const baseClaimId = BigNumber.from(0x123); - const amount = ethers.utils.parseEther('5'); + const baseClaimId = 0x123n; + const amount = ethers.parseEther('5'); const claims: Claim[] = [ { tokenType: TokenType.ERC20, @@ -765,36 +820,39 @@ describe('SignedMultiGiveaway.sol', function () { { tokenType: TokenType.ERC721, token: fixtures.landToken, - tokenId: 123, + tokenId: 123n, }, { tokenType: TokenType.ERC1155, token: fixtures.assetToken, - tokenId: 456, + tokenId: 456n, amount, - data: [], + data: '0x', }, ]; - await fixtures.mintToContract(fixtures.contract.address, claims); + await fixtures.mintToContract( + await fixtures.contract.getAddress(), + claims + ); const args = []; for (const [i, c] of claims.entries()) { - const claimId = baseClaimId.add(i); + const claimId = baseClaimId + BigInt(i); const {v, r, s} = await signedMultiGiveawaySignature( fixtures.contract, - fixtures.signer.address, + fixtures.signer, [claimId], 0, - fixtures.contract.address, - fixtures.dest.address, - getClaimEntires([c]) + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), + await getClaimEntires([c]) ); args.push({ sigs: [{v, r, s}], claimIds: [claimId], expiration: 0, - from: fixtures.contract.address, - to: fixtures.dest.address, - claims: getClaimEntires([c]), + from: await fixtures.contract.getAddress(), + to: await fixtures.dest.getAddress(), + claims: await getClaimEntires([c]), }); } await fixtures.contractAsBackofficeAdmin.pause(); @@ -806,12 +864,12 @@ describe('SignedMultiGiveaway.sol', function () { it('should be able to claim sand after pause/unpause', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); + const claimId = 0x123n; const claims: Claim[] = [ { tokenType: TokenType.ERC20, token: fixtures.sandToken, - amount: ethers.utils.parseEther('5'), + amount: ethers.parseEther('5'), }, ]; await fixtures.contractAsAdmin.pause(); @@ -834,7 +892,7 @@ describe('SignedMultiGiveaway.sol', function () { ).to.be.equal(1); await expect(fixtures.contractAsAdmin.setNumberOfSignaturesNeeded(2)) .to.emit(fixtures.contract, 'NumberOfSignaturesNeededSet') - .withArgs(2, fixtures.admin.address); + .withArgs(2, await fixtures.admin.getAddress()); expect( await fixtures.contractAsAdmin.getNumberOfSignaturesNeeded() ).to.be.equal(2); @@ -844,29 +902,34 @@ describe('SignedMultiGiveaway.sol', function () { ); await expect(fixtures.contractAsAdmin.setMaxClaimEntries(2)) .to.emit(fixtures.contract, 'MaxClaimEntriesSet') - .withArgs(2, fixtures.admin.address); + .withArgs(2, await fixtures.admin.getAddress()); expect(await fixtures.contractAsAdmin.getMaxClaimEntries()).to.be.equal( 2 ); expect( await fixtures.contractAsAdmin.getMaxWeiPerClaim( - fixtures.sandToken.address, + await fixtures.sandToken.getAddress(), 12 ) ).to.be.equal(0); await expect( fixtures.contractAsAdmin.setMaxWeiPerClaim( - fixtures.sandToken.address, + await fixtures.sandToken.getAddress(), 12, 2 ) ) .to.emit(fixtures.contract, 'MaxWeiPerClaimSet') - .withArgs(fixtures.sandToken.address, 12, 2, fixtures.admin.address); + .withArgs( + await fixtures.sandToken.getAddress(), + 12, + 2, + await fixtures.admin.getAddress() + ); expect( await fixtures.contractAsAdmin.getMaxWeiPerClaim( - fixtures.sandToken.address, + await fixtures.sandToken.getAddress(), 12 ) ).to.be.equal(2); @@ -888,7 +951,11 @@ describe('SignedMultiGiveaway.sol', function () { fixtures.contract.setNumberOfSignaturesNeeded(1) ).to.be.revertedWith('only admin'); await expect( - fixtures.contract.setMaxWeiPerClaim(fixtures.sandToken.address, 12, 2) + fixtures.contract.setMaxWeiPerClaim( + await fixtures.sandToken.getAddress(), + 12, + 2 + ) ).to.be.revertedWith('only admin'); }); @@ -911,8 +978,8 @@ describe('SignedMultiGiveaway.sol', function () { it('should fail to claim if over max entries', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); - const amount = ethers.utils.parseEther('5'); + const claimId = 0x123n; + const amount = ethers.parseEther('5'); const claims: Claim[] = [ { tokenType: TokenType.ERC20, @@ -922,14 +989,14 @@ describe('SignedMultiGiveaway.sol', function () { { tokenType: TokenType.ERC721, token: fixtures.landToken, - tokenId: 123, + tokenId: 123n, }, { tokenType: TokenType.ERC1155, token: fixtures.assetToken, - tokenId: 456, + tokenId: 456n, amount, - data: [], + data: '0x', }, ]; await fixtures.contractAsAdmin.setMaxClaimEntries(2); @@ -944,8 +1011,8 @@ describe('SignedMultiGiveaway.sol', function () { it('should fail to claim if not enough signatures', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); - const amount = ethers.utils.parseEther('5'); + const claimId = 0x123n; + const amount = ethers.parseEther('5'); const claims: Claim[] = [ { tokenType: TokenType.ERC20, @@ -965,8 +1032,8 @@ describe('SignedMultiGiveaway.sol', function () { it('signatures should expire', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); - const amount = ethers.utils.parseEther('5'); + const claimId = 0x123n; + const amount = ethers.parseEther('5'); const claims: Claim[] = [ { tokenType: TokenType.ERC20, @@ -984,13 +1051,13 @@ describe('SignedMultiGiveaway.sol', function () { it('should fail to claim if over maxPerClaim per token', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const maxPerClaim = 10; + const maxPerClaim = 10n; await fixtures.contractAsAdmin.setMaxWeiPerClaim( - fixtures.sandToken.address, + await fixtures.sandToken.getAddress(), 0, maxPerClaim ); - const claimId = BigNumber.from(0x123); + const claimId = 0x123n; // maxPerClaim+1 fails await expect( fixtures.signAndClaim( @@ -999,7 +1066,7 @@ describe('SignedMultiGiveaway.sol', function () { { tokenType: TokenType.ERC20, token: fixtures.sandToken, - amount: maxPerClaim + 1, + amount: maxPerClaim + 1n, }, ] ) @@ -1020,20 +1087,20 @@ describe('SignedMultiGiveaway.sol', function () { it('should success to claim if maxPerClaim is !=0 but amount is bellow maxPerClaim per token', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const maxPerClaim = 1000; + const maxPerClaim = 1000n; await fixtures.contractAsAdmin.setMaxWeiPerClaim( - fixtures.sandToken.address, + await fixtures.sandToken.getAddress(), 0, maxPerClaim ); - const claimId = BigNumber.from(0x123); + const claimId = 0x123n; await fixtures.signAndClaim( [claimId], [ { tokenType: TokenType.ERC20, token: fixtures.sandToken, - amount: maxPerClaim - 1, + amount: maxPerClaim - 1n, }, ] ); @@ -1042,14 +1109,15 @@ describe('SignedMultiGiveaway.sol', function () { it('should fail to claim if over maxPerClaim per token per token id (ERC1155)', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const tokenId = 0x1233; - const maxPerClaim = 10; + const tokenId = 0x123n; + 3; + const maxPerClaim = 10n; await fixtures.contractAsAdmin.setMaxWeiPerClaim( - fixtures.assetToken.address, + await fixtures.assetToken.getAddress(), tokenId, maxPerClaim ); - const claimId = BigNumber.from(0x123); + const claimId = 0x123n; await expect( fixtures.signAndClaim( [claimId], @@ -1058,8 +1126,8 @@ describe('SignedMultiGiveaway.sol', function () { tokenType: TokenType.ERC1155, token: fixtures.assetToken, tokenId, - amount: maxPerClaim + 1, - data: [], + amount: maxPerClaim + 1n, + data: '0x', }, ] ) @@ -1071,23 +1139,26 @@ describe('SignedMultiGiveaway.sol', function () { it('a valid signature must verify correctly', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); + const claimId = 0x123n; const claims: Claim[] = [ { tokenType: TokenType.ERC20, token: fixtures.sandToken, - amount: ethers.utils.parseEther('5'), + amount: ethers.parseEther('5'), }, ]; - await fixtures.mintToContract(fixtures.contract.address, claims); + await fixtures.mintToContract( + await fixtures.contract.getAddress(), + claims + ); const {v, r, s} = await signedMultiGiveawaySignature( fixtures.contract, - fixtures.signer.address, + fixtures.signer, [claimId], 0, - fixtures.contract.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), + await getClaimEntires(claims) ); expect( @@ -1095,42 +1166,47 @@ describe('SignedMultiGiveaway.sol', function () { {v, r, s}, [claimId], 0, - fixtures.contract.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), + await getClaimEntires(claims) ) - ).to.equal(fixtures.signer.address); + ).to.equal(await fixtures.signer.getAddress()); }); it('admin should be able to set the trusted forwarder', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); expect( await fixtures.contract.isTrustedForwarder( - fixtures.trustedForwarder.address + await fixtures.trustedForwarder.getAddress() ) ).to.be.true; - expect(await fixtures.contract.isTrustedForwarder(fixtures.other.address)) - .to.be.false; + expect( + await fixtures.contract.isTrustedForwarder( + await fixtures.other.getAddress() + ) + ).to.be.false; expect(await fixtures.contract.getTrustedForwarder()).to.be.equal( - fixtures.trustedForwarder.address + await fixtures.trustedForwarder.getAddress() ); expect(await fixtures.contract.trustedForwarder()).to.be.equal( - fixtures.trustedForwarder.address + await fixtures.trustedForwarder.getAddress() ); await expect( - fixtures.contractAsAdmin.setTrustedForwarder(fixtures.other.address) + fixtures.contractAsAdmin.setTrustedForwarder( + await fixtures.other.getAddress() + ) ) .to.emit(fixtures.contract, 'TrustedForwarderSet') .withArgs( - fixtures.trustedForwarder.address, - fixtures.other.address, - fixtures.admin.address + await fixtures.trustedForwarder.getAddress(), + await fixtures.other.getAddress(), + await fixtures.admin.getAddress() ); expect(await fixtures.contract.getTrustedForwarder()).to.be.equal( - fixtures.other.address + await fixtures.other.getAddress() ); expect(await fixtures.contract.trustedForwarder()).to.be.equal( - fixtures.other.address + await fixtures.other.getAddress() ); }); @@ -1139,36 +1215,36 @@ describe('SignedMultiGiveaway.sol', function () { await expect( fixtures.contractAsBackofficeAdmin.setTrustedForwarder( - fixtures.other.address + await fixtures.other.getAddress() ) ).to.be.revertedWith('only admin'); await expect( - fixtures.contract.setTrustedForwarder(fixtures.other.address) + fixtures.contract.setTrustedForwarder(await fixtures.other.getAddress()) ).to.be.revertedWith('only admin'); }); it('check the domain separator', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const typeHash = keccak256( - toUtf8Bytes( + const typeHash = ethers.keccak256( + ethers.toUtf8Bytes( 'EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)' ) ); - const hashedName = ethers.utils.keccak256( - toUtf8Bytes('Sandbox SignedMultiGiveaway') + const hashedName = ethers.keccak256( + ethers.toUtf8Bytes('Sandbox SignedMultiGiveaway') ); - const versionHash = ethers.utils.keccak256(toUtf8Bytes('1.0')); - const network = await fixtures.contract.provider.getNetwork(); - const domainSeparator = ethers.utils.keccak256( - defaultAbiCoder.encode( + const versionHash = ethers.keccak256(ethers.toUtf8Bytes('1.0')); + const network = await fixtures.contract.runner?.provider?.getNetwork(); + const domainSeparator = ethers.keccak256( + AbiCoder.defaultAbiCoder().encode( ['bytes32', 'bytes32', 'bytes32', 'uint256', 'address'], [ typeHash, hashedName, versionHash, network.chainId, - fixtures.contract.address, + await fixtures.contract.getAddress(), ] ) ); @@ -1181,8 +1257,8 @@ describe('SignedMultiGiveaway.sol', function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); await expect( fixtures.contractAsDeployer.initialize( - fixtures.trustedForwarder.address, - fixtures.admin.address + await fixtures.trustedForwarder.getAddress(), + await fixtures.admin.getAddress() ) ).to.revertedWith('Initializable: contract is already initialized'); }); @@ -1199,28 +1275,28 @@ describe('SignedMultiGiveaway.sol', function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); await expect( - fixtures.contractAsAdmin.setMaxWeiPerClaim(constants.AddressZero, 12, 2) + fixtures.contractAsAdmin.setMaxWeiPerClaim(ethers.ZeroAddress, 12, 2) ).to.be.revertedWith('invalid token address'); }); it('should fail if invalid token type', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); + const claimId = 0x123n; const claims: ClaimEntry[] = [ { tokenType: 0, - tokenAddress: fixtures.sandToken.address, + tokenAddress: await fixtures.sandToken.getAddress(), data: '0x', }, ]; const {v, r, s} = await signedMultiGiveawaySignature( fixtures.contract, - fixtures.signer.address, + fixtures.signer, [claimId], 0, - fixtures.contract.address, - fixtures.dest.address, + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), claims ); await expect( @@ -1228,8 +1304,8 @@ describe('SignedMultiGiveaway.sol', function () { [{v, r, s}], [claimId], 0, - fixtures.contract.address, - fixtures.dest.address, + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), claims ) ).to.be.revertedWith('invalid token type'); @@ -1238,8 +1314,8 @@ describe('SignedMultiGiveaway.sol', function () { it('should fail to claim with no balance', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); - const amount = ethers.utils.parseEther('5'); + const claimId = 0x123n; + const amount = ethers.parseEther('5'); const claims: Claim[] = [ { tokenType: TokenType.ERC20, @@ -1249,21 +1325,21 @@ describe('SignedMultiGiveaway.sol', function () { ]; const sig = await signedMultiGiveawaySignature( fixtures.contract, - fixtures.signer.address, + fixtures.signer, [claimId], 0, - fixtures.contract.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), + await getClaimEntires(claims) ); await expect( fixtures.contract.claim( [sig], [claimId], 0, - fixtures.contract.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.contract.getAddress(), + await fixtures.dest.getAddress(), + await getClaimEntires(claims) ) ).to.revertedWith('ERC20: transfer amount exceeds balance'); }); @@ -1271,8 +1347,8 @@ describe('SignedMultiGiveaway.sol', function () { it('should fail to claim with approve when no balance', async function () { const fixtures = await loadFixture(setupSignedMultiGiveaway); - const claimId = BigNumber.from(0x123); - const amount = ethers.utils.parseEther('5'); + const claimId = 0x123n; + const amount = ethers.parseEther('5'); const claims: Claim[] = [ { tokenType: TokenType.ERC20, @@ -1281,26 +1357,26 @@ describe('SignedMultiGiveaway.sol', function () { }, ]; await fixtures.sandTokenAsOther.approve( - fixtures.contract.address, + await fixtures.contract.getAddress(), amount ); const sig = await signedMultiGiveawaySignature( fixtures.contract, - fixtures.signer.address, + fixtures.signer, [claimId], 0, - fixtures.other.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.other.getAddress(), + await fixtures.dest.getAddress(), + await getClaimEntires(claims) ); await expect( fixtures.contract.claim( [sig], [claimId], 0, - fixtures.other.address, - fixtures.dest.address, - getClaimEntires(claims) + await fixtures.other.getAddress(), + await fixtures.dest.getAddress(), + await getClaimEntires(claims) ) ).to.revertedWith('ERC20: transfer amount exceeds balance'); }); From eb07a6349edfc781d48b568cfecdb95315cd0ba6 Mon Sep 17 00:00:00 2001 From: Andres Adjimann Date: Fri, 22 Sep 2023 08:51:55 -0300 Subject: [PATCH 2/3] chore: fix the openzeppelin contracts dependency version --- packages/giveaway/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/giveaway/package.json b/packages/giveaway/package.json index 9c3fcb004e..98528f95b8 100644 --- a/packages/giveaway/package.json +++ b/packages/giveaway/package.json @@ -55,7 +55,7 @@ } }, "dependencies": { - "@openzeppelin/contracts-upgradeable": "^4.9.3" + "@openzeppelin/contracts-upgradeable": "4.9.3" }, "devDependencies": { "@dlsl/hardhat-markup": "^1.0.0-rc.14", From 58846353ce2197bad3158325ee9bbbcc3069a8ae Mon Sep 17 00:00:00 2001 From: Andres Adjimann Date: Wed, 7 Aug 2024 13:03:05 -0300 Subject: [PATCH 3/3] chore: fix yarn.lock and lint errors --- packages/land/test/common/ERC721.behavior.ts | 1 + yarn.lock | 249 ++++++++++++++++--- 2 files changed, 213 insertions(+), 37 deletions(-) diff --git a/packages/land/test/common/ERC721.behavior.ts b/packages/land/test/common/ERC721.behavior.ts index a306b5b38e..4212722f91 100644 --- a/packages/land/test/common/ERC721.behavior.ts +++ b/packages/land/test/common/ERC721.behavior.ts @@ -866,6 +866,7 @@ export function shouldCheckForERC721(setupLand, Contract: string) { const {LandAsOwner} = await loadFixture(setupLand); expect(await LandAsOwner.supportsInterface('0x3b18763a')).to.be.true; }); + it('claim to IQuad interface', async function () { const {LandAsOwner} = await loadFixture(setupLand); expect(await LandAsOwner.supportsInterface('0xd21ed03d')).to.be.true; diff --git a/yarn.lock b/yarn.lock index bde46aa050..3d556187c3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -192,7 +192,7 @@ __metadata: languageName: node linkType: hard -"@dlsl/hardhat-markup@npm:^1.0.0-rc.11, @dlsl/hardhat-markup@npm:^1.0.0-rc.14": +"@dlsl/hardhat-markup@npm:^1.0.0-rc.14": version: 1.0.0-rc.14 resolution: "@dlsl/hardhat-markup@npm:1.0.0-rc.14" dependencies: @@ -1073,6 +1073,13 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/edr-darwin-arm64@npm:0.5.2": + version: 0.5.2 + resolution: "@nomicfoundation/edr-darwin-arm64@npm:0.5.2" + checksum: f6ab386603c6e080fe7f611b739eb6d1d6a370220318b725cb582702563577150b3be14b6d0be71cb72bdb854e6992c587ecfc6833216f750eae8e7cd96de46f + languageName: node + linkType: hard + "@nomicfoundation/edr-darwin-x64@npm:0.3.8": version: 0.3.8 resolution: "@nomicfoundation/edr-darwin-x64@npm:0.3.8" @@ -1087,6 +1094,13 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/edr-darwin-x64@npm:0.5.2": + version: 0.5.2 + resolution: "@nomicfoundation/edr-darwin-x64@npm:0.5.2" + checksum: 6f91f6d0294c0450e0501983f1de34a48582fe93f48428bc4b798ac93bb5483a96d626c2b4c62ac91102f00c826a3f9bfa16d748301440ebe1bbb2920ba3ba6d + languageName: node + linkType: hard + "@nomicfoundation/edr-linux-arm64-gnu@npm:0.3.8": version: 0.3.8 resolution: "@nomicfoundation/edr-linux-arm64-gnu@npm:0.3.8" @@ -1101,6 +1115,13 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/edr-linux-arm64-gnu@npm:0.5.2": + version: 0.5.2 + resolution: "@nomicfoundation/edr-linux-arm64-gnu@npm:0.5.2" + checksum: bd84cc2741bb2be3c3a60bae9dbb8ca7794a68b8675684c97f2c6e7310e5cba7efd1cf18d392d42481cda83fb478f83c0bd605104c5cf08bab44ec07669c3010 + languageName: node + linkType: hard + "@nomicfoundation/edr-linux-arm64-musl@npm:0.3.8": version: 0.3.8 resolution: "@nomicfoundation/edr-linux-arm64-musl@npm:0.3.8" @@ -1115,6 +1136,13 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/edr-linux-arm64-musl@npm:0.5.2": + version: 0.5.2 + resolution: "@nomicfoundation/edr-linux-arm64-musl@npm:0.5.2" + checksum: e7f7d82f16be1b26805bd90964c456aecb4a6a1397e87d507810d37bd383064271fa63932564e725fdb30868925334338ec459fe32f84fc11206644b7b37825c + languageName: node + linkType: hard + "@nomicfoundation/edr-linux-x64-gnu@npm:0.3.8": version: 0.3.8 resolution: "@nomicfoundation/edr-linux-x64-gnu@npm:0.3.8" @@ -1129,6 +1157,13 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/edr-linux-x64-gnu@npm:0.5.2": + version: 0.5.2 + resolution: "@nomicfoundation/edr-linux-x64-gnu@npm:0.5.2" + checksum: ec025bf75227638b6b2cd01b7ba01b3ddaddf54c4d18d25e9d0364ac621981be2aaf124f4e60a88da5c9e267adb41a660a42668e2d6c9a6a57e55e8671fc76f1 + languageName: node + linkType: hard + "@nomicfoundation/edr-linux-x64-musl@npm:0.3.8": version: 0.3.8 resolution: "@nomicfoundation/edr-linux-x64-musl@npm:0.3.8" @@ -1143,6 +1178,13 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/edr-linux-x64-musl@npm:0.5.2": + version: 0.5.2 + resolution: "@nomicfoundation/edr-linux-x64-musl@npm:0.5.2" + checksum: c9ff47f72645492383b2a598675878abc029b86325e2c457db1b2c4281916e11e4ef6336c355d40ae3c1736595bc43da51cfcf1e923464011f526f4db64c245b + languageName: node + linkType: hard + "@nomicfoundation/edr-win32-x64-msvc@npm:0.3.8": version: 0.3.8 resolution: "@nomicfoundation/edr-win32-x64-msvc@npm:0.3.8" @@ -1157,6 +1199,13 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/edr-win32-x64-msvc@npm:0.5.2": + version: 0.5.2 + resolution: "@nomicfoundation/edr-win32-x64-msvc@npm:0.5.2" + checksum: 56da7a1283470dede413cda5f2fef96e10250ec7a25562254ca0cd8045a653212c91e40fbcf37330e7af4e036d3c3aed83ea617831f9c7a5424389c73c53ed4e + languageName: node + linkType: hard + "@nomicfoundation/edr@npm:^0.3.7": version: 0.3.8 resolution: "@nomicfoundation/edr@npm:0.3.8" @@ -1187,6 +1236,21 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/edr@npm:^0.5.2": + version: 0.5.2 + resolution: "@nomicfoundation/edr@npm:0.5.2" + dependencies: + "@nomicfoundation/edr-darwin-arm64": 0.5.2 + "@nomicfoundation/edr-darwin-x64": 0.5.2 + "@nomicfoundation/edr-linux-arm64-gnu": 0.5.2 + "@nomicfoundation/edr-linux-arm64-musl": 0.5.2 + "@nomicfoundation/edr-linux-x64-gnu": 0.5.2 + "@nomicfoundation/edr-linux-x64-musl": 0.5.2 + "@nomicfoundation/edr-win32-x64-msvc": 0.5.2 + checksum: 336b1c7cad96fa78410f0c9cc9524abe9fb1e56384fe990b98bfd17f15f25b4665ad8f0525ccd9511f7c19173841fe712d50db993078629e2fc4047fda4665dc + languageName: node + linkType: hard + "@nomicfoundation/ethereumjs-block@npm:5.0.1": version: 5.0.1 resolution: "@nomicfoundation/ethereumjs-block@npm:5.0.1" @@ -1531,7 +1595,7 @@ __metadata: languageName: node linkType: hard -"@nomicfoundation/hardhat-verify@npm:^1.0.0": +"@nomicfoundation/hardhat-verify@npm:^1.0.0, @nomicfoundation/hardhat-verify@npm:^1.1.1": version: 1.1.1 resolution: "@nomicfoundation/hardhat-verify@npm:1.1.1" dependencies: @@ -2900,42 +2964,39 @@ __metadata: version: 0.0.0-use.local resolution: "@sandbox-smart-contracts/giveaway@workspace:packages/giveaway" dependencies: - "@dlsl/hardhat-markup": ^1.0.0-rc.11 - "@ethersproject/abi": ^5.7.0 - "@ethersproject/providers": ^5.7.2 - "@nomicfoundation/hardhat-chai-matchers": 1 - "@nomicfoundation/hardhat-network-helpers": ^1.0.8 - "@nomicfoundation/hardhat-toolbox": ^2.0.2 - "@nomiclabs/hardhat-ethers": ^2.2.3 - "@nomiclabs/hardhat-etherscan": ^3.1.7 - "@openzeppelin/contracts-upgradeable": ^4.9.0 + "@dlsl/hardhat-markup": ^1.0.0-rc.14 + "@nomicfoundation/hardhat-chai-matchers": ^2.0.2 + "@nomicfoundation/hardhat-ethers": ^3.0.4 + "@nomicfoundation/hardhat-network-helpers": ^1.0.9 + "@nomicfoundation/hardhat-toolbox": ^3.0.0 + "@nomicfoundation/hardhat-verify": ^1.1.1 + "@openzeppelin/contracts-upgradeable": 4.9.3 "@release-it/keep-a-changelog": ^4.0.0 - "@typechain/ethers-v5": ^10.1.0 - "@typechain/hardhat": ^6.1.2 - "@types/chai": ^4.3.5 + "@typechain/ethers-v6": ^0.5.0 + "@typechain/hardhat": ^9.0.0 + "@types/chai": ^4.3.6 "@types/mocha": ^10.0.1 - "@types/node": ^20.2.5 - "@typescript-eslint/eslint-plugin": ^5.59.8 - "@typescript-eslint/parser": ^5.59.8 - chai: ^4.3.7 - dotenv: ^16.1.3 - eslint: ^8.41.0 - eslint-config-prettier: ^8.8.0 + "@types/node": ^20.6.3 + "@typescript-eslint/eslint-plugin": ^6.7.2 + "@typescript-eslint/parser": ^6.7.2 + chai: ^4.3.8 + dotenv: ^16.3.1 + eslint: ^8.49.0 + eslint-config-prettier: ^9.0.0 eslint-plugin-mocha: ^10.1.0 eslint-plugin-prettier: ^4.2.1 - eth-sig-util: ^3.0.1 - ethers: ^5.0.0 - hardhat: ^2.14.1 + ethers: ^6.7.1 + hardhat: ^2.17.3 hardhat-gas-reporter: ^1.0.9 prettier: ^2.8.8 prettier-plugin-solidity: ^1.1.3 release-it: ^16.1.5 - solhint: ^3.4.1 + solhint: ^3.6.2 solhint-plugin-prettier: ^0.0.5 - solidity-coverage: ^0.8.2 + solidity-coverage: ^0.8.4 ts-node: ^10.9.1 - typechain: ^8.2.0 - typescript: 5.0.4 + typechain: ^8.3.1 + typescript: ^5.2.2 languageName: unknown linkType: soft @@ -3415,7 +3476,7 @@ __metadata: languageName: node linkType: hard -"@typechain/ethers-v6@npm:^0.5.1": +"@typechain/ethers-v6@npm:^0.5.0, @typechain/ethers-v6@npm:^0.5.1": version: 0.5.1 resolution: "@typechain/ethers-v6@npm:0.5.1" dependencies: @@ -3459,7 +3520,7 @@ __metadata: languageName: node linkType: hard -"@typechain/hardhat@npm:^9.1.0": +"@typechain/hardhat@npm:^9.0.0, @typechain/hardhat@npm:^9.1.0": version: 9.1.0 resolution: "@typechain/hardhat@npm:9.1.0" dependencies: @@ -3691,6 +3752,15 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:^20.6.3": + version: 20.14.14 + resolution: "@types/node@npm:20.14.14" + dependencies: + undici-types: ~5.26.4 + checksum: cb2199123efca94908ee7191cc7b7abc11b26bf1fbb93c2948d5537a6594eedc35d4748d9fa998078fdc2eb5cc3a11d6d87b2fea20a05bda9d304e37d3c3282a + languageName: node + linkType: hard + "@types/node@npm:^8.0.0": version: 8.10.66 resolution: "@types/node@npm:8.10.66" @@ -3818,7 +3888,7 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^6.14.0": +"@typescript-eslint/eslint-plugin@npm:^6.14.0, @typescript-eslint/eslint-plugin@npm:^6.7.2": version: 6.21.0 resolution: "@typescript-eslint/eslint-plugin@npm:6.21.0" dependencies: @@ -3893,7 +3963,7 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/parser@npm:^6.14.0": +"@typescript-eslint/parser@npm:^6.14.0, @typescript-eslint/parser@npm:^6.7.2": version: 6.21.0 resolution: "@typescript-eslint/parser@npm:6.21.0" dependencies: @@ -5746,6 +5816,13 @@ __metadata: languageName: node linkType: hard +"commander@npm:^8.1.0": + version: 8.3.0 + resolution: "commander@npm:8.3.0" + checksum: 0f82321821fc27b83bd409510bb9deeebcfa799ff0bf5d102128b500b7af22872c0c92cb6a0ebc5a4cf19c6b550fba9cedfa7329d18c6442a625f851377bacf0 + languageName: node + linkType: hard + "compare-versions@npm:^6.0.0": version: 6.1.0 resolution: "compare-versions@npm:6.1.0" @@ -6462,7 +6539,7 @@ __metadata: languageName: node linkType: hard -"dotenv@npm:^16.1.3, dotenv@npm:^16.1.4, dotenv@npm:^16.3.0": +"dotenv@npm:^16.1.3, dotenv@npm:^16.1.4, dotenv@npm:^16.3.0, dotenv@npm:^16.3.1": version: 16.4.5 resolution: "dotenv@npm:16.4.5" checksum: 301a12c3d44fd49888b74eb9ccf9f07a1f5df43f489e7fcb89647a2edcd84c42d6bc349dc8df099cd18f07c35c7b04685c1a4f3e6a6a9e6b30f8d48c15b7f49c @@ -6936,7 +7013,7 @@ __metadata: languageName: node linkType: hard -"eslint-config-prettier@npm:^9.1.0": +"eslint-config-prettier@npm:^9.0.0, eslint-config-prettier@npm:^9.1.0": version: 9.1.0 resolution: "eslint-config-prettier@npm:9.1.0" peerDependencies: @@ -7128,7 +7205,7 @@ __metadata: languageName: node linkType: hard -"eslint@npm:^8.41.0, eslint@npm:^8.43.0, eslint@npm:^8.55.0": +"eslint@npm:^8.41.0, eslint@npm:^8.43.0, eslint@npm:^8.49.0, eslint@npm:^8.55.0": version: 8.57.0 resolution: "eslint@npm:8.57.0" dependencies: @@ -8988,6 +9065,67 @@ __metadata: languageName: node linkType: hard +"hardhat@npm:^2.17.3": + version: 2.22.8 + resolution: "hardhat@npm:2.22.8" + dependencies: + "@ethersproject/abi": ^5.1.2 + "@metamask/eth-sig-util": ^4.0.0 + "@nomicfoundation/edr": ^0.5.2 + "@nomicfoundation/ethereumjs-common": 4.0.4 + "@nomicfoundation/ethereumjs-tx": 5.0.4 + "@nomicfoundation/ethereumjs-util": 9.0.4 + "@nomicfoundation/solidity-analyzer": ^0.1.0 + "@sentry/node": ^5.18.1 + "@types/bn.js": ^5.1.0 + "@types/lru-cache": ^5.1.0 + adm-zip: ^0.4.16 + aggregate-error: ^3.0.0 + ansi-escapes: ^4.3.0 + boxen: ^5.1.2 + chalk: ^2.4.2 + chokidar: ^3.4.0 + ci-info: ^2.0.0 + debug: ^4.1.1 + enquirer: ^2.3.0 + env-paths: ^2.2.0 + ethereum-cryptography: ^1.0.3 + ethereumjs-abi: ^0.6.8 + find-up: ^2.1.0 + fp-ts: 1.19.3 + fs-extra: ^7.0.1 + glob: 7.2.0 + immutable: ^4.0.0-rc.12 + io-ts: 1.10.4 + keccak: ^3.0.2 + lodash: ^4.17.11 + mnemonist: ^0.38.0 + mocha: ^10.0.0 + p-map: ^4.0.0 + raw-body: ^2.4.1 + resolve: 1.17.0 + semver: ^6.3.0 + solc: 0.8.26 + source-map-support: ^0.5.13 + stacktrace-parser: ^0.1.10 + tsort: 0.0.1 + undici: ^5.14.0 + uuid: ^8.3.2 + ws: ^7.4.6 + peerDependencies: + ts-node: "*" + typescript: "*" + peerDependenciesMeta: + ts-node: + optional: true + typescript: + optional: true + bin: + hardhat: internal/cli/bootstrap.js + checksum: 3731b510540f800b3b931e3ad7db4510dbd35eff18f34382875778db43de2a5ce1c52596c392aa694324f66392e844fede85954ab3cdc08df3da10f2a810135f + languageName: node + linkType: hard + "hardhat@npm:^2.22.4": version: 2.22.4 resolution: "hardhat@npm:2.22.4" @@ -13740,6 +13878,23 @@ __metadata: languageName: node linkType: hard +"solc@npm:0.8.26": + version: 0.8.26 + resolution: "solc@npm:0.8.26" + dependencies: + command-exists: ^1.2.8 + commander: ^8.1.0 + follow-redirects: ^1.12.1 + js-sha3: 0.8.0 + memorystream: ^0.3.1 + semver: ^5.5.0 + tmp: 0.0.33 + bin: + solcjs: solc.js + checksum: e3eaeac76e60676377b357af8f3919d4c8c6a74b74112b49279fe8c74a3dfa1de8afe4788689fc307453bde336edc8572988d2cf9e909f84d870420eb640400c + languageName: node + linkType: hard + "solhint-plugin-prettier@npm:^0.0.5": version: 0.0.5 resolution: "solhint-plugin-prettier@npm:0.0.5" @@ -13924,7 +14079,7 @@ __metadata: languageName: node linkType: hard -"solidity-coverage@npm:^0.8.2, solidity-coverage@npm:^0.8.3, solidity-coverage@npm:^0.8.5": +"solidity-coverage@npm:^0.8.2, solidity-coverage@npm:^0.8.3, solidity-coverage@npm:^0.8.4, solidity-coverage@npm:^0.8.5": version: 0.8.12 resolution: "solidity-coverage@npm:0.8.12" dependencies: @@ -14804,7 +14959,7 @@ __metadata: languageName: node linkType: hard -"typechain@npm:^8.1.1, typechain@npm:^8.2.0, typechain@npm:^8.3.2": +"typechain@npm:^8.1.1, typechain@npm:^8.2.0, typechain@npm:^8.3.1, typechain@npm:^8.3.2": version: 8.3.2 resolution: "typechain@npm:8.3.2" dependencies: @@ -14934,6 +15089,16 @@ __metadata: languageName: node linkType: hard +"typescript@npm:^5.2.2": + version: 5.5.4 + resolution: "typescript@npm:5.5.4" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: b309040f3a1cd91c68a5a58af6b9fdd4e849b8c42d837b2c2e73f9a4f96a98c4f1ed398a9aab576ee0a4748f5690cf594e6b99dbe61de7839da748c41e6d6ca8 + languageName: node + linkType: hard + "typescript@npm:^5.4.5": version: 5.4.5 resolution: "typescript@npm:5.4.5" @@ -14984,6 +15149,16 @@ __metadata: languageName: node linkType: hard +"typescript@patch:typescript@^5.2.2#~builtin": + version: 5.5.4 + resolution: "typescript@patch:typescript@npm%3A5.5.4#~builtin::version=5.5.4&hash=5da071" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: fc52962f31a5bcb716d4213bef516885e4f01f30cea797a831205fc9ef12b405a40561c40eae3127ab85ba1548e7df49df2bcdee6b84a94bfbe3a0d7eff16b14 + languageName: node + linkType: hard + "typescript@patch:typescript@^5.4.5#~builtin": version: 5.4.5 resolution: "typescript@patch:typescript@npm%3A5.4.5#~builtin::version=5.4.5&hash=5da071"