From 80c5c8a79e5d4ec598c8a89808ded8b8e5315546 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Jun 2023 22:01:11 +0000 Subject: [PATCH 01/32] Bump @nomicfoundation/hardhat-toolbox from 2.0.2 to 3.0.0 Bumps [@nomicfoundation/hardhat-toolbox](https://github.com/nomicfoundation/hardhat) from 2.0.2 to 3.0.0. - [Release notes](https://github.com/nomicfoundation/hardhat/releases) - [Commits](https://github.com/nomicfoundation/hardhat/compare/@nomicfoundation/hardhat-toolbox@2.0.2...@nomicfoundation/hardhat-toolbox@3.0.0) --- updated-dependencies: - dependency-name: "@nomicfoundation/hardhat-toolbox" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package-lock.json | 860 +++++++++++++++++++++++++++++++++------------- package.json | 2 +- 2 files changed, 616 insertions(+), 246 deletions(-) diff --git a/package-lock.json b/package-lock.json index a400be665..909b8665c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "@bosonprotocol/solidoc": "3.0.3", "@ethereum-waffle/mock-contract": "^4.0.4", "@nomicfoundation/hardhat-network-helpers": "^1.0.6", - "@nomicfoundation/hardhat-toolbox": "^2.0.2", + "@nomicfoundation/hardhat-toolbox": "^3.0.0", "@nomiclabs/hardhat-web3": "^2.0.0", "@openzeppelin/test-helpers": "^0.5.16", "coveralls": "^3.1.1", @@ -41,6 +41,13 @@ "web3": "^1.8.1" } }, + "node_modules/@adraffy/ens-normalize": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.9.2.tgz", + "integrity": "sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg==", + "dev": true, + "peer": true + }, "node_modules/@apollo/protobufjs": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/@apollo/protobufjs/-/protobufjs-1.2.7.tgz", @@ -402,6 +409,54 @@ "js-sha3": "^0.8.0" } }, + "node_modules/@ensdomains/ensjs/node_modules/ethers": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", + "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abi": "5.7.0", + "@ethersproject/abstract-provider": "5.7.0", + "@ethersproject/abstract-signer": "5.7.0", + "@ethersproject/address": "5.7.0", + "@ethersproject/base64": "5.7.0", + "@ethersproject/basex": "5.7.0", + "@ethersproject/bignumber": "5.7.0", + "@ethersproject/bytes": "5.7.0", + "@ethersproject/constants": "5.7.0", + "@ethersproject/contracts": "5.7.0", + "@ethersproject/hash": "5.7.0", + "@ethersproject/hdnode": "5.7.0", + "@ethersproject/json-wallets": "5.7.0", + "@ethersproject/keccak256": "5.7.0", + "@ethersproject/logger": "5.7.0", + "@ethersproject/networks": "5.7.1", + "@ethersproject/pbkdf2": "5.7.0", + "@ethersproject/properties": "5.7.0", + "@ethersproject/providers": "5.7.2", + "@ethersproject/random": "5.7.0", + "@ethersproject/rlp": "5.7.0", + "@ethersproject/sha2": "5.7.0", + "@ethersproject/signing-key": "5.7.0", + "@ethersproject/solidity": "5.7.0", + "@ethersproject/strings": "5.7.0", + "@ethersproject/transactions": "5.7.0", + "@ethersproject/units": "5.7.0", + "@ethersproject/wallet": "5.7.0", + "@ethersproject/web": "5.7.1", + "@ethersproject/wordlists": "5.7.0" + } + }, "node_modules/@ensdomains/resolver": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/@ensdomains/resolver/-/resolver-0.2.4.tgz", @@ -1625,40 +1680,6 @@ "rlp": "^2.2.3" } }, - "node_modules/@morgan-stanley/ts-mocking-bird": { - "version": "0.6.4", - "resolved": "https://registry.npmjs.org/@morgan-stanley/ts-mocking-bird/-/ts-mocking-bird-0.6.4.tgz", - "integrity": "sha512-57VJIflP8eR2xXa9cD1LUawh+Gh+BVQfVu0n6GALyg/AqV/Nz25kDRvws3i9kIe1PTrbsZZOYpsYp6bXPd6nVA==", - "dev": true, - "peer": true, - "dependencies": { - "lodash": "^4.17.16", - "uuid": "^7.0.3" - }, - "peerDependencies": { - "jasmine": "2.x || 3.x || 4.x", - "jest": "26.x || 27.x || 28.x", - "typescript": ">=4.2" - }, - "peerDependenciesMeta": { - "jasmine": { - "optional": true - }, - "jest": { - "optional": true - } - } - }, - "node_modules/@morgan-stanley/ts-mocking-bird/node_modules/uuid": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz", - "integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==", - "dev": true, - "peer": true, - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/@noble/hashes": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.2.0.tgz", @@ -1736,6 +1757,54 @@ "node": ">=14" } }, + "node_modules/@nomicfoundation/ethereumjs-block/node_modules/ethers": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", + "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abi": "5.7.0", + "@ethersproject/abstract-provider": "5.7.0", + "@ethersproject/abstract-signer": "5.7.0", + "@ethersproject/address": "5.7.0", + "@ethersproject/base64": "5.7.0", + "@ethersproject/basex": "5.7.0", + "@ethersproject/bignumber": "5.7.0", + "@ethersproject/bytes": "5.7.0", + "@ethersproject/constants": "5.7.0", + "@ethersproject/contracts": "5.7.0", + "@ethersproject/hash": "5.7.0", + "@ethersproject/hdnode": "5.7.0", + "@ethersproject/json-wallets": "5.7.0", + "@ethersproject/keccak256": "5.7.0", + "@ethersproject/logger": "5.7.0", + "@ethersproject/networks": "5.7.1", + "@ethersproject/pbkdf2": "5.7.0", + "@ethersproject/properties": "5.7.0", + "@ethersproject/providers": "5.7.2", + "@ethersproject/random": "5.7.0", + "@ethersproject/rlp": "5.7.0", + "@ethersproject/sha2": "5.7.0", + "@ethersproject/signing-key": "5.7.0", + "@ethersproject/solidity": "5.7.0", + "@ethersproject/strings": "5.7.0", + "@ethersproject/transactions": "5.7.0", + "@ethersproject/units": "5.7.0", + "@ethersproject/wallet": "5.7.0", + "@ethersproject/web": "5.7.1", + "@ethersproject/wordlists": "5.7.0" + } + }, "node_modules/@nomicfoundation/ethereumjs-blockchain": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-blockchain/-/ethereumjs-blockchain-7.0.1.tgz", @@ -1832,6 +1901,54 @@ "js-sdsl": "^4.1.4" } }, + "node_modules/@nomicfoundation/ethereumjs-statemanager/node_modules/ethers": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", + "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abi": "5.7.0", + "@ethersproject/abstract-provider": "5.7.0", + "@ethersproject/abstract-signer": "5.7.0", + "@ethersproject/address": "5.7.0", + "@ethersproject/base64": "5.7.0", + "@ethersproject/basex": "5.7.0", + "@ethersproject/bignumber": "5.7.0", + "@ethersproject/bytes": "5.7.0", + "@ethersproject/constants": "5.7.0", + "@ethersproject/contracts": "5.7.0", + "@ethersproject/hash": "5.7.0", + "@ethersproject/hdnode": "5.7.0", + "@ethersproject/json-wallets": "5.7.0", + "@ethersproject/keccak256": "5.7.0", + "@ethersproject/logger": "5.7.0", + "@ethersproject/networks": "5.7.1", + "@ethersproject/pbkdf2": "5.7.0", + "@ethersproject/properties": "5.7.0", + "@ethersproject/providers": "5.7.2", + "@ethersproject/random": "5.7.0", + "@ethersproject/rlp": "5.7.0", + "@ethersproject/sha2": "5.7.0", + "@ethersproject/signing-key": "5.7.0", + "@ethersproject/solidity": "5.7.0", + "@ethersproject/strings": "5.7.0", + "@ethersproject/transactions": "5.7.0", + "@ethersproject/units": "5.7.0", + "@ethersproject/wallet": "5.7.0", + "@ethersproject/web": "5.7.1", + "@ethersproject/wordlists": "5.7.0" + } + }, "node_modules/@nomicfoundation/ethereumjs-trie": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-trie/-/ethereumjs-trie-6.0.1.tgz", @@ -1923,25 +2040,38 @@ } }, "node_modules/@nomicfoundation/hardhat-chai-matchers": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-chai-matchers/-/hardhat-chai-matchers-1.0.6.tgz", - "integrity": "sha512-f5ZMNmabZeZegEfuxn/0kW+mm7+yV7VNDxLpMOMGXWFJ2l/Ct3QShujzDRF9cOkK9Ui/hbDeOWGZqyQALDXVCQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-chai-matchers/-/hardhat-chai-matchers-2.0.1.tgz", + "integrity": "sha512-qWKndseO8IPt8HiVamgEAutcBOYtX7/O6NPfe7uMNWxY2ywWaiWjDcRFuYYqxrZOMyQZl6ZuiHxbaRNctTUgLw==", "dev": true, "peer": true, "dependencies": { - "@ethersproject/abi": "^5.1.2", "@types/chai-as-promised": "^7.1.3", "chai-as-promised": "^7.1.1", "deep-eql": "^4.0.1", "ordinal": "^1.0.3" }, "peerDependencies": { - "@nomiclabs/hardhat-ethers": "^2.0.0", + "@nomicfoundation/hardhat-ethers": "^3.0.0", "chai": "^4.2.0", - "ethers": "^5.0.0", + "ethers": "^6.1.0", "hardhat": "^2.9.4" } }, + "node_modules/@nomicfoundation/hardhat-ethers": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-ethers/-/hardhat-ethers-3.0.2.tgz", + "integrity": "sha512-4Pu3OwyEvnq/gvW2IZ1Lnbcz4yCC4xqzbHze34mXkqbCwV2kHOx6jX3prFDWQ1koxtin725lAazGh9CJtTaYjg==", + "dev": true, + "peer": true, + "dependencies": { + "debug": "^4.1.1" + }, + "peerDependencies": { + "ethers": "^6.1.0", + "hardhat": "^2.0.0" + } + }, "node_modules/@nomicfoundation/hardhat-network-helpers": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-network-helpers/-/hardhat-network-helpers-1.0.8.tgz", @@ -1955,32 +2085,51 @@ } }, "node_modules/@nomicfoundation/hardhat-toolbox": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-toolbox/-/hardhat-toolbox-2.0.2.tgz", - "integrity": "sha512-vnN1AzxbvpSx9pfdRHbUzTRIXpMLPXnUlkW855VaDk6N1pwRaQ2gNzEmFAABk4lWf11E00PKwFd/q27HuwYrYg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-toolbox/-/hardhat-toolbox-3.0.0.tgz", + "integrity": "sha512-MsteDXd0UagMksqm9KvcFG6gNKYNa3GGNCy73iQ6bEasEgg2v8Qjl6XA5hjs8o5UD5A3153B6W2BIVJ8SxYUtA==", "dev": true, "peerDependencies": { - "@ethersproject/abi": "^5.4.7", - "@ethersproject/providers": "^5.4.7", - "@nomicfoundation/hardhat-chai-matchers": "^1.0.0", + "@nomicfoundation/hardhat-chai-matchers": "^2.0.0", + "@nomicfoundation/hardhat-ethers": "^3.0.0", "@nomicfoundation/hardhat-network-helpers": "^1.0.0", - "@nomiclabs/hardhat-ethers": "^2.0.0", - "@nomiclabs/hardhat-etherscan": "^3.0.0", - "@typechain/ethers-v5": "^10.1.0", - "@typechain/hardhat": "^6.1.2", + "@nomicfoundation/hardhat-verify": "^1.0.0", + "@typechain/ethers-v6": "^0.4.0", + "@typechain/hardhat": "^8.0.0", "@types/chai": "^4.2.0", "@types/mocha": ">=9.1.0", "@types/node": ">=12.0.0", "chai": "^4.2.0", - "ethers": "^5.4.7", + "ethers": "^6.4.0", "hardhat": "^2.11.0", "hardhat-gas-reporter": "^1.0.8", "solidity-coverage": "^0.8.1", "ts-node": ">=8.0.0", - "typechain": "^8.1.0", + "typechain": "^8.2.0", "typescript": ">=4.5.0" } }, + "node_modules/@nomicfoundation/hardhat-verify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-verify/-/hardhat-verify-1.0.1.tgz", + "integrity": "sha512-Z++nYMcgbCU3nXkWMVzqAPrhrIyRhrKErWHOWxj0k/GzlhindQzm/D3282mdV4bG9D5qz3+tse9kzhbi1ILCJA==", + "dev": true, + "peer": true, + "dependencies": { + "@ethersproject/abi": "^5.1.2", + "@ethersproject/address": "^5.0.2", + "cbor": "^8.1.0", + "chalk": "^2.4.2", + "debug": "^4.1.1", + "lodash.clonedeep": "^4.5.0", + "semver": "^6.3.0", + "table": "^6.8.0", + "undici": "^5.14.0" + }, + "peerDependencies": { + "hardhat": "^2.0.4" + } + }, "node_modules/@nomicfoundation/solidity-analyzer": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer/-/solidity-analyzer-0.1.1.tgz", @@ -2162,39 +2311,6 @@ "node": ">= 10" } }, - "node_modules/@nomiclabs/hardhat-ethers": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.2.3.tgz", - "integrity": "sha512-YhzPdzb612X591FOe68q+qXVXGG2ANZRvDo0RRUtimev85rCrAlv/TLMEZw5c+kq9AbzocLTVX/h2jVIFPL9Xg==", - "dev": true, - "peer": true, - "peerDependencies": { - "ethers": "^5.0.0", - "hardhat": "^2.0.0" - } - }, - "node_modules/@nomiclabs/hardhat-etherscan": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-3.1.7.tgz", - "integrity": "sha512-tZ3TvSgpvsQ6B6OGmo1/Au6u8BrAkvs1mIC/eURA3xgIfznUZBhmpne8hv7BXUzw9xNL3fXdpOYgOQlVMTcoHQ==", - "dev": true, - "peer": true, - "dependencies": { - "@ethersproject/abi": "^5.1.2", - "@ethersproject/address": "^5.0.2", - "cbor": "^8.1.0", - "chalk": "^2.4.2", - "debug": "^4.1.1", - "fs-extra": "^7.0.1", - "lodash": "^4.17.11", - "semver": "^6.3.0", - "table": "^6.8.0", - "undici": "^5.14.0" - }, - "peerDependencies": { - "hardhat": "^2.0.4" - } - }, "node_modules/@nomiclabs/hardhat-web3": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-web3/-/hardhat-web3-2.0.0.tgz", @@ -3405,10 +3521,10 @@ "dev": true, "peer": true }, - "node_modules/@typechain/ethers-v5": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/@typechain/ethers-v5/-/ethers-v5-10.2.1.tgz", - "integrity": "sha512-n3tQmCZjRE6IU4h6lqUGiQ1j866n5MTCBJreNEHHVWXa2u9GJTaeYyU1/k+1qLutkyw+sS6VAN+AbeiTqsxd/A==", + "node_modules/@typechain/ethers-v6": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@typechain/ethers-v6/-/ethers-v6-0.4.0.tgz", + "integrity": "sha512-vD3Agzz63Gf2XlU3ed2/y+8dLWQj+wf+4Eq+0JXsyOio/plyV5F6r0yYe+s3XdGI858U3Sr263pl8mliDrUqbw==", "dev": true, "peer": true, "dependencies": { @@ -3416,29 +3532,25 @@ "ts-essentials": "^7.0.1" }, "peerDependencies": { - "@ethersproject/abi": "^5.0.0", - "@ethersproject/providers": "^5.0.0", - "ethers": "^5.1.3", - "typechain": "^8.1.1", - "typescript": ">=4.3.0" + "ethers": "6.x", + "typechain": "^8.2.0", + "typescript": ">=4.7.0" } }, "node_modules/@typechain/hardhat": { - "version": "6.1.6", - "resolved": "https://registry.npmjs.org/@typechain/hardhat/-/hardhat-6.1.6.tgz", - "integrity": "sha512-BiVnegSs+ZHVymyidtK472syodx1sXYlYJJixZfRstHVGYTi8V1O7QG4nsjyb0PC/LORcq7sfBUcHto1y6UgJA==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@typechain/hardhat/-/hardhat-8.0.0.tgz", + "integrity": "sha512-XUVbqlMx8tJTOmzZCD/r196CidtNWAnTBZRcYxjLTKgcJMvc/kHQpWBnVMMB5QHxVKpYpCiz8g07FYCpG8rrjA==", "dev": true, "peer": true, "dependencies": { "fs-extra": "^9.1.0" }, "peerDependencies": { - "@ethersproject/abi": "^5.4.7", - "@ethersproject/providers": "^5.4.7", - "@typechain/ethers-v5": "^10.2.1", - "ethers": "^5.4.7", + "@typechain/ethers-v6": "^0.4.0", + "ethers": "^6.1.0", "hardhat": "^2.9.9", - "typechain": "^8.1.1" + "typechain": "^8.2.0" } }, "node_modules/@typechain/hardhat/node_modules/fs-extra": { @@ -3700,9 +3812,9 @@ } }, "node_modules/@types/prettier": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.2.tgz", - "integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==", + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.3.tgz", + "integrity": "sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==", "dev": true, "peer": true }, @@ -8173,6 +8285,54 @@ "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", "dev": true }, + "node_modules/ethereum-input-data-decoder/node_modules/ethers": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", + "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abi": "5.7.0", + "@ethersproject/abstract-provider": "5.7.0", + "@ethersproject/abstract-signer": "5.7.0", + "@ethersproject/address": "5.7.0", + "@ethersproject/base64": "5.7.0", + "@ethersproject/basex": "5.7.0", + "@ethersproject/bignumber": "5.7.0", + "@ethersproject/bytes": "5.7.0", + "@ethersproject/constants": "5.7.0", + "@ethersproject/contracts": "5.7.0", + "@ethersproject/hash": "5.7.0", + "@ethersproject/hdnode": "5.7.0", + "@ethersproject/json-wallets": "5.7.0", + "@ethersproject/keccak256": "5.7.0", + "@ethersproject/logger": "5.7.0", + "@ethersproject/networks": "5.7.1", + "@ethersproject/pbkdf2": "5.7.0", + "@ethersproject/properties": "5.7.0", + "@ethersproject/providers": "5.7.2", + "@ethersproject/random": "5.7.0", + "@ethersproject/rlp": "5.7.0", + "@ethersproject/sha2": "5.7.0", + "@ethersproject/signing-key": "5.7.0", + "@ethersproject/solidity": "5.7.0", + "@ethersproject/strings": "5.7.0", + "@ethersproject/transactions": "5.7.0", + "@ethersproject/units": "5.7.0", + "@ethersproject/wallet": "5.7.0", + "@ethersproject/web": "5.7.1", + "@ethersproject/wordlists": "5.7.0" + } + }, "node_modules/ethereumjs-abi": { "version": "0.6.8", "resolved": "https://registry.npmjs.org/ethereumjs-abi/-/ethereumjs-abi-0.6.8.tgz", @@ -8230,51 +8390,88 @@ } }, "node_modules/ethers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", - "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.5.1.tgz", + "integrity": "sha512-jDpCnUGcyn39hnRUEtrulDZOtJcIPEz4Whccl3N9qhwdLsn1ELuDM9TgGgGJq6ph0p8/Uri+Wezmo/r69E+xkA==", "dev": true, "funding": [ { "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + "url": "https://github.com/sponsors/ethers-io/" }, { "type": "individual", "url": "https://www.buymeacoffee.com/ricmoo" } ], + "peer": true, "dependencies": { - "@ethersproject/abi": "5.7.0", - "@ethersproject/abstract-provider": "5.7.0", - "@ethersproject/abstract-signer": "5.7.0", - "@ethersproject/address": "5.7.0", - "@ethersproject/base64": "5.7.0", - "@ethersproject/basex": "5.7.0", - "@ethersproject/bignumber": "5.7.0", - "@ethersproject/bytes": "5.7.0", - "@ethersproject/constants": "5.7.0", - "@ethersproject/contracts": "5.7.0", - "@ethersproject/hash": "5.7.0", - "@ethersproject/hdnode": "5.7.0", - "@ethersproject/json-wallets": "5.7.0", - "@ethersproject/keccak256": "5.7.0", - "@ethersproject/logger": "5.7.0", - "@ethersproject/networks": "5.7.1", - "@ethersproject/pbkdf2": "5.7.0", - "@ethersproject/properties": "5.7.0", - "@ethersproject/providers": "5.7.2", - "@ethersproject/random": "5.7.0", - "@ethersproject/rlp": "5.7.0", - "@ethersproject/sha2": "5.7.0", - "@ethersproject/signing-key": "5.7.0", - "@ethersproject/solidity": "5.7.0", - "@ethersproject/strings": "5.7.0", - "@ethersproject/transactions": "5.7.0", - "@ethersproject/units": "5.7.0", - "@ethersproject/wallet": "5.7.0", - "@ethersproject/web": "5.7.1", - "@ethersproject/wordlists": "5.7.0" + "@adraffy/ens-normalize": "1.9.2", + "@noble/hashes": "1.1.2", + "@noble/secp256k1": "1.7.1", + "@types/node": "18.15.13", + "aes-js": "4.0.0-beta.5", + "tslib": "2.4.0", + "ws": "8.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/ethers/node_modules/@noble/hashes": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", + "integrity": "sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "peer": true + }, + "node_modules/ethers/node_modules/@types/node": { + "version": "18.15.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", + "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==", + "dev": true, + "peer": true + }, + "node_modules/ethers/node_modules/aes-js": { + "version": "4.0.0-beta.5", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", + "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==", + "dev": true, + "peer": true + }, + "node_modules/ethers/node_modules/tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "dev": true, + "peer": true + }, + "node_modules/ethers/node_modules/ws": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", + "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "dev": true, + "peer": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } } }, "node_modules/ethjs-abi": { @@ -11992,6 +12189,13 @@ "dev": true, "peer": true }, + "node_modules/lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==", + "dev": true, + "peer": true + }, "node_modules/lodash.flatten": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", @@ -17759,13 +17963,12 @@ } }, "node_modules/ts-command-line-args": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/ts-command-line-args/-/ts-command-line-args-2.5.0.tgz", - "integrity": "sha512-Ff7Xt04WWCjj/cmPO9eWTJX3qpBZWuPWyQYG1vnxJao+alWWYjwJBc5aYz3h5p5dE08A6AnpkgiCtP/0KXXBYw==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/ts-command-line-args/-/ts-command-line-args-2.5.1.tgz", + "integrity": "sha512-H69ZwTw3rFHb5WYpQya40YAX2/w7Ut75uUECbgBIsLmM+BNuYnxsltfyyLMxy6sEeKxgijLTnQtLd0nKd6+IYw==", "dev": true, "peer": true, "dependencies": { - "@morgan-stanley/ts-mocking-bird": "^0.6.2", "chalk": "^4.1.0", "command-line-args": "^5.1.1", "command-line-usage": "^6.1.0", @@ -19343,6 +19546,13 @@ } }, "dependencies": { + "@adraffy/ens-normalize": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.9.2.tgz", + "integrity": "sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg==", + "dev": true, + "peer": true + }, "@apollo/protobufjs": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/@apollo/protobufjs/-/protobufjs-1.2.7.tgz", @@ -19634,6 +19844,46 @@ "eth-ens-namehash": "^2.0.8", "ethers": "^5.0.13", "js-sha3": "^0.8.0" + }, + "dependencies": { + "ethers": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", + "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", + "dev": true, + "requires": { + "@ethersproject/abi": "5.7.0", + "@ethersproject/abstract-provider": "5.7.0", + "@ethersproject/abstract-signer": "5.7.0", + "@ethersproject/address": "5.7.0", + "@ethersproject/base64": "5.7.0", + "@ethersproject/basex": "5.7.0", + "@ethersproject/bignumber": "5.7.0", + "@ethersproject/bytes": "5.7.0", + "@ethersproject/constants": "5.7.0", + "@ethersproject/contracts": "5.7.0", + "@ethersproject/hash": "5.7.0", + "@ethersproject/hdnode": "5.7.0", + "@ethersproject/json-wallets": "5.7.0", + "@ethersproject/keccak256": "5.7.0", + "@ethersproject/logger": "5.7.0", + "@ethersproject/networks": "5.7.1", + "@ethersproject/pbkdf2": "5.7.0", + "@ethersproject/properties": "5.7.0", + "@ethersproject/providers": "5.7.2", + "@ethersproject/random": "5.7.0", + "@ethersproject/rlp": "5.7.0", + "@ethersproject/sha2": "5.7.0", + "@ethersproject/signing-key": "5.7.0", + "@ethersproject/solidity": "5.7.0", + "@ethersproject/strings": "5.7.0", + "@ethersproject/transactions": "5.7.0", + "@ethersproject/units": "5.7.0", + "@ethersproject/wallet": "5.7.0", + "@ethersproject/web": "5.7.1", + "@ethersproject/wordlists": "5.7.0" + } + } } }, "@ensdomains/resolver": { @@ -20469,26 +20719,6 @@ } } }, - "@morgan-stanley/ts-mocking-bird": { - "version": "0.6.4", - "resolved": "https://registry.npmjs.org/@morgan-stanley/ts-mocking-bird/-/ts-mocking-bird-0.6.4.tgz", - "integrity": "sha512-57VJIflP8eR2xXa9cD1LUawh+Gh+BVQfVu0n6GALyg/AqV/Nz25kDRvws3i9kIe1PTrbsZZOYpsYp6bXPd6nVA==", - "dev": true, - "peer": true, - "requires": { - "lodash": "^4.17.16", - "uuid": "^7.0.3" - }, - "dependencies": { - "uuid": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz", - "integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==", - "dev": true, - "peer": true - } - } - }, "@noble/hashes": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.2.0.tgz", @@ -20540,6 +20770,46 @@ "@nomicfoundation/ethereumjs-util": "9.0.1", "ethereum-cryptography": "0.1.3", "ethers": "^5.7.1" + }, + "dependencies": { + "ethers": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", + "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", + "dev": true, + "requires": { + "@ethersproject/abi": "5.7.0", + "@ethersproject/abstract-provider": "5.7.0", + "@ethersproject/abstract-signer": "5.7.0", + "@ethersproject/address": "5.7.0", + "@ethersproject/base64": "5.7.0", + "@ethersproject/basex": "5.7.0", + "@ethersproject/bignumber": "5.7.0", + "@ethersproject/bytes": "5.7.0", + "@ethersproject/constants": "5.7.0", + "@ethersproject/contracts": "5.7.0", + "@ethersproject/hash": "5.7.0", + "@ethersproject/hdnode": "5.7.0", + "@ethersproject/json-wallets": "5.7.0", + "@ethersproject/keccak256": "5.7.0", + "@ethersproject/logger": "5.7.0", + "@ethersproject/networks": "5.7.1", + "@ethersproject/pbkdf2": "5.7.0", + "@ethersproject/properties": "5.7.0", + "@ethersproject/providers": "5.7.2", + "@ethersproject/random": "5.7.0", + "@ethersproject/rlp": "5.7.0", + "@ethersproject/sha2": "5.7.0", + "@ethersproject/signing-key": "5.7.0", + "@ethersproject/solidity": "5.7.0", + "@ethersproject/strings": "5.7.0", + "@ethersproject/transactions": "5.7.0", + "@ethersproject/units": "5.7.0", + "@ethersproject/wallet": "5.7.0", + "@ethersproject/web": "5.7.1", + "@ethersproject/wordlists": "5.7.0" + } + } } }, "@nomicfoundation/ethereumjs-blockchain": { @@ -20621,6 +20891,46 @@ "ethereum-cryptography": "0.1.3", "ethers": "^5.7.1", "js-sdsl": "^4.1.4" + }, + "dependencies": { + "ethers": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", + "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", + "dev": true, + "requires": { + "@ethersproject/abi": "5.7.0", + "@ethersproject/abstract-provider": "5.7.0", + "@ethersproject/abstract-signer": "5.7.0", + "@ethersproject/address": "5.7.0", + "@ethersproject/base64": "5.7.0", + "@ethersproject/basex": "5.7.0", + "@ethersproject/bignumber": "5.7.0", + "@ethersproject/bytes": "5.7.0", + "@ethersproject/constants": "5.7.0", + "@ethersproject/contracts": "5.7.0", + "@ethersproject/hash": "5.7.0", + "@ethersproject/hdnode": "5.7.0", + "@ethersproject/json-wallets": "5.7.0", + "@ethersproject/keccak256": "5.7.0", + "@ethersproject/logger": "5.7.0", + "@ethersproject/networks": "5.7.1", + "@ethersproject/pbkdf2": "5.7.0", + "@ethersproject/properties": "5.7.0", + "@ethersproject/providers": "5.7.2", + "@ethersproject/random": "5.7.0", + "@ethersproject/rlp": "5.7.0", + "@ethersproject/sha2": "5.7.0", + "@ethersproject/signing-key": "5.7.0", + "@ethersproject/solidity": "5.7.0", + "@ethersproject/strings": "5.7.0", + "@ethersproject/transactions": "5.7.0", + "@ethersproject/units": "5.7.0", + "@ethersproject/wallet": "5.7.0", + "@ethersproject/web": "5.7.1", + "@ethersproject/wordlists": "5.7.0" + } + } } }, "@nomicfoundation/ethereumjs-trie": { @@ -20704,19 +21014,28 @@ } }, "@nomicfoundation/hardhat-chai-matchers": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-chai-matchers/-/hardhat-chai-matchers-1.0.6.tgz", - "integrity": "sha512-f5ZMNmabZeZegEfuxn/0kW+mm7+yV7VNDxLpMOMGXWFJ2l/Ct3QShujzDRF9cOkK9Ui/hbDeOWGZqyQALDXVCQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-chai-matchers/-/hardhat-chai-matchers-2.0.1.tgz", + "integrity": "sha512-qWKndseO8IPt8HiVamgEAutcBOYtX7/O6NPfe7uMNWxY2ywWaiWjDcRFuYYqxrZOMyQZl6ZuiHxbaRNctTUgLw==", "dev": true, "peer": true, "requires": { - "@ethersproject/abi": "^5.1.2", "@types/chai-as-promised": "^7.1.3", "chai-as-promised": "^7.1.1", "deep-eql": "^4.0.1", "ordinal": "^1.0.3" } }, + "@nomicfoundation/hardhat-ethers": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-ethers/-/hardhat-ethers-3.0.2.tgz", + "integrity": "sha512-4Pu3OwyEvnq/gvW2IZ1Lnbcz4yCC4xqzbHze34mXkqbCwV2kHOx6jX3prFDWQ1koxtin725lAazGh9CJtTaYjg==", + "dev": true, + "peer": true, + "requires": { + "debug": "^4.1.1" + } + }, "@nomicfoundation/hardhat-network-helpers": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-network-helpers/-/hardhat-network-helpers-1.0.8.tgz", @@ -20727,12 +21046,30 @@ } }, "@nomicfoundation/hardhat-toolbox": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-toolbox/-/hardhat-toolbox-2.0.2.tgz", - "integrity": "sha512-vnN1AzxbvpSx9pfdRHbUzTRIXpMLPXnUlkW855VaDk6N1pwRaQ2gNzEmFAABk4lWf11E00PKwFd/q27HuwYrYg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-toolbox/-/hardhat-toolbox-3.0.0.tgz", + "integrity": "sha512-MsteDXd0UagMksqm9KvcFG6gNKYNa3GGNCy73iQ6bEasEgg2v8Qjl6XA5hjs8o5UD5A3153B6W2BIVJ8SxYUtA==", "dev": true, "requires": {} }, + "@nomicfoundation/hardhat-verify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-verify/-/hardhat-verify-1.0.1.tgz", + "integrity": "sha512-Z++nYMcgbCU3nXkWMVzqAPrhrIyRhrKErWHOWxj0k/GzlhindQzm/D3282mdV4bG9D5qz3+tse9kzhbi1ILCJA==", + "dev": true, + "peer": true, + "requires": { + "@ethersproject/abi": "^5.1.2", + "@ethersproject/address": "^5.0.2", + "cbor": "^8.1.0", + "chalk": "^2.4.2", + "debug": "^4.1.1", + "lodash.clonedeep": "^4.5.0", + "semver": "^6.3.0", + "table": "^6.8.0", + "undici": "^5.14.0" + } + }, "@nomicfoundation/solidity-analyzer": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer/-/solidity-analyzer-0.1.1.tgz", @@ -20821,33 +21158,6 @@ "dev": true, "optional": true }, - "@nomiclabs/hardhat-ethers": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.2.3.tgz", - "integrity": "sha512-YhzPdzb612X591FOe68q+qXVXGG2ANZRvDo0RRUtimev85rCrAlv/TLMEZw5c+kq9AbzocLTVX/h2jVIFPL9Xg==", - "dev": true, - "peer": true, - "requires": {} - }, - "@nomiclabs/hardhat-etherscan": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-3.1.7.tgz", - "integrity": "sha512-tZ3TvSgpvsQ6B6OGmo1/Au6u8BrAkvs1mIC/eURA3xgIfznUZBhmpne8hv7BXUzw9xNL3fXdpOYgOQlVMTcoHQ==", - "dev": true, - "peer": true, - "requires": { - "@ethersproject/abi": "^5.1.2", - "@ethersproject/address": "^5.0.2", - "cbor": "^8.1.0", - "chalk": "^2.4.2", - "debug": "^4.1.1", - "fs-extra": "^7.0.1", - "lodash": "^4.17.11", - "semver": "^6.3.0", - "table": "^6.8.0", - "undici": "^5.14.0" - } - }, "@nomiclabs/hardhat-web3": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-web3/-/hardhat-web3-2.0.0.tgz", @@ -21923,10 +22233,10 @@ "dev": true, "peer": true }, - "@typechain/ethers-v5": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/@typechain/ethers-v5/-/ethers-v5-10.2.1.tgz", - "integrity": "sha512-n3tQmCZjRE6IU4h6lqUGiQ1j866n5MTCBJreNEHHVWXa2u9GJTaeYyU1/k+1qLutkyw+sS6VAN+AbeiTqsxd/A==", + "@typechain/ethers-v6": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@typechain/ethers-v6/-/ethers-v6-0.4.0.tgz", + "integrity": "sha512-vD3Agzz63Gf2XlU3ed2/y+8dLWQj+wf+4Eq+0JXsyOio/plyV5F6r0yYe+s3XdGI858U3Sr263pl8mliDrUqbw==", "dev": true, "peer": true, "requires": { @@ -21935,9 +22245,9 @@ } }, "@typechain/hardhat": { - "version": "6.1.6", - "resolved": "https://registry.npmjs.org/@typechain/hardhat/-/hardhat-6.1.6.tgz", - "integrity": "sha512-BiVnegSs+ZHVymyidtK472syodx1sXYlYJJixZfRstHVGYTi8V1O7QG4nsjyb0PC/LORcq7sfBUcHto1y6UgJA==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@typechain/hardhat/-/hardhat-8.0.0.tgz", + "integrity": "sha512-XUVbqlMx8tJTOmzZCD/r196CidtNWAnTBZRcYxjLTKgcJMvc/kHQpWBnVMMB5QHxVKpYpCiz8g07FYCpG8rrjA==", "dev": true, "peer": true, "requires": { @@ -22196,9 +22506,9 @@ } }, "@types/prettier": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.2.tgz", - "integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==", + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.3.tgz", + "integrity": "sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==", "dev": true, "peer": true }, @@ -25742,6 +26052,44 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", "dev": true + }, + "ethers": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", + "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", + "dev": true, + "requires": { + "@ethersproject/abi": "5.7.0", + "@ethersproject/abstract-provider": "5.7.0", + "@ethersproject/abstract-signer": "5.7.0", + "@ethersproject/address": "5.7.0", + "@ethersproject/base64": "5.7.0", + "@ethersproject/basex": "5.7.0", + "@ethersproject/bignumber": "5.7.0", + "@ethersproject/bytes": "5.7.0", + "@ethersproject/constants": "5.7.0", + "@ethersproject/contracts": "5.7.0", + "@ethersproject/hash": "5.7.0", + "@ethersproject/hdnode": "5.7.0", + "@ethersproject/json-wallets": "5.7.0", + "@ethersproject/keccak256": "5.7.0", + "@ethersproject/logger": "5.7.0", + "@ethersproject/networks": "5.7.1", + "@ethersproject/pbkdf2": "5.7.0", + "@ethersproject/properties": "5.7.0", + "@ethersproject/providers": "5.7.2", + "@ethersproject/random": "5.7.0", + "@ethersproject/rlp": "5.7.0", + "@ethersproject/sha2": "5.7.0", + "@ethersproject/signing-key": "5.7.0", + "@ethersproject/solidity": "5.7.0", + "@ethersproject/strings": "5.7.0", + "@ethersproject/transactions": "5.7.0", + "@ethersproject/units": "5.7.0", + "@ethersproject/wallet": "5.7.0", + "@ethersproject/web": "5.7.1", + "@ethersproject/wordlists": "5.7.0" + } } } }, @@ -25801,41 +26149,57 @@ } }, "ethers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", - "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.5.1.tgz", + "integrity": "sha512-jDpCnUGcyn39hnRUEtrulDZOtJcIPEz4Whccl3N9qhwdLsn1ELuDM9TgGgGJq6ph0p8/Uri+Wezmo/r69E+xkA==", "dev": true, + "peer": true, "requires": { - "@ethersproject/abi": "5.7.0", - "@ethersproject/abstract-provider": "5.7.0", - "@ethersproject/abstract-signer": "5.7.0", - "@ethersproject/address": "5.7.0", - "@ethersproject/base64": "5.7.0", - "@ethersproject/basex": "5.7.0", - "@ethersproject/bignumber": "5.7.0", - "@ethersproject/bytes": "5.7.0", - "@ethersproject/constants": "5.7.0", - "@ethersproject/contracts": "5.7.0", - "@ethersproject/hash": "5.7.0", - "@ethersproject/hdnode": "5.7.0", - "@ethersproject/json-wallets": "5.7.0", - "@ethersproject/keccak256": "5.7.0", - "@ethersproject/logger": "5.7.0", - "@ethersproject/networks": "5.7.1", - "@ethersproject/pbkdf2": "5.7.0", - "@ethersproject/properties": "5.7.0", - "@ethersproject/providers": "5.7.2", - "@ethersproject/random": "5.7.0", - "@ethersproject/rlp": "5.7.0", - "@ethersproject/sha2": "5.7.0", - "@ethersproject/signing-key": "5.7.0", - "@ethersproject/solidity": "5.7.0", - "@ethersproject/strings": "5.7.0", - "@ethersproject/transactions": "5.7.0", - "@ethersproject/units": "5.7.0", - "@ethersproject/wallet": "5.7.0", - "@ethersproject/web": "5.7.1", - "@ethersproject/wordlists": "5.7.0" + "@adraffy/ens-normalize": "1.9.2", + "@noble/hashes": "1.1.2", + "@noble/secp256k1": "1.7.1", + "@types/node": "18.15.13", + "aes-js": "4.0.0-beta.5", + "tslib": "2.4.0", + "ws": "8.5.0" + }, + "dependencies": { + "@noble/hashes": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", + "integrity": "sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==", + "dev": true, + "peer": true + }, + "@types/node": { + "version": "18.15.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", + "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==", + "dev": true, + "peer": true + }, + "aes-js": { + "version": "4.0.0-beta.5", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", + "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==", + "dev": true, + "peer": true + }, + "tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "dev": true, + "peer": true + }, + "ws": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", + "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "dev": true, + "peer": true, + "requires": {} + } } }, "ethjs-abi": { @@ -28686,6 +29050,13 @@ "dev": true, "peer": true }, + "lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==", + "dev": true, + "peer": true + }, "lodash.flatten": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", @@ -33273,13 +33644,12 @@ } }, "ts-command-line-args": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/ts-command-line-args/-/ts-command-line-args-2.5.0.tgz", - "integrity": "sha512-Ff7Xt04WWCjj/cmPO9eWTJX3qpBZWuPWyQYG1vnxJao+alWWYjwJBc5aYz3h5p5dE08A6AnpkgiCtP/0KXXBYw==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/ts-command-line-args/-/ts-command-line-args-2.5.1.tgz", + "integrity": "sha512-H69ZwTw3rFHb5WYpQya40YAX2/w7Ut75uUECbgBIsLmM+BNuYnxsltfyyLMxy6sEeKxgijLTnQtLd0nKd6+IYw==", "dev": true, "peer": true, "requires": { - "@morgan-stanley/ts-mocking-bird": "^0.6.2", "chalk": "^4.1.0", "command-line-args": "^5.1.1", "command-line-usage": "^6.1.0", diff --git a/package.json b/package.json index 4f989b903..dc660b82c 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "@bosonprotocol/solidoc": "3.0.3", "@ethereum-waffle/mock-contract": "^4.0.4", "@nomicfoundation/hardhat-network-helpers": "^1.0.6", - "@nomicfoundation/hardhat-toolbox": "^2.0.2", + "@nomicfoundation/hardhat-toolbox": "^3.0.0", "@nomiclabs/hardhat-web3": "^2.0.0", "@openzeppelin/test-helpers": "^0.5.16", "coveralls": "^3.1.1", From 665d677759465789e0dc71880b6f3d5d2db3717c Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Thu, 15 Jun 2023 09:25:26 -0300 Subject: [PATCH 02/32] Migrate validations.js and constants.js --- scripts/util/validations.js | 33 +++++++++++++++++---------------- test/domain/OfferDatesTest.js | 8 ++++---- test/util/constants.js | 4 ++-- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/scripts/util/validations.js b/scripts/util/validations.js index 07b6db318..ccee6799d 100644 --- a/scripts/util/validations.js +++ b/scripts/util/validations.js @@ -13,23 +13,24 @@ const eip55 = require("eip55"); * @returns {boolean} */ function bigNumberIsValid(bigNumber, { optional, gt, lte, empty } = {}) { - let valid = false; + let valid = true; + if (optional && (bigNumber == undefined || bigNumber == null)) { - return true; - } - try { - valid = - typeof bigNumber === "string" && - (empty - ? bigNumber === "" || typeof ethers.BigNumber.from(bigNumber) === "object" - : typeof ethers.BigNumber.from(bigNumber) === "object"); - if (gt != undefined) { - valid = valid && ethers.BigNumber.from(bigNumber).gt(gt); + valid = true; + } else if (typeof bigNumber !== "string") { + valid = false; + } else if (empty && bigNumber === "") { + valid = true; + } else { + try { + const bigNumberValue = BigInt(bigNumber); + valid = (gt == undefined || bigNumberValue > BigInt(gt)) && + (lte == undefined || bigNumberValue <= BigInt(lte)); + } catch (e) { + valid = false; } - if (lte != undefined) { - valid = valid && ethers.BigNumber.from(bigNumber).lte(lte); - } - } catch (e) {} + } + return valid; } @@ -101,7 +102,7 @@ function stringIsValid(string) { function bytes4IsValid(bytes4) { let valid = false; try { - valid = ethers.BigNumber.from(bytes4).gte("0") && ethers.BigNumber.from(bytes4).lte("4294967295"); // max bytes4 value + valid = BigInt(bytes4) >= 0n && BigInt(bytes4) <= 4294967295n; // max bytes4 value } catch (e) {} return valid; } diff --git a/test/domain/OfferDatesTest.js b/test/domain/OfferDatesTest.js index 3ebc52662..4959cbfd5 100644 --- a/test/domain/OfferDatesTest.js +++ b/test/domain/OfferDatesTest.js @@ -14,10 +14,10 @@ describe("OfferDates", function () { beforeEach(async function () { // Required constructor params - validFrom = ethers.BigNumber.from(Date.now()).toString(); // valid from now - validUntil = ethers.BigNumber.from(Date.now() + oneMonth * 6).toString(); // until 6 months - voucherRedeemableFrom = ethers.BigNumber.from(Date.now() + oneWeek).toString(); // redeemable in 1 week - voucherRedeemableUntil = ethers.BigNumber.from(Date.now() + oneWeek * 3).toString(); // redeemable for 2 weeks + validFrom = BigInt(Date.now()).toString(); // valid from now + validUntil = BigInt(Date.now() + oneMonth * 6).toString(); // until 6 months + voucherRedeemableFrom = BigInt(Date.now() + oneWeek).toString(); // redeemable in 1 week + voucherRedeemableUntil = BigInt(Date.now() + oneWeek * 3).toString(); // redeemable for 2 weeks }); context("📋 Constructor", async function () { diff --git a/test/util/constants.js b/test/util/constants.js index eaa521d5e..f02445bee 100644 --- a/test/util/constants.js +++ b/test/util/constants.js @@ -10,9 +10,9 @@ const oneMonth = oneDay * 31; // 31 days in seconds const VOUCHER_NAME = "Boson Voucher (rNFT)"; const VOUCHER_SYMBOL = "BOSON_VOUCHER_RNFT"; const SEAPORT_ADDRESS = "0x00000000000001ad428e4906aE43D8F9852d0dD6"; // 1.4 -const tipMultiplier = ethers.BigNumber.from(environments.tipMultiplier); +const tipMultiplier = BigInt(environments.tipMultiplier); const tipSuggestion = "1500000000"; // ethers.js always returns this constant, it does not vary per block -const maxPriorityFeePerGas = ethers.BigNumber.from(tipSuggestion).mul(tipMultiplier); +const maxPriorityFeePerGas = BigInt(tipSuggestion)*tipMultiplier; exports.oneDay = oneDay; exports.ninetyDays = ninetyDays; From 7d85454252f0516b10c7cc1fb1335c0143cb5268 Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Thu, 15 Jun 2023 12:51:10 -0300 Subject: [PATCH 03/32] Migrate more files --- scripts/deploy-suite.js | 12 +- scripts/domain/Receipt.js | 4 +- scripts/domain/Role.js | 5 +- .../SnapshotGate/deploy-snapshot-gate.js | 2 +- scripts/manage-roles.js | 6 +- scripts/migrations/migrate_2.2.1.js | 4 +- scripts/upgrade-clients.js | 18 +- scripts/upgrade-facets.js | 32 +- scripts/upgrade-hooks/2.2.0.js | 12 +- scripts/util/cast-protocol-client-proxies.js | 2 +- scripts/util/create-dispute-resolver.js | 12 +- scripts/util/deploy-mock-tokens.js | 20 +- .../util/deploy-protocol-client-beacons.js | 2 +- scripts/util/deploy-protocol-client-impls.js | 2 +- .../util/deploy-protocol-client-proxies.js | 2 +- scripts/util/deploy-protocol-clients.js | 2 +- scripts/util/deploy-protocol-diamond.js | 10 +- .../util/deploy-protocol-handler-facets.js | 2 +- scripts/util/detect-changed-contracts.js | 2 +- scripts/util/diamond-utils.js | 26 +- scripts/util/estimate-limits.js | 74 +-- scripts/util/report-verify-deployments.js | 2 +- scripts/util/utils.js | 14 +- test/access/AccessControllerTest.js | 6 +- test/domain/AgentTest.js | 8 +- test/domain/BuyerTest.js | 4 +- test/domain/ConditionTest.js | 4 +- test/domain/DisputeResolverFeeTest.js | 6 +- test/domain/DisputeResolverTest.js | 4 +- test/domain/FundsTest.js | 6 +- test/domain/OfferDatesTest.js | 2 +- test/domain/OfferTest.js | 12 +- test/domain/ReceiptTest.js | 8 +- test/domain/SellerTest.js | 6 +- test/domain/TwinReceiptTest.js | 4 +- test/domain/TwinTest.js | 4 +- test/example/SnapshotGateTest.js | 20 +- .../01-update-account-roles-addresses.js | 48 +- test/integration/02-Upgraded-facet.js | 80 +-- ...DR-removes-the-seller-from-allowed-list.js | 10 +- test/integration/04-DR-removes-fees.js | 26 +- test/integration/seaport/fixtures.js | 4 +- .../seaport/seaport-integration.js | 14 +- test/protocol/AccountHandlerTest.js | 4 +- test/protocol/AgentHandlerTest.js | 4 +- test/protocol/BundleHandlerTest.js | 20 +- test/protocol/BuyerHandlerTest.js | 14 +- test/protocol/ConfigHandlerTest.js | 34 +- test/protocol/DisputeHandlerTest.js | 144 ++--- test/protocol/DisputeResolverHandlerTest.js | 92 +-- test/protocol/ExchangeHandlerTest.js | 208 +++---- test/protocol/FundsHandlerTest.js | 588 +++++++++--------- test/protocol/GroupHandlerTest.js | 30 +- test/protocol/MetaTransactionsHandlerTest.js | 78 +-- test/protocol/OfferHandlerTest.js | 146 ++--- test/protocol/OrchestrationHandlerTest.js | 252 ++++---- test/protocol/ProtocolDiamondTest.js | 130 ++-- .../ProtocolInitializationHandlerTest.js | 52 +- test/protocol/SellerHandlerTest.js | 242 +++---- test/protocol/TwinHandlerTest.js | 20 +- test/protocol/clients/BeaconClientProxy.js | 2 +- test/protocol/clients/BosonVoucherTest.js | 188 +++--- .../clients/ClientExternalAddressesTest.js | 14 +- test/upgrade/01_generic.js | 6 +- test/upgrade/2.0.0-2.1.0.js | 18 +- test/upgrade/2.1.0-2.2.0.js | 70 +-- test/upgrade/2.2.0-2.2.1.js | 4 +- test/upgrade/clients/01_generic.js | 4 +- .../clients/BosonVoucher-2.1.0-2.2.0.js | 36 +- test/util/constants.js | 2 +- test/util/mock.js | 26 +- test/util/upgrade.js | 218 +++---- test/util/utils.js | 29 +- 73 files changed, 1606 insertions(+), 1612 deletions(-) diff --git a/scripts/deploy-suite.js b/scripts/deploy-suite.js index b24551b69..d8f1d0b1b 100644 --- a/scripts/deploy-suite.js +++ b/scripts/deploy-suite.js @@ -3,9 +3,9 @@ const hre = require("hardhat"); const ethers = hre.ethers; const network = hre.network.name; const confirmations = network == "hardhat" ? 1 : environments.confirmations; -const tipMultiplier = ethers.BigNumber.from(environments.tipMultiplier); -const tipSuggestion = "1500000000"; // ethers.js always returns this constant, it does not vary per block -const maxPriorityFeePerGas = ethers.BigNumber.from(tipSuggestion).mul(tipMultiplier); +const tipMultiplier = BigInt(environments.tipMultiplier); +const tipSuggestion = "1500000000"; // js always returns this constant, it does not vary per block +const maxPriorityFeePerGas = BigInt(tipSuggestion).mul(tipMultiplier); const packageFile = require("../package.json"); const authTokenAddresses = require("./config/auth-token-addresses"); @@ -61,14 +61,14 @@ async function main(env, facetConfig) { const authTokenContracts = getAuthTokenContracts(); // Get the accounts - const accounts = await ethers.getSigners(); + const accounts = await getSigners(); const deployer = accounts[0]; // If hardhat, get an address generated by the mnemonic const adminAddress = network === "hardhat" ? accounts[1].address : environments[network].adminAddress; // If admin address is unspecified, exit the deployment process - if (adminAddress == ethers.constants.AddressZero || !adminAddress) { + if (adminAddress == ZeroAddress || !adminAddress) { console.log("Admin address must not be zero address"); process.exit(1); } @@ -152,7 +152,7 @@ async function main(env, facetConfig) { console.log(`\n🌐️Configuring and granting roles...`); // Cast Diamond to the IBosonConfigHandler interface for further interaction with it - const bosonConfigHandler = await ethers.getContractAt("IBosonConfigHandler", protocolDiamond.address); + const bosonConfigHandler = await getContractAt("IBosonConfigHandler", protocolDiamond.address); // Add Voucher addresses to protocol config transactionResponse = await bosonConfigHandler.setVoucherBeaconAddress( diff --git a/scripts/domain/Receipt.js b/scripts/domain/Receipt.js index 50ac308c4..b5f88cddf 100644 --- a/scripts/domain/Receipt.js +++ b/scripts/domain/Receipt.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { ZeroAddress} = hre.ethers; const DisputeState = require("./DisputeState"); const OfferFees = require("./OfferFees.js"); const TwinReceipt = require("./TwinReceipt.js"); @@ -70,7 +70,7 @@ class Receipt { this.agentId = agentId ?? "0"; this.exchangeToken = exchangeToken; this.finalizedDate = finalizedDate; - this.condition = condition ?? new Condition(0, 0, ethers.constants.AddressZero, "0", "0", "0"); + this.condition = condition ?? new Condition(0, 0, ZeroAddress, "0", "0", "0"); this.committedDate = committedDate; this.redeemedDate = redeemedDate; this.voucherExpired = voucherExpired; diff --git a/scripts/domain/Role.js b/scripts/domain/Role.js index b27f53df6..bde64b6c8 100644 --- a/scripts/domain/Role.js +++ b/scripts/domain/Role.js @@ -1,6 +1,5 @@ -const ethers = require("ethers"); -const keccak256 = ethers.utils.keccak256; -const toUtf8Bytes = ethers.utils.toUtf8Bytes; +const hre = require("hardhat"); +const { keccak256, toUtf8Bytes } = hre.ethers; /** * Boson Protocol Domain Enum: Role diff --git a/scripts/example/SnapshotGate/deploy-snapshot-gate.js b/scripts/example/SnapshotGate/deploy-snapshot-gate.js index cb14a40de..1cab7d0f2 100644 --- a/scripts/example/SnapshotGate/deploy-snapshot-gate.js +++ b/scripts/example/SnapshotGate/deploy-snapshot-gate.js @@ -22,7 +22,7 @@ const { getFees } = require("../../util/utils"); */ async function deploySnapshotGateExample(snapshotGateArgs, maxPriorityFeePerGas) { // Deploy the SnapshotGate - const SnapshotGate = await ethers.getContractFactory("SnapshotGate"); + const SnapshotGate = await getContractFactory("SnapshotGate"); const snapshotGate = await SnapshotGate.deploy(...snapshotGateArgs, await getFees(maxPriorityFeePerGas)); await snapshotGate.deployTransaction.wait(confirmations); diff --git a/scripts/manage-roles.js b/scripts/manage-roles.js index e103bfe62..414c27e01 100644 --- a/scripts/manage-roles.js +++ b/scripts/manage-roles.js @@ -31,7 +31,7 @@ async function main(env) { // Bail now if hardhat network if (network === "hardhat") process.exit(); - const chainId = (await hre.ethers.provider.getNetwork()).chainId; + const chainId = (await hre.provider.getNetwork()).chainId; const contractsFile = readContracts(chainId, network, env); const divider = "-".repeat(80); @@ -39,7 +39,7 @@ async function main(env) { console.log(`⛓ Network: ${hre.network.name}\n📅 ${new Date()}`); // Get the accounts - const accounts = await ethers.provider.listAccounts(); + const accounts = await provider.listAccounts(); const admin = accounts[0]; console.log("🔱 Admin account: ", admin ? admin : "not found" && process.exit()); console.log(divider); @@ -49,7 +49,7 @@ async function main(env) { const accessControllerInfo = contractsFile.contracts.find((i) => i.name === "AccessController"); // Get AccessController abstraction - const accessController = await ethers.getContractAt("AccessController", accessControllerInfo.address); + const accessController = await getContractAt("AccessController", accessControllerInfo.address); // Loop through assignments for this network const assignments = Object.entries(RoleAssignments[network]); diff --git a/scripts/migrations/migrate_2.2.1.js b/scripts/migrations/migrate_2.2.1.js index 0ebbce5e8..e8eaff506 100644 --- a/scripts/migrations/migrate_2.2.1.js +++ b/scripts/migrations/migrate_2.2.1.js @@ -40,7 +40,7 @@ async function migrate(env) { shell.exec(`npm install`); } - const { chainId } = await ethers.provider.getNetwork(); + const { chainId } = await provider.getNetwork(); const contractsFile = readContracts(chainId, network, env); if (contractsFile?.protocolVersion != "2.2.0") { @@ -86,7 +86,7 @@ async function migrate(env) { const selectorsToAdd = await getFunctionHashesClosure(); - const metaTransactionHandlerFacet = await ethers.getContractAt("MetaTransactionsHandlerFacet", protocolAddress); + const metaTransactionHandlerFacet = await getContractAt("MetaTransactionsHandlerFacet", protocolAddress); console.log("Removing selectors", selectorsToRemove.join(",")); await metaTransactionHandlerFacet.setAllowlistedFunctions(selectorsToRemove, false); diff --git a/scripts/upgrade-clients.js b/scripts/upgrade-clients.js index 7facc38aa..e7bcd3c89 100644 --- a/scripts/upgrade-clients.js +++ b/scripts/upgrade-clients.js @@ -2,9 +2,9 @@ const hre = require("hardhat"); const ethers = hre.ethers; const network = hre.network.name; const environments = require("../environments"); -const tipMultiplier = ethers.BigNumber.from(environments.tipMultiplier); -const tipSuggestion = "1500000000"; // ethers.js always returns this constant, it does not vary per block -const maxPriorityFeePerGas = ethers.BigNumber.from(tipSuggestion).mul(tipMultiplier); +const tipMultiplier = BigInt(environments.tipMultiplier); +const tipSuggestion = "1500000000"; // js always returns this constant, it does not vary per block +const maxPriorityFeePerGas = BigInt(tipSuggestion).mul(tipMultiplier); const { deploymentComplete, getFees, @@ -29,7 +29,7 @@ async function main(env, clientConfig, version) { // Bail now if hardhat network, unless the upgrade is tested if (network === "hardhat" && env !== "upgrade-test") process.exit(); - const { chainId } = await ethers.provider.getNetwork(); + const { chainId } = await provider.getNetwork(); let { contracts } = readContracts(chainId, network, env); const divider = "-".repeat(80); @@ -38,16 +38,16 @@ async function main(env, clientConfig, version) { // If hardhat, get an address generated by the mnemonic const adminAddress = - network === "hardhat" ? (await ethers.getSigners())[0].address : environments[network].adminAddress; + network === "hardhat" ? (await getSigners())[0].address : environments[network].adminAddress; // If admin address is unspecified, exit the process - if (adminAddress == ethers.constants.AddressZero || !adminAddress) { + if (adminAddress == ZeroAddress || !adminAddress) { console.log("Admin address must not be zero address"); process.exit(1); } // Get list of accounts managed by node - const nodeAccountList = (await ethers.provider.listAccounts()).map((address) => address.toLowerCase()); + const nodeAccountList = (await provider.listAccounts()).map((address) => address.toLowerCase()); if (nodeAccountList.includes(adminAddress.toLowerCase())) { console.log("🔱 Admin account: ", adminAddress); @@ -58,7 +58,7 @@ async function main(env, clientConfig, version) { console.log(divider); // Get signer for admin address - const adminSigner = await ethers.getSigner(adminAddress); + const adminSigner = await getSigner(adminAddress); // Get addresses of currently deployed Beacon contract const beaconAddress = contracts.find((c) => c.name === "BosonVoucher Beacon")?.address; @@ -81,7 +81,7 @@ async function main(env, clientConfig, version) { // Update implementation address on beacon contract console.log(`\n📋 Updating implementation address on beacon`); - const beacon = await ethers.getContractAt("BosonClientBeacon", beaconAddress); + const beacon = await getContractAt("BosonClientBeacon", beaconAddress); await beacon .connect(adminSigner) .setImplementation(bosonVoucherImplementation.address, await getFees(maxPriorityFeePerGas)); diff --git a/scripts/upgrade-facets.js b/scripts/upgrade-facets.js index 9a494dada..438694ca1 100644 --- a/scripts/upgrade-facets.js +++ b/scripts/upgrade-facets.js @@ -4,9 +4,9 @@ const ethers = hre.ethers; const network = hre.network.name; const { getFacets } = require("./config/facet-upgrade"); const environments = require("../environments"); -const tipMultiplier = ethers.BigNumber.from(environments.tipMultiplier); -const tipSuggestion = "1500000000"; // ethers.js always returns this constant, it does not vary per block -const maxPriorityFeePerGas = ethers.BigNumber.from(tipSuggestion).mul(tipMultiplier); +const tipMultiplier = BigInt(environments.tipMultiplier); +const tipSuggestion = "1500000000"; // js always returns this constant, it does not vary per block +const maxPriorityFeePerGas = BigInt(tipSuggestion).mul(tipMultiplier); const { deploymentComplete, readContracts, writeContracts, checkRole, addressNotFound } = require("./util/utils.js"); const { deployProtocolFacets } = requireUncached("./util/deploy-protocol-handler-facets.js"); const { @@ -44,7 +44,7 @@ async function main(env, facetConfig, version) { // Bail now if hardhat network, unless the upgrade is tested if (network === "hardhat" && env !== "upgrade-test") process.exit(); - const { chainId } = await ethers.provider.getNetwork(); + const { chainId } = await provider.getNetwork(); const contractsFile = readContracts(chainId, network, env); let contracts = contractsFile.contracts; const interfaceIds = await getInterfaceIds(false); @@ -82,16 +82,16 @@ async function main(env, facetConfig, version) { // If hardhat, get an address generated by the mnemonic const adminAddress = - network === "hardhat" ? (await ethers.getSigners())[0].address : environments[network].adminAddress; + network === "hardhat" ? (await getSigners())[0].address : environments[network].adminAddress; // If admin address is unspecified, exit the process - if (adminAddress == ethers.constants.AddressZero || !adminAddress) { + if (adminAddress == ZeroAddress || !adminAddress) { console.log("Admin address must not be zero address"); process.exit(1); } // Get list of accounts managed by node - const nodeAccountList = (await ethers.provider.listAccounts()).map((address) => address.toLowerCase()); + const nodeAccountList = (await provider.listAccounts()).map((address) => address.toLowerCase()); if (nodeAccountList.includes(adminAddress.toLowerCase())) { console.log("🔱 Admin account: ", adminAddress); @@ -131,8 +131,8 @@ async function main(env, facetConfig, version) { let deployedFacets = await deployProtocolFacets(facets.addOrUpgrade, facets.facetsToInit, maxPriorityFeePerGas); // Cast Diamond to DiamondCutFacet, DiamondLoupeFacet and IERC165Extended - const diamondCutFacet = await ethers.getContractAt("DiamondCutFacet", protocolAddress); - const diamondLoupe = await ethers.getContractAt("DiamondLoupeFacet", protocolAddress); + const diamondCutFacet = await getContractAt("DiamondCutFacet", protocolAddress); + const diamondLoupe = await getContractAt("DiamondLoupeFacet", protocolAddress); const facetCutRemove = []; const interfacesToRemove = {}, @@ -161,7 +161,7 @@ async function main(env, facetConfig, version) { removedSelectors.push(selectorsToRemove); // add to global list // Removing the selectors - facetCutRemove.push([ethers.constants.AddressZero, FacetCutAction.Remove, selectorsToRemove]); + facetCutRemove.push([ZeroAddress, FacetCutAction.Remove, selectorsToRemove]); if (oldFacet) { // Remove support for old interface @@ -214,7 +214,7 @@ async function main(env, facetConfig, version) { let newSelectors = selectors.selectors; // Initialize selectors should not be added - const facetFactory = await ethers.getContractFactory(newFacet.name); + const facetFactory = await getContractFactory(newFacet.name); const functionFragment = facetFactory.interface.getFunction("initialize"); const signature = facetFactory.interface.getSighash(functionFragment); newSelectors = selectors.selectors.remove([signature]); @@ -237,7 +237,7 @@ async function main(env, facetConfig, version) { if (removedSelectors.flat().includes(selectorToAdd)) continue; // skip if selector is already marked for removal from another facet const existingFacetAddress = await diamondLoupe.facetAddress(selectorToAdd); - if (existingFacetAddress != ethers.constants.AddressZero) { + if (existingFacetAddress != ZeroAddress) { // Selector exist on some other facet const selectorName = selectors.signatureToNameMapping[selectorToAdd]; let answer; @@ -270,7 +270,7 @@ async function main(env, facetConfig, version) { deployedFacets[index].cut.push([newFacetAddress, FacetCutAction.Replace, selectorsToReplace]); } if (selectorsToRemove.length > 0) { - deployedFacets[index].cut.push([ethers.constants.AddressZero, FacetCutAction.Remove, selectorsToRemove]); + deployedFacets[index].cut.push([ZeroAddress, FacetCutAction.Remove, selectorsToRemove]); } if (oldFacet && (selectorsToAdd.length > 0 || selectorsToRemove.length > 0)) { @@ -295,7 +295,7 @@ async function main(env, facetConfig, version) { }); } - const erc165 = await ethers.getContractAt("contracts/interfaces/IERC165.sol:IERC165", protocolAddress); + const erc165 = await getContractAt("contracts/interfaces/IERC165.sol:IERC165", protocolAddress); const support = await erc165.supportsInterface(newFacetInterfaceId); if (!support) { interfacesToAdd[oldFacet.name] = newFacetInterfaceId; @@ -362,7 +362,7 @@ async function main(env, facetConfig, version) { } // Cast diamond to ProtocolInitializationHandlerFacet - protocolInitializationFacet = await ethers.getContractAt("ProtocolInitializationHandlerFacet", protocolAddress); + protocolInitializationFacet = await getContractAt("ProtocolInitializationHandlerFacet", protocolAddress); const newVersion = (await protocolInitializationFacet.getVersion()).replace(/\0/g, ""); console.log(`\n📋 New version: ${newVersion}`); @@ -404,7 +404,7 @@ const getInitializationFacet = async (deployedFacets, contracts) => { if (protocolInitializationDeployed) { protocolInitializationFacet = protocolInitializationDeployed.contract; } else { - protocolInitializationFacet = await ethers.getContractAt( + protocolInitializationFacet = await getContractAt( protocolInitializationName, contracts.find((i) => i.name == protocolInitializationName).address ); diff --git a/scripts/upgrade-hooks/2.2.0.js b/scripts/upgrade-hooks/2.2.0.js index b103388a7..8401ac54a 100644 --- a/scripts/upgrade-hooks/2.2.0.js +++ b/scripts/upgrade-hooks/2.2.0.js @@ -1,8 +1,8 @@ const { ethers } = require("hardhat"); const environments = require("../../environments"); -const tipMultiplier = ethers.BigNumber.from(environments.tipMultiplier); -const tipSuggestion = "1500000000"; // ethers.js always returns this constant, it does not vary per block -const maxPriorityFeePerGas = ethers.BigNumber.from(tipSuggestion).mul(tipMultiplier); +const tipMultiplier = BigInt(environments.tipMultiplier); +const tipSuggestion = "1500000000"; // js always returns this constant, it does not vary per block +const maxPriorityFeePerGas = BigInt(tipSuggestion).mul(tipMultiplier); const { getFees } = require("./../util/utils"); const PausableRegion = require("../domain/PausableRegion.js"); @@ -10,11 +10,11 @@ const PausableRegion = require("../domain/PausableRegion.js"); async function preUpgrade(protocolAddress, facets) { // Pause the exchanges region of the protocol console.log("Pausing the protocol..."); - const pauseHandler = await ethers.getContractAt("IBosonPauseHandler", protocolAddress); + const pauseHandler = await getContractAt("IBosonPauseHandler", protocolAddress); await pauseHandler.pause([PausableRegion.Exchanges], await getFees(maxPriorityFeePerGas)); // Get next exchange Id - const exchangeHandler = await ethers.getContractAt("IBosonExchangeHandler", protocolAddress); + const exchangeHandler = await getContractAt("IBosonExchangeHandler", protocolAddress); const nextExchangeId = await exchangeHandler.getNextExchangeId(); facets.facetsToInit.ExchangeHandlerFacet.constructorArgs = [nextExchangeId]; @@ -24,7 +24,7 @@ async function preUpgrade(protocolAddress, facets) { async function postUpgrade(protocolAddress) { // Unpause the protocol console.log("Unpausing the protocol..."); - const pauseHandler = await ethers.getContractAt("IBosonPauseHandler", protocolAddress); + const pauseHandler = await getContractAt("IBosonPauseHandler", protocolAddress); await pauseHandler.unpause(await getFees(maxPriorityFeePerGas)); } diff --git a/scripts/util/cast-protocol-client-proxies.js b/scripts/util/cast-protocol-client-proxies.js index 8a0ee6713..da40b197d 100644 --- a/scripts/util/cast-protocol-client-proxies.js +++ b/scripts/util/cast-protocol-client-proxies.js @@ -25,7 +25,7 @@ async function castProtocolClientProxies(protocolClientProxies) { [bosonVoucherProxy] = protocolClientProxies; // Cast the Proxies to the appropriate interfaces for further interaction - const bosonVoucher = await ethers.getContractAt("IBosonVoucher", bosonVoucherProxy.address); + const bosonVoucher = await getContractAt("IBosonVoucher", bosonVoucherProxy.address); return [bosonVoucher]; } diff --git a/scripts/util/create-dispute-resolver.js b/scripts/util/create-dispute-resolver.js index 9e6513c63..8aaf22281 100644 --- a/scripts/util/create-dispute-resolver.js +++ b/scripts/util/create-dispute-resolver.js @@ -47,13 +47,13 @@ const createDisputeResolver = async (path) => { const adminAddress = environments[network].adminAddress; // If admin address is unspecified, exit the process - if (adminAddress == ethers.constants.AddressZero || !adminAddress) { + if (adminAddress == ZeroAddress || !adminAddress) { console.log("Admin address must not be zero address"); process.exit(1); } // Find protocol diamond and accessController addresses - const chainId = (await hre.ethers.provider.getNetwork()).chainId; + const chainId = (await hre.provider.getNetwork()).chainId; const addressList = require(`../../addresses/${chainId}-${network}.json`).contracts; const protocolAddress = addressList.find((c) => c.name === "ProtocolDiamond").address; const accessControllerAddress = addressList.find((c) => c.name === "AccessController").address; @@ -67,10 +67,10 @@ const createDisputeResolver = async (path) => { } // Cast protocol diamond to IBosonAccountHandler - const accountHandler = await ethers.getContractAt("IBosonAccountHandler", protocolAddress); + const accountHandler = await getContractAt("IBosonAccountHandler", protocolAddress); // Get signer for admin address - const protocolAdminSigner = await ethers.getSigner(adminAddress); + const protocolAdminSigner = await getSigner(adminAddress); let tx, receipt; // Create dispute resolver @@ -79,14 +79,14 @@ const createDisputeResolver = async (path) => { if (!privateKey) { disputeResolverSigner = protocolAdminSigner; } else { - disputeResolverSigner = new ethers.Wallet(privateKey, protocolAdminSigner.provider); + disputeResolverSigner = new Wallet(privateKey, protocolAdminSigner.provider); } // create dispute resolver with callers account let initialDisputeResolver = { ...disputeResolver }; initialDisputeResolver.admin = disputeResolverSigner.address; initialDisputeResolver.assistant = disputeResolverSigner.address; - initialDisputeResolver.clerk = ethers.constants.AddressZero; + initialDisputeResolver.clerk = ZeroAddress; tx = await accountHandler .connect(disputeResolverSigner) diff --git a/scripts/util/deploy-mock-tokens.js b/scripts/util/deploy-mock-tokens.js index fb8eb8611..c159c4dbf 100644 --- a/scripts/util/deploy-mock-tokens.js +++ b/scripts/util/deploy-mock-tokens.js @@ -18,7 +18,7 @@ async function deployMockTokens(tokens = ["BosonToken", "Foreign721", "Foreign11 // Deploy all the mock tokens while (tokens.length) { let token = tokens.shift(); - let TokenContractFactory = await ethers.getContractFactory(token); + let TokenContractFactory = await getContractFactory(token); const tokenContract = await TokenContractFactory.deploy(); await tokenContract.deployed(); deployedTokens.push(tokenContract); @@ -39,13 +39,13 @@ async function deployAndMintMockNFTAuthTokens() { let tx1, tx2; //Deploy a mock NFT to represent the Lens Protocol profile NFT - let lensTokenContractFactory = await ethers.getContractFactory("MockNFTAuth721"); + let lensTokenContractFactory = await getContractFactory("MockNFTAuth721"); const lensTokenContract = await lensTokenContractFactory.deploy(); await lensTokenContract.deployTransaction.wait(confirmations); console.log(`✅ Mock Lens NFT Token deployed to: ${lensTokenContract.address}`); //Deploy a mock NFT to represent the ENS NFT - let ensTokenContractFactory = await ethers.getContractFactory("MockNFTAuth721"); + let ensTokenContractFactory = await getContractFactory("MockNFTAuth721"); const ensTokenContract = await ensTokenContractFactory.deploy(); await ensTokenContract.deployTransaction.wait(confirmations); console.log(`✅ Mock ENS NFT Token deployed to: ${ensTokenContract.address}`); @@ -57,7 +57,7 @@ async function deployAndMintMockNFTAuthTokens() { console.log("\n Tokens will be minted to addresses ", addresses); } } else if (network == "hardhat") { - [...addresses] = await ethers.provider.listAccounts(); + [...addresses] = await provider.listAccounts(); //We only need auth tokens for 3 addresses addresses.splice(3, 18); @@ -69,19 +69,19 @@ async function deployAndMintMockNFTAuthTokens() { // Mint tokens for testing while (addresses.length) { let to = addresses.shift(); - tx1 = await lensTokenContract.mint(to, ethers.BigNumber.from(lensTokenId)); - tx2 = await ensTokenContract.mint(to, ethers.BigNumber.from(ensTokenId)); + tx1 = await lensTokenContract.mint(to, BigInt(lensTokenId)); + tx2 = await ensTokenContract.mint(to, BigInt(ensTokenId)); await expect(tx1) .to.emit(lensTokenContract, "Transfer") - .withArgs(ethers.constants.AddressZero, ethers.utils.getAddress(to), lensTokenId); + .withArgs(ZeroAddress, getAddress(to), lensTokenId); await expect(tx2) .to.emit(ensTokenContract, "Transfer") - .withArgs(ethers.constants.AddressZero, ethers.utils.getAddress(to), ensTokenId); + .withArgs(ZeroAddress, getAddress(to), ensTokenId); - let lensOwner = await lensTokenContract.ownerOf(ethers.BigNumber.from(lensTokenId)); - let ensOwner = await ensTokenContract.ownerOf(ethers.BigNumber.from(ensTokenId)); + let lensOwner = await lensTokenContract.ownerOf(BigInt(lensTokenId)); + let ensOwner = await ensTokenContract.ownerOf(BigInt(ensTokenId)); console.log("✅ Owner of Lens token Id %s is ", lensTokenId, lensOwner); console.log("✅ Owner of ENS token Id %s is ", ensTokenId, ensOwner); diff --git a/scripts/util/deploy-protocol-client-beacons.js b/scripts/util/deploy-protocol-client-beacons.js index 30e2ef9dc..c69e370f9 100644 --- a/scripts/util/deploy-protocol-client-beacons.js +++ b/scripts/util/deploy-protocol-client-beacons.js @@ -28,7 +28,7 @@ async function deployProtocolClientBeacons(protocolClients, protocolClientArgs, [bosonVoucherImpl] = protocolClients; // Deploy the ClientBeacon for BosonVoucher - const ClientBeacon = await ethers.getContractFactory("BosonClientBeacon"); + const ClientBeacon = await getContractFactory("BosonClientBeacon"); const clientBeacon = await ClientBeacon.deploy( ...protocolClientArgs, bosonVoucherImpl.address, diff --git a/scripts/util/deploy-protocol-client-impls.js b/scripts/util/deploy-protocol-client-impls.js index b48a73557..1357bf743 100644 --- a/scripts/util/deploy-protocol-client-impls.js +++ b/scripts/util/deploy-protocol-client-impls.js @@ -21,7 +21,7 @@ const { getFees } = require("./utils"); */ async function deployProtocolClientImpls(implementationArgs, maxPriorityFeePerGas) { // Deploy the BosonVoucher contract - const BosonVoucher = await ethers.getContractFactory("BosonVoucher"); + const BosonVoucher = await getContractFactory("BosonVoucher"); const bosonVoucher = await BosonVoucher.deploy(...implementationArgs, await getFees(maxPriorityFeePerGas)); await bosonVoucher.deployTransaction.wait(confirmations); diff --git a/scripts/util/deploy-protocol-client-proxies.js b/scripts/util/deploy-protocol-client-proxies.js index 3853f26bb..953f01650 100644 --- a/scripts/util/deploy-protocol-client-proxies.js +++ b/scripts/util/deploy-protocol-client-proxies.js @@ -29,7 +29,7 @@ async function deployProtocolClientProxies(protocolClients, maxPriorityFeePerGas [bosonClientBeacon] = protocolClients; // Deploy the ClientProxy for BosonVoucher - const ClientProxy = await ethers.getContractFactory("BeaconClientProxy"); + const ClientProxy = await getContractFactory("BeaconClientProxy"); const clientProxy = await ClientProxy.deploy(await getFees(maxPriorityFeePerGas)); await clientProxy.deployTransaction.wait(confirmations); diff --git a/scripts/util/deploy-protocol-clients.js b/scripts/util/deploy-protocol-clients.js index c1e69ba11..488eff07b 100644 --- a/scripts/util/deploy-protocol-clients.js +++ b/scripts/util/deploy-protocol-clients.js @@ -25,7 +25,7 @@ const { castProtocolClientProxies } = require("./cast-protocol-client-proxies.js async function deployProtocolClients( protocolClientArgs, maxPriorityFeePerGas, - implementationArgs = [ethers.constants.AddressZero] + implementationArgs = [ZeroAddress] ) { // Deploy Protocol Client implementation contracts const protocolClientImpls = await deployProtocolClientImpls(implementationArgs, maxPriorityFeePerGas); diff --git a/scripts/util/deploy-protocol-diamond.js b/scripts/util/deploy-protocol-diamond.js index a444e47c7..35cc88a43 100644 --- a/scripts/util/deploy-protocol-diamond.js +++ b/scripts/util/deploy-protocol-diamond.js @@ -27,22 +27,22 @@ async function deployProtocolDiamond(maxPriorityFeePerGas) { ]; // Deploy the AccessController contract - const AccessController = await ethers.getContractFactory("AccessController"); + const AccessController = await getContractFactory("AccessController"); const accessController = await AccessController.deploy(await getFees(maxPriorityFeePerGas)); await accessController.deployTransaction.wait(confirmations); // Diamond Loupe Facet - const DiamondLoupeFacet = await ethers.getContractFactory("DiamondLoupeFacet"); + const DiamondLoupeFacet = await getContractFactory("DiamondLoupeFacet"); const dlf = await DiamondLoupeFacet.deploy(await getFees(maxPriorityFeePerGas)); await dlf.deployTransaction.wait(confirmations); // Diamond Cut Facet - const DiamondCutFacet = await ethers.getContractFactory("DiamondCutFacet"); + const DiamondCutFacet = await getContractFactory("DiamondCutFacet"); const dcf = await DiamondCutFacet.deploy(await getFees(maxPriorityFeePerGas)); await dcf.deployTransaction.wait(confirmations); // ERC165 Facet - const ERC165Facet = await ethers.getContractFactory("ERC165Facet"); + const ERC165Facet = await getContractFactory("ERC165Facet"); const erc165f = await ERC165Facet.deploy(await getFees(maxPriorityFeePerGas)); await erc165f.deployTransaction.wait(confirmations); @@ -54,7 +54,7 @@ async function deployProtocolDiamond(maxPriorityFeePerGas) { ]; // Deploy Protocol Diamond - const ProtocolDiamond = await ethers.getContractFactory("ProtocolDiamond"); + const ProtocolDiamond = await getContractFactory("ProtocolDiamond"); const protocolDiamond = await ProtocolDiamond.deploy(...diamondArgs, await getFees(maxPriorityFeePerGas)); await protocolDiamond.deployTransaction.wait(confirmations); diff --git a/scripts/util/deploy-protocol-handler-facets.js b/scripts/util/deploy-protocol-handler-facets.js index bb9c0d34b..dffb3be04 100644 --- a/scripts/util/deploy-protocol-handler-facets.js +++ b/scripts/util/deploy-protocol-handler-facets.js @@ -82,7 +82,7 @@ async function deployProtocolFacets(facetNames, facetsToInit, maxPriorityFeePerG // Deploy all handler facets for (const facetName of facetNames) { - let FacetContractFactory = await ethers.getContractFactory(facetName); + let FacetContractFactory = await getContractFactory(facetName); const constructorArgs = (facetsToInit[facetName] && facetsToInit[facetName].constructorArgs) || []; const facetContract = await FacetContractFactory.deploy(...constructorArgs, await getFees(maxPriorityFeePerGas)); await facetContract.deployTransaction.wait(confirmations); diff --git a/scripts/util/detect-changed-contracts.js b/scripts/util/detect-changed-contracts.js index ee08a4a85..31598c09a 100644 --- a/scripts/util/detect-changed-contracts.js +++ b/scripts/util/detect-changed-contracts.js @@ -124,7 +124,7 @@ async function getBytecodes() { // Abstract contracts do not have bytecode, and factory creation fails. Skip them. try { - const contract = await hre.ethers.getContractFactory(name); + const contract = await hre.getContractFactory(name); // Store the bytecode byteCodes[name] = contract.bytecode; diff --git a/scripts/util/diamond-utils.js b/scripts/util/diamond-utils.js index a27559b8a..a85765e84 100644 --- a/scripts/util/diamond-utils.js +++ b/scripts/util/diamond-utils.js @@ -4,9 +4,7 @@ const confirmations = hre.network.name === "hardhat" ? 1 : environments.confirma const FacetCutAction = require("../domain/FacetCutAction"); const { interfacesWithMultipleArtifacts } = require("./constants"); const { getFees } = require("./utils"); -const ethers = hre.ethers; -const keccak256 = ethers.utils.keccak256; -const toUtf8Bytes = ethers.utils.toUtf8Bytes; +const { keccak256, toUtf8Bytes } = hre.ethers;; /** * Utilities for testing and interacting with Diamond @@ -34,14 +32,14 @@ function getSelectors(contract, returnSignatureToNameMapping = false) { // get interface id async function getInterfaceId(contractName, skipBaseCheck = false, isFullPath = false) { - const contract = await ethers.getContractAt(contractName, ethers.constants.AddressZero); + const contract = await getContractAt(contractName, ZeroAddress); const signatures = Object.keys(contract.interface.functions); const selectors = signatures.reduce((acc, val) => { - acc.push(ethers.BigNumber.from(contract.interface.getSighash(val))); + acc.push(BigInt(contract.interface.getSighash(val))); return acc; }, []); - let interfaceId = selectors.reduce((pv, cv) => pv.xor(cv), ethers.BigNumber.from("0x00000000")); + let interfaceId = selectors.reduce((pv, cv) => pv.xor(cv), BigInt("0x00000000")); // If contract inherits other contracts, their interfaces must be xor-ed if (!skipBaseCheck) { @@ -63,7 +61,7 @@ async function getInterfaceId(contractName, skipBaseCheck = false, isFullPath = isFullPath = interfacesWithMultipleArtifacts.includes(baseName); - const baseContractInterfaceId = ethers.BigNumber.from( + const baseContractInterfaceId = BigNumber.from( await getInterfaceId( interfacesWithMultipleArtifacts.includes(baseName) ? `contracts/interfaces/${baseName}.sol:${baseName}` @@ -77,13 +75,13 @@ async function getInterfaceId(contractName, skipBaseCheck = false, isFullPath = interfaceId = interfaceId.xor(baseContractInterfaceId); } } - return interfaceId.isZero() ? "0x00000000" : ethers.utils.hexZeroPad(interfaceId.toHexString(), 4); + return interfaceId.isZero() ? "0x00000000" : hexZeroPad(interfaceId.toHexString(), 4); } // get function selector from function signature function getSelector(func) { - const abiInterface = new ethers.utils.Interface([func]); - return abiInterface.getSighash(ethers.utils.Fragment.from(func)); + const abiInterface = new Interface([func]); + return abiInterface.getSighash(Fragment.from(func)); } // used with getSelectors to remove selectors from an array of selectors @@ -122,7 +120,7 @@ function get(functionNames) { // remove selectors using an array of signatures function removeSelectors(selectors, signatures) { - const iface = new ethers.utils.Interface(signatures.map((v) => "function " + v)); + const iface = new Interface(signatures.map((v) => "function " + v)); const removeSelectors = signatures.map((v) => iface.getSighash(v)); selectors = selectors.filter((v) => !removeSelectors.includes(v)); return selectors; @@ -155,7 +153,7 @@ function getFacetRemoveCut(facet, omitFunctions = []) { async function getStateModifyingFunctions(facetNames, omitFunctions = [], onlyFunctions = []) { let stateModifyingFunctions = []; for (const facetName of facetNames) { - let FacetContractFactory = await ethers.getContractFactory(facetName); + let FacetContractFactory = await getContractFactory(facetName); const functions = FacetContractFactory.interface.functions; const functionNames = Object.keys(functions); const facetStateModifyingFunctions = functionNames.filter((fn) => { @@ -200,7 +198,7 @@ function getInitializeCalldata( interfacesToRemove = [], interfacesToAdd = [] ) { - version = ethers.utils.formatBytes32String(version); + version = formatBytes32String(version); const addresses = facetsToInitialize.map((f) => f.contract.address); const calldata = facetsToInitialize.map((f) => f.initialize); @@ -224,7 +222,7 @@ async function cutDiamond( initializeCalldata, facetsToRemove = [] ) { - const diamondCutFacet = await ethers.getContractAt("DiamondCutFacet", diamond); + const diamondCutFacet = await getContractAt("DiamondCutFacet", diamond); const cut = deployedFacets.reduce((acc, val) => { val.cut.forEach((c) => acc.push(c)); diff --git a/scripts/util/estimate-limits.js b/scripts/util/estimate-limits.js index e05a0e7b7..e2a745c61 100644 --- a/scripts/util/estimate-limits.js +++ b/scripts/util/estimate-limits.js @@ -85,16 +85,16 @@ setupEnvironment["maxAllowedSellers"] = async function (sellerCount = 10) { const voucherInitValues = mockVoucherInitValues(); for (let i = 0; i < sellerCount; i++) { - const wallet = ethers.Wallet.createRandom(); + const wallet = Wallet.createRandom(); //Random wallet has no provider. Connect wallet to ethers provider. The connected wallet will have no ETH - const connectedWallet = wallet.connect(ethers.provider); + const connectedWallet = wallet.connect(provider); //Fund the new wallet let tx = { to: connectedWallet.address, // Convert currency unit from ether to wei - value: ethers.utils.parseEther("1"), + value: parseEther("1"), }; await other1.sendTransaction(tx); @@ -144,7 +144,7 @@ setupEnvironment["maxFeesPerDisputeResolver"] = async function (feesCount = 10) //Create DisputeResolverFee array let disputeResolverFees = []; for (let i = 0; i < feesCount; i++) { - const wallet = ethers.Wallet.createRandom(); + const wallet = Wallet.createRandom(); disputeResolverFees.push(new DisputeResolverFee(wallet.address, `MockToken${i}`, "0")); } @@ -215,7 +215,7 @@ setupEnvironment["maxOffersPerBatch"] = async function (offerCount = 10) { const disputeResolver = mockDisputeResolver(dr1.address, dr1.address, dr1.address, dr1.address, true); await accountHandler .connect(dr1) - .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0")], []); + .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); const { offer, offerDates, offerDurations } = await mockOffer(); const offers = new Array(offerCount).fill(offer); @@ -244,7 +244,7 @@ setupEnvironment["maxOffersPerBatch"] = async function (offerCount = 10) { const arrayIndex_2 = 0; // extendOfferBatch - const newValidUntilDate = ethers.BigNumber.from(offerDates.validUntil).add("10000").toString(); + const newValidUntilDate = BigInt(offerDates.validUntil).add("10000").toString(); const args_3 = [offerIds.map((offerId) => 2 * offerId), newValidUntilDate]; const arrayIndex_3 = 0; @@ -299,7 +299,7 @@ setupEnvironment["maxOffersPerGroup"] = async function (offerCount = 10) { const disputeResolver = mockDisputeResolver(dr1.address, dr1.address, dr1.address, dr1.address, true); await accountHandler .connect(dr1) - .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0")], []); + .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); // Mock offer, offerDates and offerDurations const { offer, offerDates, offerDurations } = await mockOffer(); @@ -370,7 +370,7 @@ setupEnvironment["maxOffersPerBundle"] = async function (offerCount = 10) { const disputeResolver = mockDisputeResolver(dr1.address, dr1.address, dr1.address, dr1.address, true); await accountHandler .connect(dr1) - .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0")], []); + .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); // Mock offer, offerDates and offerDurations const { offer, offerDates, offerDurations } = await mockOffer(); @@ -385,7 +385,7 @@ setupEnvironment["maxOffersPerBundle"] = async function (offerCount = 10) { // Create a valid twin. const [bosonToken] = await deployMockTokens(); const twin = mockTwin(bosonToken.address); - twin.supplyAvailable = ethers.BigNumber.from(twin.amount).mul(offerCount); + twin.supplyAvailable = BigInt(twin.amount).mul(offerCount); // Approving the twinHandler contract to transfer seller's tokens await bosonToken.connect(sellerWallet1).approve(twinHandler.address, twin.supplyAvailable); // approving the twin handler @@ -430,7 +430,7 @@ setupEnvironment["maxTwinsPerBundle"] = async function (twinCount = 10) { const disputeResolver = mockDisputeResolver(dr1.address, dr1.address, dr1.address, dr1.address, true); await accountHandler .connect(dr1) - .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0")], []); + .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); for (let i = 0; i < twinCount; i++) { const [twinContract] = await deployMockTokens(["Foreign20"]); @@ -487,7 +487,7 @@ setupEnvironment["maxExchangesPerBatch"] = async function (exchangesCount = 10) const disputeResolver = mockDisputeResolver(dr1.address, dr1.address, dr1.address, dr1.address, true); await accountHandler .connect(dr1) - .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0")], []); + .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); // Create an offer with big enough quantity const { offer, offerDates, offerDurations } = await mockOffer(); @@ -496,10 +496,10 @@ setupEnvironment["maxExchangesPerBatch"] = async function (exchangesCount = 10) await offerHandler.connect(sellerWallet1).createOffer(offer, offerDates, offerDurations, disputeResolver.id, agentId); // Deposit seller funds so the commit will succeed - const sellerPool = ethers.BigNumber.from(offer.price).mul(exchangesCount); + const sellerPool = BigInt(offer.price).mul(exchangesCount); await fundsHandler .connect(sellerWallet1) - .depositFunds(seller1.id, ethers.constants.AddressZero, sellerPool, { value: sellerPool }); + .depositFunds(seller1.id, ZeroAddress, sellerPool, { value: sellerPool }); await setNextBlockTimestamp(Number(offerDates.voucherRedeemableFrom)); for (let i = 1; i < exchangesCount + 1; i++) { @@ -511,9 +511,9 @@ setupEnvironment["maxExchangesPerBatch"] = async function (exchangesCount = 10) } // Set time forward to run out the dispute period - const blockNumber = await ethers.provider.getBlockNumber(); - const block = await ethers.provider.getBlock(blockNumber); - const newTime = ethers.BigNumber.from(block.timestamp).add(offerDurations.disputePeriod).add(1).toNumber(); + const blockNumber = await provider.getBlockNumber(); + const block = await provider.getBlock(blockNumber); + const newTime = BigInt(block.timestamp).add(offerDurations.disputePeriod).add(1).toNumber(); await setNextBlockTimestamp(newTime); const exchangeIds = [...Array(exchangesCount + 1).keys()].slice(1); @@ -549,7 +549,7 @@ setupEnvironment["maxDisputesPerBatch"] = async function (exchangesCount = 10) { const disputeResolver = mockDisputeResolver(dr1.address, dr1.address, dr1.address, dr1.address, true); await accountHandler .connect(dr1) - .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0")], []); + .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); // Create an offer with big enough quantity const { offer, offerDates, offerDurations } = await mockOffer(); @@ -558,10 +558,10 @@ setupEnvironment["maxDisputesPerBatch"] = async function (exchangesCount = 10) { await offerHandler.connect(sellerWallet1).createOffer(offer, offerDates, offerDurations, disputeResolver.id, agentId); // Deposit seller funds so the commit will succeed - const sellerPool = ethers.BigNumber.from(offer.price).mul(exchangesCount); + const sellerPool = BigInt(offer.price).mul(exchangesCount); await fundsHandler .connect(sellerWallet1) - .depositFunds(seller1.id, ethers.constants.AddressZero, sellerPool, { value: sellerPool }); + .depositFunds(seller1.id, ZeroAddress, sellerPool, { value: sellerPool }); await setNextBlockTimestamp(Number(offerDates.voucherRedeemableFrom)); for (let i = 1; i < exchangesCount + 1; i++) { @@ -576,9 +576,9 @@ setupEnvironment["maxDisputesPerBatch"] = async function (exchangesCount = 10) { } // Set time forward to run out the dispute period - const blockNumber = await ethers.provider.getBlockNumber(); - const block = await ethers.provider.getBlock(blockNumber); - const newTime = ethers.BigNumber.from(block.timestamp).add(offerDurations.resolutionPeriod).add(1).toNumber(); + const blockNumber = await provider.getBlockNumber(); + const block = await provider.getBlock(blockNumber); + const newTime = BigInt(block.timestamp).add(offerDurations.resolutionPeriod).add(1).toNumber(); await setNextBlockTimestamp(newTime); const exchangeIds = [...Array(exchangesCount + 1).keys()].slice(1); @@ -615,7 +615,7 @@ setupEnvironment["maxTokensPerWithdrawal"] = async function (tokenCount = 10) { const disputeResolver = mockDisputeResolver(dr1.address, dr1.address, dr1.address, dr1.address, true); await accountHandler .connect(dr1) - .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0")], []); + .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); const { offer, offerDates, offerDurations } = await mockOffer(); offerDates.voucherRedeemableFrom = offerDates.validFrom; @@ -659,7 +659,7 @@ setupEnvironment["maxTokensPerWithdrawal"] = async function (tokenCount = 10) { // protocol fee withdrawal await accessController.grantRole(Role.FEE_COLLECTOR, feeCollector.address); - const protocolFee = ethers.BigNumber.from(offer.price).mul(protocolFeePercentage).div(10000); + const protocolFee = BigInt(offer.price).mul(protocolFeePercentage).div(10000); const tokenAmounts_2 = new Array(tokenCount).fill(protocolFee); const args_2 = [tokenAddresses, tokenAmounts_2]; const arrayIndex_2 = [0, 1]; @@ -693,15 +693,15 @@ setupEnvironment["maxPremintedVouchers"] = async function (tokenCount = 10) { const disputeResolver = mockDisputeResolver(dr1.address, dr1.address, dr1.address, dr1.address, true); await accountHandler .connect(dr1) - .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0")], []); + .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); // create the offer const { offer, offerDates, offerDurations } = await mockOffer(); - offer.quantityAvailable = ethers.constants.MaxUint256; + offer.quantityAvailable = constants.MaxUint256; await offerHandler.connect(sellerWallet1).createOffer(offer, offerDates, offerDurations, disputeResolver.id, agentId); // reserve range - let length = ethers.BigNumber.from(2).pow(128).sub(1); + let length = BigInt(2).pow(128).sub(1); await offerHandler.connect(sellerWallet1).reserveRange(offer.id, length); // update bosonVoucher address @@ -842,7 +842,7 @@ async function setupCommonEnvironment() { protocolAdmin, feeCollector, other1, - ] = await ethers.getSigners(); + ] = await getSigners(); // Deploy the Protocol Diamond [protocolDiamond, , , , accessController] = await deployProtocolDiamond(); @@ -866,7 +866,7 @@ async function setupCommonEnvironment() { // Set protocolFees protocolFeePercentage = "200"; // 2 % - protocolFeeFlatBoson = ethers.utils.parseUnits("0.01", "ether").toString(); + protocolFeeFlatBoson = parseUnits("0.01", "ether").toString(); buyerEscalationDepositPercentage = "1000"; // 10% // Add config Handler, so ids start at 1, and so voucher address can be found @@ -924,14 +924,14 @@ async function setupCommonEnvironment() { // Cut the protocol handler facets into the Diamond await deployAndCutFacets(protocolDiamond.address, facetsToDeploy, gasLimit); // Cast Diamond to handlers - accountHandler = await ethers.getContractAt("IBosonAccountHandler", protocolDiamond.address); - bundleHandler = await ethers.getContractAt("IBosonBundleHandler", protocolDiamond.address); - disputeHandler = await ethers.getContractAt("IBosonDisputeHandler", protocolDiamond.address); - exchangeHandler = await ethers.getContractAt("IBosonExchangeHandler", protocolDiamond.address); - fundsHandler = await ethers.getContractAt("IBosonFundsHandler", protocolDiamond.address); - groupHandler = await ethers.getContractAt("IBosonGroupHandler", protocolDiamond.address); - offerHandler = await ethers.getContractAt("IBosonOfferHandler", protocolDiamond.address); - twinHandler = await ethers.getContractAt("IBosonTwinHandler", protocolDiamond.address); + accountHandler = await getContractAt("IBosonAccountHandler", protocolDiamond.address); + bundleHandler = await getContractAt("IBosonBundleHandler", protocolDiamond.address); + disputeHandler = await getContractAt("IBosonDisputeHandler", protocolDiamond.address); + exchangeHandler = await getContractAt("IBosonExchangeHandler", protocolDiamond.address); + fundsHandler = await getContractAt("IBosonFundsHandler", protocolDiamond.address); + groupHandler = await getContractAt("IBosonGroupHandler", protocolDiamond.address); + offerHandler = await getContractAt("IBosonOfferHandler", protocolDiamond.address); + twinHandler = await getContractAt("IBosonTwinHandler", protocolDiamond.address); handlers = { IBosonAccountHandler: accountHandler, diff --git a/scripts/util/report-verify-deployments.js b/scripts/util/report-verify-deployments.js index 1c9b9448c..93e0f13ee 100644 --- a/scripts/util/report-verify-deployments.js +++ b/scripts/util/report-verify-deployments.js @@ -33,7 +33,7 @@ async function verifyOnTestEnv(contracts) { for (const contract of contracts) { console.log(`\n📋 Verifying on test env ${contract.name}`); try { - const code = await hre.ethers.provider.getCode(contract.address); + const code = await hre.provider.getCode(contract.address); if (code === "0x0" || code === "0x") { console.log(`❌ Failed to verify ${contract.name} on test env.`); } diff --git a/scripts/util/utils.js b/scripts/util/utils.js index fad8a280d..d22d2ef7e 100644 --- a/scripts/util/utils.js +++ b/scripts/util/utils.js @@ -21,7 +21,7 @@ async function writeContracts(contracts, env, version) { fs.mkdirSync(addressesDirPath); } - const chainId = (await hre.ethers.provider.getNetwork()).chainId; + const chainId = (await hre.provider.getNetwork()).chainId; const network = hre.network.name; const path = getAddressesFilePath(chainId, network, env); fs.writeFileSync( @@ -52,7 +52,7 @@ async function getBaseFee() { // getBlock("pending") doesn't work with hardhat. This is the value one gets by calling getBlock("0") return "1000000000"; } - const { baseFeePerGas } = await ethers.provider.getBlock("pending"); + const { baseFeePerGas } = await provider.getBlock("pending"); return baseFeePerGas; } @@ -61,10 +61,10 @@ async function getMaxFeePerGas(maxPriorityFeePerGas) { } async function getFees() { - // maxPriorityFeePerGas TODO add back as an argument when ethers.js supports 1559 on polygon - const { gasPrice } = await ethers.provider.getFeeData(); - const newGasPrice = gasPrice.mul(ethers.BigNumber.from("2")); - // return { maxPriorityFeePerGas, maxFeePerGas: await getMaxFeePerGas(maxPriorityFeePerGas) }; // TODO use when ethers.js supports 1559 on polygon + // maxPriorityFeePerGas TODO add back as an argument when js supports 1559 on polygon + const { gasPrice } = await provider.getFeeData(); + const newGasPrice = gasPrice.mul(BigInt("2")); + // return { maxPriorityFeePerGas, maxFeePerGas: await getMaxFeePerGas(maxPriorityFeePerGas) }; // TODO use when js supports 1559 on polygon return { gasPrice: newGasPrice }; } @@ -77,7 +77,7 @@ async function checkRole(contracts, role, address) { } // Get AccessController abstraction - const accessController = await ethers.getContractAt("AccessController", accessControllerAddress); + const accessController = await getContractAt("AccessController", accessControllerAddress); // Check that caller has upgrader role. const hasRole = await accessController.hasRole(role, address); diff --git a/test/access/AccessControllerTest.js b/test/access/AccessControllerTest.js index 3bc2fe409..5a3931630 100644 --- a/test/access/AccessControllerTest.js +++ b/test/access/AccessControllerTest.js @@ -21,10 +21,10 @@ describe("AccessController", function () { beforeEach(async function () { // Make accounts available - [deployer, admin, protocol, upgrader, associate, pauser, client, feeCollector, rando] = await ethers.getSigners(); + [deployer, admin, protocol, upgrader, associate, pauser, client, feeCollector, rando] = await getSigners(); // Deploy the contract - AccessController = await ethers.getContractFactory("AccessController"); + AccessController = await getContractFactory("AccessController"); accessController = await AccessController.deploy(); await accessController.deployed(); }); @@ -77,7 +77,7 @@ describe("AccessController", function () { it("Deployer should not have any un managed value as role", async function () { // Random unknown role - let role = ethers.utils.keccak256(ethers.utils.toUtf8Bytes("random")); + let role = keccak256(toUtf8Bytes("random")); // Check role expect(await accessController.hasRole(role, deployer.address), "Deployer has a random role").is.false; diff --git a/test/domain/AgentTest.js b/test/domain/AgentTest.js index 195ea2385..fd4743c5d 100644 --- a/test/domain/AgentTest.js +++ b/test/domain/AgentTest.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getSigners } = hre.ethers; const { expect } = require("chai"); const Agent = require("../../scripts/domain/Agent"); @@ -14,7 +14,7 @@ describe("Agent", function () { context("📋 Constructor", async function () { beforeEach(async function () { // Get a list of accounts - accounts = await ethers.getSigners(); + accounts = await getSigners(); wallet = accounts[1].address; // Required constructor params @@ -39,7 +39,7 @@ describe("Agent", function () { context("📋 Field validations", async function () { beforeEach(async function () { // Get a list of accounts - accounts = await ethers.getSigners(); + accounts = await getSigners(); wallet = accounts[1].address; // Required constructor params @@ -159,7 +159,7 @@ describe("Agent", function () { context("📋 Utility functions", async function () { beforeEach(async function () { // Get a list of accounts - accounts = await ethers.getSigners(); + accounts = await getSigners(); wallet = accounts[1].address; // Required constructor params diff --git a/test/domain/BuyerTest.js b/test/domain/BuyerTest.js index fea4d63a9..97f15110b 100644 --- a/test/domain/BuyerTest.js +++ b/test/domain/BuyerTest.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getSigners }= hre.ethers; const { expect } = require("chai"); const Buyer = require("../../scripts/domain/Buyer"); @@ -14,7 +14,7 @@ describe("Buyer", function () { context("📋 Constructor", async function () { beforeEach(async function () { // Get a list of accounts - accounts = await ethers.getSigners(); + accounts = await getSigners(); wallet = accounts[1].address; // Required constructor params diff --git a/test/domain/ConditionTest.js b/test/domain/ConditionTest.js index 9f894086f..608fca87d 100644 --- a/test/domain/ConditionTest.js +++ b/test/domain/ConditionTest.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getSigners } = hre.ethers; const { expect } = require("chai"); const Condition = require("../../scripts/domain/Condition"); const EvaluationMethod = require("../../scripts/domain/EvaluationMethod"); @@ -16,7 +16,7 @@ describe("Condition", function () { context("📋 Constructor", async function () { beforeEach(async function () { // Get a list of accounts - accounts = await ethers.getSigners(); + accounts = await getSigners(); tokenAddress = accounts[1].address; // Required constructor params diff --git a/test/domain/DisputeResolverFeeTest.js b/test/domain/DisputeResolverFeeTest.js index a00df624c..98156a7b9 100644 --- a/test/domain/DisputeResolverFeeTest.js +++ b/test/domain/DisputeResolverFeeTest.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getSigners } = hre.ethers; const { expect } = require("chai"); const { DisputeResolverFee, DisputeResolverFeeList } = require("../../scripts/domain/DisputeResolverFee"); @@ -13,7 +13,7 @@ describe("DisputeResolverFee", function () { beforeEach(async function () { // Get a list of accounts - accounts = await ethers.getSigners(); + accounts = await getSigners(); tokenAddress = accounts[1].address; // Required constructor params @@ -218,7 +218,7 @@ describe("DisputeResolverFeeList", function () { beforeEach(async function () { // Get a list of accounts - accounts = await ethers.getSigners(); + accounts = await getSigners(); // Required constructor params disputeResolverFees = [ diff --git a/test/domain/DisputeResolverTest.js b/test/domain/DisputeResolverTest.js index e0441abf5..c4dcdc359 100644 --- a/test/domain/DisputeResolverTest.js +++ b/test/domain/DisputeResolverTest.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getSigners } = hre.ethers; const { expect } = require("chai"); const DisputeResolver = require("../../scripts/domain/DisputeResolver"); const { oneMonth } = require("../util/constants"); @@ -14,7 +14,7 @@ describe("DisputeResolver", function () { beforeEach(async function () { // Get a list of accounts - accounts = await ethers.getSigners(); + accounts = await getSigners(); assistant = accounts[0].address; admin = accounts[1].address; clerk = accounts[2].address; diff --git a/test/domain/FundsTest.js b/test/domain/FundsTest.js index e4adcc825..2d9feed40 100644 --- a/test/domain/FundsTest.js +++ b/test/domain/FundsTest.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getSigners } = hre.ethers; const { expect } = require("chai"); const { Funds, FundsList } = require("../../scripts/domain/Funds"); @@ -13,7 +13,7 @@ describe("Funds", function () { beforeEach(async function () { // Get a list of accounts - accounts = await ethers.getSigners(); + accounts = await getSigners(); tokenAddress = accounts[1].address; // Required constructor params @@ -208,7 +208,7 @@ describe("FundsList", function () { beforeEach(async function () { // Get a list of accounts - accounts = await ethers.getSigners(); + accounts = await getSigners(); // Required constructor params funds = [ diff --git a/test/domain/OfferDatesTest.js b/test/domain/OfferDatesTest.js index 4959cbfd5..ee38edca0 100644 --- a/test/domain/OfferDatesTest.js +++ b/test/domain/OfferDatesTest.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getSigners } = hre.ethers; const { expect } = require("chai"); const OfferDates = require("../../scripts/domain/OfferDates"); const { oneWeek, oneMonth } = require("../util/constants"); diff --git a/test/domain/OfferTest.js b/test/domain/OfferTest.js index d5e4c3064..aeb588d42 100644 --- a/test/domain/OfferTest.js +++ b/test/domain/OfferTest.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getSigners, parseUnits, ZeroAddress } = hre.ethers; const { expect } = require("chai"); const Offer = require("../../scripts/domain/Offer"); @@ -23,15 +23,15 @@ describe("Offer", function () { beforeEach(async function () { // Get a list of accounts - accounts = await ethers.getSigners(); + accounts = await getSigners(); // Required constructor params id = sellerId = "0"; - price = ethers.utils.parseUnits("1.5", "ether").toString(); - sellerDeposit = ethers.utils.parseUnits("0.25", "ether").toString(); - buyerCancelPenalty = ethers.utils.parseUnits("0.05", "ether").toString(); + price = parseUnits("1.5", "ether").toString(); + sellerDeposit = parseUnits("0.25", "ether").toString(); + buyerCancelPenalty = parseUnits("0.05", "ether").toString(); quantityAvailable = "1"; - exchangeToken = ethers.constants.AddressZero.toString(); // Zero addy ~ chain base currency + exchangeToken = ZeroAddress.toString(); // Zero addy ~ chain base currency metadataHash = "QmYXc12ov6F2MZVZwPs5XeCBbf61cW3wKRk8h3D5NTYj4T"; // not an actual metadataHash, just some data for tests metadataUri = `https://ipfs.io/ipfs/${metadataHash}`; voided = false; diff --git a/test/domain/ReceiptTest.js b/test/domain/ReceiptTest.js index 16eefd401..6b1fe5319 100644 --- a/test/domain/ReceiptTest.js +++ b/test/domain/ReceiptTest.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getSigners } = hre.ethers; const { expect } = require("chai"); const Receipt = require("../../scripts/domain/Receipt.js"); const { mockReceipt, mockOffer, mockTwinReceipt, mockCondition } = require("../util/mock"); @@ -14,7 +14,7 @@ describe("Receipt", function () { beforeEach(async function () { // Get a list of accounts - accounts = await ethers.getSigners(); + accounts = await getSigners(); }); context("📋 Constructor", async function () { @@ -339,7 +339,7 @@ describe("Receipt", function () { expect(receipt.isValid()).is.false; // Valid field value - receipt.condition = mockCondition(ethers.constants.AddressZero); + receipt.condition = mockCondition(ZeroAddress); expect(receipt.conditionIsValid()).is.true; expect(receipt.isValid()).is.true; }); @@ -545,7 +545,7 @@ describe("Receipt", function () { expect(receipt.isValid()).is.false; // Valid field value - receipt.twinReceipts = [mockTwinReceipt(ethers.constants.AddressZero)]; + receipt.twinReceipts = [mockTwinReceipt(ZeroAddress)]; expect(receipt.twinReceiptsIsValid()).is.true; expect(receipt.isValid()).is.true; }); diff --git a/test/domain/SellerTest.js b/test/domain/SellerTest.js index 0e21c3492..763240319 100644 --- a/test/domain/SellerTest.js +++ b/test/domain/SellerTest.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getSigners, ZeroAddress } = hre.ethers; const { expect } = require("chai"); const Seller = require("../../scripts/domain/Seller"); @@ -13,10 +13,10 @@ describe("Seller", function () { beforeEach(async function () { // Get a list of accounts - accounts = await ethers.getSigners(); + accounts = await getSigners(); assistant = accounts[0].address; admin = accounts[1].address; - clerk = ethers.constants.AddressZero; + clerk = ZeroAddress; treasury = accounts[3].address; // Required constructor params diff --git a/test/domain/TwinReceiptTest.js b/test/domain/TwinReceiptTest.js index a5ad9cc51..a9a3b9af4 100644 --- a/test/domain/TwinReceiptTest.js +++ b/test/domain/TwinReceiptTest.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getSigners } = hre.ethers; const { expect } = require("chai"); const TwinReceipt = require("../../scripts/domain/TwinReceipt.js"); const TokenType = require("../../scripts/domain/TokenType.js"); @@ -15,7 +15,7 @@ describe("TwinReceipt", function () { beforeEach(async function () { // Get a list of accounts - const accounts = await ethers.getSigners(); + const accounts = await getSigners(); tokenAddress = accounts[0].address; }); diff --git a/test/domain/TwinTest.js b/test/domain/TwinTest.js index d3607653a..9710133cd 100644 --- a/test/domain/TwinTest.js +++ b/test/domain/TwinTest.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getSigners } = hre.ethers; const { expect } = require("chai"); const Twin = require("../../scripts/domain/Twin.js"); const TokenType = require("../../scripts/domain/TokenType.js"); @@ -15,7 +15,7 @@ describe("Twin", function () { beforeEach(async function () { // Get a list of accounts - const accounts = await ethers.getSigners(); + const accounts = await getSigners(); tokenAddress = accounts[0].address; }); diff --git a/test/example/SnapshotGateTest.js b/test/example/SnapshotGateTest.js index 970f7bed8..58a06185d 100644 --- a/test/example/SnapshotGateTest.js +++ b/test/example/SnapshotGateTest.js @@ -80,12 +80,12 @@ describe("SnapshotGate", function () { holder3, holder4, holder5, - ] = await ethers.getSigners(); + ] = await getSigners(); // make all account the same assistant = admin; assistantDR = adminDR; - clerk = clerkDR = { address: ethers.constants.AddressZero }; + clerk = clerkDR = { address: ZeroAddress }; // Deploy the Protocol Diamond [protocolDiamond, , , , accessController] = await deployProtocolDiamond(maxPriorityFeePerGas); @@ -107,7 +107,7 @@ describe("SnapshotGate", function () { // Set protocolFees protocolFeePercentage = "200"; // 2 % - protocolFeeFlatBoson = ethers.utils.parseUnits("0.01", "ether").toString(); + protocolFeeFlatBoson = parseUnits("0.01", "ether").toString(); buyerEscalationDepositPercentage = "1000"; // 10% // Add config Handler, so ids start at 1, and so voucher address can be found @@ -162,16 +162,16 @@ describe("SnapshotGate", function () { await deployAndCutFacets(protocolDiamond.address, facetsToDeploy, maxPriorityFeePerGas); // Cast Diamond to IBosonAccountHandler. Use this interface to call all individual account handlers - accountHandler = await ethers.getContractAt("IBosonAccountHandler", protocolDiamond.address); + accountHandler = await getContractAt("IBosonAccountHandler", protocolDiamond.address); // Cast Diamond to IBosonOfferHandler - offerHandler = await ethers.getContractAt("IBosonOfferHandler", protocolDiamond.address); + offerHandler = await getContractAt("IBosonOfferHandler", protocolDiamond.address); // Cast Diamond to IGroupHandler - groupHandler = await ethers.getContractAt("IBosonGroupHandler", protocolDiamond.address); + groupHandler = await getContractAt("IBosonGroupHandler", protocolDiamond.address); // Cast Diamond to IBosonExchangeHandler - exchangeHandler = await ethers.getContractAt("IBosonExchangeHandler", protocolDiamond.address); + exchangeHandler = await getContractAt("IBosonExchangeHandler", protocolDiamond.address); // Deploy the SnapshotGate example sellerId = "1"; @@ -190,7 +190,7 @@ describe("SnapshotGate", function () { expect(seller.isValid()).is.true; // Create a second seller - seller2 = mockSeller(assistant2.address, assistant2.address, ethers.constants.AddressZero, assistant2.address); + seller2 = mockSeller(assistant2.address, assistant2.address, ZeroAddress, assistant2.address); expect(seller2.isValid()).is.true; // AuthToken @@ -219,7 +219,7 @@ describe("SnapshotGate", function () { // Create DisputeResolverFee array so offer creation will succeed disputeResolverFees = [ - new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0"), + new DisputeResolverFee(ZeroAddress, "Native", "0"), new DisputeResolverFee(foreign20.address, "Foriegn20", "0"), ]; @@ -732,7 +732,7 @@ describe("SnapshotGate", function () { let holder = holderByAddress[entry.owner]; // Wrong price - const halfPrice = ethers.BigNumber.from(price).div(ethers.BigNumber.from(2)).toString(); + const halfPrice = BigInt(price)/BigInt(2).toString(); // Commit to the offer await expect( diff --git a/test/integration/01-update-account-roles-addresses.js b/test/integration/01-update-account-roles-addresses.js index 35087d4ae..e6e651047 100644 --- a/test/integration/01-update-account-roles-addresses.js +++ b/test/integration/01-update-account-roles-addresses.js @@ -56,7 +56,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { // make all account the same assistant = admin; assistantDR = adminDR; - clerk = clerkDR = { address: ethers.constants.AddressZero }; + clerk = clerkDR = { address: ZeroAddress }; // Get snapshot id snapshotId = await getSnapshot(); @@ -100,7 +100,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { //Create DisputeResolverFee array so offer creation will succeed disputeResolverFeeNative = "0"; const disputeResolverFees = [ - new DisputeResolverFee(ethers.constants.AddressZero, "Native", disputeResolverFeeNative), + new DisputeResolverFee(ZeroAddress, "Native", disputeResolverFeeNative), ]; // Make empty seller list, so every seller is allowed @@ -135,7 +135,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { // Deposit seller funds so the commit will succeed await fundsHandler .connect(assistant) - .depositFunds(seller.id, ethers.constants.AddressZero, offer.sellerDeposit, { value: offer.sellerDeposit }); + .depositFunds(seller.id, ZeroAddress, offer.sellerDeposit, { value: offer.sellerDeposit }); // Create a buyer account buyerAccount = mockBuyer(buyer.address); @@ -152,7 +152,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { exchangeId = "1"; - const addressZero = ethers.constants.AddressZero; + const addressZero = ZeroAddress; sellerPendingUpdate = mockSeller(addressZero, addressZero, addressZero, addressZero); sellerPendingUpdate.id = "0"; sellerPendingUpdate.active = false; @@ -173,7 +173,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { .to.emit(accountHandler, "SellerUpdatePending") .withArgs(seller.id, sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), admin.address); - sellerPendingUpdate.assistant = ethers.constants.AddressZero; + sellerPendingUpdate.assistant = ZeroAddress; // Approve the update await expect(accountHandler.connect(rando).optInToSellerUpdate(seller.id, [SellerUpdateFields.Assistant])) @@ -203,7 +203,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { .to.emit(accountHandler, "SellerUpdatePending") .withArgs(seller.id, sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), admin.address); - sellerPendingUpdate.assistant = ethers.constants.AddressZero; + sellerPendingUpdate.assistant = ZeroAddress; // Approve the update await expect(accountHandler.connect(rando).optInToSellerUpdate(seller.id, [SellerUpdateFields.Assistant])) @@ -231,9 +231,9 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { await exchangeHandler.connect(buyer).cancelVoucher(exchangeId); // Expected buyer payoff: price - buyerCancelPenalty - buyerPayoff = ethers.BigNumber.from(offer.price).sub(offer.buyerCancelPenalty).toString(); + buyerPayoff = BigInt(offer.price)-offer.buyerCancelPenalty.toString(); // Expected seller payoff: sellerDeposit + buyerCancelPenalty - sellerPayoff = ethers.BigNumber.from(offer.sellerDeposit).add(offer.buyerCancelPenalty).toString(); + sellerPayoff = BigInt(offer.sellerDeposit)+offer.buyerCancelPenalty.toString(); }); it("Buyer should be able to withdraw funds after updating wallet address", async function () { @@ -247,15 +247,15 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { // Attempt to withdraw funds with old buyer wallet, should fail await expect( - fundsHandler.connect(buyer).withdrawFunds(buyerAccount.id, [ethers.constants.AddressZero], [buyerPayoff]) + fundsHandler.connect(buyer).withdrawFunds(buyerAccount.id, [ZeroAddress], [buyerPayoff]) ).to.revertedWith(RevertReasons.NOT_AUTHORIZED); // Attempt to withdraw funds with new buyer wallet, should succeed await expect( - fundsHandler.connect(rando).withdrawFunds(buyerAccount.id, [ethers.constants.AddressZero], [buyerPayoff]) + fundsHandler.connect(rando).withdrawFunds(buyerAccount.id, [ZeroAddress], [buyerPayoff]) ) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(buyerAccount.id, rando.address, ethers.constants.AddressZero, buyerPayoff, rando.address); + .withArgs(buyerAccount.id, rando.address, ZeroAddress, buyerPayoff, rando.address); }); it("Seller should be able to withdraw funds after updating assistant address", async function () { @@ -268,7 +268,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { .to.emit(accountHandler, "SellerUpdatePending") .withArgs(seller.id, sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), admin.address); - sellerPendingUpdate.assistant = ethers.constants.AddressZero; + sellerPendingUpdate.assistant = ZeroAddress; // Approve the update await expect(accountHandler.connect(rando).optInToSellerUpdate(seller.id, [SellerUpdateFields.Assistant])) @@ -284,15 +284,15 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { // Attempt to withdraw funds with old seller assistant, should fail await expect( - fundsHandler.connect(assistant).withdrawFunds(seller.id, [ethers.constants.AddressZero], [sellerPayoff]) + fundsHandler.connect(assistant).withdrawFunds(seller.id, [ZeroAddress], [sellerPayoff]) ).to.revertedWith(RevertReasons.NOT_AUTHORIZED); // Attempt to withdraw funds with new seller assistant, should succeed await expect( - fundsHandler.connect(rando).withdrawFunds(seller.id, [ethers.constants.AddressZero], [sellerPayoff]) + fundsHandler.connect(rando).withdrawFunds(seller.id, [ZeroAddress], [sellerPayoff]) ) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(seller.id, treasury.address, ethers.constants.AddressZero, sellerPayoff, rando.address); + .withArgs(seller.id, treasury.address, ZeroAddress, sellerPayoff, rando.address); }); }); @@ -300,8 +300,8 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { beforeEach(async function () { // Redeem the voucher so that buyer can update the wallet const tx = await exchangeHandler.connect(buyer).redeemVoucher(exchangeId); - const block = await ethers.provider.getBlock(tx.blockNumber); - redeemedDate = ethers.BigNumber.from(block.timestamp); + const block = await provider.getBlock(tx.blockNumber); + redeemedDate = BigInt(block.timestamp); }); it("Agent should be able to withdraw funds after updating wallet address", async function () { @@ -320,15 +320,15 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { // Attempt to withdraw funds with old agent wallet, should fail await expect( - fundsHandler.connect(agent).withdrawFunds(agentAccount.id, [ethers.constants.AddressZero], [agentPayoff]) + fundsHandler.connect(agent).withdrawFunds(agentAccount.id, [ZeroAddress], [agentPayoff]) ).to.revertedWith(RevertReasons.NOT_AUTHORIZED); // Attempt to withdraw funds with new agent wallet, should fail await expect( - fundsHandler.connect(rando).withdrawFunds(agentAccount.id, [ethers.constants.AddressZero], [agentPayoff]) + fundsHandler.connect(rando).withdrawFunds(agentAccount.id, [ZeroAddress], [agentPayoff]) ) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(agentAccount.id, rando.address, ethers.constants.AddressZero, agentPayoff, rando.address); + .withArgs(agentAccount.id, rando.address, ZeroAddress, agentPayoff, rando.address); }); it("Buyer should be able to raise dispute after updating wallet address", async function () { @@ -366,8 +366,8 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { .to.emit(exchangeHandler, "ExchangeCompleted") .withArgs(offer.id, buyerAccount.id, exchangeId, rando.address); - const block = await ethers.provider.getBlock(tx.blockNumber); - const disputePeriodEnd = redeemedDate.add(ethers.BigNumber.from(offerDurations.disputePeriod)); + const block = await provider.getBlock(tx.blockNumber); + const disputePeriodEnd = redeemedDate+BigInt(offerDurations.disputePeriod); // Expect the dispute period to not be over expect(block.timestamp).to.be.at.most(disputePeriodEnd); @@ -407,7 +407,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { .to.emit(accountHandler, "SellerUpdatePending") .withArgs(seller.id, sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), admin.address); - sellerPendingUpdate.assistant = ethers.constants.AddressZero; + sellerPendingUpdate.assistant = ZeroAddress; // Approve the update await expect(accountHandler.connect(rando).optInToSellerUpdate(seller.id, [SellerUpdateFields.Assistant])) @@ -504,7 +504,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { .to.emit(accountHandler, "SellerUpdatePending") .withArgs(seller.id, sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), admin.address); - sellerPendingUpdate.assistant = ethers.constants.AddressZero; + sellerPendingUpdate.assistant = ZeroAddress; // Approve the update await expect(accountHandler.connect(rando).optInToSellerUpdate(seller.id, [SellerUpdateFields.Assistant])) diff --git a/test/integration/02-Upgraded-facet.js b/test/integration/02-Upgraded-facet.js index 3f887cb56..a76f5dd29 100644 --- a/test/integration/02-Upgraded-facet.js +++ b/test/integration/02-Upgraded-facet.js @@ -72,8 +72,8 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // make all account the same assistant = admin; assistantDR = adminDR; - clerk = clerkDR = { address: ethers.constants.AddressZero }; - [deployer] = await ethers.getSigners(); + clerk = clerkDR = { address: ZeroAddress }; + [deployer] = await getSigners(); // Initial ids for all the things exchangeId = offerId = "1"; @@ -115,10 +115,10 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation async function upgradeExchangeHandlerFacet(mockFacet) { // Upgrade the Exchange Handler Facet functions // DiamondCutFacet - const cutFacetViaDiamond = await ethers.getContractAt("DiamondCutFacet", protocolDiamondAddress); + const cutFacetViaDiamond = await getContractAt("DiamondCutFacet", protocolDiamondAddress); // Deploy MockExchangeHandlerFacet - const MockExchangeHandlerFacet = await ethers.getContractFactory(mockFacet); + const MockExchangeHandlerFacet = await getContractFactory(mockFacet); const mockExchangeHandlerFacet = await MockExchangeHandlerFacet.deploy(); await mockExchangeHandlerFacet.deployed(); @@ -132,7 +132,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation ]; // Send the DiamondCut transaction - const tx = await cutFacetViaDiamond.connect(deployer).diamondCut(facetCuts, ethers.constants.AddressZero, "0x"); + const tx = await cutFacetViaDiamond.connect(deployer).diamondCut(facetCuts, ZeroAddress, "0x"); // Wait for transaction to confirm const receipt = await tx.wait(); @@ -141,7 +141,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation assert.equal(receipt.status, 1, `Diamond upgrade failed: ${tx.hash}`); // Cast Diamond to the mock exchange handler facet. - mockExchangeHandlerUpgrade = await ethers.getContractAt(mockFacet, protocolDiamondAddress); + mockExchangeHandlerUpgrade = await getContractAt(mockFacet, protocolDiamondAddress); } // Exchange methods @@ -158,7 +158,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation expect(disputeResolver.isValid()).is.true; //Create DisputeResolverFee array so offer creation will succeed - const disputeResolverFees = [new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0")]; + const disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", "0")]; // Make empty seller list, so every seller is allowed const sellerAllowList = []; @@ -187,7 +187,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation price = offer.price; voucherRedeemableFrom = offerDates.voucherRedeemableFrom; voucherValid = offerDurations.voucherValid; - sellerPool = ethers.utils.parseUnits("15", "ether").toString(); + sellerPool = parseUnits("15", "ether").toString(); // Required voucher constructor params voucher = mockVoucher(); @@ -203,7 +203,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Deposit seller funds so the commit will succeed await fundsHandler .connect(assistant) - .depositFunds(seller.id, ethers.constants.AddressZero, sellerPool, { value: sellerPool }); + .depositFunds(seller.id, ZeroAddress, sellerPool, { value: sellerPool }); }); afterEach(async function () { @@ -351,7 +351,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Get the block timestamp of the confirmed tx const blockNumber = tx.blockNumber; - const block = await ethers.provider.getBlock(blockNumber); + const block = await provider.getBlock(blockNumber); // Update the committed date in the expected exchange struct with the block timestamp of the tx voucher.committedDate = block.timestamp.toString(); @@ -360,7 +360,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation voucher.validUntilDate = calculateVoucherExpiry(block, voucherRedeemableFrom, voucherValid); // New expiry date for extensions - const validUntilDate = ethers.BigNumber.from(voucher.validUntilDate).add(oneMonth).toString(); + const validUntilDate = BigInt(voucher.validUntilDate)+oneMonth.toString(); // Upgrade Exchange handler facet await upgradeExchangeHandlerFacet("MockExchangeHandlerFacet"); @@ -388,7 +388,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation //Create DisputeResolverFee array so offer creation will succeed const DRFeeNative = "0"; - const disputeResolverFees = [new DisputeResolverFee(ethers.constants.AddressZero, "Native", DRFeeNative)]; + const disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", DRFeeNative)]; // Make empty seller list, so every seller is allowed const sellerAllowList = []; @@ -422,10 +422,10 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation escalationPeriod = disputeResolver.escalationResponsePeriod; // Deposit seller funds so the commit will succeed - const fundsToDeposit = ethers.BigNumber.from(sellerDeposit).mul(quantityAvailable); + const fundsToDeposit = BigInt(sellerDeposit)*quantityAvailable; await fundsHandler .connect(assistant) - .depositFunds(seller.id, ethers.constants.AddressZero, fundsToDeposit, { value: fundsToDeposit }); + .depositFunds(seller.id, ZeroAddress, fundsToDeposit, { value: fundsToDeposit }); buyerId = accountId.next().value; }); @@ -483,12 +483,12 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Get the block timestamp of the confirmed tx and set disputedDate const blockNumber = tx.blockNumber; - const block = await ethers.provider.getBlock(blockNumber); + const block = await provider.getBlock(blockNumber); const disputedDate = block.timestamp.toString(); - const timeout = ethers.BigNumber.from(disputedDate).add(resolutionPeriod).toString(); + const timeout = BigInt(disputedDate)+resolutionPeriod.toString(); // extend timeout for a month - const newDisputeTimeout = ethers.BigNumber.from(timeout).add(oneMonth).toString(); + const newDisputeTimeout = BigInt(timeout)+oneMonth.toString(); // Extend the dispute timeout, testing for the event await expect(disputeHandler.connect(assistant).extendDisputeTimeout(exchangeId, newDisputeTimeout)) @@ -504,9 +504,9 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Get the block timestamp of the confirmed tx and set disputedDate const blockNumber = tx.blockNumber; - const block = await ethers.provider.getBlock(blockNumber); + const block = await provider.getBlock(blockNumber); const disputedDate = block.timestamp.toString(); - const timeout = ethers.BigNumber.from(disputedDate).add(resolutionPeriod).toString(); + const timeout = BigInt(disputedDate)+resolutionPeriod.toString(); // Set time forward past the dispute resolution period await setNextBlockTimestamp(Number(timeout) + Number(oneWeek)); @@ -622,7 +622,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Get the block timestamp of the confirmed tx and set escalatedDate const blockNumber = tx.blockNumber; - const block = await ethers.provider.getBlock(blockNumber); + const block = await provider.getBlock(blockNumber); const escalatedDate = block.timestamp.toString(); // Set time forward past the dispute escalation period @@ -676,7 +676,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation //Create DisputeResolverFee array so offer creation will succeed const disputeResolverFees = [ - new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0"), + new DisputeResolverFee(ZeroAddress, "Native", "0"), new DisputeResolverFee(mockToken.address, "mockToken", "0"), ]; @@ -735,7 +735,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, sellerDeposit), fundsHandler .connect(assistant) - .depositFunds(seller.id, ethers.constants.AddressZero, sellerDeposit, { value: sellerDeposit }), + .depositFunds(seller.id, ZeroAddress, sellerDeposit, { value: sellerDeposit }), ]); // commit to both offers @@ -761,21 +761,21 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // expected payoffs - they are the same for token and native currency // buyer: price - buyerCancelPenalty - const buyerPayoff = ethers.BigNumber.from(offerToken.price).sub(offerToken.buyerCancelPenalty).toString(); + const buyerPayoff = BigInt(offerToken.price)-offerToken.buyerCancelPenalty.toString(); // seller: sellerDeposit + buyerCancelPenalty - const sellerPayoff = ethers.BigNumber.from(offerToken.sellerDeposit) - .add(offerToken.buyerCancelPenalty) + const sellerPayoff = BigInt(offerToken.sellerDeposit) + +offerToken.buyerCancelPenalty .toString(); // Withdraw funds, testing for the event // Withdraw tokens - const tokenListSeller = [mockToken.address, ethers.constants.AddressZero]; - const tokenListBuyer = [ethers.constants.AddressZero, mockToken.address]; + const tokenListSeller = [mockToken.address, ZeroAddress]; + const tokenListBuyer = [ZeroAddress, mockToken.address]; // Withdraw amounts - const tokenAmountsSeller = [sellerPayoff, ethers.BigNumber.from(sellerPayoff).div("2").toString()]; - const tokenAmountsBuyer = [buyerPayoff, ethers.BigNumber.from(buyerPayoff).div("5").toString()]; + const tokenAmountsSeller = [sellerPayoff, BigInt(sellerPayoff)/"2".toString()]; + const tokenAmountsBuyer = [buyerPayoff, BigInt(buyerPayoff)/"5".toString()]; // seller withdrawal const tx = await fundsHandler @@ -790,8 +790,8 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation .withArgs( seller.id, treasury.address, - ethers.constants.Zero, - ethers.BigNumber.from(sellerPayoff).div("2"), + constants.Zero, + BigInt(sellerPayoff)/"2", assistant.address ); @@ -803,13 +803,13 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation buyerId, buyer.address, mockToken.address, - ethers.BigNumber.from(buyerPayoff).div("5"), + BigInt(buyerPayoff)/"5", buyer.address ); await expect(tx2) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(buyerId, buyer.address, ethers.constants.Zero, buyerPayoff, buyer.address); + .withArgs(buyerId, buyer.address, constants.Zero, buyerPayoff, buyer.address); }); }); @@ -823,21 +823,21 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // expected payoffs - they are the same for token and native currency // buyer: price - buyerCancelPenalty - const buyerPayoff = ethers.BigNumber.from(offerToken.price).sub(offerToken.buyerCancelPenalty).toString(); + const buyerPayoff = BigInt(offerToken.price)-offerToken.buyerCancelPenalty.toString(); // seller: sellerDeposit + buyerCancelPenalty - const sellerPayoff = ethers.BigNumber.from(offerToken.sellerDeposit) - .add(offerToken.buyerCancelPenalty) + const sellerPayoff = BigInt(offerToken.sellerDeposit) + +offerToken.buyerCancelPenalty .toString(); // Withdraw funds, testing for the event // Withdraw tokens - const tokenListSeller = [mockToken.address, ethers.constants.AddressZero]; - const tokenListBuyer = [ethers.constants.AddressZero, mockToken.address]; + const tokenListSeller = [mockToken.address, ZeroAddress]; + const tokenListBuyer = [ZeroAddress, mockToken.address]; // Withdraw amounts - const tokenAmountsSeller = [sellerPayoff, ethers.BigNumber.from(sellerPayoff).div("2").toString()]; - const tokenAmountsBuyer = [buyerPayoff, ethers.BigNumber.from(buyerPayoff).div("5").toString()]; + const tokenAmountsSeller = [sellerPayoff, BigInt(sellerPayoff)/"2".toString()]; + const tokenAmountsBuyer = [buyerPayoff, BigInt(buyerPayoff)/"5".toString()]; // seller withdrawal // Attempt to withdraw the funds, expecting revert diff --git a/test/integration/03-DR-removes-the-seller-from-allowed-list.js b/test/integration/03-DR-removes-the-seller-from-allowed-list.js index 79b6743d9..03c27179b 100644 --- a/test/integration/03-DR-removes-the-seller-from-allowed-list.js +++ b/test/integration/03-DR-removes-the-seller-from-allowed-list.js @@ -56,7 +56,7 @@ describe("[@skip-on-coverage] DR removes sellers from the approved seller list", // make all account the same assistant = admin; assistantDR = adminDR; - clerk = clerkDR = { address: ethers.constants.AddressZero }; + clerk = clerkDR = { address: ZeroAddress }; // Get snapshot id snapshotId = await getSnapshot(); @@ -77,7 +77,7 @@ describe("[@skip-on-coverage] DR removes sellers from the approved seller list", seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); expect(seller.isValid()).is.true; - const seller2 = mockSeller(other1.address, other1.address, ethers.constants.AddressZero, other1.address); + const seller2 = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); expect(seller2.isValid()).is.true; // VoucherInitValues @@ -106,7 +106,7 @@ describe("[@skip-on-coverage] DR removes sellers from the approved seller list", // Create DisputeResolverFee array so offer creation will succeed const DRFeeNative = "0"; - const disputeResolverFees = [new DisputeResolverFee(ethers.constants.AddressZero, "Native", DRFeeNative)]; + const disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", DRFeeNative)]; // Make a sellerAllowList const sellerAllowList = ["2", "1"]; @@ -139,10 +139,10 @@ describe("[@skip-on-coverage] DR removes sellers from the approved seller list", const voucherRedeemableFrom = offerDates.voucherRedeemableFrom; // Deposit seller funds so the commit will succeed - const fundsToDeposit = ethers.BigNumber.from(sellerDeposit).mul(quantityAvailable); + const fundsToDeposit = BigInt(sellerDeposit)*quantityAvailable; await fundsHandler .connect(assistant) - .depositFunds(seller.id, ethers.constants.AddressZero, fundsToDeposit, { value: fundsToDeposit }); + .depositFunds(seller.id, ZeroAddress, fundsToDeposit, { value: fundsToDeposit }); // Set time forward to the offer's voucherRedeemableFrom await setNextBlockTimestamp(Number(voucherRedeemableFrom)); diff --git a/test/integration/04-DR-removes-fees.js b/test/integration/04-DR-removes-fees.js index 18edbb5ac..b130f5ab8 100644 --- a/test/integration/04-DR-removes-fees.js +++ b/test/integration/04-DR-removes-fees.js @@ -57,7 +57,7 @@ describe("[@skip-on-coverage] DR removes fee", function () { // make all account the same assistant = admin; assistantDR = adminDR; - clerk = clerkDR = { address: ethers.constants.AddressZero }; + clerk = clerkDR = { address: ZeroAddress }; expectedCloneAddress = calculateContractAddress(accountHandler.address, "1"); emptyAuthToken = mockAuthToken(); @@ -84,7 +84,7 @@ describe("[@skip-on-coverage] DR removes fee", function () { //Create DisputeResolverFee array so offer creation will succeed disputeResolverFeeNative = "0"; const disputeResolverFees = [ - new DisputeResolverFee(ethers.constants.AddressZero, "Native", disputeResolverFeeNative), + new DisputeResolverFee(ZeroAddress, "Native", disputeResolverFeeNative), ]; // Make empty seller list, so every seller is allowed @@ -106,8 +106,8 @@ describe("[@skip-on-coverage] DR removes fee", function () { await offerHandler.connect(assistant).createOffer(offer, offerDates, offerDurations, disputeResolverId, "0"); // Deposit seller funds so the commit will succeed - const fundsToDeposit = ethers.BigNumber.from(offer.sellerDeposit).mul(offer.quantityAvailable); - await fundsHandler.connect(assistant).depositFunds(seller.id, ethers.constants.AddressZero, fundsToDeposit, { + const fundsToDeposit = BigInt(offer.sellerDeposit)*offer.quantityAvailable; + await fundsHandler.connect(assistant).depositFunds(seller.id, ZeroAddress, fundsToDeposit, { value: fundsToDeposit, }); @@ -141,14 +141,14 @@ describe("[@skip-on-coverage] DR removes fee", function () { it("Buyer should be able to commit to offer even when DR removes fee", async function () { // Removes fee await expect( - accountHandler.connect(adminDR).removeFeesFromDisputeResolver(disputeResolver.id, [ethers.constants.AddressZero]) + accountHandler.connect(adminDR).removeFeesFromDisputeResolver(disputeResolver.id, [ZeroAddress]) ) .to.emit(accountHandler, "DisputeResolverFeesRemoved") - .withArgs(disputeResolver.id, [ethers.constants.AddressZero], adminDR.address); + .withArgs(disputeResolver.id, [ZeroAddress], adminDR.address); // Commit to offer const tx = await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offer.id, { value: offer.price }); - const blockTimestamp = (await ethers.provider.getBlock(tx.blockNumber)).timestamp; + const blockTimestamp = (await provider.getBlock(tx.blockNumber)).timestamp; // Mock voucher const voucher = mockVoucher({ @@ -188,10 +188,10 @@ describe("[@skip-on-coverage] DR removes fee", function () { await expect( accountHandler .connect(adminDR) - .removeFeesFromDisputeResolver(disputeResolver.id, [ethers.constants.AddressZero]) + .removeFeesFromDisputeResolver(disputeResolver.id, [ZeroAddress]) ) .to.emit(accountHandler, "DisputeResolverFeesRemoved") - .withArgs(disputeResolver.id, [ethers.constants.AddressZero], adminDR.address); + .withArgs(disputeResolver.id, [ZeroAddress], adminDR.address); // Escalate dispute after removing fee exchangeId = "2"; @@ -228,10 +228,10 @@ describe("[@skip-on-coverage] DR removes fee", function () { await expect( accountHandler .connect(adminDR) - .removeFeesFromDisputeResolver(disputeResolver.id, [ethers.constants.AddressZero]) + .removeFeesFromDisputeResolver(disputeResolver.id, [ZeroAddress]) ) .to.emit(accountHandler, "DisputeResolverFeesRemoved") - .withArgs(disputeResolver.id, [ethers.constants.AddressZero], adminDR.address); + .withArgs(disputeResolver.id, [ZeroAddress], adminDR.address); // Decide the dispute after removing fee exchangeId = "2"; @@ -251,10 +251,10 @@ describe("[@skip-on-coverage] DR removes fee", function () { await expect( accountHandler .connect(adminDR) - .removeFeesFromDisputeResolver(disputeResolver.id, [ethers.constants.AddressZero]) + .removeFeesFromDisputeResolver(disputeResolver.id, [ZeroAddress]) ) .to.emit(accountHandler, "DisputeResolverFeesRemoved") - .withArgs(disputeResolver.id, [ethers.constants.AddressZero], adminDR.address); + .withArgs(disputeResolver.id, [ZeroAddress], adminDR.address); // Refuse to decide the dispute after removing fee exchangeId = "2"; diff --git a/test/integration/seaport/fixtures.js b/test/integration/seaport/fixtures.js index c7a7e0864..412fed8a4 100644 --- a/test/integration/seaport/fixtures.js +++ b/test/integration/seaport/fixtures.js @@ -70,13 +70,13 @@ const seaportFixtures = async (seaport) => { .map((x) => x.itemType === 0 ? (x.endAmount.gt(x.startAmount) ? x.endAmount : x.startAmount) : BigNumber.from(0) ) - .reduce((a, b) => a.add(b), BigNumber.from(0)) + .reduce((a, b) => a+b, BigNumber.from(0)) .add( consideration .map((x) => x.itemType === 0 ? (x.endAmount.gt(x.startAmount) ? x.endAmount : x.startAmount) : BigNumber.from(0) ) - .reduce((a, b) => a.add(b), BigNumber.from(0)) + .reduce((a, b) => a+b, BigNumber.from(0)) ); return { diff --git a/test/integration/seaport/seaport-integration.js b/test/integration/seaport/seaport-integration.js index c8744419c..359307f40 100644 --- a/test/integration/seaport/seaport-integration.js +++ b/test/integration/seaport/seaport-integration.js @@ -28,7 +28,7 @@ describe("[@skip-on-coverage] Seaport integration", function () { before(async function () { accountId.next(true); - seaport = await ethers.getContractAt("Seaport", SEAPORT_ADDRESS); + seaport = await getContractAt("Seaport", SEAPORT_ADDRESS); seaportFixtures = await seaportFixtures(seaport); // Specify contracts needed for this test @@ -44,15 +44,15 @@ describe("[@skip-on-coverage] Seaport integration", function () { contractInstances: { accountHandler, offerHandler, fundsHandler }, } = await setupTestEnvironment(contracts)); - const seller = mockSeller(assistant.address, assistant.address, ethers.constants.AddressZero, assistant.address); + const seller = mockSeller(assistant.address, assistant.address, ZeroAddress, assistant.address); const emptyAuthToken = mockAuthToken(); const voucherInitValues = mockVoucherInitValues(); await accountHandler.connect(assistant).createSeller(seller, emptyAuthToken, voucherInitValues); - const disputeResolver = mockDisputeResolver(DR.address, DR.address, ethers.constants.AddressZero, DR.address, true); + const disputeResolver = mockDisputeResolver(DR.address, DR.address, ZeroAddress, DR.address, true); - const disputeResolverFees = [new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0")]; + const disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", "0")]; const sellerAllowList = []; await accountHandler.connect(DR).createDisputeResolver(disputeResolver, disputeResolverFees, sellerAllowList); @@ -65,11 +65,11 @@ describe("[@skip-on-coverage] Seaport integration", function () { .createOffer(offer.toStruct(), offerDates.toStruct(), offerDurations.toStruct(), disputeResolverId, "0"); const voucherAddress = calculateContractAddress(accountHandler.address, seller.id); - bosonVoucher = await ethers.getContractAt("BosonVoucher", voucherAddress); + bosonVoucher = await getContractAt("BosonVoucher", voucherAddress); // Pool needs to cover both seller deposit and price - const pool = ethers.BigNumber.from(offer.sellerDeposit).add(offer.price); - await fundsHandler.connect(assistant).depositFunds(seller.id, ethers.constants.AddressZero, pool, { + const pool = BigInt(offer.sellerDeposit)+offer.price; + await fundsHandler.connect(assistant).depositFunds(seller.id, ZeroAddress, pool, { value: pool, }); diff --git a/test/protocol/AccountHandlerTest.js b/test/protocol/AccountHandlerTest.js index 590dbee11..70e31728f 100644 --- a/test/protocol/AccountHandlerTest.js +++ b/test/protocol/AccountHandlerTest.js @@ -51,7 +51,7 @@ describe("IBosonAccountHandler", function () { // make all account the same assistant = admin; - clerk = { address: ethers.constants.AddressZero }; + clerk = { address: ZeroAddress }; // Get snapshot id snapshotId = await getSnapshot(); @@ -150,7 +150,7 @@ describe("IBosonAccountHandler", function () { //addresses need to be unique to seller Id, so setting them to random addresses here seller.assistant = rando.address; seller.admin = rando.address; - seller.clerk = ethers.constants.AddressZero; + seller.clerk = ZeroAddress; // Create another seller await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); diff --git a/test/protocol/AgentHandlerTest.js b/test/protocol/AgentHandlerTest.js index 1569d530d..79bde804e 100644 --- a/test/protocol/AgentHandlerTest.js +++ b/test/protocol/AgentHandlerTest.js @@ -172,7 +172,7 @@ describe("AgentHandler", function () { }); it("addresses are the zero address", async function () { - agent.wallet = ethers.constants.AddressZero; + agent.wallet = ZeroAddress; // Attempt to Create an Agent, expecting revert await expect(accountHandler.connect(rando).createAgent(agent)).to.revertedWith(RevertReasons.INVALID_ADDRESS); @@ -463,7 +463,7 @@ describe("AgentHandler", function () { }); it("wallet address is the zero address", async function () { - agent.wallet = ethers.constants.AddressZero; + agent.wallet = ZeroAddress; // Attempt to update the agent, expecting revert await expect(accountHandler.connect(other1).updateAgent(agent)).to.revertedWith( diff --git a/test/protocol/BundleHandlerTest.js b/test/protocol/BundleHandlerTest.js index 5fab960e5..f894cb069 100644 --- a/test/protocol/BundleHandlerTest.js +++ b/test/protocol/BundleHandlerTest.js @@ -95,7 +95,7 @@ describe("IBosonBundleHandler", function () { // make all account the same assistant = admin; assistantDR = adminDR; - clerk = clerkDR = { address: ethers.constants.AddressZero }; + clerk = clerkDR = { address: ZeroAddress }; // Deploy the mock tokens [bosonToken] = await deployMockTokens(); @@ -154,7 +154,7 @@ describe("IBosonBundleHandler", function () { expect(disputeResolver.isValid()).is.true; //Create DisputeResolverFee array so offer creation will succeed - disputeResolverFees = [new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0")]; + disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", "0")]; // Make empty seller list, so every seller is allowed const sellerAllowList = []; @@ -201,7 +201,7 @@ describe("IBosonBundleHandler", function () { bundleStruct = bundle.toStruct(); // initialize bundleHandler - bundleHandlerFacet_Factory = await ethers.getContractFactory("BundleHandlerFacet"); + bundleHandlerFacet_Factory = await getContractFactory("BundleHandlerFacet"); }); afterEach(async function () { @@ -294,7 +294,7 @@ describe("IBosonBundleHandler", function () { it("If sum of offers' quantities is more than maxUint256, total quantity is maxUint256", async function () { // create two offers with close to unlimited supply const newOffer = offer.clone(); - newOffer.quantityAvailable = ethers.constants.MaxUint256.div(10).mul(9).toString(); + newOffer.quantityAvailable = constants.MaxUint256/10*9.toString(); const newOffer2 = newOffer.clone(); const newOfferId = "6"; const newOfferId2 = "7"; @@ -309,7 +309,7 @@ describe("IBosonBundleHandler", function () { // create a twin with almost unlimited supply twin = mockTwin(bosonToken.address); - twin.supplyAvailable = ethers.constants.MaxUint256.sub(1).toString(); + twin.supplyAvailable = constants.MaxUint256-1.toString(); expect(twin.isValid()).is.true; // Approving the twinHandler contract to transfer seller's tokens @@ -326,7 +326,7 @@ describe("IBosonBundleHandler", function () { // create a twin with unlimited supply twin = mockTwin(bosonToken.address); - twin.supplyAvailable = ethers.constants.MaxUint256.toString(); + twin.supplyAvailable = constants.MaxUint256.toString(); expect(twin.isValid()).is.true; // Approving the twinHandler contract to transfer seller's tokens @@ -386,7 +386,7 @@ describe("IBosonBundleHandler", function () { it("Caller is not the seller of all offers", async function () { // create another seller and an offer let expectedNewOfferId = "6"; - seller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); const tx = await offerHandler @@ -426,7 +426,7 @@ describe("IBosonBundleHandler", function () { it("Caller is not the seller of all twins", async function () { // create another seller and a twin let expectedNewTwinId = "6"; - seller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); await bosonToken.connect(rando).approve(twinHandler.address, 1); // approving the twin handler @@ -519,7 +519,7 @@ describe("IBosonBundleHandler", function () { // Deposit seller funds so the commit will succeed await fundsHandler .connect(assistant) - .depositFunds(seller.id, ethers.constants.AddressZero, sellerDeposit, { value: sellerDeposit }); + .depositFunds(seller.id, ZeroAddress, sellerDeposit, { value: sellerDeposit }); // Commit to an offer let offerIdToCommit = bundle.offerIds[0]; @@ -564,7 +564,7 @@ describe("IBosonBundleHandler", function () { it("Offers quantity is unlimited but twin supply is not", async function () { const newOffer = offer.clone(); - newOffer.quantityAvailable = ethers.constants.MaxUint256.toString(); + newOffer.quantityAvailable = constants.MaxUint256.toString(); let expectedNewOfferId = "6"; await offerHandler diff --git a/test/protocol/BuyerHandlerTest.js b/test/protocol/BuyerHandlerTest.js index 9471e1f85..eb09c08f7 100644 --- a/test/protocol/BuyerHandlerTest.js +++ b/test/protocol/BuyerHandlerTest.js @@ -54,7 +54,7 @@ describe("BuyerHandler", function () { // make all account the same assistant = admin; - clerk = { address: ethers.constants.AddressZero }; + clerk = { address: ZeroAddress }; // Get snapshot id snapshotId = await getSnapshot(); @@ -140,7 +140,7 @@ describe("BuyerHandler", function () { }); it("addresses are the zero address", async function () { - buyer.wallet = ethers.constants.AddressZero; + buyer.wallet = ZeroAddress; // Attempt to Create a Buyer, expecting revert await expect(accountHandler.connect(rando).createBuyer(buyer)).to.revertedWith(RevertReasons.INVALID_ADDRESS); @@ -349,7 +349,7 @@ describe("BuyerHandler", function () { treasury.address, true ); - disputeResolver.id = id.add(1).toString(); + disputeResolver.id = id+1.toString(); expect(disputeResolver.isValid()).is.true; //Create DisputeResolverFee array @@ -357,7 +357,7 @@ describe("BuyerHandler", function () { new DisputeResolverFee(other1.address, "MockToken1", "0"), new DisputeResolverFee(other2.address, "MockToken2", "0"), new DisputeResolverFee(other3.address, "MockToken3", "0"), - new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0"), + new DisputeResolverFee(ZeroAddress, "Native", "0"), ]; // Add seller to sellerAllowList @@ -387,13 +387,13 @@ describe("BuyerHandler", function () { // Deposit seller funds so the commit will succeed await fundsHandler .connect(assistant) - .depositFunds(seller.id, ethers.constants.AddressZero, sellerDeposit, { value: sellerDeposit }); + .depositFunds(seller.id, ZeroAddress, sellerDeposit, { value: sellerDeposit }); //Commit to offer await exchangeHandler.connect(other1).commitToOffer(other1.address, offerId, { value: offer.price }); const bosonVoucherCloneAddress = calculateContractAddress(exchangeHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", bosonVoucherCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", bosonVoucherCloneAddress); const balance = await bosonVoucher.connect(rando).balanceOf(other1.address); expect(balance).equal(1); }); @@ -433,7 +433,7 @@ describe("BuyerHandler", function () { }); it("wallet address is the zero address", async function () { - buyer.wallet = ethers.constants.AddressZero; + buyer.wallet = ZeroAddress; // Attempt to update the buyer, expecting revert await expect(accountHandler.connect(other1).updateBuyer(buyer)).to.revertedWith( diff --git a/test/protocol/ConfigHandlerTest.js b/test/protocol/ConfigHandlerTest.js index fe6705d91..d9a8fbff6 100644 --- a/test/protocol/ConfigHandlerTest.js +++ b/test/protocol/ConfigHandlerTest.js @@ -42,7 +42,7 @@ describe("IBosonConfigHandler", function () { InterfaceIds = await getInterfaceIds(); // Make accounts available - accounts = await ethers.getSigners(); + accounts = await getSigners(); [deployer, rando, token, treasury, beacon, proxy] = accounts; // Deploy the Protocol Diamond @@ -53,7 +53,7 @@ describe("IBosonConfigHandler", function () { // Set protocol config protocolFeePercentage = 12; - protocolFeeFlatBoson = ethers.utils.parseUnits("0.01", "ether").toString(); + protocolFeeFlatBoson = parseUnits("0.01", "ether").toString(); maxExchangesPerBatch = 100; maxOffersPerGroup = 100; maxTwinsPerBundle = 100; @@ -72,10 +72,10 @@ describe("IBosonConfigHandler", function () { maxPremintedVouchers = 10000; // Cast Diamond to IERC165 - erc165 = await ethers.getContractAt("ERC165Facet", protocolDiamond.address); + erc165 = await getContractAt("ERC165Facet", protocolDiamond.address); // Cast Diamond to IBosonConfigHandler - configHandler = await ethers.getContractAt("IBosonConfigHandler", protocolDiamond.address); + configHandler = await getContractAt("IBosonConfigHandler", protocolDiamond.address); // Get snapshot id snapshotId = await getSnapshot(); @@ -515,7 +515,7 @@ describe("IBosonConfigHandler", function () { it("token address is the zero address", async function () { // Attempt to set new token address, expecting revert - await expect(configHandler.connect(deployer).setTokenAddress(ethers.constants.AddressZero)).to.revertedWith( + await expect(configHandler.connect(deployer).setTokenAddress(ZeroAddress)).to.revertedWith( RevertReasons.INVALID_ADDRESS ); }); @@ -555,7 +555,7 @@ describe("IBosonConfigHandler", function () { it("treasury address is the zero address", async function () { // Attempt to set new treasury address, expecting revert await expect( - configHandler.connect(deployer).setTreasuryAddress(ethers.constants.AddressZero) + configHandler.connect(deployer).setTreasuryAddress(ZeroAddress) ).to.revertedWith(RevertReasons.INVALID_ADDRESS); }); }); @@ -594,7 +594,7 @@ describe("IBosonConfigHandler", function () { it("voucher beacon address is the zero address", async function () { // Attempt to set new beacon address, expecting revert await expect( - configHandler.connect(deployer).setVoucherBeaconAddress(ethers.constants.AddressZero) + configHandler.connect(deployer).setVoucherBeaconAddress(ZeroAddress) ).to.revertedWith(RevertReasons.INVALID_ADDRESS); }); }); @@ -633,7 +633,7 @@ describe("IBosonConfigHandler", function () { it("beacon proxy address is the zero address", async function () { // Attempt to set new proxy address, expecting revert await expect( - configHandler.connect(deployer).setBeaconProxyAddress(ethers.constants.AddressZero) + configHandler.connect(deployer).setBeaconProxyAddress(ZeroAddress) ).to.revertedWith(RevertReasons.INVALID_ADDRESS); }); }); @@ -683,7 +683,7 @@ describe("IBosonConfigHandler", function () { let protocolFeeFlatBoson; beforeEach(async function () { // set new value for flat boson protocol fee - protocolFeeFlatBoson = ethers.utils.parseUnits("0.02", "ether").toString(); + protocolFeeFlatBoson = parseUnits("0.02", "ether").toString(); }); it("should emit a ProtocolFeeFlatBosonChanged event", async function () { @@ -794,7 +794,7 @@ describe("IBosonConfigHandler", function () { let maxEscalationResponsePeriod; beforeEach(async function () { // set new value - maxEscalationResponsePeriod = ethers.BigNumber.from(oneMonth).add(oneWeek); + maxEscalationResponsePeriod = BigInt(oneMonth)+oneWeek; }); it("should emit a MaxEscalationResponsePeriodChanged event", async function () { @@ -1054,7 +1054,7 @@ describe("IBosonConfigHandler", function () { it("_authTokenContract is the zero address", async function () { // Attempt to set new auth token contract, expecting revert await expect( - configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.ENS, ethers.constants.AddressZero) + configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.ENS, ZeroAddress) ).to.revertedWith(RevertReasons.INVALID_ADDRESS); }); }); @@ -1103,7 +1103,7 @@ describe("IBosonConfigHandler", function () { let maxResolutionPeriod; beforeEach(async function () { // set new value - maxResolutionPeriod = ethers.BigNumber.from(oneMonth).add(oneWeek); + maxResolutionPeriod = BigInt(oneMonth)+oneWeek; }); it("should emit a MaxResolutionPeriodChanged event", async function () { @@ -1142,7 +1142,7 @@ describe("IBosonConfigHandler", function () { let minDisputePeriod; beforeEach(async function () { // set new value - minDisputePeriod = ethers.BigNumber.from(oneMonth).sub(oneWeek); + minDisputePeriod = BigInt(oneMonth)-oneWeek; }); it("should emit a MinDisputePeriodChanged event", async function () { @@ -1249,7 +1249,7 @@ describe("IBosonConfigHandler", function () { it("_accessControllerAddress is the zero address", async function () { // Attempt to set new value, expecting revert await expect( - configHandler.connect(deployer).setAccessControllerAddress(ethers.constants.AddressZero) + configHandler.connect(deployer).setAccessControllerAddress(ZeroAddress) ).to.revertedWith(RevertReasons.INVALID_ADDRESS); }); }); @@ -1333,15 +1333,15 @@ describe("IBosonConfigHandler", function () { ); //setAuthTokenContract is not called in the initialize function expect(await configHandler.connect(rando).getAuthTokenContract(AuthTokenType.Lens)).to.equal( - ethers.constants.AddressZero, + ZeroAddress, "Invalid auth token contract address" ); expect(await configHandler.connect(rando).getAuthTokenContract(AuthTokenType.ENS)).to.equal( - ethers.constants.AddressZero, + ZeroAddress, "Invalid auth token contract address" ); expect(await configHandler.connect(rando).getAuthTokenContract(AuthTokenType.Custom)).to.equal( - ethers.constants.AddressZero, + ZeroAddress, "Invalid auth token contract address" ); expect(await configHandler.connect(rando).getMaxExchangesPerBatch()).to.equal( diff --git a/test/protocol/DisputeHandlerTest.js b/test/protocol/DisputeHandlerTest.js index 4e6dac311..36ddb960f 100644 --- a/test/protocol/DisputeHandlerTest.js +++ b/test/protocol/DisputeHandlerTest.js @@ -117,7 +117,7 @@ describe("IBosonDisputeHandler", function () { // make all account the same assistant = admin; assistantDR = adminDR; - clerk = clerkDR = { address: ethers.constants.AddressZero }; + clerk = clerkDR = { address: ZeroAddress }; // Get snapshot id snapshotId = await getSnapshot(); @@ -174,7 +174,7 @@ describe("IBosonDisputeHandler", function () { //Create DisputeResolverFee array so offer creation will succeed DRFeeNative = "0"; - disputeResolverFees = [new DisputeResolverFee(ethers.constants.AddressZero, "Native", DRFeeNative)]; + disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", DRFeeNative)]; // Make empty seller list, so every seller is allowed const sellerAllowList = []; @@ -209,10 +209,10 @@ describe("IBosonDisputeHandler", function () { escalationPeriod = disputeResolver.escalationResponsePeriod; // Deposit seller funds so the commit will succeed - const fundsToDeposit = ethers.BigNumber.from(sellerDeposit).mul(quantityAvailable); + const fundsToDeposit = BigInt(sellerDeposit)*quantityAvailable; await fundsHandler .connect(assistant) - .depositFunds(seller.id, ethers.constants.AddressZero, fundsToDeposit, { value: fundsToDeposit }); + .depositFunds(seller.id, ZeroAddress, fundsToDeposit, { value: fundsToDeposit }); buyerId = accountId.next().value; }); @@ -253,9 +253,9 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set disputedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(disputedDate).add(resolutionPeriod).toString(); + timeout = BigInt(disputedDate)+resolutionPeriod.toString(); // expected values dispute = new Dispute(exchangeId, DisputeState.Resolving, buyerPercentBasisPoints); @@ -306,8 +306,8 @@ describe("IBosonDisputeHandler", function () { }); it("exchange is not in a redeemed state - completed", async function () { - const blockNumber = await ethers.provider.getBlockNumber(); - const block = await ethers.provider.getBlock(blockNumber); + const blockNumber = await provider.getBlockNumber(); + const block = await provider.getBlock(blockNumber); const currentTime = block.timestamp; // Set time forward to run out the dispute period @@ -344,7 +344,7 @@ describe("IBosonDisputeHandler", function () { const voucherRedeemedDate = voucherStruct.redeemedDate; // Set time forward past the dispute period - await setNextBlockTimestamp(voucherRedeemedDate.add(disputePeriod).add(1).toNumber()); + await setNextBlockTimestamp(voucherRedeemedDate+disputePeriod+1.toNumber()); // Attempt to raise a dispute, expecting revert await expect(disputeHandler.connect(buyer).raiseDispute(exchangeId)).to.revertedWith( @@ -361,9 +361,9 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set disputedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(disputedDate).add(resolutionPeriod).toString(); + timeout = BigInt(disputedDate)+resolutionPeriod.toString(); }); it("should emit a DisputeRetracted event", async function () { @@ -379,7 +379,7 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set finalizedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); finalizedDate = block.timestamp.toString(); dispute = new Dispute(exchangeId, DisputeState.Retracted, buyerPercentBasisPoints); @@ -484,7 +484,7 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set escalatedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); escalatedDate = block.timestamp.toString(); await setNextBlockTimestamp(Number(escalatedDate) + Number(escalationPeriod)); @@ -503,12 +503,12 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set disputedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(disputedDate).add(resolutionPeriod).toString(); + timeout = BigInt(disputedDate)+resolutionPeriod.toString(); // extend timeout for a month - newDisputeTimeout = ethers.BigNumber.from(timeout).add(oneMonth).toString(); + newDisputeTimeout = BigInt(timeout)+oneMonth.toString(); }); it("should emit a DisputeTimeoutExtended event", async function () { @@ -555,7 +555,7 @@ describe("IBosonDisputeHandler", function () { await setNextBlockTimestamp(Number(timeout) + Number(oneWeek)); // extend for another week - newDisputeTimeout = ethers.BigNumber.from(newDisputeTimeout).add(oneWeek).toString(); + newDisputeTimeout = BigInt(newDisputeTimeout)+oneWeek.toString(); // Extend the dispute timeout, testing for the event await expect(disputeHandler.connect(assistant).extendDisputeTimeout(exchangeId, newDisputeTimeout)) @@ -614,7 +614,7 @@ describe("IBosonDisputeHandler", function () { }); it("new dispute timeout is before the current dispute timeout", async function () { - newDisputeTimeout = ethers.BigNumber.from(timeout).sub(oneWeek).toString(); + newDisputeTimeout = BigInt(timeout)-oneWeek.toString(); // Attempt to extend the dispute timeout, expecting revert await expect( @@ -641,9 +641,9 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set disputedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(disputedDate).add(resolutionPeriod).toString(); + timeout = BigInt(disputedDate)+resolutionPeriod.toString(); }); it("should emit a DisputeExpired event", async function () { @@ -665,7 +665,7 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set finalizedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); finalizedDate = block.timestamp.toString(); dispute = new Dispute(exchangeId, DisputeState.Retracted, buyerPercentBasisPoints); @@ -780,9 +780,9 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set disputedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(disputedDate).add(resolutionPeriod).toString(); + timeout = BigInt(disputedDate)+resolutionPeriod.toString(); buyerPercentBasisPoints = "1234"; @@ -827,7 +827,7 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set finalizedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); finalizedDate = block.timestamp.toString(); dispute = new Dispute(exchangeId, DisputeState.Resolved, buyerPercentBasisPoints); @@ -867,7 +867,7 @@ describe("IBosonDisputeHandler", function () { it("Buyer can also have a seller account and this will work", async function () { // Create a valid seller with buyer's wallet - seller = mockSeller(buyer.address, buyer.address, ethers.constants.AddressZero, buyer.address); + seller = mockSeller(buyer.address, buyer.address, ZeroAddress, buyer.address); expect(seller.isValid()).is.true; await accountHandler.connect(buyer).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -891,8 +891,8 @@ describe("IBosonDisputeHandler", function () { it("Dispute can be mutually resolved even if it's in escalated state and past the resolution period", async function () { // Set time forward before the dispute original expiration date await setNextBlockTimestamp( - ethers.BigNumber.from(disputedDate) - .add(resolutionPeriod / 2) + BigInt(disputedDate) + +resolutionPeriod / 2 .toNumber() ); @@ -949,7 +949,7 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set finalizedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); finalizedDate = block.timestamp.toString(); dispute = new Dispute(exchangeId, DisputeState.Resolved, buyerPercentBasisPoints); @@ -1012,8 +1012,8 @@ describe("IBosonDisputeHandler", function () { it("Dispute can be mutually resolved even if it's in escalated state and past the resolution period", async function () { // Set time forward before the dispute original expiration date await setNextBlockTimestamp( - ethers.BigNumber.from(disputedDate) - .add(resolutionPeriod / 2) + BigInt(disputedDate) + +resolutionPeriod / 2 .toNumber() ); @@ -1118,7 +1118,7 @@ describe("IBosonDisputeHandler", function () { // Wallet with seller account, but not the seller in this exchange // Create a valid seller - seller = mockSeller(other1.address, other1.address, ethers.constants.AddressZero, other1.address); + seller = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); expect(seller.isValid()).is.true; await accountHandler.connect(other1).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -1178,17 +1178,17 @@ describe("IBosonDisputeHandler", function () { await expect( disputeHandler .connect(assistant) - .resolveDispute(exchangeId, buyerPercentBasisPoints, r, ethers.utils.hexZeroPad("0x", 32), v) + .resolveDispute(exchangeId, buyerPercentBasisPoints, r, hexZeroPad("0x", 32), v) ).to.revertedWith(RevertReasons.INVALID_SIGNATURE); await expect( disputeHandler .connect(assistant) - .resolveDispute(exchangeId, buyerPercentBasisPoints, ethers.utils.hexZeroPad("0x", 32), s, v) + .resolveDispute(exchangeId, buyerPercentBasisPoints, hexZeroPad("0x", 32), s, v) ).to.revertedWith(RevertReasons.INVALID_SIGNATURE); await expect( disputeHandler .connect(assistant) - .resolveDispute(exchangeId, buyerPercentBasisPoints, r, ethers.constants.MaxUint256, v) + .resolveDispute(exchangeId, buyerPercentBasisPoints, r, constants.MaxUint256, v) ).to.revertedWith(RevertReasons.INVALID_SIGNATURE); }); @@ -1247,9 +1247,9 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set disputedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(disputedDate).add(resolutionPeriod).toString(); + timeout = BigInt(disputedDate)+resolutionPeriod.toString(); }); it("should emit a DisputeEscalated event", async function () { @@ -1263,16 +1263,16 @@ describe("IBosonDisputeHandler", function () { it("should update state", async function () { // Protocol balance before - const escrowBalanceBefore = await ethers.provider.getBalance(disputeHandler.address); + const escrowBalanceBefore = await provider.getBalance(disputeHandler.address); // Escalate the dispute tx = await disputeHandler.connect(buyer).escalateDispute(exchangeId, { value: buyerEscalationDepositNative }); // Get the block timestamp of the confirmed tx and set escalatedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); escalatedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(escalatedDate).add(escalationPeriod).toString(); + timeout = BigInt(escalatedDate)+escalationPeriod.toString(); dispute = new Dispute(exchangeId, DisputeState.Escalated, "0"); disputeDates = new DisputeDates(disputedDate, escalatedDate, "0", timeout); @@ -1299,8 +1299,8 @@ describe("IBosonDisputeHandler", function () { assert.equal(response, DisputeState.Escalated, "Dispute state is incorrect"); // Protocol balance should increase for buyer escalation deposit - const escrowBalanceAfter = await ethers.provider.getBalance(disputeHandler.address); - expect(escrowBalanceAfter.sub(escrowBalanceBefore)).to.equal( + const escrowBalanceAfter = await provider.getBalance(disputeHandler.address); + expect(escrowBalanceAfter-escrowBalanceBefore).to.equal( buyerEscalationDepositNative, "Escrow balance mismatch" ); @@ -1319,7 +1319,7 @@ describe("IBosonDisputeHandler", function () { // Protocol balance should increase for buyer escalation deposit const escrowBalanceAfter = await mockToken.balanceOf(disputeHandler.address); - expect(escrowBalanceAfter.sub(escrowBalanceBefore)).to.equal( + expect(escrowBalanceAfter-escrowBalanceBefore).to.equal( buyerEscalationDepositToken, "Escrow balance mismatch" ); @@ -1412,7 +1412,7 @@ describe("IBosonDisputeHandler", function () { // Attempt to escalate the dispute, expecting revert await expect( disputeHandler.connect(buyer).escalateDispute(exchangeId, { - value: ethers.BigNumber.from(buyerEscalationDepositNative).sub("1").toString(), + value: BigInt(buyerEscalationDepositNative)-"1".toString(), }) ).to.revertedWith(RevertReasons.INSUFFICIENT_VALUE_RECEIVED); }); @@ -1423,7 +1423,7 @@ describe("IBosonDisputeHandler", function () { // Attempt to escalate the dispute, expecting revert await expect( disputeHandler.connect(buyer).escalateDispute(exchangeId, { - value: ethers.BigNumber.from("1").toString(), + value: BigInt("1").toString(), }) ).to.revertedWith(RevertReasons.NATIVE_NOT_ALLOWED); }); @@ -1456,7 +1456,7 @@ describe("IBosonDisputeHandler", function () { // not approved await mockToken .connect(buyer) - .approve(protocolDiamond.address, ethers.BigNumber.from(buyerEscalationDepositToken).sub("1").toString()); + .approve(protocolDiamond.address, BigInt(buyerEscalationDepositToken)-"1".toString()); // Attempt to commit to an offer, expecting revert await expect(disputeHandler.connect(buyer).escalateDispute(exchangeId)).to.revertedWith( @@ -1469,7 +1469,7 @@ describe("IBosonDisputeHandler", function () { const [Foreign20WithFee] = await deployMockTokens(["Foreign20WithFee"]); // add to DR fees - DRFeeToken = ethers.utils.parseUnits("2", "ether").toString(); + DRFeeToken = parseUnits("2", "ether").toString(); await accountHandler .connect(adminDR) .addFeesToDisputeResolver(disputeResolverId, [ @@ -1512,7 +1512,7 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set disputedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); // Escalate the dispute @@ -1520,9 +1520,9 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set escalatedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); escalatedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(escalatedDate).add(escalationPeriod).toString(); + timeout = BigInt(escalatedDate)+escalationPeriod.toString(); // buyer percent used in tests buyerPercentBasisPoints = "4321"; @@ -1541,7 +1541,7 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set finalizedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); finalizedDate = block.timestamp.toString(); dispute = new Dispute(exchangeId, DisputeState.Decided, buyerPercentBasisPoints); @@ -1656,7 +1656,7 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set disputedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); // Escalate the dispute @@ -1664,9 +1664,9 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set escalatedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); escalatedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(escalatedDate).add(escalationPeriod).toString(); + timeout = BigInt(escalatedDate)+escalationPeriod.toString(); }); it("should emit a EscalatedDisputeExpired event", async function () { @@ -1688,7 +1688,7 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set finalizedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); finalizedDate = block.timestamp.toString(); dispute = new Dispute(exchangeId, DisputeState.Refused, buyerPercentBasisPoints); @@ -1805,7 +1805,7 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set disputedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); // Escalate the dispute @@ -1813,9 +1813,9 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set escalatedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); escalatedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(escalatedDate).add(escalationPeriod).toString(); + timeout = BigInt(escalatedDate)+escalationPeriod.toString(); }); it("should emit a EscalatedDisputeRefused event", async function () { @@ -1831,7 +1831,7 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set finalizedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); finalizedDate = block.timestamp.toString(); dispute = new Dispute(exchangeId, DisputeState.Refused, buyerPercentBasisPoints); @@ -1955,9 +1955,9 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(disputedDate).add(resolutionPeriod).toString(); + timeout = BigInt(disputedDate)+resolutionPeriod.toString(); // Expected value for dispute dispute = new Dispute(exchangeId, DisputeState.Resolving, buyerPercentBasisPoints); @@ -2041,9 +2041,9 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set disputedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(disputedDate).add(resolutionPeriod).toString(); + timeout = BigInt(disputedDate)+resolutionPeriod.toString(); }); it("should return true for exists if exchange id is valid", async function () { @@ -2098,9 +2098,9 @@ describe("IBosonDisputeHandler", function () { it("should return the expected dispute state if exchange id is valid and dispute has been resolved", async function () { // Get the block timestamp of the confirmed tx and set disputedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(disputedDate).add(resolutionPeriod).toString(); + timeout = BigInt(disputedDate)+resolutionPeriod.toString(); buyerPercentBasisPoints = "1234"; @@ -2155,9 +2155,9 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set escalatedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); escalatedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(escalatedDate).add(escalationPeriod).toString(); + timeout = BigInt(escalatedDate)+escalationPeriod.toString(); // buyer percent used in tests buyerPercentBasisPoints = "4321"; @@ -2194,9 +2194,9 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set disputedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(disputedDate).add(resolutionPeriod).toString(); + timeout = BigInt(disputedDate)+resolutionPeriod.toString(); }); it("should return true for exists if exchange id is valid", async function () { @@ -2333,7 +2333,7 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set escalatedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); escalatedDate = block.timestamp.toString(); await setNextBlockTimestamp(Number(escalatedDate) + Number(escalationPeriod)); @@ -2381,9 +2381,9 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set disputedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(disputedDate).add(resolutionPeriod).toString(); + timeout = BigInt(disputedDate)+resolutionPeriod.toString(); dispute[exchangeId] = new Dispute(exchangeId, DisputeState.Retracted, buyerPercentBasisPoints); disputeDates[exchangeId] = new DisputeDates(disputedDate, "0", finalizedDate, timeout); @@ -2412,7 +2412,7 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set finalizedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); finalizedDate = block.timestamp.toString(); // verify that state for all disputes was updated diff --git a/test/protocol/DisputeResolverHandlerTest.js b/test/protocol/DisputeResolverHandlerTest.js index 40e25a6f5..e3be8fac1 100644 --- a/test/protocol/DisputeResolverHandlerTest.js +++ b/test/protocol/DisputeResolverHandlerTest.js @@ -104,7 +104,7 @@ describe("DisputeResolverHandler", function () { // make all account the same assistant = admin; - clerk = { address: ethers.constants.AddressZero }; + clerk = { address: ZeroAddress }; // Get snapshot id snapshotId = await getSnapshot(); @@ -127,8 +127,8 @@ describe("DisputeResolverHandler", function () { // Create two additional sellers and create seller allow list seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); - seller2 = mockSeller(other1.address, other1.address, ethers.constants.AddressZero, other1.address); - let seller3 = mockSeller(other2.address, other2.address, ethers.constants.AddressZero, other2.address); + seller2 = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); + let seller3 = mockSeller(other2.address, other2.address, ZeroAddress, other2.address); // VoucherInitValues voucherInitValues = mockVoucherInitValues(); @@ -150,10 +150,10 @@ describe("DisputeResolverHandler", function () { disputeResolverPendingUpdate = disputeResolver.clone(); disputeResolverPendingUpdate.id = "0"; - disputeResolverPendingUpdate.admin = ethers.constants.AddressZero; - disputeResolverPendingUpdate.clerk = ethers.constants.AddressZero; - disputeResolverPendingUpdate.treasury = ethers.constants.AddressZero; - disputeResolverPendingUpdate.assistant = ethers.constants.AddressZero; + disputeResolverPendingUpdate.admin = ZeroAddress; + disputeResolverPendingUpdate.clerk = ZeroAddress; + disputeResolverPendingUpdate.treasury = ZeroAddress; + disputeResolverPendingUpdate.assistant = ZeroAddress; disputeResolverPendingUpdate.escalationResponsePeriod = "0"; disputeResolverPendingUpdate.metadataUri = ""; disputeResolverPendingUpdate.active = false; @@ -330,7 +330,7 @@ describe("DisputeResolverHandler", function () { disputeResolver2 = mockDisputeResolver( other1.address, other1.address, - ethers.constants.AddressZero, + ZeroAddress, other1.address, true ); @@ -414,7 +414,7 @@ describe("DisputeResolverHandler", function () { disputeResolver2 = mockDisputeResolver( other1.address, other1.address, - ethers.constants.AddressZero, + ZeroAddress, treasury.address, true ); @@ -449,7 +449,7 @@ describe("DisputeResolverHandler", function () { }); it("Any address is the zero address", async function () { - disputeResolver.assistant = ethers.constants.AddressZero; + disputeResolver.assistant = ZeroAddress; // Attempt to Create a DisputeResolver, expecting revert await expect( @@ -457,7 +457,7 @@ describe("DisputeResolverHandler", function () { ).to.revertedWith(RevertReasons.INVALID_ADDRESS); disputeResolver.assistant = assistant.address; - disputeResolver.admin = ethers.constants.AddressZero; + disputeResolver.admin = ZeroAddress; // Attempt to Create a DisputeResolver, expecting revert await expect( @@ -465,7 +465,7 @@ describe("DisputeResolverHandler", function () { ).to.revertedWith(RevertReasons.INVALID_ADDRESS); disputeResolver.admin = admin.address; - disputeResolver.treasury = ethers.constants.AddressZero; + disputeResolver.treasury = ZeroAddress; // Attempt to Create a DisputeResolver, expecting revert await expect( @@ -486,7 +486,7 @@ describe("DisputeResolverHandler", function () { disputeResolver2 = mockDisputeResolver( assistant.address, assistant.address, - ethers.constants.AddressZero, + ZeroAddress, assistant.address ); expect(disputeResolver2.isValid()).is.true; @@ -659,7 +659,7 @@ describe("DisputeResolverHandler", function () { Array.isArray(returnedSellerAllowList) && returnedSellerAllowList.reduce( (previousAllowedSeller, currentAllowedSeller) => - previousAllowedSeller && typeof ethers.BigNumber.from(currentAllowedSeller) === "object", + previousAllowedSeller && typeof BigInt(currentAllowedSeller) === "object", true ); expect(valid).to.be.true; @@ -759,7 +759,7 @@ describe("DisputeResolverHandler", function () { // Assistant and admin needs owner approval and won't be updated until then expectedDisputeResolver.assistant = assistant.address; expectedDisputeResolver.admin = admin.address; - expectedDisputeResolver.clerk = ethers.constants.AddressZero; + expectedDisputeResolver.clerk = ZeroAddress; expectedDisputeResolverStruct = expectedDisputeResolver.toStruct(); // Testing for the DisputeResolverUpdateApplied event @@ -779,7 +779,7 @@ describe("DisputeResolverHandler", function () { ).toString(); disputeResolver.assistant = other1.address; disputeResolver.admin = other2.address; - disputeResolver.clerk = ethers.constants.AddressZero; + disputeResolver.clerk = ZeroAddress; disputeResolver.treasury = other4.address; disputeResolver.metadataUri = "https://ipfs.io/ipfs/updatedUri"; disputeResolver.active = true; @@ -910,7 +910,7 @@ describe("DisputeResolverHandler", function () { disputeResolver2 = mockDisputeResolver( other1.address, other1.address, - ethers.constants.AddressZero, + ZeroAddress, other1.address ); expect(disputeResolver2.isValid()).is.true; @@ -945,7 +945,7 @@ describe("DisputeResolverHandler", function () { ).toString(); disputeResolver.assistant = rando.address; disputeResolver.admin = rando.address; - disputeResolver.clerk = ethers.constants.AddressZero; + disputeResolver.clerk = ZeroAddress; disputeResolver.treasury = rando.address; disputeResolver.metadataUri = "https://ipfs.io/ipfs/updatedUri"; expect(disputeResolver.isValid()).is.true; @@ -1021,7 +1021,7 @@ describe("DisputeResolverHandler", function () { .to.emit(accountHandler, "DisputeResolverUpdatePending") .withArgs(disputeResolver.id, disputeResolverPendingUpdateStruct, admin.address); - disputeResolverPendingUpdate.admin = ethers.constants.AddressZero; + disputeResolverPendingUpdate.admin = ZeroAddress; disputeResolverPendingUpdateStruct = disputeResolverPendingUpdate.toStruct(); // Approve admin update @@ -1050,7 +1050,7 @@ describe("DisputeResolverHandler", function () { .to.emit(accountHandler, "DisputeResolverUpdatePending") .withArgs(disputeResolver.id, disputeResolverPendingUpdateStruct, other2.address); - disputeResolverPendingUpdate.admin = ethers.constants.AddressZero; + disputeResolverPendingUpdate.admin = ZeroAddress; disputeResolverPendingUpdateStruct = disputeResolverPendingUpdate.toStruct(); // Approve admin update @@ -1077,7 +1077,7 @@ describe("DisputeResolverHandler", function () { // Update dispute resolver fields disputeResolver.assistant = other1.address; disputeResolver.admin = other2.address; - disputeResolver.clerk = ethers.constants.AddressZero; + disputeResolver.clerk = ZeroAddress; disputeResolver.active = true; expect(disputeResolver.isValid()).is.true; @@ -1085,7 +1085,7 @@ describe("DisputeResolverHandler", function () { disputeResolverPendingUpdate.assistant = other1.address; disputeResolverPendingUpdate.admin = other2.address; - disputeResolverPendingUpdate.clerk = ethers.constants.AddressZero; + disputeResolverPendingUpdate.clerk = ZeroAddress; disputeResolverPendingUpdateStruct = disputeResolverPendingUpdate.toStruct(); // Request to update a dispute resolver, testing for the DisputeResolerUpdatePending event @@ -1107,7 +1107,7 @@ describe("DisputeResolverHandler", function () { disputeResolver2 = mockDisputeResolver( rando.address, rando.address, - ethers.constants.AddressZero, + ZeroAddress, rando.address ); expect(disputeResolver2.isValid()).is.true; @@ -1120,9 +1120,9 @@ describe("DisputeResolverHandler", function () { disputeResolver2.treasury = treasury.address; disputeResolver2Struct = disputeResolver2.toStruct(); - disputeResolverPendingUpdate.admin = ethers.constants.AddressZero; - disputeResolverPendingUpdate.assistant = ethers.constants.AddressZero; - disputeResolverPendingUpdate.clerk = ethers.constants.AddressZero; + disputeResolverPendingUpdate.admin = ZeroAddress; + disputeResolverPendingUpdate.assistant = ZeroAddress; + disputeResolverPendingUpdate.clerk = ZeroAddress; disputeResolverPendingUpdateStruct = disputeResolverPendingUpdate.toStruct(); // Update new dispute resolver with same treasury address, testing for the event @@ -1135,7 +1135,7 @@ describe("DisputeResolverHandler", function () { // Update dispute resolver fields disputeResolver.assistant = other1.address; disputeResolver.admin = other1.address; - disputeResolver.clerk = ethers.constants.AddressZero; + disputeResolver.clerk = ZeroAddress; disputeResolver.treasury = other1.address; expect(disputeResolver.isValid()).is.true; @@ -1143,12 +1143,12 @@ describe("DisputeResolverHandler", function () { expectedDisputeResolver = disputeResolver.clone(); expectedDisputeResolver.assistant = assistant.address; expectedDisputeResolver.admin = admin.address; - expectedDisputeResolver.clerk = ethers.constants.AddressZero; + expectedDisputeResolver.clerk = ZeroAddress; expectedDisputeResolverStruct = expectedDisputeResolver.toStruct(); disputeResolverPendingUpdate.assistant = other1.address; disputeResolverPendingUpdate.admin = other1.address; - disputeResolverPendingUpdate.clerk = ethers.constants.AddressZero; + disputeResolverPendingUpdate.clerk = ZeroAddress; disputeResolverPendingUpdateStruct = disputeResolverPendingUpdate.toStruct(); // Update a dispute resolver @@ -1172,9 +1172,9 @@ describe("DisputeResolverHandler", function () { expectedDisputeResolver = disputeResolver.clone(); expectedDisputeResolverStruct = expectedDisputeResolver.toStruct(); - disputeResolverPendingUpdate.assistant = ethers.constants.AddressZero; - disputeResolverPendingUpdate.admin = ethers.constants.AddressZero; - disputeResolverPendingUpdate.clerk = ethers.constants.AddressZero; + disputeResolverPendingUpdate.assistant = ZeroAddress; + disputeResolverPendingUpdate.admin = ZeroAddress; + disputeResolverPendingUpdate.clerk = ZeroAddress; disputeResolverPendingUpdateStruct = disputeResolverPendingUpdate.toStruct(); // Approve assistant update @@ -1232,7 +1232,7 @@ describe("DisputeResolverHandler", function () { }); it("Any address is the zero address", async function () { - disputeResolver.assistant = ethers.constants.AddressZero; + disputeResolver.assistant = ZeroAddress; // Attempt to update the disputer resolver, expecting revert await expect(accountHandler.connect(admin).updateDisputeResolver(disputeResolver)).to.revertedWith( @@ -1240,7 +1240,7 @@ describe("DisputeResolverHandler", function () { ); disputeResolver.assistant = assistant.address; - disputeResolver.admin = ethers.constants.AddressZero; + disputeResolver.admin = ZeroAddress; // Attempt to update the disputer resolver, expecting revert await expect(accountHandler.connect(admin).updateDisputeResolver(disputeResolver)).to.revertedWith( @@ -1248,7 +1248,7 @@ describe("DisputeResolverHandler", function () { ); disputeResolver.admin = admin.address; - disputeResolver.treasury = ethers.constants.AddressZero; + disputeResolver.treasury = ZeroAddress; // Attempt to update the disputer resolver, expecting revert await expect(accountHandler.connect(admin).updateDisputeResolver(disputeResolver)).to.revertedWith( @@ -1269,7 +1269,7 @@ describe("DisputeResolverHandler", function () { disputeResolver2 = mockDisputeResolver( other1.address, other1.address, - ethers.constants.AddressZero, + ZeroAddress, other1.address ); expect(disputeResolver2.isValid()).is.true; @@ -1299,7 +1299,7 @@ describe("DisputeResolverHandler", function () { disputeResolver2 = mockDisputeResolver( other1.address, other1.address, - ethers.constants.AddressZero, + ZeroAddress, other1.address ); expect(disputeResolver2.isValid()).is.true; @@ -1761,7 +1761,7 @@ describe("DisputeResolverHandler", function () { .createDisputeResolver(disputeResolver, disputeResolverFees, sellerAllowList); // make another seller with id = "5" - let seller4 = mockSeller(other3.address, other3.address, ethers.constants.AddressZero, other3.address); + let seller4 = mockSeller(other3.address, other3.address, ZeroAddress, other3.address); await accountHandler.connect(other3).createSeller(seller4, emptyAuthToken, voucherInitValues); @@ -1924,7 +1924,7 @@ describe("DisputeResolverHandler", function () { .createDisputeResolver(disputeResolver, disputeResolverFees, sellerAllowList); // make another seller with id = "5" - const seller4 = mockSeller(other3.address, other3.address, ethers.constants.AddressZero, other3.address); + const seller4 = mockSeller(other3.address, other3.address, ZeroAddress, other3.address); // AuthToken emptyAuthToken = mockAuthToken(); @@ -2018,7 +2018,7 @@ describe("DisputeResolverHandler", function () { expect(returnedSellerAllowList.toString()).to.eql(expectedSellerAllowList.toString(), "Allowed list wrong"); // make another seller with id = "6" - const seller6 = mockSeller(other4.address, other4.address, ethers.constants.AddressZero, other4.address); + const seller6 = mockSeller(other4.address, other4.address, ZeroAddress, other4.address); await accountHandler.connect(other4).createSeller(seller6, emptyAuthToken, voucherInitValues); // check that mappings of allowed selleres were updated @@ -2084,7 +2084,7 @@ describe("DisputeResolverHandler", function () { it("Seller id is not approved", async function () { // make another seller with id = "6" - const seller6 = mockSeller(other4.address, other4.address, ethers.constants.AddressZero, other4.address); + const seller6 = mockSeller(other4.address, other4.address, ZeroAddress, other4.address); await accountHandler.connect(other4).createSeller(seller6, emptyAuthToken, voucherInitValues); // seller exists, it's not approved @@ -2159,7 +2159,7 @@ describe("DisputeResolverHandler", function () { }); it("Should update admin and assistant in a single call ", async function () { - disputeResolver.clerk = expectedDisputeResolver.clerk = ethers.constants.AddressZero; + disputeResolver.clerk = expectedDisputeResolver.clerk = ZeroAddress; disputeResolver.admin = expectedDisputeResolver.admin = other1.address; disputeResolver.assistant = expectedDisputeResolver.assistant = other1.address; expectedDisputeResolverStruct = expectedDisputeResolver.toStruct(); @@ -2208,7 +2208,7 @@ describe("DisputeResolverHandler", function () { .optInToDisputeResolverUpdate(disputeResolver.id, [DisputeResolverUpdateFields.Assistant]) ).to.revertedWith(RevertReasons.UNAUTHORIZED_CALLER_UPDATE); - disputeResolverPendingUpdate.assistant = ethers.constants.AddressZero; + disputeResolverPendingUpdate.assistant = ZeroAddress; disputeResolverPendingUpdate2Struct = disputeResolverPendingUpdate.toStruct(); expectedDisputeResolverStruct = expectedDisputeResolver.toStruct(); @@ -2250,7 +2250,7 @@ describe("DisputeResolverHandler", function () { context("💔 Revert Reasons", async function () { it("There are no pending updates", async function () { - disputeResolver.clerk = ethers.constants.AddressZero; + disputeResolver.clerk = ZeroAddress; disputeResolver.admin = other1.address; disputeResolver.assistant = other1.address; expectedDisputeResolver = disputeResolver.clone(); @@ -2329,7 +2329,7 @@ describe("DisputeResolverHandler", function () { disputeResolver2 = mockDisputeResolver( other1.address, other1.address, - ethers.constants.AddressZero, + ZeroAddress, other1.address ); expect(disputeResolver2.isValid()).is.true; @@ -2355,7 +2355,7 @@ describe("DisputeResolverHandler", function () { disputeResolver2 = mockDisputeResolver( other1.address, other1.address, - ethers.constants.AddressZero, + ZeroAddress, other1.address ); expect(disputeResolver2.isValid()).is.true; diff --git a/test/protocol/ExchangeHandlerTest.js b/test/protocol/ExchangeHandlerTest.js index ccf8e0b8d..77435a03e 100644 --- a/test/protocol/ExchangeHandlerTest.js +++ b/test/protocol/ExchangeHandlerTest.js @@ -148,12 +148,12 @@ describe("IBosonExchangeHandler", function () { diamondAddress: protocolDiamondAddress, } = await setupTestEnvironment(contracts)); - [deployer] = await ethers.getSigners(); + [deployer] = await getSigners(); // make all account the same assistant = admin; assistantDR = adminDR; - clerk = clerkDR = { address: ethers.constants.AddressZero }; + clerk = clerkDR = { address: ZeroAddress }; // Deploy the mock tokens [foreign20, foreign721, foreign1155] = await deployMockTokens(["Foreign20", "Foreign721", "Foreign1155"]); @@ -170,10 +170,10 @@ describe("IBosonExchangeHandler", function () { async function upgradeMetaTransactionsHandlerFacet() { // Upgrade the ExchangeHandlerFacet functions // DiamondCutFacet - const cutFacetViaDiamond = await ethers.getContractAt("DiamondCutFacet", protocolDiamondAddress); + const cutFacetViaDiamond = await getContractAt("DiamondCutFacet", protocolDiamondAddress); // Deploy MockMetaTransactionsHandlerFacet - const MockMetaTransactionsHandlerFacet = await ethers.getContractFactory("MockMetaTransactionsHandlerFacet"); + const MockMetaTransactionsHandlerFacet = await getContractFactory("MockMetaTransactionsHandlerFacet"); const mockMetaTransactionsHandlerFacet = await MockMetaTransactionsHandlerFacet.deploy(); await mockMetaTransactionsHandlerFacet.deployed(); @@ -187,7 +187,7 @@ describe("IBosonExchangeHandler", function () { ]; // Send the DiamondCut transaction - const tx = await cutFacetViaDiamond.connect(deployer).diamondCut(facetCuts, ethers.constants.AddressZero, "0x"); + const tx = await cutFacetViaDiamond.connect(deployer).diamondCut(facetCuts, ZeroAddress, "0x"); // Wait for transaction to confirm const receipt = await tx.wait(); @@ -196,7 +196,7 @@ describe("IBosonExchangeHandler", function () { assert.equal(receipt.status, 1, `Diamond upgrade failed: ${tx.hash}`); // Cast Diamond to MockMetaTransactionsHandlerFacet - mockMetaTransactionsHandler = await ethers.getContractAt( + mockMetaTransactionsHandler = await getContractAt( "MockMetaTransactionsHandlerFacet", protocolDiamondAddress ); @@ -250,7 +250,7 @@ describe("IBosonExchangeHandler", function () { expect(disputeResolver.isValid()).is.true; //Create DisputeResolverFee array so offer creation will succeed - disputeResolverFees = [new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0")]; + disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", "0")]; // Make empty seller list, so every seller is allowed const sellerAllowList = []; @@ -283,7 +283,7 @@ describe("IBosonExchangeHandler", function () { voucherRedeemableFrom = offerDates.voucherRedeemableFrom; voucherValid = offerDurations.voucherValid; disputePeriod = offerDurations.disputePeriod; - sellerPool = ethers.utils.parseUnits("15", "ether").toString(); + sellerPool = parseUnits("15", "ether").toString(); // Required voucher constructor params voucher = mockVoucher(); @@ -299,7 +299,7 @@ describe("IBosonExchangeHandler", function () { // Deposit seller funds so the commit will succeed await fundsHandler .connect(assistant) - .depositFunds(seller.id, ethers.constants.AddressZero, sellerPool, { value: sellerPool }); + .depositFunds(seller.id, ZeroAddress, sellerPool, { value: sellerPool }); }); afterEach(async function () { @@ -316,7 +316,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the committed date in the expected exchange struct with the block timestamp of the tx voucher.committedDate = block.timestamp.toString(); @@ -351,17 +351,17 @@ describe("IBosonExchangeHandler", function () { it("should issue the voucher on the correct clone", async function () { // Cast expectedCloneAddress to IBosonVoucher (existing clone) - bosonVoucherClone = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucherClone = await getContractAt("IBosonVoucher", expectedCloneAddress); // Create a new seller to get new clone - seller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); seller.id = "3"; // buyer is created after seller in this test expect(seller.isValid()).is.true; await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); expectedCloneAddress = calculateContractAddress(accountHandler.address, "2"); - const bosonVoucherClone2 = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + const bosonVoucherClone2 = await getContractAt("IBosonVoucher", expectedCloneAddress); // Create an offer with new seller const { offer, offerDates, offerDurations, disputeResolverId } = await mockOffer(); @@ -372,7 +372,7 @@ describe("IBosonExchangeHandler", function () { // Deposit seller funds so the commit will succeed await fundsHandler .connect(rando) - .depositFunds(seller.id, ethers.constants.AddressZero, sellerPool, { value: sellerPool }); + .depositFunds(seller.id, ZeroAddress, sellerPool, { value: sellerPool }); const buyer2 = newOwner; @@ -384,10 +384,10 @@ describe("IBosonExchangeHandler", function () { await expect(tx) .to.emit(bosonVoucherClone, "Transfer") - .withArgs(ethers.constants.Zero, buyer.address, tokenId1); + .withArgs(constants.Zero, buyer.address, tokenId1); await expect(tx2) .to.emit(bosonVoucherClone2, "Transfer") - .withArgs(ethers.constants.Zero, buyer2.address, tokenId2); + .withArgs(constants.Zero, buyer2.address, tokenId2); // buyer should own 1 voucher on the clone1 address and buyer2 should own 1 voucher on clone2 expect(await bosonVoucherClone.balanceOf(buyer.address)).to.equal("1", "Clone 1: buyer 1 balance should be 1"); @@ -435,10 +435,10 @@ describe("IBosonExchangeHandler", function () { it("ERC2981: issued voucher should have royalty fees", async function () { // Cast expectedCloneAddress to IBosonVoucher (existing clone) - bosonVoucherClone = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucherClone = await getContractAt("IBosonVoucher", expectedCloneAddress); // Create a new seller to get new clone - seller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); seller.id = "3"; // buyer is created after seller in this test expect(seller.isValid()).is.true; @@ -448,7 +448,7 @@ describe("IBosonExchangeHandler", function () { await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); expectedCloneAddress = calculateContractAddress(accountHandler.address, "2"); - const bosonVoucherClone2 = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + const bosonVoucherClone2 = await getContractAt("IBosonVoucher", expectedCloneAddress); // Create an offer with new seller const { offer, offerDates, offerDurations, disputeResolverId } = await mockOffer(); @@ -459,7 +459,7 @@ describe("IBosonExchangeHandler", function () { // Deposit seller funds so the commit will succeed await fundsHandler .connect(rando) - .depositFunds(seller.id, ethers.constants.AddressZero, sellerPool, { value: sellerPool }); + .depositFunds(seller.id, ZeroAddress, sellerPool, { value: sellerPool }); const buyer2 = newOwner; @@ -471,10 +471,10 @@ describe("IBosonExchangeHandler", function () { await expect(tx) .to.emit(bosonVoucherClone, "Transfer") - .withArgs(ethers.constants.Zero, buyer.address, tokenId1); + .withArgs(constants.Zero, buyer.address, tokenId1); await expect(tx2) .to.emit(bosonVoucherClone2, "Transfer") - .withArgs(ethers.constants.Zero, buyer2.address, tokenId2); + .withArgs(constants.Zero, buyer2.address, tokenId2); // buyer should own 1 voucher on the clone1 address and buyer2 should own 1 voucher on clone2 expect(await bosonVoucherClone.balanceOf(buyer.address)).to.equal("1", "Clone 1: buyer 1 balance should be 1"); @@ -543,7 +543,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the committed date in the expected exchange struct with the block timestamp of the tx voucher.committedDate = block.timestamp.toString(); @@ -579,7 +579,7 @@ describe("IBosonExchangeHandler", function () { it("Should not decrement quantityAvailable if offer is unlimited", async function () { // Create an offer with unlimited quantity let { offer, ...details } = await mockOffer(); - offer.quantityAvailable = ethers.constants.MaxUint256.toString(); + offer.quantityAvailable = constants.MaxUint256.toString(); // Delete unnecessary field delete details.offerFees; @@ -596,7 +596,7 @@ describe("IBosonExchangeHandler", function () { // Offer qunantityAvailable should not be decremented [, offer] = await offerHandler.connect(rando).getOffer(offerId); - expect(offer.quantityAvailable).to.equal(ethers.constants.MaxUint256, "Quantity available should be unlimited"); + expect(offer.quantityAvailable).to.equal(constants.MaxUint256, "Quantity available should be unlimited"); }); it("Should not decrement seller funds if offer price and sellerDeposit is 0", async function () { @@ -661,7 +661,7 @@ describe("IBosonExchangeHandler", function () { it("buyer address is the zero address", async function () { // Attempt to commit, expecting revert await expect( - exchangeHandler.connect(buyer).commitToOffer(ethers.constants.AddressZero, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(ZeroAddress, offerId, { value: price }) ).to.revertedWith(RevertReasons.INVALID_ADDRESS); }); @@ -688,14 +688,14 @@ describe("IBosonExchangeHandler", function () { it("offer is not yet available for commits", async function () { // Create an offer with staring date in the future // get current block timestamp - const block = await ethers.provider.getBlock("latest"); + const block = await provider.getBlock("latest"); const now = block.timestamp.toString(); // set validFrom date in the past - offerDates.validFrom = ethers.BigNumber.from(now) - .add(oneMonth * 6) + offerDates.validFrom = BigInt(now) + +oneMonth * 6 .toString(); // 6 months in the future - offerDates.validUntil = ethers.BigNumber.from(offerDates.validFrom).add(10).toString(); // just after the valid from so it succeeds. + offerDates.validUntil = BigInt(offerDates.validFrom)+10.toString(); // just after the valid from so it succeeds. await offerHandler .connect(assistant) @@ -742,7 +742,7 @@ describe("IBosonExchangeHandler", function () { // expected address of the first clone const voucherCloneAddress = calculateContractAddress(accountHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("BosonVoucher", voucherCloneAddress); + bosonVoucher = await getContractAt("BosonVoucher", voucherCloneAddress); await bosonVoucher.connect(assistant).preMint(offer.id, offer.quantityAvailable); tokenId = "1"; @@ -757,7 +757,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the committed date in the expected exchange struct with the block timestamp of the tx voucher.committedDate = block.timestamp.toString(); @@ -814,7 +814,7 @@ describe("IBosonExchangeHandler", function () { // Before voucher is transferred, it should have zero royalty fee let [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(tokenId, offer.price); - assert.equal(receiver, ethers.constants.AddressZero, "Recipient address is incorrect"); + assert.equal(receiver, ZeroAddress, "Recipient address is incorrect"); assert.equal(royaltyAmount.toString(), "0", "Royalty amount is incorrect"); // Commit to preminted offer, creating a new exchange @@ -862,7 +862,7 @@ describe("IBosonExchangeHandler", function () { // Deposit seller funds so the commit will succeed await fundsHandler .connect(rando) - .depositFunds(seller.id, ethers.constants.AddressZero, offer.sellerDeposit, { value: offer.sellerDeposit }); + .depositFunds(seller.id, ZeroAddress, offer.sellerDeposit, { value: offer.sellerDeposit }); // reserve half of the offer, so it's still possible to commit directly await offerHandler.connect(assistant).reserveRange(offerId, rangeLength, assistant.address); @@ -906,10 +906,10 @@ describe("IBosonExchangeHandler", function () { await bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId); // impersonate voucher contract and give it some funds - const impersonatedBosonVoucher = await ethers.getImpersonatedSigner(bosonVoucher.address); - await ethers.provider.send("hardhat_setBalance", [ + const impersonatedBosonVoucher = await getImpersonatedSigner(bosonVoucher.address); + await provider.send("hardhat_setBalance", [ impersonatedBosonVoucher.address, - ethers.utils.parseEther("10").toHexString(), + parseEther("10").toHexString(), ]); // Simulate a second commit with the same token id @@ -931,16 +931,16 @@ describe("IBosonExchangeHandler", function () { it("offer is not yet available for commits", async function () { // Create an offer with staring date in the future // get current block timestamp - const block = await ethers.provider.getBlock("latest"); + const block = await provider.getBlock("latest"); const now = block.timestamp.toString(); // Get next offer id offerId = await offerHandler.getNextOfferId(); // set validFrom date in the past - offerDates.validFrom = ethers.BigNumber.from(now) - .add(oneMonth * 6) + offerDates.validFrom = BigInt(now) + +oneMonth * 6 .toString(); // 6 months in the future - offerDates.validUntil = ethers.BigNumber.from(offerDates.validFrom).add(10).toString(); // just after the valid from so it succeeds. + offerDates.validUntil = BigInt(offerDates.validFrom)+10.toString(); // just after the valid from so it succeeds. await offerHandler .connect(assistant) @@ -1350,11 +1350,11 @@ describe("IBosonExchangeHandler", function () { await exchangeHandler.connect(buyer).redeemVoucher(exchange.id); // Get the current block info - blockNumber = await ethers.provider.getBlockNumber(); - block = await ethers.provider.getBlock(blockNumber); + blockNumber = await provider.getBlockNumber(); + block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = ethers.BigNumber.from(block.timestamp).add(disputePeriod).add(1).toNumber(); + newTime = BigInt(block.timestamp)+disputePeriod+1.toNumber(); await setNextBlockTimestamp(newTime); // Complete exchange @@ -1371,11 +1371,11 @@ describe("IBosonExchangeHandler", function () { await exchangeHandler.connect(buyer).redeemVoucher(exchange.id); // Get the current block info - blockNumber = await ethers.provider.getBlockNumber(); - block = await ethers.provider.getBlock(blockNumber); + blockNumber = await provider.getBlockNumber(); + block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = ethers.BigNumber.from(block.timestamp).add(disputePeriod).add(1).toNumber(); + newTime = BigInt(block.timestamp)+disputePeriod+1.toNumber(); await setNextBlockTimestamp(newTime); // Complete exchange @@ -1392,11 +1392,11 @@ describe("IBosonExchangeHandler", function () { await exchangeHandler.connect(buyer).redeemVoucher(exchange.id); // Get the current block info - blockNumber = await ethers.provider.getBlockNumber(); - block = await ethers.provider.getBlock(blockNumber); + blockNumber = await provider.getBlockNumber(); + block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = ethers.BigNumber.from(block.timestamp).add(disputePeriod).add(1).toNumber(); + newTime = BigInt(block.timestamp)+disputePeriod+1.toNumber(); await setNextBlockTimestamp(newTime); // Create a rando buyer account @@ -1551,11 +1551,11 @@ describe("IBosonExchangeHandler", function () { it("should emit an ExchangeCompleted event if assistant calls after dispute period", async function () { // Get the current block info - blockNumber = await ethers.provider.getBlockNumber(); - block = await ethers.provider.getBlock(blockNumber); + blockNumber = await provider.getBlockNumber(); + block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = ethers.BigNumber.from(block.timestamp).add(disputePeriod).add(1).toNumber(); + newTime = BigInt(block.timestamp)+disputePeriod+1.toNumber(); await setNextBlockTimestamp(newTime); // Complete exchange @@ -1583,11 +1583,11 @@ describe("IBosonExchangeHandler", function () { it("should emit an ExchangeCompleted event if anyone calls after dispute period", async function () { // Get the current block info - blockNumber = await ethers.provider.getBlockNumber(); - block = await ethers.provider.getBlock(blockNumber); + blockNumber = await provider.getBlockNumber(); + block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = ethers.BigNumber.from(block.timestamp).add(disputePeriod).add(1).toNumber(); + newTime = BigInt(block.timestamp)+disputePeriod+1.toNumber(); await setNextBlockTimestamp(newTime); // Complete exchange @@ -1780,7 +1780,7 @@ describe("IBosonExchangeHandler", function () { // Transfer voucher to new owner tokenId = deriveTokenId(offerId, exchange.id); bosonVoucherCloneAddress = calculateContractAddress(exchangeHandler.address, "1"); - bosonVoucherClone = await ethers.getContractAt("IBosonVoucher", bosonVoucherCloneAddress); + bosonVoucherClone = await getContractAt("IBosonVoucher", bosonVoucherCloneAddress); await bosonVoucherClone.connect(buyer).transferFrom(buyer.address, newOwner.address, tokenId); // Cancel the voucher, expecting event @@ -1860,7 +1860,7 @@ describe("IBosonExchangeHandler", function () { it("getCurrentSenderAddress() returns zero address and has isMetaTransaction set to true on chain", async function () { await upgradeMetaTransactionsHandlerFacet(); - await mockMetaTransactionsHandler.setAsMetaTransactionAndCurrentSenderAs(ethers.constants.AddressZero); + await mockMetaTransactionsHandler.setAsMetaTransactionAndCurrentSenderAs(ZeroAddress); // Attempt to cancel the voucher, expecting revert await expect(exchangeHandler.connect(rando).cancelVoucher(exchange.id)).to.revertedWith( @@ -2156,7 +2156,7 @@ describe("IBosonExchangeHandler", function () { it("Should not decrease twin supplyAvailable if supply is unlimited", async function () { // Change twin supply to unlimited - twin20.supplyAvailable = ethers.constants.MaxUint256.toString(); + twin20.supplyAvailable = constants.MaxUint256.toString(); twin20.id = "4"; // Create a new twin @@ -2296,7 +2296,7 @@ describe("IBosonExchangeHandler", function () { await foreign20.connect(assistant).approve(protocolDiamondAddress, "0"); // Deploy contract to test redeem called by another contract - let TestProtocolFunctionsFactory = await ethers.getContractFactory("TestProtocolFunctions"); + let TestProtocolFunctionsFactory = await getContractFactory("TestProtocolFunctions"); const testProtocolFunctions = await TestProtocolFunctionsFactory.deploy(protocolDiamondAddress); await testProtocolFunctions.deployed(); @@ -2436,7 +2436,7 @@ describe("IBosonExchangeHandler", function () { let other721; beforeEach(async function () { // Deploy a new ERC721 token - let TokenContractFactory = await ethers.getContractFactory("Foreign721"); + let TokenContractFactory = await getContractFactory("Foreign721"); other721 = await TokenContractFactory.connect(rando).deploy(); // Mint enough tokens to cover the offer @@ -2454,7 +2454,7 @@ describe("IBosonExchangeHandler", function () { .createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId); // Change twin supply to unlimited and token address to the new token - twin721.supplyAvailable = ethers.constants.MaxUint256.toString(); + twin721.supplyAvailable = constants.MaxUint256.toString(); twin721.tokenAddress = other721.address; twin721.id = "4"; @@ -2547,7 +2547,7 @@ describe("IBosonExchangeHandler", function () { it("should raise a dispute when buyer account is a contract", async function () { // Deploy contract to test redeem called by another contract - let TestProtocolFunctionsFactory = await ethers.getContractFactory("TestProtocolFunctions"); + let TestProtocolFunctionsFactory = await getContractFactory("TestProtocolFunctions"); const testProtocolFunctions = await TestProtocolFunctionsFactory.deploy(protocolDiamondAddress); await testProtocolFunctions.deployed(); @@ -2616,7 +2616,7 @@ describe("IBosonExchangeHandler", function () { it("Should not decrease twin supplyAvailable if supply is unlimited", async function () { // Change twin supply to unlimited - twin1155.supplyAvailable = ethers.constants.MaxUint256.toString(); + twin1155.supplyAvailable = constants.MaxUint256.toString(); twin1155.id = "4"; // Create a new twin @@ -2726,7 +2726,7 @@ describe("IBosonExchangeHandler", function () { it("should raise a dispute when buyer account is a contract", async function () { // Deploy contract to test redeem called by another contract - let TestProtocolFunctionsFactory = await ethers.getContractFactory("TestProtocolFunctions"); + let TestProtocolFunctionsFactory = await getContractFactory("TestProtocolFunctions"); const testProtocolFunctions = await TestProtocolFunctionsFactory.deploy(protocolDiamondAddress); await testProtocolFunctions.deployed(); @@ -2911,7 +2911,7 @@ describe("IBosonExchangeHandler", function () { beforeEach(async function () { // Deploy a new ERC721 token - let TokenContractFactory = await ethers.getContractFactory("Foreign721"); + let TokenContractFactory = await getContractFactory("Foreign721"); other721 = await TokenContractFactory.connect(rando).deploy(); // Mint enough tokens to cover the offer @@ -2929,18 +2929,18 @@ describe("IBosonExchangeHandler", function () { .createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId); // Change twin supply to unlimited and token address to the new token - twin721.supplyAvailable = ethers.constants.MaxUint256.toString(); + twin721.supplyAvailable = constants.MaxUint256.toString(); twin721.tokenAddress = other721.address; twin721.id = "4"; // Create a new ERC721 twin with the new token address await twinHandler.connect(assistant).createTwin(twin721.toStruct()); - twin20.supplyAvailable = ethers.constants.MaxUint256.toString(); + twin20.supplyAvailable = constants.MaxUint256.toString(); twin20.id = "5"; // Create a new ERC20 twin with the new token address await twinHandler.connect(assistant).createTwin(twin20.toStruct()); - twin1155.supplyAvailable = ethers.constants.MaxUint256.toString(); + twin1155.supplyAvailable = constants.MaxUint256.toString(); twin1155.id = "6"; // Create a new ERC1155 twin with the new token address await twinHandler.connect(assistant).createTwin(twin1155.toStruct()); @@ -3075,7 +3075,7 @@ describe("IBosonExchangeHandler", function () { await foreign20.connect(assistant).approve(protocolDiamondAddress, "0"); // Deploy contract to test redeem called by another contract - let TestProtocolFunctionsFactory = await ethers.getContractFactory("TestProtocolFunctions"); + let TestProtocolFunctionsFactory = await getContractFactory("TestProtocolFunctions"); const testProtocolFunctions = await TestProtocolFunctionsFactory.deploy(protocolDiamondAddress); await testProtocolFunctions.deployed(); @@ -3125,7 +3125,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the committed date in the expected exchange struct with the block timestamp of the tx voucher.committedDate = block.timestamp.toString(); @@ -3134,7 +3134,7 @@ describe("IBosonExchangeHandler", function () { voucher.validUntilDate = calculateVoucherExpiry(block, voucherRedeemableFrom, voucherValid); // New expiry date for extensions - validUntilDate = ethers.BigNumber.from(voucher.validUntilDate).add(oneMonth).toString(); + validUntilDate = BigInt(voucher.validUntilDate)+oneMonth.toString(); }); it("should emit an VoucherExtended event when seller's assistant calls", async function () { @@ -3196,7 +3196,7 @@ describe("IBosonExchangeHandler", function () { it("new date is not later than the current one", async function () { // New expiry date is older than current - validUntilDate = ethers.BigNumber.from(voucher.validUntilDate).sub(oneMonth).toString(); + validUntilDate = BigInt(voucher.validUntilDate)-oneMonth.toString(); // Attempt to extend voucher, expecting revert await expect(exchangeHandler.connect(assistant).extendVoucher(exchange.id, validUntilDate)).to.revertedWith( @@ -3213,7 +3213,7 @@ describe("IBosonExchangeHandler", function () { // Client used for tests bosonVoucherCloneAddress = calculateContractAddress(exchangeHandler.address, "1"); - bosonVoucherClone = await ethers.getContractAt("IBosonVoucher", bosonVoucherCloneAddress); + bosonVoucherClone = await getContractAt("IBosonVoucher", bosonVoucherCloneAddress); tokenId = deriveTokenId(offerId, exchange.id); }); @@ -3339,12 +3339,12 @@ describe("IBosonExchangeHandler", function () { it("Caller is not a clone address associated with the seller", async function () { // Create a new seller to get new clone - seller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); expect(seller.isValid()).is.true; await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); expectedCloneAddress = calculateContractAddress(accountHandler.address, "2"); - const bosonVoucherClone2 = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + const bosonVoucherClone2 = await getContractAt("IBosonVoucher", expectedCloneAddress); // For the sake of test, mint token on bv2 with the id of token on bv1 // Temporarily grant PROTOCOL role to deployer account @@ -3439,11 +3439,11 @@ describe("IBosonExchangeHandler", function () { await exchangeHandler.connect(buyer).redeemVoucher(exchange.id); // Get the current block info - blockNumber = await ethers.provider.getBlockNumber(); - block = await ethers.provider.getBlock(blockNumber); + blockNumber = await provider.getBlockNumber(); + block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = ethers.BigNumber.from(voucherRedeemableFrom).add(disputePeriod).add(1).toNumber(); + newTime = BigInt(voucherRedeemableFrom)+disputePeriod+1.toNumber(); await setNextBlockTimestamp(newTime); // Complete exchange @@ -3578,7 +3578,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx and set escalatedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); const escalatedDate = block.timestamp.toString(); await setNextBlockTimestamp(Number(escalatedDate) + Number(disputeResolver.escalationResponsePeriod)); @@ -3692,7 +3692,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the committed date in the expected exchange struct with the block timestamp of the tx voucher.committedDate = block.timestamp.toString(); @@ -3708,7 +3708,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the redeemedDate date in the expected exchange struct voucher.redeemedDate = block.timestamp.toString(); @@ -3720,7 +3720,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the finalizedDate date in the expected exchange struct exchange.finalizedDate = block.timestamp.toString(); @@ -3799,7 +3799,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the committed date in the expected exchange struct with the block timestamp of the tx voucher.committedDate = block.timestamp.toString(); @@ -3815,14 +3815,14 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the redeemedDate date in the expected exchange struct voucher.redeemedDate = block.timestamp.toString(); // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the redeemedDate date in the expected exchange struct voucher.redeemedDate = block.timestamp.toString(); @@ -3832,7 +3832,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the finalizedDate date in the expected exchange struct exchange.finalizedDate = block.timestamp.toString(); @@ -3880,7 +3880,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); }); @@ -3891,7 +3891,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the finalizedDate date in the expected exchange struct exchange.finalizedDate = block.timestamp.toString(); @@ -3943,7 +3943,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); const escalatedDate = block.timestamp.toString(); @@ -3952,7 +3952,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the finalizedDate date in the expected exchange struct exchange.finalizedDate = block.timestamp.toString(); @@ -4061,7 +4061,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the committed date in the expected exchange struct with the block timestamp of the tx voucher.committedDate = block.timestamp.toString(); @@ -4081,7 +4081,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the redeemedDate date in the expected exchange struct voucher.redeemedDate = block.timestamp.toString(); @@ -4091,7 +4091,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the finalizedDate date in the expected exchange struct exchange.finalizedDate = block.timestamp.toString(); @@ -4159,7 +4159,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the committed date in the expected exchange struct with the block timestamp of the tx voucher.committedDate = block.timestamp.toString(); @@ -4179,7 +4179,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the redeemedDate date in the expected exchange struct voucher.redeemedDate = block.timestamp.toString(); @@ -4189,7 +4189,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the finalizedDate date in the expected exchange struct exchange.finalizedDate = block.timestamp.toString(); @@ -4281,7 +4281,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the committed date in the expected exchange struct with the block timestamp of the tx voucher.committedDate = block.timestamp.toString(); @@ -4297,7 +4297,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the redeemedDate date in the expected exchange struct voucher.redeemedDate = block.timestamp.toString(); @@ -4307,7 +4307,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the finalizedDate date in the expected exchange struct exchange.finalizedDate = block.timestamp.toString(); @@ -4358,7 +4358,7 @@ describe("IBosonExchangeHandler", function () { await accountHandler.connect(rando).createAgent(agent); // Update agentFee - const agentFee = ethers.BigNumber.from(offer.price).mul(agent.feePercentage).div("10000").toString(); + const agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); offerFees.agentFee = agentFee; // Create a new offer @@ -4393,7 +4393,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the committed date in the expected exchange struct with the block timestamp of the tx voucher.committedDate = block.timestamp.toString(); @@ -4409,7 +4409,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the redeemedDate date in the expected exchange struct voucher.redeemedDate = block.timestamp.toString(); @@ -4419,7 +4419,7 @@ describe("IBosonExchangeHandler", function () { // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); // Update the finalizedDate date in the expected exchange struct exchange.finalizedDate = block.timestamp.toString(); diff --git a/test/protocol/FundsHandlerTest.js b/test/protocol/FundsHandlerTest.js index 9212ed4cf..72d7c59f5 100644 --- a/test/protocol/FundsHandlerTest.js +++ b/test/protocol/FundsHandlerTest.js @@ -135,9 +135,9 @@ describe("IBosonFundsHandler", function () { // make all account the same assistant = admin; assistantDR = adminDR; - clerk = clerkDR = { address: ethers.constants.AddressZero }; + clerk = clerkDR = { address: ZeroAddress }; - [deployer, protocolTreasury] = await ethers.getSigners(); + [deployer, protocolTreasury] = await getSigners(); // Deploy the mock token [mockToken] = await deployMockTokens(["Foreign20"]); @@ -211,10 +211,10 @@ describe("IBosonFundsHandler", function () { await expect( fundsHandler .connect(rando) - .depositFunds(seller.id, ethers.constants.AddressZero, depositAmount, { value: depositAmount }) + .depositFunds(seller.id, ZeroAddress, depositAmount, { value: depositAmount }) ) .to.emit(fundsHandler, "FundsDeposited") - .withArgs(seller.id, rando.address, ethers.constants.AddressZero, depositAmount); + .withArgs(seller.id, rando.address, ZeroAddress, depositAmount); }); it("should update state", async function () { @@ -231,13 +231,13 @@ describe("IBosonFundsHandler", function () { // Deposit native currency to the same seller id await fundsHandler .connect(rando) - .depositFunds(seller.id, ethers.constants.AddressZero, depositAmount, { value: depositAmount }); + .depositFunds(seller.id, ZeroAddress, depositAmount, { value: depositAmount }); // Get new on chain state returnedAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); // Chain state should match the expected available funds - expectedAvailableFunds.funds.push(new Funds(ethers.constants.AddressZero, "Native currency", depositAmount)); + expectedAvailableFunds.funds.push(new Funds(ZeroAddress, "Native currency", depositAmount)); expect(returnedAvailableFunds).to.eql(expectedAvailableFunds); }); @@ -296,7 +296,7 @@ describe("IBosonFundsHandler", function () { await expect( fundsHandler .connect(rando) - .depositFunds(seller.id, ethers.constants.AddressZero, depositAmount * 2, { value: depositAmount }) + .depositFunds(seller.id, ZeroAddress, depositAmount * 2, { value: depositAmount }) ).to.revertedWith(RevertReasons.NATIVE_WRONG_AMOUNT); }); @@ -377,7 +377,7 @@ describe("IBosonFundsHandler", function () { //Create DisputeResolverFee array so offer creation will succeed disputeResolverFees = [ - new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0"), + new DisputeResolverFee(ZeroAddress, "Native", "0"), new DisputeResolverFee(mockToken.address, "mockToken", "0"), ]; @@ -437,7 +437,7 @@ describe("IBosonFundsHandler", function () { fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, sellerDeposit), fundsHandler .connect(assistant) - .depositFunds(seller.id, ethers.constants.AddressZero, sellerDeposit, { value: sellerDeposit }), + .depositFunds(seller.id, ZeroAddress, sellerDeposit, { value: sellerDeposit }), ]); // commit to both offers @@ -460,21 +460,21 @@ describe("IBosonFundsHandler", function () { // expected payoffs - they are the same for token and native currency // buyer: price - buyerCancelPenalty - buyerPayoff = ethers.BigNumber.from(offerToken.price).sub(offerToken.buyerCancelPenalty).toString(); + buyerPayoff = BigInt(offerToken.price)-offerToken.buyerCancelPenalty.toString(); // seller: sellerDeposit + buyerCancelPenalty - sellerPayoff = ethers.BigNumber.from(offerToken.sellerDeposit).add(offerToken.buyerCancelPenalty).toString(); + sellerPayoff = BigInt(offerToken.sellerDeposit)+offerToken.buyerCancelPenalty.toString(); }); it("should emit a FundsWithdrawn event", async function () { // Withdraw funds, testing for the event // Withdraw tokens - tokenListSeller = [mockToken.address, ethers.constants.AddressZero]; - tokenListBuyer = [ethers.constants.AddressZero, mockToken.address]; + tokenListSeller = [mockToken.address, ZeroAddress]; + tokenListBuyer = [ZeroAddress, mockToken.address]; // Withdraw amounts - tokenAmountsSeller = [sellerPayoff, ethers.BigNumber.from(sellerPayoff).div("2").toString()]; - tokenAmountsBuyer = [buyerPayoff, ethers.BigNumber.from(buyerPayoff).div("5").toString()]; + tokenAmountsSeller = [sellerPayoff, BigInt(sellerPayoff)/"2".toString()]; + tokenAmountsBuyer = [buyerPayoff, BigInt(buyerPayoff)/"5".toString()]; // seller withdrawal const tx = await fundsHandler @@ -489,8 +489,8 @@ describe("IBosonFundsHandler", function () { .withArgs( seller.id, treasury.address, - ethers.constants.Zero, - ethers.BigNumber.from(sellerPayoff).div("2"), + constants.Zero, + BigInt(sellerPayoff)/"2", assistant.address ); @@ -502,13 +502,13 @@ describe("IBosonFundsHandler", function () { buyerId, buyer.address, mockToken.address, - ethers.BigNumber.from(buyerPayoff).div("5"), + BigInt(buyerPayoff)/"5", buyer.address ); await expect(tx2) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(buyerId, buyer.address, ethers.constants.Zero, buyerPayoff, buyer.address); + .withArgs(buyerId, buyer.address, constants.Zero, buyerPayoff, buyer.address); }); it("should update state", async function () { @@ -516,12 +516,12 @@ describe("IBosonFundsHandler", function () { // Read on chain state sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); - const treasuryBalanceBefore = await ethers.provider.getBalance(treasury.address); + const treasuryBalanceBefore = await provider.getBalance(treasury.address); // Chain state should match the expected available funds before the withdrawal expectedSellerAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", sellerPayoff), - new Funds(ethers.constants.AddressZero, "Native currency", sellerPayoff), + new Funds(ZeroAddress, "Native currency", sellerPayoff), ]); expect(sellersAvailableFunds).to.eql( expectedSellerAvailableFunds, @@ -529,23 +529,23 @@ describe("IBosonFundsHandler", function () { ); // withdraw funds - const withdrawAmount = ethers.BigNumber.from(sellerPayoff) - .sub(ethers.utils.parseUnits("0.1", "ether")) + const withdrawAmount = BigInt(sellerPayoff) + -parseUnits("0.1", "ether") .toString(); await fundsHandler .connect(assistant) - .withdrawFunds(seller.id, [ethers.constants.AddressZero], [withdrawAmount]); + .withdrawFunds(seller.id, [ZeroAddress], [withdrawAmount]); // Read on chain state sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); - const treasuryBalanceAfter = await ethers.provider.getBalance(treasury.address); + const treasuryBalanceAfter = await provider.getBalance(treasury.address); // Chain state should match the expected available funds after the withdrawal // Native currency available funds are reduced for the withdrawal amount expectedSellerAvailableFunds.funds[1] = new Funds( - ethers.constants.AddressZero, + ZeroAddress, "Native currency", - ethers.BigNumber.from(sellerPayoff).sub(withdrawAmount).toString() + BigInt(sellerPayoff)-withdrawAmount.toString() ); expect(sellersAvailableFunds).to.eql( expectedSellerAvailableFunds, @@ -553,7 +553,7 @@ describe("IBosonFundsHandler", function () { ); // Native currency balance is increased for the withdrawAmount expect(treasuryBalanceAfter).to.eql( - treasuryBalanceBefore.add(withdrawAmount), + treasuryBalanceBefore+withdrawAmount, "Treasury token balance mismatch" ); @@ -566,7 +566,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds before the withdrawal expectedBuyerAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", buyerPayoff), - new Funds(ethers.constants.AddressZero, "Native currency", buyerPayoff), + new Funds(ZeroAddress, "Native currency", buyerPayoff), ]); expect(buyerAvailableFunds).to.eql( expectedBuyerAvailableFunds, @@ -583,26 +583,26 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds after the withdrawal // Since all tokens are withdrawn, token should be removed from the list expectedBuyerAvailableFunds = new FundsList([ - new Funds(ethers.constants.AddressZero, "Native currency", buyerPayoff), + new Funds(ZeroAddress, "Native currency", buyerPayoff), ]); expect(buyerAvailableFunds).to.eql( expectedBuyerAvailableFunds, "Buyer available funds mismatch after withdrawal" ); // Token balance is increased for the buyer payoff - expect(buyerBalanceAfter).to.eql(buyerBalanceBefore.add(buyerPayoff), "Buyer token balance mismatch"); + expect(buyerBalanceAfter).to.eql(buyerBalanceBefore+buyerPayoff, "Buyer token balance mismatch"); }); it("should allow to withdraw all funds at once", async function () { // Read on chain state sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); - const treasuryNativeBalanceBefore = await ethers.provider.getBalance(treasury.address); + const treasuryNativeBalanceBefore = await provider.getBalance(treasury.address); const treasuryTokenBalanceBefore = await mockToken.balanceOf(treasury.address); // Chain state should match the expected available funds before the withdrawal expectedSellerAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", sellerPayoff), - new Funds(ethers.constants.AddressZero, "Native currency", sellerPayoff), + new Funds(ZeroAddress, "Native currency", sellerPayoff), ]); expect(sellersAvailableFunds).to.eql( expectedSellerAvailableFunds, @@ -614,7 +614,7 @@ describe("IBosonFundsHandler", function () { // Read on chain state sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); - const treasuryNativeBalanceAfter = await ethers.provider.getBalance(treasury.address); + const treasuryNativeBalanceAfter = await provider.getBalance(treasury.address); const treasuryTokenBalanceAfter = await mockToken.balanceOf(treasury.address); // Chain state should match the expected available funds after the withdrawal @@ -626,11 +626,11 @@ describe("IBosonFundsHandler", function () { ); // Native currency balance is increased for the withdrawAmount expect(treasuryNativeBalanceAfter).to.eql( - treasuryNativeBalanceBefore.add(sellerPayoff), + treasuryNativeBalanceBefore+sellerPayoff, "Treasury native currency balance mismatch" ); expect(treasuryTokenBalanceAfter).to.eql( - treasuryTokenBalanceBefore.add(sellerPayoff), + treasuryTokenBalanceBefore+sellerPayoff, "Treasury token balance mismatch" ); }); @@ -641,13 +641,13 @@ describe("IBosonFundsHandler", function () { // Read on chain state sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); - const treasuryNativeBalanceBefore = await ethers.provider.getBalance(treasury.address); + const treasuryNativeBalanceBefore = await provider.getBalance(treasury.address); const treasuryTokenBalanceBefore = await mockToken.balanceOf(treasury.address); // Chain state should match the expected available funds before the withdrawal expectedSellerAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", sellerPayoff), - new Funds(ethers.constants.AddressZero, "Native currency", sellerPayoff), + new Funds(ZeroAddress, "Native currency", sellerPayoff), ]); expect(sellersAvailableFunds).to.eql( expectedSellerAvailableFunds, @@ -659,13 +659,13 @@ describe("IBosonFundsHandler", function () { // Read on chain state sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); - let treasuryNativeBalanceAfter = await ethers.provider.getBalance(treasury.address); + let treasuryNativeBalanceAfter = await provider.getBalance(treasury.address); const treasuryTokenBalanceAfter = await mockToken.balanceOf(treasury.address); // Chain state should match the expected available funds after the withdrawal // Funds available should still have the entries from above the threshold expectedSellerAvailableFunds = new FundsList([ - new Funds(ethers.constants.AddressZero, "Native currency", sellerPayoff), + new Funds(ZeroAddress, "Native currency", sellerPayoff), ]); expect(sellersAvailableFunds).to.eql( expectedSellerAvailableFunds, @@ -677,7 +677,7 @@ describe("IBosonFundsHandler", function () { "Treasury native currency balance mismatch after first withdrawal" ); expect(treasuryTokenBalanceAfter).to.eql( - treasuryTokenBalanceBefore.add(sellerPayoff), + treasuryTokenBalanceBefore+sellerPayoff, "Treasury token balance mismatch after first withdrawal" ); @@ -686,7 +686,7 @@ describe("IBosonFundsHandler", function () { // Read on chain state sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); - treasuryNativeBalanceAfter = await ethers.provider.getBalance(treasury.address); + treasuryNativeBalanceAfter = await provider.getBalance(treasury.address); // Chain state should match the expected available funds after the withdrawal // Funds available should now be an empty list @@ -697,16 +697,16 @@ describe("IBosonFundsHandler", function () { ); // Native currency balance is increased for the withdrawAmount expect(treasuryNativeBalanceAfter).to.eql( - treasuryNativeBalanceBefore.add(sellerPayoff), + treasuryNativeBalanceBefore+sellerPayoff, "Treasury native currency balance mismatch after second withdrawal" ); }); it("It's possible to withdraw same toke twice if in total enough available funds", async function () { - let reduction = ethers.utils.parseUnits("0.1", "ether").toString(); + let reduction = parseUnits("0.1", "ether").toString(); // Withdraw token tokenListSeller = [mockToken.address, mockToken.address]; - tokenAmountsSeller = [ethers.BigNumber.from(sellerPayoff).sub(reduction).toString(), reduction]; + tokenAmountsSeller = [BigInt(sellerPayoff)-reduction.toString(), reduction]; // seller withdrawal const tx = await fundsHandler @@ -718,7 +718,7 @@ describe("IBosonFundsHandler", function () { seller.id, treasury.address, mockToken.address, - ethers.BigNumber.from(sellerPayoff).sub(reduction).toString(), + BigInt(sellerPayoff)-reduction.toString(), assistant.address ); @@ -793,7 +793,7 @@ describe("IBosonFundsHandler", function () { const feeCollectorNativeBalanceAfter = await mockToken.balanceOf(agent.wallet); // Expected balance - const expectedFeeCollectorNativeBalanceAfter = ethers.BigNumber.from(feeCollectorNativeBalanceBefore).add( + const expectedFeeCollectorNativeBalanceAfter = BigInt(feeCollectorNativeBalanceBefore).add( agentPayoff ); @@ -811,7 +811,7 @@ describe("IBosonFundsHandler", function () { // retract from the dispute await disputeHandler.connect(buyer).retractDispute(exchangeId); - agentPayoff = ethers.BigNumber.from(agentOffer.price).mul(agent.feePercentage).div("10000").toString(); + agentPayoff = BigInt(agentOffer.price)*agent.feePercentage/"10000".toString(); // Check the balance BEFORE withdrawFunds() const feeCollectorNativeBalanceBefore = await mockToken.balanceOf(agent.wallet); @@ -824,7 +824,7 @@ describe("IBosonFundsHandler", function () { const feeCollectorNativeBalanceAfter = await mockToken.balanceOf(agent.wallet); // Expected balance - const expectedFeeCollectorNativeBalanceAfter = ethers.BigNumber.from(feeCollectorNativeBalanceBefore).add( + const expectedFeeCollectorNativeBalanceAfter = BigInt(feeCollectorNativeBalanceBefore).add( agentPayoff ); @@ -839,10 +839,10 @@ describe("IBosonFundsHandler", function () { context("💔 Revert Reasons", async function () { it("The funds region of protocol is paused", async function () { // Withdraw tokens - tokenListBuyer = [ethers.constants.AddressZero, mockToken.address]; + tokenListBuyer = [ZeroAddress, mockToken.address]; // Withdraw amounts - tokenAmountsBuyer = [buyerPayoff, ethers.BigNumber.from(buyerPayoff).div("5").toString()]; + tokenAmountsBuyer = [buyerPayoff, BigInt(buyerPayoff)/"5".toString()]; // Pause the funds region of the protocol await pauseHandler.connect(pauser).pause([PausableRegion.Funds]); @@ -872,7 +872,7 @@ describe("IBosonFundsHandler", function () { it("Token list address does not match token amount address", async function () { // Withdraw token - tokenList = [mockToken.address, ethers.constants.AddressZero]; + tokenList = [mockToken.address, ZeroAddress]; tokenAmounts = [sellerPayoff]; // Attempt to withdraw the funds, expecting revert @@ -882,7 +882,7 @@ describe("IBosonFundsHandler", function () { }); it("Caller wants to withdraw more different tokens than allowed", async function () { - tokenList = new Array(101).fill(ethers.constants.AddressZero); + tokenList = new Array(101).fill(ZeroAddress); tokenAmounts = new Array(101).fill("1"); // Attempt to withdraw the funds, expecting revert @@ -894,7 +894,7 @@ describe("IBosonFundsHandler", function () { it("Caller tries to withdraw more than they have in the available funds", async function () { // Withdraw token tokenList = [mockToken.address]; - tokenAmounts = [ethers.BigNumber.from(sellerPayoff).mul("2")]; + tokenAmounts = [BigInt(sellerPayoff)*"2"]; // Attempt to withdraw the funds, expecting revert await expect( @@ -952,7 +952,7 @@ describe("IBosonFundsHandler", function () { fallbackErrorContract.withdrawFunds( fundsHandler.address, fallbackContractBuyerId, - [ethers.constants.AddressZero], + [ZeroAddress], [offerNative.price] ) ).to.revertedWith(RevertReasons.TOKEN_TRANSFER_FAILED); @@ -979,7 +979,7 @@ describe("IBosonFundsHandler", function () { fallbackErrorContract.withdrawFunds( fundsHandler.address, fallbackContractBuyerId, - [ethers.constants.AddressZero], + [ZeroAddress], [offerNative.price] ) ).to.revertedWith(RevertReasons.TOKEN_TRANSFER_FAILED); @@ -1035,7 +1035,7 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // seller: sellerDeposit + offerToken.price - sellerPayoff = ethers.BigNumber.from(offerToken.sellerDeposit).add(offerToken.price).toString(); + sellerPayoff = BigInt(offerToken.sellerDeposit)+offerToken.price.toString(); // protocol: protocolFee protocolPayoff = offerTokenProtocolFee; @@ -1049,7 +1049,7 @@ describe("IBosonFundsHandler", function () { it("should emit a FundsWithdrawn event", async function () { // Withdraw funds, testing for the event - tokenList = [mockToken.address, ethers.constants.AddressZero]; + tokenList = [mockToken.address, ZeroAddress]; tokenAmounts = [protocolPayoff, protocolPayoff]; // protocol fee withdrawal @@ -1063,7 +1063,7 @@ describe("IBosonFundsHandler", function () { .withArgs( protocolId, protocolTreasury.address, - ethers.constants.Zero, + constants.Zero, protocolPayoff, feeCollector.address ); @@ -1072,13 +1072,13 @@ describe("IBosonFundsHandler", function () { it("should update state", async function () { // Read on chain state protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); - const protocolTreasuryNativeBalanceBefore = await ethers.provider.getBalance(protocolTreasury.address); + const protocolTreasuryNativeBalanceBefore = await provider.getBalance(protocolTreasury.address); const protocolTreasuryTokenBalanceBefore = await mockToken.balanceOf(protocolTreasury.address); // Chain state should match the expected available funds before the withdrawal expectedProtocolAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", protocolPayoff), - new Funds(ethers.constants.AddressZero, "Native currency", protocolPayoff), + new Funds(ZeroAddress, "Native currency", protocolPayoff), ]); expect(protocolAvailableFunds).to.eql( expectedProtocolAvailableFunds, @@ -1086,24 +1086,24 @@ describe("IBosonFundsHandler", function () { ); // withdraw funds - const partialFeeWithdrawAmount = ethers.BigNumber.from(protocolPayoff) - .sub(ethers.utils.parseUnits("0.01", "ether")) + const partialFeeWithdrawAmount = BigInt(protocolPayoff) + -parseUnits("0.01", "ether") .toString(); tx = await fundsHandler .connect(feeCollector) .withdrawProtocolFees( - [mockToken.address, ethers.constants.AddressZero], + [mockToken.address, ZeroAddress], [protocolPayoff, partialFeeWithdrawAmount] ); // calcualte tx costs txReceipt = await tx.wait(); - txCost = tx.gasPrice.mul(txReceipt.gasUsed); + txCost = tx.gasPrice*txReceipt.gasUsed; // Read on chain state protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); - const protocolTreasuryNativeBalanceAfter = await ethers.provider.getBalance(protocolTreasury.address); + const protocolTreasuryNativeBalanceAfter = await provider.getBalance(protocolTreasury.address); const protocolTreasuryTokenBalanceAfter = await mockToken.balanceOf(protocolTreasury.address); // Chain state should match the expected available funds after the withdrawal @@ -1111,9 +1111,9 @@ describe("IBosonFundsHandler", function () { // Mock token is fully withdrawn expectedProtocolAvailableFunds = new FundsList([ new Funds( - ethers.constants.AddressZero, + ZeroAddress, "Native currency", - ethers.BigNumber.from(protocolPayoff).sub(partialFeeWithdrawAmount).toString() + BigInt(protocolPayoff)-partialFeeWithdrawAmount.toString() ), ]); @@ -1123,12 +1123,12 @@ describe("IBosonFundsHandler", function () { ); // Native currency balance is increased for the partialFeeWithdrawAmount expect(protocolTreasuryNativeBalanceAfter).to.eql( - protocolTreasuryNativeBalanceBefore.add(partialFeeWithdrawAmount), + protocolTreasuryNativeBalanceBefore+partialFeeWithdrawAmount, "Fee collector token balance mismatch" ); // Token balance is increased for the protocol fee expect(protocolTreasuryTokenBalanceAfter).to.eql( - protocolTreasuryTokenBalanceBefore.add(protocolPayoff), + protocolTreasuryTokenBalanceBefore+protocolPayoff, "Fee collector token balance mismatch" ); }); @@ -1136,13 +1136,13 @@ describe("IBosonFundsHandler", function () { it("should allow to withdraw all funds at once", async function () { // Read on chain state protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); - const protocolTreasuryNativeBalanceBefore = await ethers.provider.getBalance(protocolTreasury.address); + const protocolTreasuryNativeBalanceBefore = await provider.getBalance(protocolTreasury.address); const protocolTreasuryTokenBalanceBefore = await mockToken.balanceOf(protocolTreasury.address); // Chain state should match the expected available funds before the withdrawal expectedProtocolAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", protocolPayoff), - new Funds(ethers.constants.AddressZero, "Native currency", protocolPayoff), + new Funds(ZeroAddress, "Native currency", protocolPayoff), ]); expect(protocolAvailableFunds).to.eql( expectedProtocolAvailableFunds, @@ -1154,11 +1154,11 @@ describe("IBosonFundsHandler", function () { // calcualte tx costs txReceipt = await tx.wait(); - txCost = tx.gasPrice.mul(txReceipt.gasUsed); + txCost = tx.gasPrice*txReceipt.gasUsed; // Read on chain state protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); - const protocolTreasuryNativeBalanceAfter = await ethers.provider.getBalance(protocolTreasury.address); + const protocolTreasuryNativeBalanceAfter = await provider.getBalance(protocolTreasury.address); const protocolTreasuryTokenBalanceAfter = await mockToken.balanceOf(protocolTreasury.address); // Chain state should match the expected available funds after the withdrawal @@ -1170,12 +1170,12 @@ describe("IBosonFundsHandler", function () { ); // Native currency balance is increased for the partialFeeWithdrawAmount expect(protocolTreasuryNativeBalanceAfter).to.eql( - protocolTreasuryNativeBalanceBefore.add(protocolPayoff), + protocolTreasuryNativeBalanceBefore+protocolPayoff, "Fee collector native currency balance mismatch" ); // Token balance is increased for the protocol fee expect(protocolTreasuryTokenBalanceAfter).to.eql( - protocolTreasuryTokenBalanceBefore.add(protocolPayoff), + protocolTreasuryTokenBalanceBefore+protocolPayoff, "Fee collector token balance mismatch" ); }); @@ -1186,13 +1186,13 @@ describe("IBosonFundsHandler", function () { // Read on chain state protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); - let protocolTreasuryNativeBalanceBefore = await ethers.provider.getBalance(protocolTreasury.address); + let protocolTreasuryNativeBalanceBefore = await provider.getBalance(protocolTreasury.address); const protocolTreasuryTokenBalanceBefore = await mockToken.balanceOf(protocolTreasury.address); // Chain state should match the expected available funds before the withdrawal expectedProtocolAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", protocolPayoff), - new Funds(ethers.constants.AddressZero, "Native currency", protocolPayoff), + new Funds(ZeroAddress, "Native currency", protocolPayoff), ]); expect(protocolAvailableFunds).to.eql( expectedProtocolAvailableFunds, @@ -1204,17 +1204,17 @@ describe("IBosonFundsHandler", function () { // calcualte tx costs txReceipt = await tx.wait(); - txCost = tx.gasPrice.mul(txReceipt.gasUsed); + txCost = tx.gasPrice*txReceipt.gasUsed; // Read on chain state protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); - let protocolTreasuryNativeBalanceAfter = await ethers.provider.getBalance(protocolTreasury.address); + let protocolTreasuryNativeBalanceAfter = await provider.getBalance(protocolTreasury.address); const protocolTreasuryTokenBalanceAfter = await mockToken.balanceOf(protocolTreasury.address); // Chain state should match the expected available funds after the withdrawal // Funds available should still have the entries from above the threshold expectedProtocolAvailableFunds = new FundsList([ - new Funds(ethers.constants.AddressZero, "Native currency", protocolPayoff), + new Funds(ZeroAddress, "Native currency", protocolPayoff), ]); expect(protocolAvailableFunds).to.eql( expectedProtocolAvailableFunds, @@ -1226,7 +1226,7 @@ describe("IBosonFundsHandler", function () { "Fee collector native currency balance mismatch after first withdrawal" ); expect(protocolTreasuryTokenBalanceAfter).to.eql( - protocolTreasuryTokenBalanceBefore.add(protocolPayoff), + protocolTreasuryTokenBalanceBefore+protocolPayoff, "Fee collector token balance mismatch after first withdrawal" ); @@ -1235,11 +1235,11 @@ describe("IBosonFundsHandler", function () { // calcualte tx costs txReceipt = await tx.wait(); - txCost = tx.gasPrice.mul(txReceipt.gasUsed); + txCost = tx.gasPrice*txReceipt.gasUsed; // Read on chain state protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); - protocolTreasuryNativeBalanceAfter = await ethers.provider.getBalance(protocolTreasury.address); + protocolTreasuryNativeBalanceAfter = await provider.getBalance(protocolTreasury.address); // Chain state should match the expected available funds after the withdrawal // Funds available should now be an empty list @@ -1250,16 +1250,16 @@ describe("IBosonFundsHandler", function () { ); // Native currency balance is increased for the protocol fee expect(protocolTreasuryNativeBalanceAfter).to.eql( - protocolTreasuryNativeBalanceBefore.add(offerTokenProtocolFee), + protocolTreasuryNativeBalanceBefore+offerTokenProtocolFee, "Fee collector native currency balance mismatch after second withdrawal" ); }); it("It's possible to withdraw same token twice if in total enough available funds", async function () { - let reduction = ethers.utils.parseUnits("0.01", "ether").toString(); + let reduction = parseUnits("0.01", "ether").toString(); // Withdraw token tokenList = [mockToken.address, mockToken.address]; - tokenAmounts = [ethers.BigNumber.from(protocolPayoff).sub(reduction).toString(), reduction]; + tokenAmounts = [BigInt(protocolPayoff)-reduction.toString(), reduction]; // protocol fee withdrawal const tx = await fundsHandler.connect(feeCollector).withdrawProtocolFees(tokenList, tokenAmounts); @@ -1269,7 +1269,7 @@ describe("IBosonFundsHandler", function () { protocolId, protocolTreasury.address, mockToken.address, - ethers.BigNumber.from(protocolPayoff).sub(reduction).toString(), + BigInt(protocolPayoff)-reduction.toString(), feeCollector.address ); @@ -1281,7 +1281,7 @@ describe("IBosonFundsHandler", function () { context("💔 Revert Reasons", async function () { it("The funds region of protocol is paused", async function () { // Withdraw funds, testing for the event - tokenList = [mockToken.address, ethers.constants.AddressZero]; + tokenList = [mockToken.address, ZeroAddress]; tokenAmounts = [protocolPayoff, protocolPayoff]; // Pause the funds region of the protocol @@ -1302,7 +1302,7 @@ describe("IBosonFundsHandler", function () { it("Token list address does not match token amount address", async function () { // Withdraw token - tokenList = [mockToken.address, ethers.constants.AddressZero]; + tokenList = [mockToken.address, ZeroAddress]; tokenAmounts = [sellerPayoff]; // Attempt to withdraw the funds, expecting revert @@ -1312,7 +1312,7 @@ describe("IBosonFundsHandler", function () { }); it("Caller wants to withdraw more different tokens than allowed", async function () { - tokenList = new Array(101).fill(ethers.constants.AddressZero); + tokenList = new Array(101).fill(ZeroAddress); tokenAmounts = new Array(101).fill("1"); // Attempt to withdraw the funds, expecting revert @@ -1324,7 +1324,7 @@ describe("IBosonFundsHandler", function () { it("Caller tries to withdraw more than they have in the available funds", async function () { // Withdraw token tokenList = [mockToken.address]; - tokenAmounts = [ethers.BigNumber.from(offerTokenProtocolFee).mul("2")]; + tokenAmounts = [BigInt(offerTokenProtocolFee)*"2"]; // Attempt to withdraw the funds, expecting revert await expect( @@ -1375,7 +1375,7 @@ describe("IBosonFundsHandler", function () { await expect( fundsHandler .connect(feeCollector) - .withdrawProtocolFees([ethers.constants.AddressZero], [offerNativeProtocolFee]) + .withdrawProtocolFees([ZeroAddress], [offerNativeProtocolFee]) ).to.revertedWith(RevertReasons.TOKEN_TRANSFER_FAILED); }); @@ -1393,7 +1393,7 @@ describe("IBosonFundsHandler", function () { await expect( fundsHandler .connect(feeCollector) - .withdrawProtocolFees([ethers.constants.AddressZero], [offerNativeProtocolFee]) + .withdrawProtocolFees([ZeroAddress], [offerNativeProtocolFee]) ).to.revertedWith(RevertReasons.TOKEN_TRANSFER_FAILED); }); @@ -1471,9 +1471,9 @@ describe("IBosonFundsHandler", function () { expect(disputeResolver.isValid()).is.true; //Create DisputeResolverFee array so offer creation will succeed - DRFee = ethers.utils.parseUnits("0", "ether").toString(); + DRFee = parseUnits("0", "ether").toString(); disputeResolverFees = [ - new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0"), + new DisputeResolverFee(ZeroAddress, "Native", "0"), new DisputeResolverFee(mockToken.address, "mockToken", DRFee), ]; @@ -1531,7 +1531,7 @@ describe("IBosonFundsHandler", function () { await fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, `${2 * sellerDeposit}`); await fundsHandler .connect(assistant) - .depositFunds(seller.id, ethers.constants.AddressZero, `${2 * sellerDeposit}`, { + .depositFunds(seller.id, ZeroAddress, `${2 * sellerDeposit}`, { value: `${2 * sellerDeposit}`, }); @@ -1576,18 +1576,18 @@ describe("IBosonFundsHandler", function () { const tx2 = await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerNative.id, { value: price }); await expect(tx2) .to.emit(exchangeHandler, "FundsEncumbered") - .withArgs(buyerId, ethers.constants.AddressZero, price, buyer.address); + .withArgs(buyerId, ZeroAddress, price, buyer.address); await expect(tx2) .to.emit(exchangeHandler, "FundsEncumbered") - .withArgs(seller.id, ethers.constants.AddressZero, sellerDeposit, buyer.address); + .withArgs(seller.id, ZeroAddress, sellerDeposit, buyer.address); }); it("should update state", async function () { // contract token value const contractTokenBalanceBefore = await mockToken.balanceOf(protocolDiamondAddress); // contract native token balance - const contractNativeBalanceBefore = await ethers.provider.getBalance(protocolDiamondAddress); + const contractNativeBalanceBefore = await provider.getBalance(protocolDiamondAddress); // seller's available funds const sellersAvailableFundsBefore = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -1598,7 +1598,7 @@ describe("IBosonFundsHandler", function () { const contractTokenBalanceAfter = await mockToken.balanceOf(protocolDiamondAddress); // contract token balance should increase for the incoming price // seller's deposit was already held in the contract's pool before - expect(contractTokenBalanceAfter.sub(contractTokenBalanceBefore).toString()).to.eql( + expect(contractTokenBalanceAfter-contractTokenBalanceBefore.toString()).to.eql( price, "Token wrong balance increase" ); @@ -1607,8 +1607,8 @@ describe("IBosonFundsHandler", function () { let sellersAvailableFundsAfter = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); // token is the first on the list of the available funds and the amount should be decreased for the sellerDeposit expect( - ethers.BigNumber.from(sellersAvailableFundsBefore.funds[0].availableAmount) - .sub(ethers.BigNumber.from(sellersAvailableFundsAfter.funds[0].availableAmount)) + BigInt(sellersAvailableFundsBefore.funds[0].availableAmount) + -BigInt(sellersAvailableFundsAfter.funds[0].availableAmount) .toString() ).to.eql(sellerDeposit, "Token seller available funds mismatch"); @@ -1616,10 +1616,10 @@ describe("IBosonFundsHandler", function () { await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerNative.id, { value: price }); // check that native currency balance increased - const contractNativeBalanceAfter = await ethers.provider.getBalance(protocolDiamondAddress); + const contractNativeBalanceAfter = await provider.getBalance(protocolDiamondAddress); // contract token balance should increase for the incoming price // seller's deposit was already held in the contract's pool before - expect(contractNativeBalanceAfter.sub(contractNativeBalanceBefore).toString()).to.eql( + expect(contractNativeBalanceAfter-contractNativeBalanceBefore.toString()).to.eql( price, "Native currency wrong balance increase" ); @@ -1628,8 +1628,8 @@ describe("IBosonFundsHandler", function () { sellersAvailableFundsAfter = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); // native currency is the second on the list of the available funds and the amount should be decreased for the sellerDeposit expect( - ethers.BigNumber.from(sellersAvailableFundsBefore.funds[1].availableAmount) - .sub(ethers.BigNumber.from(sellersAvailableFundsAfter.funds[1].availableAmount)) + BigInt(sellersAvailableFundsBefore.funds[1].availableAmount) + -BigInt(sellersAvailableFundsAfter.funds[1].availableAmount) .toString() ).to.eql(sellerDeposit, "Native currency seller available funds mismatch"); }); @@ -1644,7 +1644,7 @@ describe("IBosonFundsHandler", function () { "Token contract address mismatch" ); expect(sellersAvailableFunds.funds[1].tokenAddress).to.eql( - ethers.constants.AddressZero, + ZeroAddress, "Native currency address mismatch" ); @@ -1656,7 +1656,7 @@ describe("IBosonFundsHandler", function () { sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); expect(sellersAvailableFunds.funds.length).to.eql(1, "Funds length mismatch"); expect(sellersAvailableFunds.funds[0].tokenAddress).to.eql( - ethers.constants.AddressZero, + ZeroAddress, "Native currency address mismatch" ); @@ -1672,7 +1672,7 @@ describe("IBosonFundsHandler", function () { it("token should be removed from the token list even when list length - 1 is different from index", async function () { // length - 1 is different from index when index isn't the first or last element in the list // Deploy a new mock token - let TokenContractFactory = await ethers.getContractFactory("Foreign20"); + let TokenContractFactory = await getContractFactory("Foreign20"); const otherToken = await TokenContractFactory.deploy(); await otherToken.deployed(); @@ -1700,7 +1700,7 @@ describe("IBosonFundsHandler", function () { "Token contract address mismatch" ); expect(sellersAvailableFunds.funds[1].tokenAddress).to.eql( - ethers.constants.AddressZero, + ZeroAddress, "Native currency address mismatch" ); expect(sellersAvailableFunds.funds[2].tokenAddress).to.eql( @@ -1740,7 +1740,7 @@ describe("IBosonFundsHandler", function () { const randoTokenBalanceAfter = await mockToken.balanceOf(rando.address); // buyer's balance should decrease, rando's should remain - expect(buyerTokenBalanceBefore.sub(buyerTokenBalanceAfter).toString()).to.eql( + expect(buyerTokenBalanceBefore-buyerTokenBalanceAfter.toString()).to.eql( price, "Buyer's token balance should decrease for a price" ); @@ -1754,20 +1754,20 @@ describe("IBosonFundsHandler", function () { expect(exchange.buyerId.toString()).to.eql(randoBuyerId, "Wrong buyer id"); // get native currency balance before the commit - const buyerNativeBalanceBefore = await ethers.provider.getBalance(buyer.address); - const randoNativeBalanceBefore = await ethers.provider.getBalance(rando.address); + const buyerNativeBalanceBefore = await provider.getBalance(buyer.address); + const randoNativeBalanceBefore = await provider.getBalance(rando.address); // commit to an offer with native currency on rando's behalf tx = await exchangeHandler.connect(buyer).commitToOffer(rando.address, offerNative.id, { value: price }); txReceipt = await tx.wait(); - txCost = tx.gasPrice.mul(txReceipt.gasUsed); + txCost = tx.gasPrice*txReceipt.gasUsed; // get token balance after the commit - const buyerNativeBalanceAfter = await ethers.provider.getBalance(buyer.address); - const randoNativeBalanceAfter = await ethers.provider.getBalance(rando.address); + const buyerNativeBalanceAfter = await provider.getBalance(buyer.address); + const randoNativeBalanceAfter = await provider.getBalance(rando.address); // buyer's balance should decrease, rando's should remain - expect(buyerNativeBalanceBefore.sub(buyerNativeBalanceAfter).sub(txCost).toString()).to.eql( + expect(buyerNativeBalanceBefore-buyerNativeBalanceAfter.sub(txCost).toString()).to.eql( price, "Buyer's native balance should decrease for a price" ); @@ -1790,7 +1790,7 @@ describe("IBosonFundsHandler", function () { await mockToken.mint(assistant.address, `${2 * price}`); await mockToken.connect(assistant).approve(protocolDiamondAddress, `${2 * price}`); await fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, `${2 * price}`); - await fundsHandler.connect(assistant).depositFunds(seller.id, ethers.constants.AddressZero, `${2 * price}`, { + await fundsHandler.connect(assistant).depositFunds(seller.id, ZeroAddress, `${2 * price}`, { value: `${2 * price}`, }); @@ -1804,7 +1804,7 @@ describe("IBosonFundsHandler", function () { .connect(assistant) .reserveRange(offerToken.id, offerToken.quantityAvailable, assistant.address); const voucherCloneAddress = calculateContractAddress(accountHandler.address, "1"); - const bosonVoucher = await ethers.getContractAt("BosonVoucher", voucherCloneAddress); + const bosonVoucher = await getContractAt("BosonVoucher", voucherCloneAddress); await bosonVoucher.connect(assistant).preMint(offerToken.id, offerToken.quantityAvailable); // commit to an offer via preminted voucher @@ -1813,7 +1813,7 @@ describe("IBosonFundsHandler", function () { tx = await bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId); // it should emit FundsEncumbered event with amount equal to sellerDeposit + price - let encumberedFunds = ethers.BigNumber.from(sellerDeposit).add(price); + let encumberedFunds = BigInt(sellerDeposit)+price; await expect(tx) .to.emit(exchangeHandler, "FundsEncumbered") .withArgs(seller.id, mockToken.address, encumberedFunds, bosonVoucher.address); @@ -1822,8 +1822,8 @@ describe("IBosonFundsHandler", function () { let sellersAvailableFundsAfter = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); // token is the first on the list of the available funds and the amount should be decreased for the sellerDeposit and price expect( - ethers.BigNumber.from(sellersAvailableFundsBefore.funds[0].availableAmount) - .sub(ethers.BigNumber.from(sellersAvailableFundsAfter.funds[0].availableAmount)) + BigInt(sellersAvailableFundsBefore.funds[0].availableAmount) + -BigInt(sellersAvailableFundsAfter.funds[0].availableAmount) .toString() ).to.eql(encumberedFunds.toString(), "Token seller available funds mismatch"); @@ -1840,7 +1840,7 @@ describe("IBosonFundsHandler", function () { expect(exchange.buyerId.toString()).to.eql(buyerId, "Wrong buyer id"); // get native currency balance before the commit - const buyerNativeBalanceBefore = await ethers.provider.getBalance(buyer.address); + const buyerNativeBalanceBefore = await provider.getBalance(buyer.address); // reserve a range and premint vouchers exchangeId = await exchangeHandler.getNextExchangeId(); @@ -1854,13 +1854,13 @@ describe("IBosonFundsHandler", function () { tx = await bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId); // it should emit FundsEncumbered event with amount equal to sellerDeposit + price - encumberedFunds = ethers.BigNumber.from(sellerDeposit).add(price); + encumberedFunds = BigInt(sellerDeposit)+price; await expect(tx) .to.emit(exchangeHandler, "FundsEncumbered") - .withArgs(seller.id, ethers.constants.AddressZero, encumberedFunds, bosonVoucher.address); + .withArgs(seller.id, ZeroAddress, encumberedFunds, bosonVoucher.address); // buyer's balance should remain the same - const buyerNativeBalanceAfter = await ethers.provider.getBalance(buyer.address); + const buyerNativeBalanceAfter = await provider.getBalance(buyer.address); expect(buyerNativeBalanceBefore.toString()).to.eql( buyerNativeBalanceAfter.toString(), "Buyer's native balance should remain the same" @@ -1870,8 +1870,8 @@ describe("IBosonFundsHandler", function () { sellersAvailableFundsAfter = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); // native currency the second on the list of the available funds and the amount should be decreased for the sellerDeposit and price expect( - ethers.BigNumber.from(sellersAvailableFundsBefore.funds[1].availableAmount) - .sub(ethers.BigNumber.from(sellersAvailableFundsAfter.funds[1].availableAmount)) + BigInt(sellersAvailableFundsBefore.funds[1].availableAmount) + -BigInt(sellersAvailableFundsAfter.funds[1].availableAmount) .toString() ).to.eql(encumberedFunds.toString(), "Native currency seller available funds mismatch"); @@ -1886,7 +1886,7 @@ describe("IBosonFundsHandler", function () { await expect( exchangeHandler .connect(buyer) - .commitToOffer(buyer.address, offerNative.id, { value: ethers.BigNumber.from(price).sub("1").toString() }) + .commitToOffer(buyer.address, offerNative.id, { value: BigInt(price)-"1".toString() }) ).to.revertedWith(RevertReasons.INSUFFICIENT_VALUE_RECEIVED); }); @@ -1955,7 +1955,7 @@ describe("IBosonFundsHandler", function () { // not approved await mockToken .connect(rando) - .approve(protocolDiamondAddress, ethers.BigNumber.from(price).sub("1").toString()); + .approve(protocolDiamondAddress, BigInt(price)-"1".toString()); // Attempt to commit to an offer, expecting revert await expect(exchangeHandler.connect(rando).commitToOffer(rando.address, offerToken.id)).to.revertedWith( RevertReasons.ERC20_INSUFFICIENT_ALLOWANCE @@ -1964,7 +1964,7 @@ describe("IBosonFundsHandler", function () { it("Seller'a availableFunds is less than the required sellerDeposit", async function () { // create an offer with token with higher seller deposit - offerToken.sellerDeposit = ethers.BigNumber.from(offerToken.sellerDeposit).mul("4"); + offerToken.sellerDeposit = BigInt(offerToken.sellerDeposit)*"4"; offerToken.id = "3"; await offerHandler .connect(assistant) @@ -1976,7 +1976,7 @@ describe("IBosonFundsHandler", function () { ); // create an offer with native currency with higher seller deposit - offerNative.sellerDeposit = ethers.BigNumber.from(offerNative.sellerDeposit).mul("4"); + offerNative.sellerDeposit = BigInt(offerNative.sellerDeposit)*"4"; offerNative.id = "4"; await offerHandler .connect(assistant) @@ -1994,7 +1994,7 @@ describe("IBosonFundsHandler", function () { .connect(assistant) .reserveRange(offerToken.id, offerToken.quantityAvailable, assistant.address); const voucherCloneAddress = calculateContractAddress(accountHandler.address, "1"); - const bosonVoucher = await ethers.getContractAt("BosonVoucher", voucherCloneAddress); + const bosonVoucher = await getContractAt("BosonVoucher", voucherCloneAddress); await bosonVoucher.connect(assistant).preMint(offerToken.id, offerToken.quantityAvailable); // Seller's availableFunds is 2*sellerDeposit which is less than sellerDeposit + price. @@ -2025,7 +2025,7 @@ describe("IBosonFundsHandler", function () { const [Foreign20WithFee] = await deployMockTokens(["Foreign20WithFee"]); // add to DR fees - DRFee = ethers.utils.parseUnits("0", "ether").toString(); + DRFee = parseUnits("0", "ether").toString(); await accountHandler .connect(adminDR) .addFeesToDisputeResolver(disputeResolverId, [ @@ -2079,9 +2079,9 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // seller: sellerDeposit + price - protocolFee - sellerPayoff = ethers.BigNumber.from(offerToken.sellerDeposit) - .add(offerToken.price) - .sub(offerTokenProtocolFee) + sellerPayoff = BigInt(offerToken.sellerDeposit) + +offerToken.price + -offerTokenProtocolFee .toString(); // protocol: protocolFee @@ -2113,7 +2113,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -2153,12 +2153,12 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[1] = new Funds( mockToken.address, "Foreign20", - ethers.BigNumber.from(sellerPayoff).mul(2).toString() + BigInt(sellerPayoff)*2.toString() ); expectedProtocolAvailableFunds.funds[0] = new Funds( mockToken.address, "Foreign20", - ethers.BigNumber.from(protocolPayoff).mul(2).toString() + BigInt(protocolPayoff)*2.toString() ); expect(sellersAvailableFunds).to.eql(expectedSellerAvailableFunds); expect(buyerAvailableFunds).to.eql(expectedBuyerAvailableFunds); @@ -2185,14 +2185,14 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // agentPayoff: agentFee - agentFee = ethers.BigNumber.from(agentOffer.price).mul(agentFeePercentage).div("10000").toString(); + agentFee = BigInt(agentOffer.price)*agentFeePercentage/"10000".toString(); agentPayoff = agentFee; // seller: sellerDeposit + price - protocolFee - agentFee - sellerPayoff = ethers.BigNumber.from(agentOffer.sellerDeposit) - .add(agentOffer.price) - .sub(agentOfferProtocolFee) - .sub(agentFee) + sellerPayoff = BigInt(agentOffer.sellerDeposit) + +agentOffer.price + -agentOfferProtocolFee + -agentFee .toString(); // protocol: protocolFee @@ -2226,7 +2226,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -2263,7 +2263,7 @@ describe("IBosonFundsHandler", function () { beforeEach(async function () { // expected payoffs // buyer: sellerDeposit + price - buyerPayoff = ethers.BigNumber.from(offerToken.sellerDeposit).add(offerToken.price).toString(); + buyerPayoff = BigInt(offerToken.sellerDeposit)+offerToken.price.toString(); // seller: 0 sellerPayoff = 0; @@ -2289,7 +2289,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", sellerDeposit), - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -2332,10 +2332,10 @@ describe("IBosonFundsHandler", function () { expectedBuyerAvailableFunds.funds[0] = new Funds( mockToken.address, "Foreign20", - ethers.BigNumber.from(buyerPayoff).mul(2).toString() + BigInt(buyerPayoff)*2.toString() ); expectedSellerAvailableFunds = new FundsList([ - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -2370,7 +2370,7 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: sellerDeposit + price - buyerPayoff = ethers.BigNumber.from(agentOffer.sellerDeposit).add(agentOffer.price).toString(); + buyerPayoff = BigInt(agentOffer.sellerDeposit)+agentOffer.price.toString(); // seller: 0 sellerPayoff = 0; @@ -2394,7 +2394,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", `${2 * sellerDeposit}`), - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -2437,11 +2437,11 @@ describe("IBosonFundsHandler", function () { expectedBuyerAvailableFunds.funds[0] = new Funds( mockToken.address, "Foreign20", - ethers.BigNumber.from(buyerPayoff).mul(2).toString() + BigInt(buyerPayoff)*2.toString() ); expectedSellerAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", `${sellerDeposit}`), - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -2459,10 +2459,10 @@ describe("IBosonFundsHandler", function () { beforeEach(async function () { // expected payoffs // buyer: price - buyerCancelPenalty - buyerPayoff = ethers.BigNumber.from(offerToken.price).sub(offerToken.buyerCancelPenalty).toString(); + buyerPayoff = BigInt(offerToken.price)-offerToken.buyerCancelPenalty.toString(); // seller: sellerDeposit + buyerCancelPenalty - sellerPayoff = ethers.BigNumber.from(offerToken.sellerDeposit).add(offerToken.buyerCancelPenalty).toString(); + sellerPayoff = BigInt(offerToken.sellerDeposit)+offerToken.buyerCancelPenalty.toString(); // protocol: 0 protocolPayoff = 0; @@ -2492,7 +2492,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", sellerDeposit), - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -2513,7 +2513,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( mockToken.address, "Foreign20", - ethers.BigNumber.from(sellerDeposit).add(sellerPayoff).toString() + BigInt(sellerDeposit)+sellerPayoff.toString() ); expectedBuyerAvailableFunds.funds.push(new Funds(mockToken.address, "Foreign20", buyerPayoff)); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -2549,11 +2549,11 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: price - buyerCancelPenalty - buyerPayoff = ethers.BigNumber.from(agentOffer.price).sub(agentOffer.buyerCancelPenalty).toString(); + buyerPayoff = BigInt(agentOffer.price)-agentOffer.buyerCancelPenalty.toString(); // seller: sellerDeposit + buyerCancelPenalty - sellerPayoff = ethers.BigNumber.from(agentOffer.sellerDeposit) - .add(agentOffer.buyerCancelPenalty) + sellerPayoff = BigInt(agentOffer.sellerDeposit) + +agentOffer.buyerCancelPenalty .toString(); // protocol: 0 @@ -2575,7 +2575,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", sellerDeposit), - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -2596,7 +2596,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( mockToken.address, "Foreign20", - ethers.BigNumber.from(sellerDeposit).add(sellerPayoff).toString() + BigInt(sellerDeposit)+sellerPayoff.toString() ); expectedBuyerAvailableFunds.funds.push(new Funds(mockToken.address, "Foreign20", buyerPayoff)); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -2624,9 +2624,9 @@ describe("IBosonFundsHandler", function () { // Get the block timestamp of the confirmed tx and set disputedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(disputedDate).add(resolutionPeriod).toString(); + timeout = BigInt(disputedDate)+resolutionPeriod.toString(); }); context("Final state DISPUTED - RETRACTED", async function () { @@ -2636,9 +2636,9 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // seller: sellerDeposit + price - protocolFee - sellerPayoff = ethers.BigNumber.from(offerToken.sellerDeposit) - .add(offerToken.price) - .sub(offerTokenProtocolFee) + sellerPayoff = BigInt(offerToken.sellerDeposit) + +offerToken.price + -offerTokenProtocolFee .toString(); // protocol: 0 @@ -2679,7 +2679,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", sellerDeposit), - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -2700,7 +2700,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( mockToken.address, "Foreign20", - ethers.BigNumber.from(sellerDeposit).add(sellerPayoff).toString() + BigInt(sellerDeposit)+sellerPayoff.toString() ); expectedProtocolAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", protocolPayoff); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -2720,14 +2720,14 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // agentPayoff: agentFee - agentFee = ethers.BigNumber.from(agentOffer.price).mul(agentFeePercentage).div("10000").toString(); + agentFee = BigInt(agentOffer.price)*agentFeePercentage/"10000".toString(); agentPayoff = agentFee; // seller: sellerDeposit + price - protocolFee - agentFee - sellerPayoff = ethers.BigNumber.from(agentOffer.sellerDeposit) - .add(agentOffer.price) - .sub(agentOfferProtocolFee) - .sub(agentFee) + sellerPayoff = BigInt(agentOffer.sellerDeposit) + +agentOffer.price + -agentOfferProtocolFee + -agentFee .toString(); // protocol: 0 @@ -2773,7 +2773,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -2792,7 +2792,7 @@ describe("IBosonFundsHandler", function () { // protocol: protocolFee // agent: agentFee expectedSellerAvailableFunds.funds.push( - new Funds(mockToken.address, "Foreign20", ethers.BigNumber.from(sellerPayoff).toString()) + new Funds(mockToken.address, "Foreign20", BigInt(sellerPayoff).toString()) ); expectedProtocolAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", protocolPayoff); expectedAgentAvailableFunds.funds.push(new Funds(mockToken.address, "Foreign20", agentPayoff)); @@ -2815,9 +2815,9 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // seller: sellerDeposit + price - protocolFee - sellerPayoff = ethers.BigNumber.from(offerToken.sellerDeposit) - .add(offerToken.price) - .sub(offerTokenProtocolFee) + sellerPayoff = BigInt(offerToken.sellerDeposit) + +offerToken.price + -offerTokenProtocolFee .toString(); // protocol: protocolFee @@ -2859,7 +2859,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", sellerDeposit), - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -2880,7 +2880,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( mockToken.address, "Foreign20", - ethers.BigNumber.from(sellerDeposit).add(sellerPayoff).toString() + BigInt(sellerDeposit)+sellerPayoff.toString() ); expectedProtocolAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", protocolPayoff); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -2908,14 +2908,14 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // agentPayoff: agentFee - agentFee = ethers.BigNumber.from(agentOffer.price).mul(agentFeePercentage).div("10000").toString(); + agentFee = BigInt(agentOffer.price)*agentFeePercentage/"10000".toString(); agentPayoff = agentFee; // seller: sellerDeposit + price - protocolFee - agent fee - sellerPayoff = ethers.BigNumber.from(agentOffer.sellerDeposit) - .add(agentOffer.price) - .sub(agentOfferProtocolFee) - .sub(agentFee) + sellerPayoff = BigInt(agentOffer.sellerDeposit) + +agentOffer.price + -agentOfferProtocolFee + -agentFee .toString(); // protocol: protocolFee @@ -2932,9 +2932,9 @@ describe("IBosonFundsHandler", function () { // Get the block timestamp of the confirmed tx and set disputedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(disputedDate).add(resolutionPeriod).toString(); + timeout = BigInt(disputedDate)+resolutionPeriod.toString(); await setNextBlockTimestamp(Number(timeout)); }); @@ -2966,7 +2966,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -2985,7 +2985,7 @@ describe("IBosonFundsHandler", function () { // protocol: protocolFee // agent: agent fee expectedSellerAvailableFunds = new FundsList([ - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), new Funds(mockToken.address, "Foreign20", sellerPayoff), ]); @@ -3009,16 +3009,16 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: (price + sellerDeposit)*buyerPercentage - buyerPayoff = ethers.BigNumber.from(offerToken.price) - .add(offerToken.sellerDeposit) - .mul(buyerPercentBasisPoints) - .div("10000") + buyerPayoff = BigInt(offerToken.price) + +offerToken.sellerDeposit + *buyerPercentBasisPoints + /"10000" .toString(); // seller: (price + sellerDeposit)*(1-buyerPercentage) - sellerPayoff = ethers.BigNumber.from(offerToken.price) - .add(offerToken.sellerDeposit) - .sub(buyerPayoff) + sellerPayoff = BigInt(offerToken.price) + +offerToken.sellerDeposit + -buyerPayoff .toString(); // protocol: 0 @@ -3075,7 +3075,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", sellerDeposit), - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -3096,7 +3096,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( mockToken.address, "Foreign20", - ethers.BigNumber.from(sellerDeposit).add(sellerPayoff).toString() + BigInt(sellerDeposit)+sellerPayoff.toString() ); expectedBuyerAvailableFunds = new FundsList([new Funds(mockToken.address, "Foreign20", buyerPayoff)]); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -3132,16 +3132,16 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: (price + sellerDeposit)*buyerPercentage - buyerPayoff = ethers.BigNumber.from(agentOffer.price) - .add(agentOffer.sellerDeposit) - .mul(buyerPercentBasisPoints) - .div("10000") + buyerPayoff = BigInt(agentOffer.price) + +agentOffer.sellerDeposit + *buyerPercentBasisPoints + /"10000" .toString(); // seller: (price + sellerDeposit)*(1-buyerPercentage) - sellerPayoff = ethers.BigNumber.from(agentOffer.price) - .add(agentOffer.sellerDeposit) - .sub(buyerPayoff) + sellerPayoff = BigInt(agentOffer.price) + +agentOffer.sellerDeposit + -buyerPayoff .toString(); // protocol: 0 @@ -3181,7 +3181,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -3200,7 +3200,7 @@ describe("IBosonFundsHandler", function () { // protocol: 0 // agent: 0 expectedSellerAvailableFunds.funds.push( - new Funds(mockToken.address, "Foreign20", ethers.BigNumber.from(sellerPayoff).toString()) + new Funds(mockToken.address, "Foreign20", BigInt(sellerPayoff).toString()) ); expectedBuyerAvailableFunds = new FundsList([new Funds(mockToken.address, "Foreign20", buyerPayoff)]); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -3223,10 +3223,10 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // seller: sellerDeposit + price - protocolFee + buyerEscalationDeposit - sellerPayoff = ethers.BigNumber.from(offerToken.sellerDeposit) - .add(offerToken.price) - .sub(offerTokenProtocolFee) - .add(buyerEscalationDeposit) + sellerPayoff = BigInt(offerToken.sellerDeposit) + +offerToken.price + -offerTokenProtocolFee + +buyerEscalationDeposit .toString(); // protocol: 0 @@ -3270,7 +3270,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", sellerDeposit), - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -3291,7 +3291,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( mockToken.address, "Foreign20", - ethers.BigNumber.from(sellerDeposit).add(sellerPayoff).toString() + BigInt(sellerDeposit)+sellerPayoff.toString() ); expectedProtocolAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", protocolPayoff); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -3311,15 +3311,15 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // agentPayoff: agentFee - agentFee = ethers.BigNumber.from(agentOffer.price).mul(agentFeePercentage).div("10000").toString(); + agentFee = BigInt(agentOffer.price)*agentFeePercentage/"10000".toString(); agentPayoff = agentFee; // seller: sellerDeposit + price - protocolFee - agentFee + buyerEscalationDeposit - sellerPayoff = ethers.BigNumber.from(agentOffer.sellerDeposit) - .add(agentOffer.price) - .sub(agentOfferProtocolFee) - .sub(agentFee) - .add(buyerEscalationDeposit) + sellerPayoff = BigInt(agentOffer.sellerDeposit) + +agentOffer.price + -agentOfferProtocolFee + -agentFee + +buyerEscalationDeposit .toString(); // protocol: 0 @@ -3357,7 +3357,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -3376,7 +3376,7 @@ describe("IBosonFundsHandler", function () { // protocol: protocolFee // agent: agentFee expectedSellerAvailableFunds.funds.push( - new Funds(mockToken.address, "Foreign20", ethers.BigNumber.from(sellerPayoff).toString()) + new Funds(mockToken.address, "Foreign20", BigInt(sellerPayoff).toString()) ); expectedProtocolAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", protocolPayoff); expectedAgentAvailableFunds.funds.push(new Funds(mockToken.address, "Foreign20", agentPayoff)); @@ -3398,18 +3398,18 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: (price + sellerDeposit + buyerEscalationDeposit)*buyerPercentage - buyerPayoff = ethers.BigNumber.from(offerToken.price) - .add(offerToken.sellerDeposit) - .add(buyerEscalationDeposit) - .mul(buyerPercentBasisPoints) - .div("10000") + buyerPayoff = BigInt(offerToken.price) + +offerToken.sellerDeposit + +buyerEscalationDeposit + *buyerPercentBasisPoints + /"10000" .toString(); // seller: (price + sellerDeposit + buyerEscalationDeposit)*(1-buyerPercentage) - sellerPayoff = ethers.BigNumber.from(offerToken.price) - .add(offerToken.sellerDeposit) - .add(buyerEscalationDeposit) - .sub(buyerPayoff) + sellerPayoff = BigInt(offerToken.price) + +offerToken.sellerDeposit + +buyerEscalationDeposit + -buyerPayoff .toString(); // protocol: 0 @@ -3469,7 +3469,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", sellerDeposit), - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -3491,7 +3491,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( mockToken.address, "Foreign20", - ethers.BigNumber.from(sellerDeposit).add(sellerPayoff).toString() + BigInt(sellerDeposit)+sellerPayoff.toString() ); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -3529,18 +3529,18 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: (price + sellerDeposit + buyerEscalationDeposit)*buyerPercentage - buyerPayoff = ethers.BigNumber.from(agentOffer.price) - .add(agentOffer.sellerDeposit) - .add(buyerEscalationDeposit) - .mul(buyerPercentBasisPoints) - .div("10000") + buyerPayoff = BigInt(agentOffer.price) + +agentOffer.sellerDeposit + +buyerEscalationDeposit + *buyerPercentBasisPoints + /"10000" .toString(); // seller: (price + sellerDeposit + buyerEscalationDeposit)*(1-buyerPercentage) - sellerPayoff = ethers.BigNumber.from(agentOffer.price) - .add(agentOffer.sellerDeposit) - .add(buyerEscalationDeposit) - .sub(buyerPayoff) + sellerPayoff = BigInt(agentOffer.price) + +agentOffer.sellerDeposit + +buyerEscalationDeposit + -buyerPayoff .toString(); // protocol: 0 @@ -3585,7 +3585,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -3604,7 +3604,7 @@ describe("IBosonFundsHandler", function () { // protocol: 0 // agent: 0 expectedSellerAvailableFunds.funds.push( - new Funds(mockToken.address, "Foreign20", ethers.BigNumber.from(sellerPayoff).toString()) + new Funds(mockToken.address, "Foreign20", BigInt(sellerPayoff).toString()) ); expectedBuyerAvailableFunds = new FundsList([new Funds(mockToken.address, "Foreign20", buyerPayoff)]); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -3626,18 +3626,18 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: (price + sellerDeposit + buyerEscalationDeposit)*buyerPercentage - buyerPayoff = ethers.BigNumber.from(offerToken.price) - .add(offerToken.sellerDeposit) - .add(buyerEscalationDeposit) - .mul(buyerPercentBasisPoints) - .div("10000") + buyerPayoff = BigInt(offerToken.price) + +offerToken.sellerDeposit + +buyerEscalationDeposit + *buyerPercentBasisPoints + /"10000" .toString(); // seller: (price + sellerDeposit + buyerEscalationDeposit)*(1-buyerPercentage) - sellerPayoff = ethers.BigNumber.from(offerToken.price) - .add(offerToken.sellerDeposit) - .add(buyerEscalationDeposit) - .sub(buyerPayoff) + sellerPayoff = BigInt(offerToken.price) + +offerToken.sellerDeposit + +buyerEscalationDeposit + -buyerPayoff .toString(); // protocol: 0 @@ -3671,7 +3671,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", sellerDeposit), - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -3693,7 +3693,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( mockToken.address, "Foreign20", - ethers.BigNumber.from(sellerDeposit).add(sellerPayoff).toString() + BigInt(sellerDeposit)+sellerPayoff.toString() ); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -3729,26 +3729,26 @@ describe("IBosonFundsHandler", function () { // Get the block timestamp of the confirmed tx and set disputedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(disputedDate).add(resolutionPeriod).toString(); + timeout = BigInt(disputedDate)+resolutionPeriod.toString(); buyerPercentBasisPoints = "5566"; // 55.66% // expected payoffs // buyer: (price + sellerDeposit + buyerEscalationDeposit)*buyerPercentage - buyerPayoff = ethers.BigNumber.from(agentOffer.price) - .add(agentOffer.sellerDeposit) - .add(buyerEscalationDeposit) - .mul(buyerPercentBasisPoints) - .div("10000") + buyerPayoff = BigInt(agentOffer.price) + +agentOffer.sellerDeposit + +buyerEscalationDeposit + *buyerPercentBasisPoints + /"10000" .toString(); // seller: (price + sellerDeposit + buyerEscalationDeposit)*(1-buyerPercentage) - sellerPayoff = ethers.BigNumber.from(agentOffer.price) - .add(agentOffer.sellerDeposit) - .add(buyerEscalationDeposit) - .sub(buyerPayoff) + sellerPayoff = BigInt(agentOffer.price) + +agentOffer.sellerDeposit + +buyerEscalationDeposit + -buyerPayoff .toString(); // protocol: 0 @@ -3769,7 +3769,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -3788,7 +3788,7 @@ describe("IBosonFundsHandler", function () { // protocol: 0 // agent: 0 expectedSellerAvailableFunds.funds.push( - new Funds(mockToken.address, "Foreign20", ethers.BigNumber.from(sellerPayoff).toString()) + new Funds(mockToken.address, "Foreign20", BigInt(sellerPayoff).toString()) ); expectedBuyerAvailableFunds = new FundsList([new Funds(mockToken.address, "Foreign20", buyerPayoff)]); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -3809,7 +3809,7 @@ describe("IBosonFundsHandler", function () { beforeEach(async function () { // expected payoffs // buyer: price + buyerEscalationDeposit - buyerPayoff = ethers.BigNumber.from(offerToken.price).add(buyerEscalationDeposit).toString(); + buyerPayoff = BigInt(offerToken.price)+buyerEscalationDeposit.toString(); // seller: sellerDeposit sellerPayoff = offerToken.sellerDeposit; @@ -3822,7 +3822,7 @@ describe("IBosonFundsHandler", function () { // Get the block timestamp of the confirmed tx and set escalatedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); escalatedDate = block.timestamp.toString(); await setNextBlockTimestamp(Number(escalatedDate) + Number(disputeResolver.escalationResponsePeriod)); @@ -3851,7 +3851,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", sellerDeposit), - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -3873,7 +3873,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( mockToken.address, "Foreign20", - ethers.BigNumber.from(sellerDeposit).add(sellerPayoff).toString() + BigInt(sellerDeposit)+sellerPayoff.toString() ); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -3909,7 +3909,7 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: price + buyerEscalationDeposit - buyerPayoff = ethers.BigNumber.from(offerToken.price).add(buyerEscalationDeposit).toString(); + buyerPayoff = BigInt(offerToken.price)+buyerEscalationDeposit.toString(); // seller: sellerDeposit sellerPayoff = offerToken.sellerDeposit; @@ -3924,7 +3924,7 @@ describe("IBosonFundsHandler", function () { // Get the block timestamp of the confirmed tx and set escalatedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); escalatedDate = block.timestamp.toString(); await setNextBlockTimestamp(Number(escalatedDate) + Number(disputeResolver.escalationResponsePeriod)); @@ -3939,7 +3939,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -3959,7 +3959,7 @@ describe("IBosonFundsHandler", function () { // agent: 0 expectedBuyerAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", buyerPayoff); expectedSellerAvailableFunds.funds.push( - new Funds(mockToken.address, "Foreign20", ethers.BigNumber.from(sellerPayoff).toString()) + new Funds(mockToken.address, "Foreign20", BigInt(sellerPayoff).toString()) ); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -3980,7 +3980,7 @@ describe("IBosonFundsHandler", function () { beforeEach(async function () { // expected payoffs // buyer: price + buyerEscalationDeposit - buyerPayoff = ethers.BigNumber.from(offerToken.price).add(buyerEscalationDeposit).toString(); + buyerPayoff = BigInt(offerToken.price)+buyerEscalationDeposit.toString(); // seller: sellerDeposit sellerPayoff = offerToken.sellerDeposit; @@ -4028,7 +4028,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", sellerDeposit), - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -4050,7 +4050,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( mockToken.address, "Foreign20", - ethers.BigNumber.from(sellerDeposit).add(sellerPayoff).toString() + BigInt(sellerDeposit)+sellerPayoff.toString() ); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -4086,7 +4086,7 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: price + buyerEscalationDeposit - buyerPayoff = ethers.BigNumber.from(offerToken.price).add(buyerEscalationDeposit).toString(); + buyerPayoff = BigInt(offerToken.price)+buyerEscalationDeposit.toString(); // seller: sellerDeposit sellerPayoff = offerToken.sellerDeposit; @@ -4109,7 +4109,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(ethers.constants.AddressZero, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -4129,7 +4129,7 @@ describe("IBosonFundsHandler", function () { // agent: 0 expectedBuyerAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", buyerPayoff); expectedSellerAvailableFunds.funds.push( - new Funds(mockToken.address, "Foreign20", ethers.BigNumber.from(sellerPayoff).toString()) + new Funds(mockToken.address, "Foreign20", BigInt(sellerPayoff).toString()) ); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -4148,16 +4148,16 @@ describe("IBosonFundsHandler", function () { context("Changing the protocol fee", async function () { beforeEach(async function () { // Cast Diamond to IBosonConfigHandler - configHandler = await ethers.getContractAt("IBosonConfigHandler", protocolDiamondAddress); + configHandler = await getContractAt("IBosonConfigHandler", protocolDiamondAddress); // expected payoffs // buyer: 0 buyerPayoff = 0; // seller: sellerDeposit + price - protocolFee - sellerPayoff = ethers.BigNumber.from(offerToken.sellerDeposit) - .add(offerToken.price) - .sub(offerTokenProtocolFee) + sellerPayoff = BigInt(offerToken.sellerDeposit) + +offerToken.price + -offerTokenProtocolFee .toString(); }); @@ -4218,21 +4218,21 @@ describe("IBosonFundsHandler", function () { exchangeId = "2"; // Cast Diamond to IBosonConfigHandler - configHandler = await ethers.getContractAt("IBosonConfigHandler", protocolDiamondAddress); + configHandler = await getContractAt("IBosonConfigHandler", protocolDiamondAddress); // expected payoffs // buyer: 0 buyerPayoff = 0; // agentPayoff: agentFee - agentFee = ethers.BigNumber.from(agentOffer.price).mul(agentFeePercentage).div("10000").toString(); + agentFee = BigInt(agentOffer.price)*agentFeePercentage/"10000".toString(); agentPayoff = agentFee; // seller: sellerDeposit + price - protocolFee - agentFee - sellerPayoff = ethers.BigNumber.from(agentOffer.sellerDeposit) - .add(agentOffer.price) - .sub(agentOfferProtocolFee) - .sub(agentFee) + sellerPayoff = BigInt(agentOffer.sellerDeposit) + +agentOffer.price + -agentOfferProtocolFee + -agentFee .toString(); // protocol: protocolFee diff --git a/test/protocol/GroupHandlerTest.js b/test/protocol/GroupHandlerTest.js index 466c6f017..33573f837 100644 --- a/test/protocol/GroupHandlerTest.js +++ b/test/protocol/GroupHandlerTest.js @@ -68,9 +68,9 @@ describe("IBosonGroupHandler", function () { // make all account the same assistant = admin; assistantDR = adminDR; - clerk = clerkDR = { address: ethers.constants.AddressZero }; + clerk = clerkDR = { address: ZeroAddress }; - accounts = await ethers.getSigners(); + accounts = await getSigners(); // Get snapshot id snapshotId = await getSnapshot(); @@ -127,7 +127,7 @@ describe("IBosonGroupHandler", function () { expect(disputeResolver.isValid()).is.true; //Create DisputeResolverFee array so offer creation will succeed - disputeResolverFees = [new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0")]; + disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", "0")]; // Make empty seller list, so every seller is allowed const sellerAllowList = []; @@ -147,12 +147,12 @@ describe("IBosonGroupHandler", function () { // Set unique offer properties based on index offer.id = `${i + 1}`; - offer.price = ethers.utils.parseUnits(`${1.5 + i * 1}`, "ether").toString(); - offer.sellerDeposit = ethers.utils.parseUnits(`${0.25 + i * 0.1}`, "ether").toString(); - offer.buyerCancelPenalty = ethers.utils.parseUnits(`${0.05 + i * 0.1}`, "ether").toString(); + offer.price = parseUnits(`${1.5 + i * 1}`, "ether").toString(); + offer.sellerDeposit = parseUnits(`${0.25 + i * 0.1}`, "ether").toString(); + offer.buyerCancelPenalty = parseUnits(`${0.05 + i * 0.1}`, "ether").toString(); offer.quantityAvailable = `${(i + 1) * 2}`; - offerDates.validFrom = ethers.BigNumber.from(Date.now() + oneMonth * i).toString(); - offerDates.validUntil = ethers.BigNumber.from(Date.now() + oneMonth * 6 * (i + 1)).toString(); + offerDates.validFrom = BigInt(Date.now() + oneMonth * i).toString(); + offerDates.validUntil = BigInt(Date.now() + oneMonth * 6 * (i + 1)).toString(); // Check if domains are valid expect(offer.isValid()).is.true; @@ -183,7 +183,7 @@ describe("IBosonGroupHandler", function () { groupStruct = group.toStruct(); // initialize groupHandler - groupHandlerFacet_Factory = await ethers.getContractFactory("GroupHandlerFacet"); + groupHandlerFacet_Factory = await getContractFactory("GroupHandlerFacet"); }); afterEach(async function () { @@ -304,7 +304,7 @@ describe("IBosonGroupHandler", function () { it("Caller is not the seller of all offers", async function () { // create another seller and an offer - seller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); await offerHandler.connect(rando).createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId); // creates an offer with id 6 @@ -422,7 +422,7 @@ describe("IBosonGroupHandler", function () { }); it("Condition 'Threshold' has zero token contract address", async function () { - condition.tokenAddress = ethers.constants.AddressZero; + condition.tokenAddress = ZeroAddress; // Attempt to create the group, expecting revert await expect(groupHandler.connect(assistant).createGroup(group, condition)).to.revertedWith( @@ -460,7 +460,7 @@ describe("IBosonGroupHandler", function () { }); it("Condition 'SpecificToken' has zero token contract address", async function () { - condition.tokenAddress = ethers.constants.AddressZero; + condition.tokenAddress = ZeroAddress; // Attempt to create the group, expecting revert await expect(groupHandler.connect(assistant).createGroup(group, condition)).to.revertedWith( @@ -572,7 +572,7 @@ describe("IBosonGroupHandler", function () { it("Caller is not the seller of all offers", async function () { // create another seller and an offer - seller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); await offerHandler.connect(rando).createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId); // creates an offer with id 6 @@ -918,7 +918,7 @@ describe("IBosonGroupHandler", function () { it("Condition 'Threshold' has zero token contract address", async function () { condition.method = EvaluationMethod.Threshold; - condition.tokenAddress = ethers.constants.AddressZero; + condition.tokenAddress = ZeroAddress; // Attempt to update the group, expecting revert await expect(groupHandler.connect(assistant).setGroupCondition(group.id, condition)).to.revertedWith( @@ -938,7 +938,7 @@ describe("IBosonGroupHandler", function () { it("Condition 'SpecificToken' has zero token contract address", async function () { condition.method = EvaluationMethod.SpecificToken; - condition.tokenAddress = ethers.constants.AddressZero; + condition.tokenAddress = ZeroAddress; // Attempt to update the group, expecting revert await expect(groupHandler.connect(assistant).setGroupCondition(group.id, condition)).to.revertedWith( diff --git a/test/protocol/MetaTransactionsHandlerTest.js b/test/protocol/MetaTransactionsHandlerTest.js index 9287b79e2..7720da9bf 100644 --- a/test/protocol/MetaTransactionsHandlerTest.js +++ b/test/protocol/MetaTransactionsHandlerTest.js @@ -152,9 +152,9 @@ describe("IBosonMetaTransactionsHandler", function () { // make all account the same assistant = admin; assistantDR = adminDR; - clerk = clerkDR = { address: ethers.constants.AddressZero }; + clerk = clerkDR = { address: ZeroAddress }; - [deployer] = await ethers.getSigners(); + [deployer] = await getSigners(); // Deploy the mock tokens [bosonToken, mockToken] = await deployMockTokens(["BosonToken", "Foreign20"]); @@ -174,10 +174,10 @@ describe("IBosonMetaTransactionsHandler", function () { async function upgradeMetaTransactionsHandlerFacet() { // Upgrade the ExchangeHandlerFacet functions // DiamondCutFacet - const cutFacetViaDiamond = await ethers.getContractAt("DiamondCutFacet", protocolDiamondAddress); + const cutFacetViaDiamond = await getContractAt("DiamondCutFacet", protocolDiamondAddress); // Deploy MockMetaTransactionsHandlerFacet - const MockMetaTransactionsHandlerFacet = await ethers.getContractFactory("MockMetaTransactionsHandlerFacet"); + const MockMetaTransactionsHandlerFacet = await getContractFactory("MockMetaTransactionsHandlerFacet"); const mockMetaTransactionsHandlerFacet = await MockMetaTransactionsHandlerFacet.deploy(); await mockMetaTransactionsHandlerFacet.deployed(); @@ -191,7 +191,7 @@ describe("IBosonMetaTransactionsHandler", function () { ]; // Send the DiamondCut transaction - const tx = await cutFacetViaDiamond.connect(deployer).diamondCut(facetCuts, ethers.constants.AddressZero, "0x"); + const tx = await cutFacetViaDiamond.connect(deployer).diamondCut(facetCuts, ZeroAddress, "0x"); // Wait for transaction to confirm const receipt = await tx.wait(); @@ -200,7 +200,7 @@ describe("IBosonMetaTransactionsHandler", function () { assert.equal(receipt.status, 1, `Diamond upgrade failed: ${tx.hash}`); // Cast Diamond to MockMetaTransactionsHandlerFacet - mockMetaTransactionsHandler = await ethers.getContractAt( + mockMetaTransactionsHandler = await getContractAt( "MockMetaTransactionsHandlerFacet", protocolDiamondAddress ); @@ -222,7 +222,7 @@ describe("IBosonMetaTransactionsHandler", function () { // All supported methods context("📋 Meta Transactions Handler Methods", async function () { beforeEach(async function () { - nonce = parseInt(ethers.utils.randomBytes(8)); + nonce = parseInt(randomBytes(8)); }); context("👉 isUsedNonce()", async function () { @@ -246,7 +246,7 @@ describe("IBosonMetaTransactionsHandler", function () { assert.equal(result, expectedResult, "Nonce is used"); // Create a valid seller for meta transaction - seller = mockSeller(assistant.address, assistant.address, ethers.constants.AddressZero, assistant.address); + seller = mockSeller(assistant.address, assistant.address, ZeroAddress, assistant.address); expect(seller.isValid()).is.true; // VoucherInitValues @@ -511,7 +511,7 @@ describe("IBosonMetaTransactionsHandler", function () { context("👉 AccountHandlerFacet 👉 createSeller()", async function () { beforeEach(async function () { // Create a valid seller for meta transaction - seller = mockSeller(assistant.address, assistant.address, ethers.constants.AddressZero, assistant.address); + seller = mockSeller(assistant.address, assistant.address, ZeroAddress, assistant.address); expect(seller.isValid()).is.true; // VoucherInitValues @@ -866,11 +866,11 @@ describe("IBosonMetaTransactionsHandler", function () { // Prepare a function, which selector collide with another funtion selector // In this case certain bytes are appended to redeemVoucher so it gets the same selector as cancelVoucher const fn = `redeemVoucher(uint256)`; - const fnBytes = ethers.utils.toUtf8Bytes(fn); + const fnBytes = toUtf8Bytes(fn); const collisionBytes = "0a7f0f031e"; const collisionBytesBuffer = Buffer.from(collisionBytes, "hex"); const fnCollision = Buffer.concat([fnBytes, collisionBytesBuffer]); - const sigCollision = ethers.utils.keccak256(fnCollision).slice(0, 10); + const sigCollision = keccak256(fnCollision).slice(0, 10); // Prepare the function signature for the facet function. functionSignature = exchangeHandler.interface.encodeFunctionData("cancelVoucher", [1]); @@ -1025,7 +1025,7 @@ describe("IBosonMetaTransactionsHandler", function () { functionSignature, nonce, r, - ethers.constants.MaxUint256, // invalid s signature component + constants.MaxUint256, // invalid s signature component v ) ).to.revertedWith(RevertReasons.INVALID_SIGNATURE); @@ -1038,7 +1038,7 @@ describe("IBosonMetaTransactionsHandler", function () { functionSignature, nonce, r, - ethers.utils.hexZeroPad("0x", 32), // invalid s signature component + hexZeroPad("0x", 32), // invalid s signature component v ) ).to.revertedWith(RevertReasons.INVALID_SIGNATURE); @@ -1050,7 +1050,7 @@ describe("IBosonMetaTransactionsHandler", function () { message.functionName, functionSignature, nonce, - ethers.utils.hexZeroPad("0x", 32), // invalid r signature component + hexZeroPad("0x", 32), // invalid r signature component s, v ) @@ -1062,7 +1062,7 @@ describe("IBosonMetaTransactionsHandler", function () { context("👉TwinHandler 👉 removeTwin()", async function () { beforeEach(async function () { // Create a valid seller for meta transaction - seller = mockSeller(assistant.address, assistant.address, ethers.constants.AddressZero, assistant.address); + seller = mockSeller(assistant.address, assistant.address, ZeroAddress, assistant.address); expect(seller.isValid()).is.true; // VoucherInitValues @@ -1146,11 +1146,11 @@ describe("IBosonMetaTransactionsHandler", function () { functionSignature = metaTransactionsHandler.interface.encodeFunctionData("executeMetaTransaction", [ assistant.address, "executeMetaTransaction", - ethers.constants.HashZero, // hash of zero + constants.HashZero, // hash of zero nonce, - ethers.utils.randomBytes(32), // random bytes32 - ethers.utils.randomBytes(32), // random bytes32 - parseInt(ethers.utils.randomBytes(8)), // random uint8 + randomBytes(32), // random bytes32 + randomBytes(32), // random bytes32 + parseInt(randomBytes(8)), // random uint8 ]); // Prepare the message @@ -1183,7 +1183,7 @@ describe("IBosonMetaTransactionsHandler", function () { it("Returns default revert reason if called function reverts without a reason", async function () { // Create a valid seller for meta transaction - seller = mockSeller(assistant.address, assistant.address, ethers.constants.AddressZero, assistant.address); + seller = mockSeller(assistant.address, assistant.address, ZeroAddress, assistant.address); voucherInitValues = mockVoucherInitValues(); emptyAuthToken = mockAuthToken(); await accountHandler.connect(assistant).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -1225,7 +1225,7 @@ describe("IBosonMetaTransactionsHandler", function () { context("Reentrancy guard", async function () { beforeEach(async function () { // Create a valid seller for meta transaction - seller = mockSeller(assistant.address, assistant.address, ethers.constants.AddressZero, assistant.address); + seller = mockSeller(assistant.address, assistant.address, ZeroAddress, assistant.address); expect(seller.isValid()).is.true; // VoucherInitValues @@ -1308,7 +1308,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Expected payoffs - they are the same for token and native currency // Buyer: price - buyerCancelPenalty - buyerPayoff = ethers.BigNumber.from(offerToken.price).sub(offerToken.buyerCancelPenalty).toString(); + buyerPayoff = BigInt(offerToken.price)-offerToken.buyerCancelPenalty.toString(); // Prepare validFundDetails tokenListBuyer = [maliciousToken.address]; @@ -1454,7 +1454,7 @@ describe("IBosonMetaTransactionsHandler", function () { offerId = "1"; // Create a valid seller - seller = mockSeller(assistant.address, assistant.address, ethers.constants.AddressZero, assistant.address); + seller = mockSeller(assistant.address, assistant.address, ZeroAddress, assistant.address); expect(seller.isValid()).is.true; // VoucherInitValues @@ -1478,7 +1478,7 @@ describe("IBosonMetaTransactionsHandler", function () { //Create DisputeResolverFee array so offer creation will succeed disputeResolverFees = [ - new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0"), + new DisputeResolverFee(ZeroAddress, "Native", "0"), new DisputeResolverFee(mockToken.address, "BosonToken", "0"), ]; @@ -1520,7 +1520,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Deposit native currency to the same seller id await fundsHandler .connect(rando) - .depositFunds(seller.id, ethers.constants.AddressZero, sellerDeposit, { value: sellerDeposit }); + .depositFunds(seller.id, ZeroAddress, sellerDeposit, { value: sellerDeposit }); }); afterEach(async function () { @@ -1586,7 +1586,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Deposit native currency to the same seller id await fundsHandler .connect(rando) - .depositFunds(seller.id, ethers.constants.AddressZero, sellerDeposit, { value: sellerDeposit }); + .depositFunds(seller.id, ZeroAddress, sellerDeposit, { value: sellerDeposit }); }); it("Should emit MetaTransactionExecuted event and update state", async () => { @@ -3013,7 +3013,7 @@ describe("IBosonMetaTransactionsHandler", function () { offerId = "1"; // Create a valid seller - seller = mockSeller(assistant.address, assistant.address, ethers.constants.AddressZero, assistant.address); + seller = mockSeller(assistant.address, assistant.address, ZeroAddress, assistant.address); expect(seller.isValid()).is.true; // VoucherInitValues @@ -3142,8 +3142,8 @@ describe("IBosonMetaTransactionsHandler", function () { it("does not modify revert reasons", async function () { // Reverse the from and until dates - offerDates.validFrom = ethers.BigNumber.from(Date.now() + oneMonth * 6).toString(); // 6 months from now - offerDates.validUntil = ethers.BigNumber.from(Date.now()).toString(); // now + offerDates.validFrom = BigInt(Date.now() + oneMonth * 6).toString(); // 6 months from now + offerDates.validUntil = BigInt(Date.now()).toString(); // now // Prepare the function signature for the facet function. functionSignature = offerHandler.interface.encodeFunctionData("createOffer", [ @@ -3275,7 +3275,7 @@ describe("IBosonMetaTransactionsHandler", function () { //Create DisputeResolverFee array so offer creation will succeed disputeResolverFees = [ - new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0"), + new DisputeResolverFee(ZeroAddress, "Native", "0"), new DisputeResolverFee(mockToken.address, "mockToken", "0"), ]; @@ -3324,7 +3324,7 @@ describe("IBosonMetaTransactionsHandler", function () { // deposit to seller's pool await fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, sellerDeposit); - await fundsHandler.connect(assistant).depositFunds(seller.id, ethers.constants.AddressZero, sellerDeposit, { + await fundsHandler.connect(assistant).depositFunds(seller.id, ZeroAddress, sellerDeposit, { value: sellerDeposit, }); @@ -3340,11 +3340,11 @@ describe("IBosonMetaTransactionsHandler", function () { // expected payoffs - they are the same for token and native currency // buyer: price - buyerCancelPenalty - buyerPayoff = ethers.BigNumber.from(offerToken.price).sub(offerToken.buyerCancelPenalty).toString(); + buyerPayoff = BigInt(offerToken.price)-offerToken.buyerCancelPenalty.toString(); // prepare validFundDetails - tokenListBuyer = [mockToken.address, ethers.constants.AddressZero]; - tokenAmountsBuyer = [buyerPayoff, ethers.BigNumber.from(buyerPayoff).div("2").toString()]; + tokenListBuyer = [mockToken.address, ZeroAddress]; + tokenAmountsBuyer = [buyerPayoff, BigInt(buyerPayoff)/"2".toString()]; validFundDetails = { entityId: buyerId, tokenList: tokenListBuyer, @@ -3395,7 +3395,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Chain state should match the expected available funds before the withdrawal expectedBuyerAvailableFunds = new FundsList([ new Funds(mockToken.address, "Foreign20", buyerPayoff), - new Funds(ethers.constants.AddressZero, "Native currency", buyerPayoff), + new Funds(ZeroAddress, "Native currency", buyerPayoff), ]); expect(buyerAvailableFunds).to.eql( expectedBuyerAvailableFunds, @@ -3443,9 +3443,9 @@ describe("IBosonMetaTransactionsHandler", function () { // Since all tokens are withdrawn, token should be removed from the list expectedBuyerAvailableFunds = new FundsList([ new Funds( - ethers.constants.AddressZero, + ZeroAddress, "Native currency", - ethers.BigNumber.from(buyerPayoff).div("2").toString() + BigInt(buyerPayoff)/"2".toString() ), ]); expect(buyerAvailableFunds).to.eql( @@ -3454,7 +3454,7 @@ describe("IBosonMetaTransactionsHandler", function () { ); // Token balance is increased for the buyer payoff - expect(buyerBalanceAfter).to.eql(buyerBalanceBefore.add(buyerPayoff), "Buyer token balance mismatch"); + expect(buyerBalanceAfter).to.eql(buyerBalanceBefore+buyerPayoff, "Buyer token balance mismatch"); // Verify that nonce is used. Expect true. let expectedResult = true; @@ -3516,7 +3516,7 @@ describe("IBosonMetaTransactionsHandler", function () { ); // Token balance is increased for the buyer payoff - expect(buyerBalanceAfter).to.eql(buyerBalanceBefore.add(buyerPayoff), "Buyer token balance mismatch"); + expect(buyerBalanceAfter).to.eql(buyerBalanceBefore+buyerPayoff, "Buyer token balance mismatch"); // Verify that nonce is used. Expect true. let expectedResult = true; diff --git a/test/protocol/OfferHandlerTest.js b/test/protocol/OfferHandlerTest.js index f182e0441..bf50559b9 100644 --- a/test/protocol/OfferHandlerTest.js +++ b/test/protocol/OfferHandlerTest.js @@ -130,8 +130,8 @@ describe("IBosonOfferHandler", function () { // make all account the same assistant = admin; assistantDR = adminDR; - clerk = clerkDR = { address: ethers.constants.AddressZero }; - [deployer] = await ethers.getSigners(); + clerk = clerkDR = { address: ZeroAddress }; + [deployer] = await getSigners(); // Get snapshot id snapshotId = await getSnapshot(); @@ -189,7 +189,7 @@ describe("IBosonOfferHandler", function () { DRFeeNative = "0"; DRFeeToken = "0"; disputeResolverFees = [ - new DisputeResolverFee(ethers.constants.AddressZero, "Native", DRFeeNative), + new DisputeResolverFee(ZeroAddress, "Native", DRFeeNative), new DisputeResolverFee(bosonToken.address, "Boson", DRFeeToken), ]; @@ -436,7 +436,7 @@ describe("IBosonOfferHandler", function () { it("Should allow creation of an offer with unlimited supply", async function () { // Prepare an absolute zero offer - offer.quantityAvailable = ethers.constants.MaxUint256.toString(); + offer.quantityAvailable = constants.MaxUint256.toString(); // Create a new offer await expect( @@ -506,7 +506,7 @@ describe("IBosonOfferHandler", function () { it("Should allow creation of an offer if DR has a sellerAllowList and seller is on it", async function () { // Create new seller so sellerAllowList can have an entry - seller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -548,8 +548,8 @@ describe("IBosonOfferHandler", function () { it("Valid from date is greater than valid until date", async function () { // Reverse the from and until dates - offerDates.validFrom = ethers.BigNumber.from(Date.now() + oneMonth * 6).toString(); // 6 months from now - offerDates.validUntil = ethers.BigNumber.from(Date.now()).toString(); // now + offerDates.validFrom = BigInt(Date.now() + oneMonth * 6).toString(); // 6 months from now + offerDates.validUntil = BigInt(Date.now()).toString(); // now // Attempt to Create an offer, expecting revert await expect( @@ -559,14 +559,14 @@ describe("IBosonOfferHandler", function () { it("Valid until date is not in the future", async function () { // get current block timestamp - const block = await ethers.provider.getBlock("latest"); + const block = await provider.getBlock("latest"); const now = block.timestamp.toString(); // set validFrom date in the past - offerDates.validFrom = ethers.BigNumber.from(now - oneMonth * 6).toString(); // 6 months ago + offerDates.validFrom = BigInt(now - oneMonth * 6).toString(); // 6 months ago // set valid until > valid from - offerDates.validUntil = ethers.BigNumber.from(now - oneMonth).toString(); // 1 month ago + offerDates.validUntil = BigInt(now - oneMonth).toString(); // 1 month ago // Attempt to Create an offer, expecting revert await expect( @@ -576,7 +576,7 @@ describe("IBosonOfferHandler", function () { it("Buyer cancel penalty is greater than price", async function () { // Set buyer cancel penalty higher than offer price - offer.buyerCancelPenalty = ethers.BigNumber.from(offer.price).add("10").toString(); + offer.buyerCancelPenalty = BigInt(offer.price)+"10".toString(); // Attempt to Create an offer, expecting revert await expect( @@ -641,7 +641,7 @@ describe("IBosonOfferHandler", function () { it("Dispute period is less than minimum dispute period", async function () { // Set dispute period to less than minDisputePeriod (oneWeek) - offerDurations.disputePeriod = ethers.BigNumber.from(oneWeek).sub(1000).toString(); + offerDurations.disputePeriod = BigInt(oneWeek)-1000.toString(); // Attempt to Create an offer, expecting revert await expect( @@ -706,7 +706,7 @@ describe("IBosonOfferHandler", function () { disputeResolver = mockDisputeResolver( rando.address, rando.address, - ethers.constants.AddressZero, + ZeroAddress, rando.address, false ); @@ -745,7 +745,7 @@ describe("IBosonOfferHandler", function () { disputeResolver = mockDisputeResolver( rando.address, rando.address, - ethers.constants.AddressZero, + ZeroAddress, rando.address, false ); @@ -772,7 +772,7 @@ describe("IBosonOfferHandler", function () { it("Seller is not on dispute resolver's seller allow list", async function () { // Create new seller so sellerAllowList can have an entry - seller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -807,7 +807,7 @@ describe("IBosonOfferHandler", function () { // Create an agent await accountHandler.connect(rando).createAgent(agent); - agentFee = ethers.BigNumber.from(offer.price).mul(agent.feePercentage).div("10000").toString(); + agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); offerFees.agentFee = agentFee; offerFeesStruct = offerFees.toStruct(); }); @@ -845,7 +845,7 @@ describe("IBosonOfferHandler", function () { offerFees.protocolFee = protocolFee; // Calculate the new agent fee amount. - let newOfferAgentFee = ethers.BigNumber.from(offer.price).mul(agent.feePercentage).div("10000").toString(); + let newOfferAgentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); offerFees.agentFee = newOfferAgentFee; offerFeesStruct = offerFees.toStruct(); @@ -876,7 +876,7 @@ describe("IBosonOfferHandler", function () { let oldOfferId = await offerHandler.getNextOfferId(); // Calculate the new agent fee amount. - let oldOfferAgentFee = ethers.BigNumber.from(offer.price).mul(agent.feePercentage).div("10000").toString(); + let oldOfferAgentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); // Create a new offer await offerHandler @@ -889,7 +889,7 @@ describe("IBosonOfferHandler", function () { // Creating 2nd offer // Calculate the new agent fee amount. - let newOfferAgentFee = ethers.BigNumber.from(offer.price).mul(agent.feePercentage).div("10000").toString(); + let newOfferAgentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); let newOfferId = await offerHandler.getNextOfferId(); @@ -1016,7 +1016,7 @@ describe("IBosonOfferHandler", function () { // caller is an assistant of another seller // Create a valid seller, then set fields in tests directly - seller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); // AuthToken emptyAuthToken = mockAuthToken(); @@ -1051,7 +1051,7 @@ describe("IBosonOfferHandler", function () { id = nextOfferId++; // update the values - offerDates.validUntil = ethers.BigNumber.from(offerDates.validUntil).add("10000").toString(); + offerDates.validUntil = BigInt(offerDates.validUntil)+"10000".toString(); offerStruct = offer.toStruct(); }); @@ -1116,7 +1116,7 @@ describe("IBosonOfferHandler", function () { // caller is an assistant of another seller // Create a valid seller, then set fields in tests directly - seller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); // AuthToken emptyAuthToken = mockAuthToken(); @@ -1141,14 +1141,14 @@ describe("IBosonOfferHandler", function () { it("New valid until date is lower than the existing valid until date", async function () { // Make the valid until date the same as the existing offer - offerDates.validUntil = ethers.BigNumber.from(offerDates.validUntil).sub("10000").toString(); + offerDates.validUntil = BigInt(offerDates.validUntil)-"10000".toString(); await expect(offerHandler.connect(assistant).extendOffer(offer.id, offerDates.validUntil)).to.revertedWith( RevertReasons.OFFER_PERIOD_INVALID ); // Make new the valid until date less than existing one - offerDates.validUntil = ethers.BigNumber.from(offerDates.validUntil).sub("1").toString(); + offerDates.validUntil = BigInt(offerDates.validUntil)-"1".toString(); // Attempt to update an offer, expecting revert await expect(offerHandler.connect(assistant).extendOffer(offer.id, offerDates.validUntil)).to.revertedWith( @@ -1158,7 +1158,7 @@ describe("IBosonOfferHandler", function () { it("Valid until date is not in the future", async function () { // Set until date in the past - offerDates.validUntil = ethers.BigNumber.from(offerDates.validFrom - oneMonth * 6).toString(); // 6 months ago + offerDates.validUntil = BigInt(offerDates.validFrom - oneMonth * 6).toString(); // 6 months ago // Attempt to update an offer, expecting revert await expect(offerHandler.connect(assistant).extendOffer(offer.id, offerDates.validUntil)).to.revertedWith( @@ -1170,7 +1170,7 @@ describe("IBosonOfferHandler", function () { context("Offers with fixed voucher expiration date", async function () { beforeEach(async function () { - offerDates.voucherRedeemableUntil = ethers.BigNumber.from(offerDates.validUntil).add(oneMonth).toString(); + offerDates.voucherRedeemableUntil = BigInt(offerDates.validUntil)+oneMonth.toString(); offerDurations.voucherValid = "0"; // only one of voucherRedeemableUntil and voucherValid can be non zero // Create an offer @@ -1182,7 +1182,7 @@ describe("IBosonOfferHandler", function () { id = nextOfferId++; // update the values - offerDates.validUntil = ethers.BigNumber.from(offerDates.validUntil).add("10000").toString(); + offerDates.validUntil = BigInt(offerDates.validUntil)+"10000".toString(); offerStruct = offer.toStruct(); }); @@ -1212,7 +1212,7 @@ describe("IBosonOfferHandler", function () { context("💔 Revert Reasons", async function () { it("Offer has voucherRedeemableUntil set and new valid until date is greater than that", async function () { // Set until date in the before offerDates.voucherRedeemableUntil - offerDates.validUntil = ethers.BigNumber.from(offerDates.voucherRedeemableUntil).add(oneWeek).toString(); // one week after voucherRedeemableUntil + offerDates.validUntil = BigInt(offerDates.voucherRedeemableUntil)+oneWeek.toString(); // one week after voucherRedeemableUntil // Attempt to update an offer, expecting revert await expect(offerHandler.connect(assistant).extendOffer(offer.id, offerDates.validUntil)).to.revertedWith( @@ -1239,7 +1239,7 @@ describe("IBosonOfferHandler", function () { // expected address of the first clone const voucherCloneAddress = calculateContractAddress(accountHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("BosonVoucher", voucherCloneAddress); + bosonVoucher = await getContractAt("BosonVoucher", voucherCloneAddress); length = 100; firstTokenId = 1; @@ -1272,14 +1272,14 @@ describe("IBosonOfferHandler", function () { [, offerStruct] = await offerHandler.connect(rando).getOffer(id); const quantityAvailableAfter = offerStruct.quantityAvailable; assert.equal( - quantityAvailableBefore.sub(quantityAvailableAfter).toNumber(), + quantityAvailableBefore-quantityAvailableAfter.toNumber(), length, "Quantity available mismatch" ); // nextExchangeId should be updated const nextExchangeIdAfter = await exchangeHandler.getNextExchangeId(); - assert.equal(nextExchangeIdAfter.sub(nextExchangeIdBefore).toNumber(), length, "nextExchangeId mismatch"); + assert.equal(nextExchangeIdAfter-nextExchangeIdBefore.toNumber(), length, "nextExchangeId mismatch"); // Get range object from the voucher contract const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(id)); @@ -1288,10 +1288,10 @@ describe("IBosonOfferHandler", function () { it("it's possible to reserve range even if somebody already committed to", async function () { // Deposit seller funds so the commit will succeed - const sellerPool = ethers.BigNumber.from(offer.sellerDeposit).mul(2); + const sellerPool = BigInt(offer.sellerDeposit)*2; await fundsHandler .connect(assistant) - .depositFunds(seller.id, ethers.constants.AddressZero, sellerPool, { value: sellerPool }); + .depositFunds(seller.id, ZeroAddress, sellerPool, { value: sellerPool }); // Commit to the offer twice await exchangeHandler.connect(rando).commitToOffer(rando.address, id, { value: price }); @@ -1305,13 +1305,13 @@ describe("IBosonOfferHandler", function () { it("It's possible to reserve a range with maximum allowed length", async function () { // Create an unlimited offer - offer.quantityAvailable = ethers.constants.MaxUint256.toString(); + offer.quantityAvailable = constants.MaxUint256.toString(); await offerHandler .connect(assistant) .createOffer(offer, offerDates, offerDurations, disputeResolver.id, agentId); // Set maximum allowed length - length = ethers.BigNumber.from(2).pow(64).sub(1); + length = BigInt(2)**64-1; await expect(offerHandler.connect(assistant).reserveRange(nextOfferId, length, assistant.address)).to.emit( offerHandler, "RangeReserved" @@ -1320,7 +1320,7 @@ describe("IBosonOfferHandler", function () { it("Reserving range of unlimited offer does not decrease quantity available", async function () { // Create an unlimited offer - offer.quantityAvailable = ethers.constants.MaxUint256.toString(); + offer.quantityAvailable = constants.MaxUint256.toString(); await offerHandler .connect(assistant) .createOffer(offer, offerDates, offerDurations, disputeResolver.id, agentId); @@ -1371,14 +1371,14 @@ describe("IBosonOfferHandler", function () { [, offerStruct] = await offerHandler.connect(rando).getOffer(id); const quantityAvailableAfter = offerStruct.quantityAvailable; assert.equal( - quantityAvailableBefore.sub(quantityAvailableAfter).toNumber(), + quantityAvailableBefore-quantityAvailableAfter.toNumber(), length, "Quantity available mismatch" ); // nextExchangeId should be updated const nextExchangeIdAfter = await exchangeHandler.getNextExchangeId(); - assert.equal(nextExchangeIdAfter.sub(nextExchangeIdBefore).toNumber(), length, "nextExchangeId mismatch"); + assert.equal(nextExchangeIdAfter-nextExchangeIdBefore.toNumber(), length, "nextExchangeId mismatch"); // Get range object from the voucher contract const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(id)); @@ -1444,7 +1444,7 @@ describe("IBosonOfferHandler", function () { // caller is an assistant of another seller // Create a valid seller, then set fields in tests directly - seller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); // AuthToken emptyAuthToken = mockAuthToken(); @@ -1479,13 +1479,13 @@ describe("IBosonOfferHandler", function () { it("Range length is greater than maximum allowed range length", async function () { // Create an unlimited offer - offer.quantityAvailable = ethers.constants.MaxUint256.toString(); + offer.quantityAvailable = constants.MaxUint256.toString(); await offerHandler .connect(assistant) .createOffer(offer, offerDates, offerDurations, disputeResolver.id, agentId); // Set length to more than maximum allowed range length - length = ethers.BigNumber.from(2).pow(64); + length = BigInt(2)**64; // Attempt to reserve a range, expecting revert await expect( @@ -1706,7 +1706,7 @@ describe("IBosonOfferHandler", function () { DRFeeNative = "0"; DRFeeToken = "0"; disputeResolverFees = [ - new DisputeResolverFee(ethers.constants.AddressZero, "Native", DRFeeNative), + new DisputeResolverFee(ZeroAddress, "Native", DRFeeNative), new DisputeResolverFee(bosonToken.address, "Boson", DRFeeToken), ]; @@ -1737,17 +1737,17 @@ describe("IBosonOfferHandler", function () { // Set unique offer properties based on index offer.id = `${i + 1}`; - offer.price = ethers.utils.parseUnits(`${1.5 + i * 1}`, "ether").toString(); - offer.sellerDeposit = ethers.utils.parseUnits(`${0.25 + i * 0.1}`, "ether").toString(); - offer.buyerCancelPenalty = ethers.utils.parseUnits(`${0.05 + i * 0.1}`, "ether").toString(); + offer.price = parseUnits(`${1.5 + i * 1}`, "ether").toString(); + offer.sellerDeposit = parseUnits(`${0.25 + i * 0.1}`, "ether").toString(); + offer.buyerCancelPenalty = parseUnits(`${0.05 + i * 0.1}`, "ether").toString(); offer.quantityAvailable = `${(i + 1) * 2}`; let now = offerDates.validFrom; - offerDates.validFrom = validFrom = ethers.BigNumber.from(now) - .add(oneMonth * i) + offerDates.validFrom = validFrom = BigInt(now) + +oneMonth * i .toString(); - offerDates.validUntil = validUntil = ethers.BigNumber.from(now) - .add(oneMonth * 6 * (i + 1)) + offerDates.validUntil = validUntil = BigInt(now) + +oneMonth * 6 * (i + 1) .toString(); offerDurations.disputePeriod = disputePeriod = `${(i + 1) * oneMonth}`; @@ -1794,7 +1794,7 @@ describe("IBosonOfferHandler", function () { offers[2].exchangeToken = bosonToken.address; offerFeesList[2].protocolFee = protocolFeeFlatBoson; offerFeesStructs[2] = offerFeesList[2].toStruct(); - offers[2].quantityAvailable = ethers.constants.MaxUint256.toString(); + offers[2].quantityAvailable = constants.MaxUint256.toString(); offerStructs[2] = offers[2].toStruct(); disputeResolutionTermsList[2] = new DisputeResolutionTerms( disputeResolver.id, @@ -2117,7 +2117,7 @@ describe("IBosonOfferHandler", function () { it("Should allow creation of an offer if DR has a sellerAllowList and seller is on it", async function () { // Create new seller so sellerAllowList can have an entry - seller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -2167,8 +2167,8 @@ describe("IBosonOfferHandler", function () { it("Valid from date is greater than valid until date in some offer", async function () { // Reverse the from and until dates - offerDatesList[4].validFrom = ethers.BigNumber.from(Date.now() + oneMonth * 6).toString(); // 6 months from now - offerDatesList[4].validUntil = ethers.BigNumber.from(Date.now()).toString(); // now + offerDatesList[4].validFrom = BigInt(Date.now() + oneMonth * 6).toString(); // 6 months from now + offerDatesList[4].validUntil = BigInt(Date.now()).toString(); // now // Attempt to Create an offer, expecting revert await expect( @@ -2182,10 +2182,10 @@ describe("IBosonOfferHandler", function () { let now = offerDatesList[0].validFrom; // set validFrom date in the past - offerDatesList[0].validFrom = ethers.BigNumber.from(now - oneMonth * 6).toString(); // 6 months ago + offerDatesList[0].validFrom = BigInt(now - oneMonth * 6).toString(); // 6 months ago // set valid until > valid from - offerDatesList[0].validUntil = ethers.BigNumber.from(now - oneMonth).toString(); // 1 month ago + offerDatesList[0].validUntil = BigInt(now - oneMonth).toString(); // 1 month ago // Attempt to Create an offer, expecting revert await expect( @@ -2197,7 +2197,7 @@ describe("IBosonOfferHandler", function () { it("Buyer cancel penalty is greater than price", async function () { // Set buyer cancel penalty higher than offer price - offers[0].buyerCancelPenalty = ethers.BigNumber.from(offers[0].price).add("10").toString(); + offers[0].buyerCancelPenalty = BigInt(offers[0].price)+"10".toString(); // Attempt to Create an offer, expecting revert await expect( @@ -2247,8 +2247,8 @@ describe("IBosonOfferHandler", function () { it("For some offer, both voucher expiration date and voucher expiration period are defined", async function () { // Set both voucherRedeemableUntil and voucherValid - offerDatesList[2].voucherRedeemableUntil = ethers.BigNumber.from(offerDatesList[2].voucherRedeemableFrom) - .add(oneMonth) + offerDatesList[2].voucherRedeemableUntil = BigInt(offerDatesList[2].voucherRedeemableFrom) + +oneMonth .toString(); offerDurationsList[2].voucherValid = oneMonth.toString(); @@ -2275,8 +2275,8 @@ describe("IBosonOfferHandler", function () { it("For some offer, voucher redeemable period is fixed, but it ends before it starts", async function () { // Set both voucherRedeemableUntil that is less than voucherRedeemableFrom - offerDatesList[0].voucherRedeemableUntil = ethers.BigNumber.from(offerDatesList[0].voucherRedeemableFrom) - .sub(10) + offerDatesList[0].voucherRedeemableUntil = BigInt(offerDatesList[0].voucherRedeemableFrom) + -10 .toString(); offerDurationsList[0].voucherValid = "0"; @@ -2304,7 +2304,7 @@ describe("IBosonOfferHandler", function () { it("For some offer, Dispute period is less than minimum dispute period", async function () { // Set dispute period to less than minDisputePeriod (oneWeek) - offerDurationsList[1].disputePeriod = ethers.BigNumber.from(oneWeek).sub(1000).toString(); + offerDurationsList[1].disputePeriod = BigInt(oneWeek)-1000.toString(); // Attempt to Create an offer, expecting revert await expect( @@ -2356,7 +2356,7 @@ describe("IBosonOfferHandler", function () { disputeResolver = mockDisputeResolver( rando.address, rando.address, - ethers.constants.AddressZero, + ZeroAddress, rando.address, false ); @@ -2404,7 +2404,7 @@ describe("IBosonOfferHandler", function () { disputeResolver = mockDisputeResolver( rando.address, rando.address, - ethers.constants.AddressZero, + ZeroAddress, rando.address, false ); @@ -2436,7 +2436,7 @@ describe("IBosonOfferHandler", function () { it("For some offer seller is not on dispute resolver's seller allow list", async function () { // Create new seller so sellerAllowList can have an entry - seller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -2555,7 +2555,7 @@ describe("IBosonOfferHandler", function () { } else { protocolFee = applyPercentage(offers[i].price, protocolFeePercentage); } - let agentFee = ethers.BigNumber.from(offers[i].price).mul(agent.feePercentage).div("10000").toString(); + let agentFee = BigInt(offers[i].price)*agent.feePercentage/"10000".toString(); offerFees = new OfferFees(protocolFee, agentFee); offerFeesList.push(offerFees); @@ -2790,7 +2790,7 @@ describe("IBosonOfferHandler", function () { ); // caller is an assistant of another seller - seller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); // AuthToken emptyAuthToken = mockAuthToken(); @@ -2843,7 +2843,7 @@ describe("IBosonOfferHandler", function () { .createOfferBatch(offers, offerDatesList, offerDurationsList, disputeResolverIds, agentIds); offersToExtend = ["1", "3", "5"]; - newValidUntilDate = ethers.BigNumber.from(offerDatesList[4].validUntil).add("10000").toString(); // offer "5" has the highest validUntilDate so we need to set something greater + newValidUntilDate = BigInt(offerDatesList[4].validUntil)+"10000".toString(); // offer "5" has the highest validUntilDate so we need to set something greater for (const offerToExtend of offersToExtend) { let i = offerToExtend - 1; @@ -2921,7 +2921,7 @@ describe("IBosonOfferHandler", function () { ); // caller is an assistant of another seller - seller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); // AuthToken emptyAuthToken = mockAuthToken(); @@ -2946,14 +2946,14 @@ describe("IBosonOfferHandler", function () { it("New valid until date is lower than the existing valid until date", async function () { // Make the valid until date the same as the existing offer - newValidUntilDate = ethers.BigNumber.from(offers[4].validUntilDate).sub("10000").toString(); // same as that validUntilDate of offer 5 + newValidUntilDate = BigInt(offers[4].validUntilDate)-"10000".toString(); // same as that validUntilDate of offer 5 await expect( offerHandler.connect(assistant).extendOfferBatch(offersToExtend, newValidUntilDate) ).to.revertedWith(RevertReasons.OFFER_PERIOD_INVALID); // Make new the valid until date less than existing one - newValidUntilDate = ethers.BigNumber.from(newValidUntilDate).sub("1").toString(); // less that validUntilDate of offer 5 + newValidUntilDate = BigInt(newValidUntilDate)-"1".toString(); // less that validUntilDate of offer 5 // Attempt to extend the offers, expecting revert await expect( @@ -2963,7 +2963,7 @@ describe("IBosonOfferHandler", function () { it("Valid until date is not in the future", async function () { // Set until date in the past - newValidUntilDate = ethers.BigNumber.from(offerDatesList[0].validFrom - oneMonth * 6).toString(); // 6 months ago + newValidUntilDate = BigInt(offerDatesList[0].validFrom - oneMonth * 6).toString(); // 6 months ago // Attempt to extend the offers, expecting revert await expect( @@ -2974,7 +2974,7 @@ describe("IBosonOfferHandler", function () { it("Offer has voucherRedeemableUntil set and new valid until date is greater than that", async function () { // create a new offer with vouchers with fix expiration date offer.id++; - offerDates.voucherRedeemableUntil = ethers.BigNumber.from(offerDates.validUntil).add(oneMonth).toString(); + offerDates.voucherRedeemableUntil = BigInt(offerDates.validUntil)+oneMonth.toString(); offerDurations.voucherValid = "0"; // only one of voucherRedeemableUntil and voucherValid can be non zero await offerHandler .connect(assistant) @@ -2982,7 +2982,7 @@ describe("IBosonOfferHandler", function () { offersToExtend.push(offer.id); // Set until date in after the offerDates.voucherRedeemableUntil - newValidUntilDate = ethers.BigNumber.from(offerDates.voucherRedeemableUntil).add(oneWeek).toString(); // one week after voucherRedeemableUntil + newValidUntilDate = BigInt(offerDates.voucherRedeemableUntil)+oneWeek.toString(); // one week after voucherRedeemableUntil // Attempt to extend the offers, expecting revert await expect( diff --git a/test/protocol/OrchestrationHandlerTest.js b/test/protocol/OrchestrationHandlerTest.js index a13413570..03d6cff1c 100644 --- a/test/protocol/OrchestrationHandlerTest.js +++ b/test/protocol/OrchestrationHandlerTest.js @@ -165,9 +165,9 @@ describe("IBosonOrchestrationHandler", function () { // make all account the same assistant = admin; assistantDR = adminDR; - clerk = clerkDR = { address: ethers.constants.AddressZero }; + clerk = clerkDR = { address: ZeroAddress }; - [deployer] = await ethers.getSigners(); + [deployer] = await getSigners(); // Get snapshot id snapshotId = await getSnapshot(); @@ -209,7 +209,7 @@ describe("IBosonOrchestrationHandler", function () { DRFeeNative = "0"; DRFeeToken = "0"; disputeResolverFees = [ - new DisputeResolverFee(ethers.constants.AddressZero, "Native", DRFeeNative), + new DisputeResolverFee(ZeroAddress, "Native", DRFeeNative), new DisputeResolverFee(bosonToken.address, "Boson", DRFeeToken), ]; @@ -348,10 +348,10 @@ describe("IBosonOrchestrationHandler", function () { escalationPeriod = disputeResolver.escalationResponsePeriod; // Deposit seller funds so the commit will succeed - const fundsToDeposit = ethers.BigNumber.from(sellerDeposit).mul(quantityAvailable); + const fundsToDeposit = BigInt(sellerDeposit)*quantityAvailable; await fundsHandler .connect(assistant) - .depositFunds(seller.id, ethers.constants.AddressZero, fundsToDeposit, { value: fundsToDeposit }); + .depositFunds(seller.id, ZeroAddress, fundsToDeposit, { value: fundsToDeposit }); buyerId = accountId.next().value; @@ -391,7 +391,7 @@ describe("IBosonOrchestrationHandler", function () { it("should update state", async function () { // Protocol balance before - const escrowBalanceBefore = await ethers.provider.getBalance(protocolDiamondAddress); + const escrowBalanceBefore = await provider.getBalance(protocolDiamondAddress); // Raise and escalate the dispute tx = await orchestrationHandler @@ -400,9 +400,9 @@ describe("IBosonOrchestrationHandler", function () { // Get the block timestamp of the confirmed tx and set escalatedDate blockNumber = tx.blockNumber; - block = await ethers.provider.getBlock(blockNumber); + block = await provider.getBlock(blockNumber); disputedDate = escalatedDate = block.timestamp.toString(); - timeout = ethers.BigNumber.from(escalatedDate).add(escalationPeriod).toString(); + timeout = BigInt(escalatedDate)+escalationPeriod.toString(); dispute = new Dispute(exchangeId, DisputeState.Escalated, "0"); disputeDates = new DisputeDates(disputedDate, escalatedDate, "0", timeout); @@ -430,8 +430,8 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(response, DisputeState.Escalated, "Dispute state is incorrect"); // Protocol balance should increase for buyer escalation deposit - const escrowBalanceAfter = await ethers.provider.getBalance(protocolDiamondAddress); - expect(escrowBalanceAfter.sub(escrowBalanceBefore)).to.equal( + const escrowBalanceAfter = await provider.getBalance(protocolDiamondAddress); + expect(escrowBalanceAfter-escrowBalanceBefore).to.equal( buyerEscalationDepositNative, "Escrow balance mismatch" ); @@ -450,7 +450,7 @@ describe("IBosonOrchestrationHandler", function () { // Protocol balance should increase for buyer escalation deposit const escrowBalanceAfter = await mockToken.balanceOf(protocolDiamondAddress); - expect(escrowBalanceAfter.sub(escrowBalanceBefore)).to.equal( + expect(escrowBalanceAfter-escrowBalanceBefore).to.equal( buyerEscalationDepositToken, "Escrow balance mismatch" ); @@ -517,8 +517,8 @@ describe("IBosonOrchestrationHandler", function () { }); it("exchange is not in a redeemed state - completed", async function () { - const blockNumber = await ethers.provider.getBlockNumber(); - const block = await ethers.provider.getBlock(blockNumber); + const blockNumber = await provider.getBlockNumber(); + const block = await provider.getBlock(blockNumber); const currentTime = block.timestamp; // Set time forward to run out the dispute period @@ -559,7 +559,7 @@ describe("IBosonOrchestrationHandler", function () { const voucherRedeemedDate = voucherStruct.redeemedDate; // Set time forward past the dispute period - await setNextBlockTimestamp(voucherRedeemedDate.add(disputePeriod).add(1).toNumber()); + await setNextBlockTimestamp(voucherRedeemedDate+disputePeriod+1.toNumber()); // Attempt to raise a dispute, expecting revert await expect( @@ -607,22 +607,22 @@ describe("IBosonOrchestrationHandler", function () { ); // Voucher clone contract - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged").withArgs(contractURI); await expect(tx) .to.emit(bosonVoucher, "RoyaltyPercentageChanged") .withArgs(voucherInitValues.royaltyPercentage); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ethers.constants.AddressZero, assistant.address); + .withArgs(ZeroAddress, assistant.address); }); it("should emit a SellerCreated and OfferCreated events with auth token", async function () { - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; sellerStruct = seller.toStruct(); // Create a seller and an offer, testing for the event @@ -660,22 +660,22 @@ describe("IBosonOrchestrationHandler", function () { ); // Voucher clone contract - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged").withArgs(contractURI); await expect(tx) .to.emit(bosonVoucher, "RoyaltyPercentageChanged") .withArgs(voucherInitValues.royaltyPercentage); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ethers.constants.AddressZero, assistant.address); + .withArgs(ZeroAddress, assistant.address); }); it("should update state", async function () { - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; sellerStruct = seller.toStruct(); // Create a seller and an offer @@ -736,18 +736,18 @@ describe("IBosonOrchestrationHandler", function () { // Voucher clone contract expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); }); it("should update state when voucherInitValues has zero royaltyPercentage and exchangeId does not exist", async function () { - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; // ERC2981 Royalty fee is 0% voucherInitValues.royaltyPercentage = "0"; //0% @@ -768,7 +768,7 @@ describe("IBosonOrchestrationHandler", function () { ); expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); @@ -787,7 +787,7 @@ describe("IBosonOrchestrationHandler", function () { [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(exchangeId, offerPrice); // Expectations - let expectedRecipient = ethers.constants.AddressZero; //expect zero address when exchange id does not exist + let expectedRecipient = ZeroAddress; //expect zero address when exchange id does not exist let expectedRoyaltyAmount = "0"; // Zero Fee when exchange id does not exist assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); @@ -795,7 +795,7 @@ describe("IBosonOrchestrationHandler", function () { }); it("should update state when voucherInitValues has non zero royaltyPercentage and exchangeId does not exist", async function () { - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; // ERC2981 Royalty fee is 10% voucherInitValues.royaltyPercentage = "1000"; //10% @@ -816,7 +816,7 @@ describe("IBosonOrchestrationHandler", function () { ); expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); @@ -835,7 +835,7 @@ describe("IBosonOrchestrationHandler", function () { [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(exchangeId, offerPrice); // Expectations - let expectedRecipient = ethers.constants.AddressZero; //expect zero address when exchange id does not exist + let expectedRecipient = ZeroAddress; //expect zero address when exchange id does not exist let expectedRoyaltyAmount = "0"; // Zero Fee when exchange id does not exist assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); @@ -1047,7 +1047,7 @@ describe("IBosonOrchestrationHandler", function () { it("Should allow creation of an offer with unlimited supply", async function () { // Prepare an offer with unlimited supply - offer.quantityAvailable = ethers.constants.MaxUint256.toString(); + offer.quantityAvailable = constants.MaxUint256.toString(); // Create a seller and an offer, testing for the event await expect( @@ -1108,7 +1108,7 @@ describe("IBosonOrchestrationHandler", function () { ); // create another offer, now with bosonToken as exchange token - seller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); contractURI = `https://ipfs.io/ipfs/QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ`; offer.exchangeToken = bosonToken.address; offer.id = "2"; @@ -1164,7 +1164,7 @@ describe("IBosonOrchestrationHandler", function () { }); it("should emit a SellerCreated, OfferCreated and RangeReserved events with auth token", async function () { - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; sellerStruct = seller.toStruct(); // Create a seller and a preminted offer, testing for the event @@ -1208,7 +1208,7 @@ describe("IBosonOrchestrationHandler", function () { .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, assistant.address, assistant.address); // Voucher clone contract - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged").withArgs(contractURI); await expect(tx) @@ -1217,15 +1217,15 @@ describe("IBosonOrchestrationHandler", function () { await expect(tx).to.emit(bosonVoucher, "RangeReserved").withArgs(nextOfferId, range.toStruct()); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ethers.constants.AddressZero, assistant.address); + .withArgs(ZeroAddress, assistant.address); }); it("should update state", async function () { - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; sellerStruct = seller.toStruct(); // Create a seller and a preminted offer @@ -1291,11 +1291,11 @@ describe("IBosonOrchestrationHandler", function () { // Voucher clone contract expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); @@ -1457,7 +1457,7 @@ describe("IBosonOrchestrationHandler", function () { }); it("Caller does not own supplied auth token", async function () { - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; seller.assistant = rando.address; // Attempt to create a seller and an offer, expecting revert @@ -1538,7 +1538,7 @@ describe("IBosonOrchestrationHandler", function () { }); it("admin address is zero address and AuthTokenType is None", async function () { - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; // Attempt to create a seller and an offer, expecting revert await expect( @@ -1559,7 +1559,7 @@ describe("IBosonOrchestrationHandler", function () { it("authToken is not unique to this seller", async function () { // Set admin == zero address because seller will be created with auth token - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; // Create a seller await accountHandler.connect(assistant).createSeller(seller, authToken, voucherInitValues); @@ -1583,8 +1583,8 @@ describe("IBosonOrchestrationHandler", function () { it("Valid from date is greater than valid until date", async function () { // Reverse the from and until dates - offerDates.validFrom = ethers.BigNumber.from(Date.now() + oneMonth * 6).toString(); // 6 months from now - offerDates.validUntil = ethers.BigNumber.from(Date.now()).toString(); // now + offerDates.validFrom = BigInt(Date.now() + oneMonth * 6).toString(); // 6 months from now + offerDates.validUntil = BigInt(Date.now()).toString(); // now // Attempt to create a seller and an offer, expecting revert await expect( @@ -1605,12 +1605,12 @@ describe("IBosonOrchestrationHandler", function () { it("Valid until date is not in the future", async function () { // Get the current block info - const blockNumber = await ethers.provider.getBlockNumber(); - const block = await ethers.provider.getBlock(blockNumber); + const blockNumber = await provider.getBlockNumber(); + const block = await provider.getBlock(blockNumber); // Set until date in the past - offerDates.validUntil = ethers.BigNumber.from(block.timestamp) - .sub(oneMonth * 6) + offerDates.validUntil = BigInt(block.timestamp) + -oneMonth * 6 .toString(); // 6 months ago // Attempt to create a seller and an offer, expecting revert @@ -1632,7 +1632,7 @@ describe("IBosonOrchestrationHandler", function () { it("Buyer cancel penalty is less than item price", async function () { // Set buyer cancel penalty higher than offer price - offer.buyerCancelPenalty = ethers.BigNumber.from(offer.price).add(10).toString(); + offer.buyerCancelPenalty = BigInt(offer.price)+10.toString(); // Attempt to create a seller and an offer, expecting revert await expect( @@ -1763,7 +1763,7 @@ describe("IBosonOrchestrationHandler", function () { it("Dispute period is less than minimum dispute period", async function () { // Set dispute period to less than minDisputePeriod (oneWeek) - offerDurations.disputePeriod = ethers.BigNumber.from(oneWeek).sub(1000).toString(); + offerDurations.disputePeriod = BigInt(oneWeek)-1000.toString(); // Attempt to create a seller and an offer, expecting revert await expect( @@ -1872,7 +1872,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolver = mockDisputeResolver( rando.address, rando.address, - ethers.constants.AddressZero, + ZeroAddress, rando.address, false ); @@ -1927,7 +1927,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolver = mockDisputeResolver( rando.address, rando.address, - ethers.constants.AddressZero, + ZeroAddress, rando.address, false ); @@ -1960,7 +1960,7 @@ describe("IBosonOrchestrationHandler", function () { it("Seller is not on dispute resolver's seller allow list", async function () { // Create new seller so sellerAllowList can have an entry - const newSeller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + const newSeller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); await accountHandler.connect(rando).createSeller(newSeller, emptyAuthToken, voucherInitValues); @@ -2053,7 +2053,7 @@ describe("IBosonOrchestrationHandler", function () { it("Reserved range length is greater than maximum allowed range length", async function () { // Set reserved range length to more than maximum allowed range length - let reservedRangeLength = ethers.BigNumber.from(2).pow(64).sub(1); + let reservedRangeLength = BigInt(2)**64-1; // Attempt to create a seller and an offer, expecting revert await expect( @@ -2093,7 +2093,7 @@ describe("IBosonOrchestrationHandler", function () { // Create an agent await accountHandler.connect(rando).createAgent(agent); - agentFee = ethers.BigNumber.from(offer.price).mul(agent.feePercentage).div("10000").toString(); + agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); offerFees.agentFee = agentFee; offerFeesStruct = offerFees.toStruct(); }); @@ -2144,7 +2144,7 @@ describe("IBosonOrchestrationHandler", function () { let agentId = "16"; // Seller can have admin address OR auth token - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; // Attempt to Create an offer, expecting revert await expect( @@ -2447,7 +2447,7 @@ describe("IBosonOrchestrationHandler", function () { it("Should allow creation of an offer with unlimited supply", async function () { // Prepare an absolute zero offer - offer.quantityAvailable = ethers.constants.MaxUint256.toString(); + offer.quantityAvailable = constants.MaxUint256.toString(); // Create an offer with condition, testing for the events await expect( @@ -2547,7 +2547,7 @@ describe("IBosonOrchestrationHandler", function () { // Create an agent await accountHandler.connect(rando).createAgent(agent); - agentFee = ethers.BigNumber.from(offer.price).mul(agent.feePercentage).div("10000").toString(); + agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); offerFees.agentFee = agentFee; offerFeesStruct = offerFees.toStruct(); }); @@ -2600,7 +2600,7 @@ describe("IBosonOrchestrationHandler", function () { // Voucher clone contract expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); const tokenIdStart = deriveTokenId(offer.id, firstTokenId); range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", bosonVoucher.address); @@ -2820,7 +2820,7 @@ describe("IBosonOrchestrationHandler", function () { it("Condition 'Threshold' has zero token contract address", async function () { condition.method = EvaluationMethod.Threshold; - condition.tokenAddress = ethers.constants.AddressZero; + condition.tokenAddress = ZeroAddress; // Attempt to create an offer with condition, expecting revert await expect( @@ -2832,7 +2832,7 @@ describe("IBosonOrchestrationHandler", function () { it("Condition 'SpecificToken' has has zero token contract address", async function () { condition.method = EvaluationMethod.SpecificToken; - condition.tokenAddress = ethers.constants.AddressZero; + condition.tokenAddress = ZeroAddress; // Attempt to create an offer with condition, expecting revert await expect( @@ -2857,14 +2857,14 @@ describe("IBosonOrchestrationHandler", function () { // Mock offer, offerDates and offerDurations ({ offer, offerDates, offerDurations } = await mockOffer()); offer.id = `${i + 1}`; - offer.price = ethers.utils.parseUnits(`${1.5 + i * 1}`, "ether").toString(); - offer.sellerDeposit = ethers.utils.parseUnits(`${0.25 + i * 0.1}`, "ether").toString(); - offer.buyerCancelPenalty = ethers.utils.parseUnits(`${0.05 + i * 0.1}`, "ether").toString(); + offer.price = parseUnits(`${1.5 + i * 1}`, "ether").toString(); + offer.sellerDeposit = parseUnits(`${0.25 + i * 0.1}`, "ether").toString(); + offer.buyerCancelPenalty = parseUnits(`${0.05 + i * 0.1}`, "ether").toString(); offer.quantityAvailable = `${(i + 1) * 2}`; offer.sellerId = seller.id; // "2" is dispute resolver - offerDates.validFrom = ethers.BigNumber.from(Date.now() + oneMonth * i).toString(); - offerDates.validUntil = ethers.BigNumber.from(Date.now() + oneMonth * 6 * (i + 1)).toString(); + offerDates.validFrom = BigInt(Date.now() + oneMonth * i).toString(); + offerDates.validUntil = BigInt(Date.now() + oneMonth * 6 * (i + 1)).toString(); disputeResolver.id = "1"; agentId = "0"; @@ -3137,7 +3137,7 @@ describe("IBosonOrchestrationHandler", function () { it("Should allow creation of an offer with unlimited supply", async function () { // Prepare an absolute zero offer - offer.quantityAvailable = ethers.constants.MaxUint256.toString(); + offer.quantityAvailable = constants.MaxUint256.toString(); // Create an offer, add it to the group, testing for the events await expect( @@ -3237,7 +3237,7 @@ describe("IBosonOrchestrationHandler", function () { // Create an agent await accountHandler.connect(rando).createAgent(agent); - agentFee = ethers.BigNumber.from(offer.price).mul(agent.feePercentage).div("10000").toString(); + agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); offerFees.agentFee = agentFee; offerFeesStruct = offerFees.toStruct(); }); @@ -3291,7 +3291,7 @@ describe("IBosonOrchestrationHandler", function () { // Voucher clone contract expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); }); it("should emit an OfferCreated, a GroupUpdated and a RangeReserved events", async function () { @@ -3806,9 +3806,9 @@ describe("IBosonOrchestrationHandler", function () { it("Should allow creation of an offer with unlimited supply", async function () { // Prepare an offer with unlimited supply - offer.quantityAvailable = ethers.constants.MaxUint256.toString(); + offer.quantityAvailable = constants.MaxUint256.toString(); // Twin supply should be unlimited as well - twin.supplyAvailable = ethers.constants.MaxUint256.toString(); + twin.supplyAvailable = constants.MaxUint256.toString(); // Create an offer, a twin and a bundle, testing for the events await expect( @@ -3908,7 +3908,7 @@ describe("IBosonOrchestrationHandler", function () { // Create an agent await accountHandler.connect(rando).createAgent(agent); - agentFee = ethers.BigNumber.from(offer.price).mul(agent.feePercentage).div("10000").toString(); + agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); offerFees.agentFee = agentFee; offerFeesStruct = offerFees.toStruct(); }); @@ -3970,7 +3970,7 @@ describe("IBosonOrchestrationHandler", function () { // Voucher clone contract expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); const tokenIdStart = deriveTokenId(offer.id, firstTokenId); range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", bosonVoucher.address); @@ -4220,7 +4220,7 @@ describe("IBosonOrchestrationHandler", function () { context("Token address is unsupported", async function () { it("Token address is a zero address", async function () { - twin.tokenAddress = ethers.constants.AddressZero; + twin.tokenAddress = ZeroAddress; await expect( orchestrationHandler @@ -4663,9 +4663,9 @@ describe("IBosonOrchestrationHandler", function () { it("Should allow creation of an offer with unlimited supply", async function () { // Prepare an offer with unlimited supply - offer.quantityAvailable = ethers.constants.MaxUint256.toString(); + offer.quantityAvailable = constants.MaxUint256.toString(); // Twin supply should be unlimited as well - twin.supplyAvailable = ethers.constants.MaxUint256.toString(); + twin.supplyAvailable = constants.MaxUint256.toString(); // Create an offer with condition, twin and bundle testing for the events await expect( @@ -4798,7 +4798,7 @@ describe("IBosonOrchestrationHandler", function () { // Create an agent await accountHandler.connect(rando).createAgent(agent); - agentFee = ethers.BigNumber.from(offer.price).mul(agent.feePercentage).div("10000").toString(); + agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); offerFees.agentFee = agentFee; offerFeesStruct = offerFees.toStruct(); }); @@ -4880,7 +4880,7 @@ describe("IBosonOrchestrationHandler", function () { // Voucher clone contract expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); }); it("should emit an OfferCreated, a GroupCreated, a TwinCreated, a BundleCreated and a RangeReserved events", async function () { @@ -5247,18 +5247,18 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(groupInstance.toString(), group.toString(), "Group struct is incorrect"); // Voucher clone contract - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged").withArgs(contractURI); await expect(tx) .to.emit(bosonVoucher, "RoyaltyPercentageChanged") .withArgs(voucherInitValues.royaltyPercentage); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ethers.constants.AddressZero, assistant.address); + .withArgs(ZeroAddress, assistant.address); }); it("should update state", async function () { @@ -5340,11 +5340,11 @@ describe("IBosonOrchestrationHandler", function () { // Voucher clone contract expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); @@ -5372,7 +5372,7 @@ describe("IBosonOrchestrationHandler", function () { // Voucher clone contract expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); @@ -5391,7 +5391,7 @@ describe("IBosonOrchestrationHandler", function () { [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(exchangeId, offerPrice); // Expectations - let expectedRecipient = ethers.constants.AddressZero; //expect zero address when exchange id does not exist + let expectedRecipient = ZeroAddress; //expect zero address when exchange id does not exist let expectedRoyaltyAmount = "0"; // Zero Fee when exchange id does not exist assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); @@ -5420,7 +5420,7 @@ describe("IBosonOrchestrationHandler", function () { // Voucher clone contract expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); @@ -5439,7 +5439,7 @@ describe("IBosonOrchestrationHandler", function () { [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(exchangeId, offerPrice); // Expectations - let expectedRecipient = ethers.constants.AddressZero; //expect zero address when exchange id does not exist + let expectedRecipient = ZeroAddress; //expect zero address when exchange id does not exist let expectedRoyaltyAmount = "0"; // Zero Fee when exchange id does not exist assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); @@ -5524,7 +5524,7 @@ describe("IBosonOrchestrationHandler", function () { // Create an agent await accountHandler.connect(rando).createAgent(agent); - agentFee = ethers.BigNumber.from(offer.price).mul(agent.feePercentage).div("10000").toString(); + agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); offerFees.agentFee = agentFee; offerFeesStruct = offerFees.toStruct(); }); @@ -5654,7 +5654,7 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(groupInstance.toString(), group.toString(), "Group struct is incorrect"); // Voucher clone contract - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged").withArgs(contractURI); await expect(tx) @@ -5663,11 +5663,11 @@ describe("IBosonOrchestrationHandler", function () { await expect(tx).to.emit(bosonVoucher, "RangeReserved").withArgs(nextOfferId, range.toStruct()); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ethers.constants.AddressZero, assistant.address); + .withArgs(ZeroAddress, assistant.address); }); it("should update state", async function () { @@ -5754,11 +5754,11 @@ describe("IBosonOrchestrationHandler", function () { // Voucher clone contract expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); @@ -5979,18 +5979,18 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(bundleInstance.toString(), bundle.toString(), "Bundle struct is incorrect"); // Voucher clone contract - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged").withArgs(contractURI); await expect(tx) .to.emit(bosonVoucher, "RoyaltyPercentageChanged") .withArgs(voucherInitValues.royaltyPercentage); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ethers.constants.AddressZero, assistant.address); + .withArgs(ZeroAddress, assistant.address); }); it("should update state", async function () { @@ -6078,11 +6078,11 @@ describe("IBosonOrchestrationHandler", function () { // Voucher clone contract expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); @@ -6113,7 +6113,7 @@ describe("IBosonOrchestrationHandler", function () { // Voucher clone contract expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); @@ -6132,7 +6132,7 @@ describe("IBosonOrchestrationHandler", function () { [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(exchangeId, offerPrice); // Expectations - let expectedRecipient = ethers.constants.AddressZero; //expect zero address when exchange id does not exist + let expectedRecipient = ZeroAddress; //expect zero address when exchange id does not exist let expectedRoyaltyAmount = "0"; // Zero Fee when exchange id does not exist assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); @@ -6164,7 +6164,7 @@ describe("IBosonOrchestrationHandler", function () { // Voucher clone contract expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); @@ -6183,7 +6183,7 @@ describe("IBosonOrchestrationHandler", function () { [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(exchangeId, offerPrice); // Expectations - let expectedRecipient = ethers.constants.AddressZero; //expect zero address when exchange id does not exist + let expectedRecipient = ZeroAddress; //expect zero address when exchange id does not exist let expectedRoyaltyAmount = "0"; // Zero Fee when exchange id does not exist assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); @@ -6287,7 +6287,7 @@ describe("IBosonOrchestrationHandler", function () { // Create an agent await accountHandler.connect(rando).createAgent(agent); - agentFee = ethers.BigNumber.from(offer.price).mul(agent.feePercentage).div("10000").toString(); + agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); offerFees.agentFee = agentFee; offerFeesStruct = offerFees.toStruct(); }); @@ -6447,7 +6447,7 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(bundleInstance.toString(), bundle.toString(), "Bundle struct is incorrect"); // Voucher clone contract - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged").withArgs(contractURI); await expect(tx) @@ -6456,11 +6456,11 @@ describe("IBosonOrchestrationHandler", function () { await expect(tx).to.emit(bosonVoucher, "RangeReserved").withArgs(nextOfferId, range.toStruct()); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ethers.constants.AddressZero, assistant.address); + .withArgs(ZeroAddress, assistant.address); }); it("should update state", async function () { @@ -6553,11 +6553,11 @@ describe("IBosonOrchestrationHandler", function () { // Voucher clone contract expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); @@ -6827,18 +6827,18 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(bundleInstance.toString(), bundle.toString(), "Bundle struct is incorrect"); // Voucher clone contract - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged").withArgs(contractURI); await expect(tx) .to.emit(bosonVoucher, "RoyaltyPercentageChanged") .withArgs(voucherInitValues.royaltyPercentage); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ethers.constants.AddressZero, assistant.address); + .withArgs(ZeroAddress, assistant.address); }); it("should update state", async function () { @@ -6946,11 +6946,11 @@ describe("IBosonOrchestrationHandler", function () { // Voucher clone contract expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); @@ -6982,7 +6982,7 @@ describe("IBosonOrchestrationHandler", function () { // Voucher clone contract expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); @@ -7001,7 +7001,7 @@ describe("IBosonOrchestrationHandler", function () { [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(exchangeId, offerPrice); // Expectations - let expectedRecipient = ethers.constants.AddressZero; //expect zero address when exchange id does not exist + let expectedRecipient = ZeroAddress; //expect zero address when exchange id does not exist let expectedRoyaltyAmount = "0"; // Zero Fee when exchange id does not exist assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); @@ -7034,7 +7034,7 @@ describe("IBosonOrchestrationHandler", function () { // Voucher clone contract expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); @@ -7053,7 +7053,7 @@ describe("IBosonOrchestrationHandler", function () { [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(exchangeId, offerPrice); // Expectations - let expectedRecipient = ethers.constants.AddressZero; //expect zero address when exchange id does not exist + let expectedRecipient = ZeroAddress; //expect zero address when exchange id does not exist let expectedRoyaltyAmount = "0"; // Zero Fee when exchange id does not exist assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); @@ -7169,7 +7169,7 @@ describe("IBosonOrchestrationHandler", function () { // Create an agent await accountHandler.connect(rando).createAgent(agent); - agentFee = ethers.BigNumber.from(offer.price).mul(agent.feePercentage).div("10000").toString(); + agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); offerFees.agentFee = agentFee; offerFeesStruct = offerFees.toStruct(); }); @@ -7249,18 +7249,18 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(bundleInstance.toString(), bundle.toString(), "Bundle struct is incorrect"); // Voucher clone contract - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged").withArgs(contractURI); await expect(tx) .to.emit(bosonVoucher, "RoyaltyPercentageChanged") .withArgs(voucherInitValues.royaltyPercentage); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ethers.constants.AddressZero, assistant.address); + .withArgs(ZeroAddress, assistant.address); }); }); @@ -7357,7 +7357,7 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(bundleInstance.toString(), bundle.toString(), "Bundle struct is incorrect"); // Voucher clone contract - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged").withArgs(contractURI); await expect(tx) @@ -7366,11 +7366,11 @@ describe("IBosonOrchestrationHandler", function () { await expect(tx).to.emit(bosonVoucher, "RangeReserved").withArgs(nextOfferId, range.toStruct()); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ethers.constants.AddressZero, assistant.address); + .withArgs(ZeroAddress, assistant.address); }); it("should update state", async function () { @@ -7483,11 +7483,11 @@ describe("IBosonOrchestrationHandler", function () { // Voucher clone contract expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); diff --git a/test/protocol/ProtocolDiamondTest.js b/test/protocol/ProtocolDiamondTest.js index 0af807554..d5ada610c 100644 --- a/test/protocol/ProtocolDiamondTest.js +++ b/test/protocol/ProtocolDiamondTest.js @@ -57,7 +57,7 @@ describe("ProtocolDiamond", async function () { beforeEach(async function () { // Make accounts available - [deployer, admin, upgrader, rando] = await ethers.getSigners(); + [deployer, admin, upgrader, rando] = await getSigners(); // Deploy the Diamond [protocolDiamond, diamondLoupe, diamondCut, erc165, accessController] = await deployProtocolDiamond( @@ -65,13 +65,13 @@ describe("ProtocolDiamond", async function () { ); // Cast Diamond to DiamondLoupeFacet - loupeFacetViaDiamond = await ethers.getContractAt("DiamondLoupeFacet", protocolDiamond.address); + loupeFacetViaDiamond = await getContractAt("DiamondLoupeFacet", protocolDiamond.address); // Cast Diamond to DiamondCutFacet - cutFacetViaDiamond = await ethers.getContractAt("DiamondCutFacet", protocolDiamond.address); + cutFacetViaDiamond = await getContractAt("DiamondCutFacet", protocolDiamond.address); // Cast Diamond to ERC165Facet - erc165ViaDiamond = await ethers.getContractAt("ERC165Facet", protocolDiamond.address); + erc165ViaDiamond = await getContractAt("ERC165Facet", protocolDiamond.address); // Get the facet addresses addresses = Object.assign([], await loupeFacetViaDiamond.facetAddresses()); @@ -146,7 +146,7 @@ describe("ProtocolDiamond", async function () { it("should revert if more than 255 functions are added", async () => { // add more than 256 facets // Deploy TestFacet256 - const TestFacet256 = await ethers.getContractFactory("TestFacet256"); + const TestFacet256 = await getContractFactory("TestFacet256"); const testFacet256 = await TestFacet256.deploy(); await testFacet256.deployed(); @@ -165,7 +165,7 @@ describe("ProtocolDiamond", async function () { // Send the DiamondCut transaction tx = await cutFacetViaDiamond .connect(upgrader) - .diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit: "10000000" }); + .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit: "10000000" }); // this should revert await expect(loupeFacetViaDiamond.facets()).to.be.revertedWith(RevertReasons.TOO_MANY_FUNCTIONS); @@ -191,7 +191,7 @@ describe("ProtocolDiamond", async function () { it("Should return correct addresses even when selectorCount is greater than 8", async () => { // Deploy Test1Facet to have more selectors - Test1Facet = await ethers.getContractFactory("Test1Facet"); + Test1Facet = await getContractFactory("Test1Facet"); test1Facet = await Test1Facet.deploy(); await test1Facet.deployed(); @@ -210,7 +210,7 @@ describe("ProtocolDiamond", async function () { // Send the DiamondCut transaction await cutFacetViaDiamond .connect(upgrader) - .diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }); + .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); const addresses = await loupeFacetViaDiamond.facetAddresses(); @@ -261,17 +261,17 @@ describe("ProtocolDiamond", async function () { context("📋 DiamondCutFacet", async function () { beforeEach(async function () { // Deploy Test1Facet - Test1Facet = await ethers.getContractFactory("Test1Facet"); + Test1Facet = await getContractFactory("Test1Facet"); test1Facet = await Test1Facet.deploy(); await test1Facet.deployed(); // Deploy Test2Facet - Test2Facet = await ethers.getContractFactory("Test2Facet"); + Test2Facet = await getContractFactory("Test2Facet"); test2Facet = await Test2Facet.deploy(); await test2Facet.deployed(); // Deploy Test3Facet - Test3Facet = await ethers.getContractFactory("Test3Facet"); + Test3Facet = await getContractFactory("Test3Facet"); test3Facet = await Test3Facet.deploy(); await test3Facet.deployed(); @@ -280,13 +280,13 @@ describe("ProtocolDiamond", async function () { // the ABI of these facets, once their functions have been added. // Cast Diamond to Test1Facet - test1ViaDiamond = await ethers.getContractAt("Test1Facet", protocolDiamond.address); + test1ViaDiamond = await getContractAt("Test1Facet", protocolDiamond.address); // Cast Diamond to Test2Facet - test2ViaDiamond = await ethers.getContractAt("Test2Facet", protocolDiamond.address); + test2ViaDiamond = await getContractAt("Test2Facet", protocolDiamond.address); // Cast Diamond to Test3Facet - test3ViaDiamond = await ethers.getContractAt("Test3Facet", protocolDiamond.address); + test3ViaDiamond = await getContractAt("Test3Facet", protocolDiamond.address); }); context("👉 diamondCut() - Privileged Access", async function () { @@ -305,13 +305,13 @@ describe("ProtocolDiamond", async function () { // non-UPGRADER attempt await expect( - cutFacetViaDiamond.connect(admin).diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }) + cutFacetViaDiamond.connect(admin).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }) ).to.be.revertedWith(RevertReasons.ONLY_UPGRADER); // UPGRADER attempt tx = await cutFacetViaDiamond .connect(upgrader) - .diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }); + .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); @@ -338,7 +338,7 @@ describe("ProtocolDiamond", async function () { // Send the DiamondCut transaction tx = await cutFacetViaDiamond .connect(upgrader) - .diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }); + .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); @@ -367,7 +367,7 @@ describe("ProtocolDiamond", async function () { // Send the DiamondCut transaction tx = await cutFacetViaDiamond .connect(upgrader) - .diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }); + .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); @@ -404,7 +404,7 @@ describe("ProtocolDiamond", async function () { // Send the DiamondCut transaction tx = await cutFacetViaDiamond .connect(upgrader) - .diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }); + .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Be certain transaction was successful assert.equal(receipt.status, 1, `Diamond upgrade failed: ${tx.hash}`); @@ -421,7 +421,7 @@ describe("ProtocolDiamond", async function () { // Define the facet cut facetCuts = [ { - facetAddress: ethers.constants.AddressZero, + facetAddress: ZeroAddress, action: FacetCutAction.Add, functionSelectors: [], }, @@ -429,7 +429,7 @@ describe("ProtocolDiamond", async function () { // attempt to add zero selectors await expect( - cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }) + cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }) ).to.be.revertedWith(RevertReasons.NO_SELECTORS_TO_CUT); }); @@ -449,11 +449,11 @@ describe("ProtocolDiamond", async function () { // Send the DiamondCut transaction await cutFacetViaDiamond .connect(upgrader) - .diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }); + .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // attempt to add the same selectors again await expect( - cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }) + cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }) ).to.be.revertedWith(RevertReasons.FUNCTION_ALREADY_EXISTS); }); }); @@ -477,7 +477,7 @@ describe("ProtocolDiamond", async function () { // Send the DiamondCut transaction tx = await cutFacetViaDiamond .connect(upgrader) - .diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }); + .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); @@ -494,7 +494,7 @@ describe("ProtocolDiamond", async function () { // Define the facet cuts facetCuts = [ { - facetAddress: ethers.constants.AddressZero, + facetAddress: ZeroAddress, action: FacetCutAction.Remove, functionSelectors: selectors, }, @@ -503,7 +503,7 @@ describe("ProtocolDiamond", async function () { // Send the DiamondCut transaction tx = await cutFacetViaDiamond .connect(upgrader) - .diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }); + .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); @@ -524,7 +524,7 @@ describe("ProtocolDiamond", async function () { // Define the facet cuts facetCuts = [ { - facetAddress: ethers.constants.AddressZero, + facetAddress: ZeroAddress, action: FacetCutAction.Remove, functionSelectors: selectors, }, @@ -533,7 +533,7 @@ describe("ProtocolDiamond", async function () { // Send the DiamondCut transaction tx = await cutFacetViaDiamond .connect(upgrader) - .diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }); + .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); @@ -564,7 +564,7 @@ describe("ProtocolDiamond", async function () { // Define the facet cuts facetCuts = [ { - facetAddress: ethers.constants.AddressZero, + facetAddress: ZeroAddress, action: FacetCutAction.Remove, functionSelectors: selectors, }, @@ -573,7 +573,7 @@ describe("ProtocolDiamond", async function () { // Send the DiamondCut transaction tx = await cutFacetViaDiamond .connect(upgrader) - .diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }); + .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); @@ -600,7 +600,7 @@ describe("ProtocolDiamond", async function () { // Define the facet cut facetCuts = [ { - facetAddress: ethers.constants.AddressZero, + facetAddress: ZeroAddress, action: FacetCutAction.Remove, functionSelectors: [], }, @@ -608,7 +608,7 @@ describe("ProtocolDiamond", async function () { // attempt to remove zero selectors await expect( - cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }) + cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }) ).to.be.revertedWith(RevertReasons.NO_SELECTORS_TO_CUT); }); @@ -628,7 +628,7 @@ describe("ProtocolDiamond", async function () { // attempt to make remove cut with non zero facet address await expect( - cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }) + cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }) ).to.be.revertedWith(RevertReasons.REMOVING_NON_ZERO_ADDRESS_FACET); }); @@ -636,7 +636,7 @@ describe("ProtocolDiamond", async function () { // Define the facet cut facetCuts = [ { - facetAddress: ethers.constants.AddressZero, + facetAddress: ZeroAddress, action: FacetCutAction.Remove, functionSelectors: getSelectors(test3Facet), }, @@ -644,7 +644,7 @@ describe("ProtocolDiamond", async function () { // attempt to remove function that doesn't exist await expect( - cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }) + cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }) ).to.be.revertedWith(RevertReasons.REMOVING_FUNCTION_DOES_NOT_EXIST); }); @@ -662,12 +662,12 @@ describe("ProtocolDiamond", async function () { // Send the DiamondCut transaction that adds immutable functions await cutFacetViaDiamond .connect(upgrader) - .diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }); + .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Define the facet cut facetCuts = [ { - facetAddress: ethers.constants.AddressZero, + facetAddress: ZeroAddress, action: FacetCutAction.Remove, functionSelectors: getSelectors(test3Facet), }, @@ -675,7 +675,7 @@ describe("ProtocolDiamond", async function () { // attempt to make remove immutable function await expect( - cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }) + cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }) ).to.be.revertedWith(RevertReasons.REMOVING_IMMUTABLE_FUNCTION); }); }); @@ -699,7 +699,7 @@ describe("ProtocolDiamond", async function () { // Send the DiamondCut transaction tx = await cutFacetViaDiamond .connect(upgrader) - .diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }); + .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); @@ -713,7 +713,7 @@ describe("ProtocolDiamond", async function () { assert.equal(await test2ViaDiamond.test2Func13(), "Boson"); // Deploy Test2FacetUpgrade - Test2FacetUpgrade = await ethers.getContractFactory("Test2FacetUpgrade"); + Test2FacetUpgrade = await getContractFactory("Test2FacetUpgrade"); test2FacetUpgrade = await Test2FacetUpgrade.deploy(); await test2FacetUpgrade.deployed(); @@ -729,7 +729,7 @@ describe("ProtocolDiamond", async function () { // Send the DiamondCut transaction tx = await cutFacetViaDiamond .connect(upgrader) - .diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }); + .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); @@ -745,7 +745,7 @@ describe("ProtocolDiamond", async function () { // Define the facet cut facetCuts = [ { - facetAddress: ethers.constants.AddressZero, + facetAddress: ZeroAddress, action: FacetCutAction.Replace, functionSelectors: [], }, @@ -753,7 +753,7 @@ describe("ProtocolDiamond", async function () { // attempt to replace zero selectors await expect( - cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }) + cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }) ).to.be.revertedWith(RevertReasons.NO_SELECTORS_TO_CUT); }); @@ -772,7 +772,7 @@ describe("ProtocolDiamond", async function () { // Send the DiamondCut transaction that adds immutable functions await cutFacetViaDiamond .connect(upgrader) - .diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }); + .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Define the facet cut facetCuts = [ @@ -785,7 +785,7 @@ describe("ProtocolDiamond", async function () { // attempt to replace immutable functions await expect( - cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }) + cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }) ).to.be.revertedWith(RevertReasons.REPLACING_IMMUTABLE_FUNCTION); }); @@ -801,7 +801,7 @@ describe("ProtocolDiamond", async function () { // attempt to replace function with same function await expect( - cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }) + cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }) ).to.be.revertedWith(RevertReasons.REPLACING_WITH_SAME_FUNCTION); }); @@ -817,7 +817,7 @@ describe("ProtocolDiamond", async function () { // attempt to replace function that doesn't exist await expect( - cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }) + cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }) ).to.be.revertedWith(RevertReasons.REPLACING_FUNCTION_DOES_NOT_EXIST); }); }); @@ -834,7 +834,7 @@ describe("ProtocolDiamond", async function () { // Send the DiamondCut transaction await expect( - cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }) + cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }) ).to.be.reverted; }); }); @@ -843,7 +843,7 @@ describe("ProtocolDiamond", async function () { context("📋 Initializer", async function () { beforeEach(async function () { // Deploy Test3Facet - Test3Facet = await ethers.getContractFactory("Test3Facet"); + Test3Facet = await getContractFactory("Test3Facet"); test3Facet = await Test3Facet.deploy(); await test3Facet.deployed(); @@ -852,14 +852,14 @@ describe("ProtocolDiamond", async function () { // the ABI of these facets, once their functions have been added. // Cast Diamond to Test3Facet - test3ViaDiamond = await ethers.getContractAt("Test3Facet", protocolDiamond.address); + test3ViaDiamond = await getContractAt("Test3Facet", protocolDiamond.address); }); context("👉 Normal operation", async function () { beforeEach(async function () { // Encode the initialization call initFunction = "initialize(address _testAddress)"; - initInterface = new ethers.utils.Interface([`function ${initFunction}`]); + initInterface = new Interface([`function ${initFunction}`]); initCallData = initInterface.encodeFunctionData("initialize", [rando.address]); // Get the Test3Facet function selectors from the abi, removing the initializer @@ -918,12 +918,12 @@ describe("ProtocolDiamond", async function () { ]; // Deploy Protocol Diamond - const ProtocolDiamond = await ethers.getContractFactory("TestInitializableDiamond"); + const ProtocolDiamond = await getContractFactory("TestInitializableDiamond"); const protocolDiamond = await ProtocolDiamond.deploy(...diamondArgs); await protocolDiamond.deployTransaction.wait(); // Cast new Diamond to DiamondCutFacet - cutFacetViaDiamond = await ethers.getContractAt("DiamondCutFacet", protocolDiamond.address); + cutFacetViaDiamond = await getContractAt("DiamondCutFacet", protocolDiamond.address); // Create facet cut payload facetCuts = [ @@ -949,7 +949,7 @@ describe("ProtocolDiamond", async function () { it("Reason supplied by implementation", async () => { // Encode the initialization call initFunction = "initialize(address _testAddress)"; - initInterface = new ethers.utils.Interface([`function ${initFunction}`]); + initInterface = new Interface([`function ${initFunction}`]); initCallData = initInterface.encodeFunctionData("initialize", [accessController.address]); // Get the Test3Facet function selectors from the abi, removing the initializer @@ -973,7 +973,7 @@ describe("ProtocolDiamond", async function () { it("Library reason if not supplied by implementation", async () => { // Encode the initialization call initFunction = "initialize(address _testAddress)"; - initInterface = new ethers.utils.Interface([`function ${initFunction}`]); + initInterface = new Interface([`function ${initFunction}`]); initCallData = initInterface.encodeFunctionData("initialize", [upgrader.address]); // Get the Test3Facet function selectors from the abi, removing the initializer @@ -998,7 +998,7 @@ describe("ProtocolDiamond", async function () { it("_init is address(0) but _calldata is not empty", async () => { // Encode the initialization call initFunction = "initialize(address _testAddress)"; - initInterface = new ethers.utils.Interface([`function ${initFunction}`]); + initInterface = new Interface([`function ${initFunction}`]); initCallData = initInterface.encodeFunctionData("initialize", [accessController.address]); // Get the Test3Facet function selectors from the abi, removing the initializer @@ -1017,7 +1017,7 @@ describe("ProtocolDiamond", async function () { await expect( cutFacetViaDiamond .connect(upgrader) - .diamondCut(facetCuts, ethers.constants.AddressZero, initCallData, { gasLimit }) + .diamondCut(facetCuts, ZeroAddress, initCallData, { gasLimit }) ).to.revertedWith(RevertReasons.INIT_ZERO_ADDRESS_NON_EMPTY_CALLDATA); }); @@ -1044,7 +1044,7 @@ describe("ProtocolDiamond", async function () { it("_init address has no code", async () => { // Encode the initialization call initFunction = "initialize(address _testAddress)"; - initInterface = new ethers.utils.Interface([`function ${initFunction}`]); + initInterface = new Interface([`function ${initFunction}`]); initCallData = initInterface.encodeFunctionData("initialize", [accessController.address]); // Get the Test3Facet function selectors from the abi, removing the initializer @@ -1071,13 +1071,13 @@ describe("ProtocolDiamond", async function () { // Arguments for Diamond constructor const diamondArgs = [ - ethers.constants.AddressZero, + ZeroAddress, [getFacetAddCut(diamondLoupe), getFacetAddCut(diamondCut), getFacetAddCut(erc165)], interfaces, ]; // Attempt to deploy Protocol Diamond - const ProtocolDiamond = await ethers.getContractFactory("ProtocolDiamond"); + const ProtocolDiamond = await getContractFactory("ProtocolDiamond"); await expect(ProtocolDiamond.deploy(...diamondArgs)).to.revertedWith(RevertReasons.INVALID_ADDRESS); }); @@ -1088,20 +1088,20 @@ describe("ProtocolDiamond", async function () { context("📋 Proxying", async function () { beforeEach(async function () { // Deploy Test1Facet - Test1Facet = await ethers.getContractFactory("Test1Facet"); + Test1Facet = await getContractFactory("Test1Facet"); test1Facet = await Test1Facet.deploy(); await test1Facet.deployed(); // Deploy Test2Facet - Test2Facet = await ethers.getContractFactory("Test2Facet"); + Test2Facet = await getContractFactory("Test2Facet"); test2Facet = await Test2Facet.deploy(); await test2Facet.deployed(); // Cast Diamond to Test1Facet - test1ViaDiamond = await ethers.getContractAt("Test1Facet", protocolDiamond.address); + test1ViaDiamond = await getContractAt("Test1Facet", protocolDiamond.address); // Cast Diamond to Test2Facet - test2ViaDiamond = await ethers.getContractAt("Test2Facet", protocolDiamond.address); + test2ViaDiamond = await getContractAt("Test2Facet", protocolDiamond.address); // Define the facet cuts facetCuts = [ @@ -1120,7 +1120,7 @@ describe("ProtocolDiamond", async function () { // Send the DiamondCut transaction tx = await cutFacetViaDiamond .connect(upgrader) - .diamondCut(facetCuts, ethers.constants.AddressZero, "0x", { gasLimit }); + .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); diff --git a/test/protocol/ProtocolInitializationHandlerTest.js b/test/protocol/ProtocolInitializationHandlerTest.js index 16ba4cb19..77d09d1fe 100644 --- a/test/protocol/ProtocolInitializationHandlerTest.js +++ b/test/protocol/ProtocolInitializationHandlerTest.js @@ -30,7 +30,7 @@ describe("ProtocolInitializationHandler", async function () { beforeEach(async function () { // Make accounts available - [deployer, rando] = await ethers.getSigners(); + [deployer, rando] = await getSigners(); // Deploy the Protocol Diamond [protocolDiamond, , , , accessController] = await deployProtocolDiamond(maxPriorityFeePerGas); @@ -42,13 +42,13 @@ describe("ProtocolInitializationHandler", async function () { await accessController.grantRole(Role.UPGRADER, deployer.address); // Cast Diamond to IERC165 - erc165 = await ethers.getContractAt("ERC165Facet", protocolDiamond.address); + erc165 = await getContractAt("ERC165Facet", protocolDiamond.address); // Cast Diamond to DiamondCutFacet - diamondCutFacet = await ethers.getContractAt("DiamondCutFacet", protocolDiamond.address); + diamondCutFacet = await getContractAt("DiamondCutFacet", protocolDiamond.address); // Cast Diamond to ProtocolInitializationHandlerFacet - protocolInitializationFacet = await ethers.getContractAt( + protocolInitializationFacet = await getContractAt( "ProtocolInitializationHandlerFacet", protocolDiamond.address ); @@ -57,7 +57,7 @@ describe("ProtocolInitializationHandler", async function () { // initialization data for v2.2.0 maxPremintedVouchers = "1000"; - initializationData = ethers.utils.defaultAbiCoder.encode(["uint256"], [maxPremintedVouchers]); + initializationData = defaultAbiCoder.encode(["uint256"], [maxPremintedVouchers]); }); describe("Deploy tests", async function () { @@ -76,7 +76,7 @@ describe("ProtocolInitializationHandler", async function () { let protocolInitializationFacetDeployed; beforeEach(async function () { - const ProtocolInitilizationContractFactory = await ethers.getContractFactory( + const ProtocolInitilizationContractFactory = await getContractFactory( "ProtocolInitializationHandlerFacet" ); protocolInitializationFacetDeployed = await ProtocolInitilizationContractFactory.deploy( @@ -87,7 +87,7 @@ describe("ProtocolInitializationHandler", async function () { }); it("Addresses and calldata length mismatch", async function () { - version = ethers.utils.formatBytes32String("2.2.0"); + version = formatBytes32String("2.2.0"); const callData = protocolInitializationFacetDeployed.interface.encodeFunctionData("initialize", [ version, @@ -115,7 +115,7 @@ describe("ProtocolInitializationHandler", async function () { it("Version is empty", async function () { const callData = protocolInitializationFacetDeployed.interface.encodeFunctionData("initialize", [ - ethers.constants.HashZero, + constants.HashZero, [], [], true, @@ -139,7 +139,7 @@ describe("ProtocolInitializationHandler", async function () { }); it("Initialize same version twice", async function () { - version = ethers.utils.formatBytes32String("2.2.0"); + version = formatBytes32String("2.2.0"); const callData = protocolInitializationFacetDeployed.interface.encodeFunctionData("initialize", [ version, @@ -161,7 +161,7 @@ describe("ProtocolInitializationHandler", async function () { ); // Mock a new facet to add to diamond so we can call initialize again - let FacetTestFactory = await ethers.getContractFactory("Test3Facet"); + let FacetTestFactory = await getContractFactory("Test3Facet"); const testFacet = await FacetTestFactory.deploy(await getFees(maxPriorityFeePerGas)); await testFacet.deployTransaction.wait(); @@ -196,23 +196,23 @@ describe("ProtocolInitializationHandler", async function () { ); // Get actual deployed protocolInitializationFacet - const diamondLoupe = await ethers.getContractAt("DiamondLoupeFacet", protocolDiamond.address); + const diamondLoupe = await getContractAt("DiamondLoupeFacet", protocolDiamond.address); const signature = protocolInitializationFacet.interface.getSighash("getVersion()"); const existingFacetAddress = await diamondLoupe.facetAddress(signature); - const protocolInitializationFacet2 = await ethers.getContractAt( + const protocolInitializationFacet2 = await getContractAt( "ProtocolInitializationHandlerFacet", existingFacetAddress ); // Deploy selfDestruct contract that will be called during initialize - const SelfDestructorFactory = await ethers.getContractFactory("SelfDestructor"); + const SelfDestructorFactory = await getContractFactory("SelfDestructor"); const selfDestructor = await SelfDestructorFactory.deploy(); const selfDestructorInitData = selfDestructor.interface.encodeFunctionData("destruct"); // call initialize await expect( protocolInitializationFacet2.initialize( - ethers.utils.formatBytes32String("haha"), + formatBytes32String("haha"), [selfDestructor.address], [selfDestructorInitData], false, @@ -260,7 +260,7 @@ describe("ProtocolInitializationHandler", async function () { const configHandlerInterface = InterfaceIds[interfaceImplementers["ConfigHandlerFacet"]]; const accountInterface = InterfaceIds[interfaceImplementers["AccountHandlerFacet"]]; - version = ethers.utils.formatBytes32String("2.3.0"); + version = formatBytes32String("2.3.0"); const calldataProtocolInitialization = deployedProtocolInitializationHandlerFacet.contract.interface.encodeFunctionData("initialize", [ version, @@ -296,13 +296,13 @@ describe("ProtocolInitializationHandler", async function () { }); it("Should call facet initializer internally when _addresses and _calldata are supplied", async function () { - let FacetTestFactory = await ethers.getContractFactory("Test3Facet"); + let FacetTestFactory = await getContractFactory("Test3Facet"); const testFacet = await FacetTestFactory.deploy(await getFees(maxPriorityFeePerGas)); await testFacet.deployTransaction.wait(); const calldataTestFacet = testFacet.interface.encodeFunctionData("initialize", [rando.address]); - version = ethers.utils.formatBytes32String("2.3.0"); + version = formatBytes32String("2.3.0"); const calldataProtocolInitialization = deployedProtocolInitializationHandlerFacet.contract.interface.encodeFunctionData("initialize", [ version, @@ -323,7 +323,7 @@ describe("ProtocolInitializationHandler", async function () { await getFees(maxPriorityFeePerGas) ); - const testFacetContract = await ethers.getContractAt("Test3Facet", protocolDiamond.address); + const testFacetContract = await getContractAt("Test3Facet", protocolDiamond.address); expect(await testFacetContract.getTestAddress()).to.equal(rando.address); }); @@ -332,11 +332,11 @@ describe("ProtocolInitializationHandler", async function () { let testFacet, version; beforeEach(async function () { - let FacetTestFactory = await ethers.getContractFactory("Test3Facet"); + let FacetTestFactory = await getContractFactory("Test3Facet"); testFacet = await FacetTestFactory.deploy(await getFees(maxPriorityFeePerGas)); await testFacet.deployTransaction.wait(); - version = ethers.utils.formatBytes32String("2.3.0"); + version = formatBytes32String("2.3.0"); }); it("Delegate call to initialize fails", async function () { @@ -405,7 +405,7 @@ describe("ProtocolInitializationHandler", async function () { version = "2.1.0"; // Deploy mock protocol initialization facet which simulates state before v2.2.0 - const ProtocolInitilizationContractFactory = await ethers.getContractFactory( + const ProtocolInitilizationContractFactory = await getContractFactory( "MockProtocolInitializationHandlerFacet" ); const mockInitializationFacetDeployed = await ProtocolInitilizationContractFactory.deploy( @@ -444,7 +444,7 @@ describe("ProtocolInitializationHandler", async function () { await getFees(maxPriorityFeePerGas) ); - version = ethers.utils.formatBytes32String("2.2.0"); + version = formatBytes32String("2.2.0"); // Prepare cut data facetCut = getFacetAddCut(configHandler); @@ -488,7 +488,7 @@ describe("ProtocolInitializationHandler", async function () { it("Max preminted vouchers is zero", async function () { // set invalid maxPremintedVouchers maxPremintedVouchers = "0"; - initializationData = ethers.utils.defaultAbiCoder.encode(["uint256"], [maxPremintedVouchers]); + initializationData = defaultAbiCoder.encode(["uint256"], [maxPremintedVouchers]); calldataProtocolInitialization = deployedProtocolInitializationHandlerFacet.interface.encodeFunctionData( "initialize", @@ -522,7 +522,7 @@ describe("ProtocolInitializationHandler", async function () { ); // Prepare 2.2.0 deployment - version = ethers.utils.formatBytes32String("2.2.0"); + version = formatBytes32String("2.2.0"); // make diamond cut, expect revert await expect( @@ -564,7 +564,7 @@ describe("ProtocolInitializationHandler", async function () { // Prepare calldata calldataProtocolInitialization = deployedProtocolInitializationHandlerFacet.interface.encodeFunctionData( "initialize", - [ethers.utils.formatBytes32String(version), [], [], true, [], [], []] + [formatBytes32String(version), [], [], true, [], [], []] ); }); @@ -587,7 +587,7 @@ describe("ProtocolInitializationHandler", async function () { // Prepare calldata const calldataProtocolInitializationWrong = deployedProtocolInitializationHandlerFacet.interface.encodeFunctionData("initialize", [ - ethers.utils.formatBytes32String(wrongVersion), + formatBytes32String(wrongVersion), [], [], true, diff --git a/test/protocol/SellerHandlerTest.js b/test/protocol/SellerHandlerTest.js index f282f44b3..768aaaf86 100644 --- a/test/protocol/SellerHandlerTest.js +++ b/test/protocol/SellerHandlerTest.js @@ -69,8 +69,8 @@ describe("SellerHandler", function () { // make all account the same authTokenOwner = assistant = admin; - clerk = { address: ethers.constants.AddressZero }; - [deployer] = await ethers.getSigners(); + clerk = { address: ZeroAddress }; + [deployer] = await getSigners(); // Deploy mock ERC721 tokens [mockAuthERC721Contract, mockAuthERC721Contract2] = await deployMockTokens(["Foreign721", "Foreign721"]); @@ -149,7 +149,7 @@ describe("SellerHandler", function () { .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, admin.address); // Voucher clone contract - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged").withArgs(contractURI); @@ -161,16 +161,16 @@ describe("SellerHandler", function () { .to.emit(bosonVoucher, "VoucherInitialized") .withArgs(seller.id, voucherInitValues.royaltyPercentage, contractURI); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ethers.constants.AddressZero, assistant.address); + .withArgs(ZeroAddress, assistant.address); }); it("should emit a SellerCreated event when auth token is not empty", async function () { // Create a seller, testing for the event - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; sellerStruct = seller.toStruct(); const tx = await accountHandler.connect(authTokenOwner).createSeller(seller, authToken, voucherInitValues); @@ -179,7 +179,7 @@ describe("SellerHandler", function () { .withArgs(seller.id, sellerStruct, expectedCloneAddress, authTokenStruct, authTokenOwner.address); // Voucher clone contract - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged").withArgs(contractURI); @@ -191,11 +191,11 @@ describe("SellerHandler", function () { .to.emit(bosonVoucher, "VoucherInitialized") .withArgs(seller.id, voucherInitValues.royaltyPercentage, contractURI); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ethers.constants.AddressZero, assistant.address); + .withArgs(ZeroAddress, assistant.address); }); it("should update state when authToken is empty", async function () { @@ -220,11 +220,11 @@ describe("SellerHandler", function () { } // Voucher clone contract - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); @@ -238,7 +238,7 @@ describe("SellerHandler", function () { // Create a seller await accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); @@ -257,7 +257,7 @@ describe("SellerHandler", function () { [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(exchangeId, offerPrice); // Expectations - let expectedRecipient = ethers.constants.AddressZero; //expect zero address when exchange id does not exist + let expectedRecipient = ZeroAddress; //expect zero address when exchange id does not exist let expectedRoyaltyAmount = "0"; // Zero Fee when exchange id does not exist assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); @@ -272,7 +272,7 @@ describe("SellerHandler", function () { // Create a seller await accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); @@ -291,7 +291,7 @@ describe("SellerHandler", function () { [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(exchangeId, offerPrice); // Expectations - let expectedRecipient = ethers.constants.AddressZero; //expect zero address when exchange id does not exist + let expectedRecipient = ZeroAddress; //expect zero address when exchange id does not exist let expectedRoyaltyAmount = "0"; // Zero Fee when exchange id does not exist assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); @@ -299,7 +299,7 @@ describe("SellerHandler", function () { }); it("should update state when authToken is not empty", async function () { - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; // Create a seller await accountHandler.connect(authTokenOwner).createSeller(seller, authToken, voucherInitValues); @@ -322,11 +322,11 @@ describe("SellerHandler", function () { } // Voucher clone contract - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); expect(await bosonVoucher.symbol()).to.equal(VOUCHER_SYMBOL + "_" + seller.id, "Wrong voucher client symbol"); @@ -353,7 +353,7 @@ describe("SellerHandler", function () { it("should be possible to use the same address for assistant, admin and treasury", async function () { seller.assistant = other1.address; seller.admin = other1.address; - seller.clerk = ethers.constants.AddressZero; + seller.clerk = ZeroAddress; seller.treasury = other1.address; //Create struct again with new addresses @@ -395,7 +395,7 @@ describe("SellerHandler", function () { // second seller expectedCloneAddress = calculateContractAddress(accountHandler.address, "2"); - seller = mockSeller(other1.address, other1.address, ethers.constants.AddressZero, other1.address); + seller = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); // Create a seller, testing for the event await expect(accountHandler.connect(other1).createSeller(seller, emptyAuthToken, voucherInitValues)) @@ -405,7 +405,7 @@ describe("SellerHandler", function () { it("should be possible to create a seller with same auth token id but different type", async function () { // Set admin == zero address because seller will be created with auth token - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; //Create struct again with new address sellerStruct = seller.toStruct(); @@ -421,7 +421,7 @@ describe("SellerHandler", function () { const tx = await accountHandler.connect(authTokenOwner).updateSeller(seller, authToken); pendingSellerUpdate = seller.clone(); - pendingSellerUpdate.treasury = ethers.constants.AddressZero; + pendingSellerUpdate.treasury = ZeroAddress; pendingSellerUpdate.active = false; pendingSellerUpdate.metadataUri = ""; pendingSellerUpdate.id = "0"; @@ -440,8 +440,8 @@ describe("SellerHandler", function () { sellerStruct = seller.toStruct(); // Nothing pending left - pendingSellerUpdate.assistant = ethers.constants.AddressZero; - pendingSellerUpdate.clerk = ethers.constants.AddressZero; + pendingSellerUpdate.assistant = ZeroAddress; + pendingSellerUpdate.clerk = ZeroAddress; pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); // Assistant address owner must approve the update @@ -482,7 +482,7 @@ describe("SellerHandler", function () { it("should be possible to create a seller with same auth token type but different id", async function () { // Set admin == zero address because seller will be created with auth token - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; //Create struct again with new address sellerStruct = seller.toStruct(); @@ -496,7 +496,7 @@ describe("SellerHandler", function () { pendingSellerUpdate = seller.clone(); pendingSellerUpdate.id = "0"; - pendingSellerUpdate.treasury = ethers.constants.AddressZero; + pendingSellerUpdate.treasury = ZeroAddress; pendingSellerUpdate.metadataUri = ""; pendingSellerUpdate.active = false; pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); @@ -515,8 +515,8 @@ describe("SellerHandler", function () { .withArgs(seller.id, pendingSellerUpdateStruct, pendingAuthTokenStruct, authTokenOwner.address); // Nothing pending left - pendingSellerUpdate.assistant = ethers.constants.AddressZero; - pendingSellerUpdate.clerk = ethers.constants.AddressZero; + pendingSellerUpdate.assistant = ZeroAddress; + pendingSellerUpdate.clerk = ZeroAddress; pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); sellerStruct = seller.toStruct(); @@ -646,8 +646,8 @@ describe("SellerHandler", function () { seller2 = mockSeller( authTokenOwner.address, - ethers.constants.AddressZero, - ethers.constants.AddressZero, + ZeroAddress, + ZeroAddress, authTokenOwner.address ); @@ -674,7 +674,7 @@ describe("SellerHandler", function () { }); it("admin address is zero address and AuthTokenType is None", async function () { - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; // Attempt to Create a seller, expecting revert await expect( @@ -684,7 +684,7 @@ describe("SellerHandler", function () { it("authToken is not unique to this seller", async function () { // Set admin == zero address because seller will be created with auth token - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; seller.assistant = authTokenOwner.address; // Create a seller @@ -698,7 +698,7 @@ describe("SellerHandler", function () { it("authTokenType is Custom", async function () { // Set admin == zero address because seller will be created with auth token - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; authToken.tokenType = AuthTokenType.Custom; @@ -719,7 +719,7 @@ describe("SellerHandler", function () { it("Caller does not own supplied auth token", async function () { // Set admin == zero address because seller will be created with auth token - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; seller.assistant = rando.address; // Attempt to Create a seller without owning the auth token @@ -749,8 +749,8 @@ describe("SellerHandler", function () { }); it("addresses are the zero address", async function () { - seller.assistant = ethers.constants.AddressZero; - seller.treasury = ethers.constants.AddressZero; + seller.assistant = ZeroAddress; + seller.treasury = ZeroAddress; // Attempt to update a seller, expecting revert await expect( @@ -759,7 +759,7 @@ describe("SellerHandler", function () { }); it("Assistant address is zero address", async function () { - seller.assistant = ethers.constants.AddressZero; + seller.assistant = ZeroAddress; // Attempt to Create a seller with assistant == zero address await expect( @@ -768,7 +768,7 @@ describe("SellerHandler", function () { }); it("Treasury address is zero address", async function () { - seller.treasury = ethers.constants.AddressZero; + seller.treasury = ZeroAddress; // Attempt to Create a seller with treasury == zero address await expect( @@ -788,13 +788,13 @@ describe("SellerHandler", function () { expect(authToken.isValid()).is.true; // Seller can have either admin address or auth token - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; // Create a seller await accountHandler.connect(authTokenOwner).createSeller(seller, authToken, voucherInitValues); // Create a another seller - seller2 = mockSeller(other1.address, other1.address, ethers.constants.AddressZero, other1.address); + seller2 = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); expect(seller2.isValid()).is.true; await accountHandler.connect(other1).createSeller(seller2, emptyAuthToken, voucherInitValues); @@ -865,13 +865,13 @@ describe("SellerHandler", function () { expect(authToken.isValid()).is.true; // Seller can have either admin address or auth token - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; // Create a seller await accountHandler.connect(authTokenOwner).createSeller(seller, authToken, voucherInitValues); // Create a another seller - seller2 = mockSeller(other1.address, other1.address, ethers.constants.AddressZero, other1.address); + seller2 = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); expect(seller2.isValid()).is.true; contractURI = `https://ipfs.io/ipfs/QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ`; @@ -942,7 +942,7 @@ describe("SellerHandler", function () { // Returned values should be the default value for it's data type for ([key, value] of Object.entries(returnedSeller)) { if (key != "active") { - expect(value == 0).is.true || expect(value === ethers.constants.AddressZero).is.true; + expect(value == 0).is.true || expect(value === ZeroAddress).is.true; } else { expect(value).is.false; } @@ -968,7 +968,7 @@ describe("SellerHandler", function () { // Returned values should be the default value for it's data type for ([key, value] of Object.entries(returnedSeller)) { if (key != "active") { - expect(value == 0).is.true || expect(value === ethers.constants.AddressZero).is.true; + expect(value == 0).is.true || expect(value === ZeroAddress).is.true; } else { expect(value).is.false; } @@ -994,7 +994,7 @@ describe("SellerHandler", function () { // Returned values should be the default value for it's data type for ([key, value] of Object.entries(returnedSeller)) { if (key != "active") { - expect(value == 0).is.true || expect(value === ethers.constants.AddressZero).is.true; + expect(value == 0).is.true || expect(value === ZeroAddress).is.true; } else { expect(value).is.false; } @@ -1009,7 +1009,7 @@ describe("SellerHandler", function () { it("should return exists false and default values when searching on zero address", async function () { [exists, sellerStruct, emptyAuthTokenStruct] = await accountHandler .connect(rando) - .getSellerByAddress(ethers.constants.AddressZero); + .getSellerByAddress(ZeroAddress); expect(exists).is.false; @@ -1020,7 +1020,7 @@ describe("SellerHandler", function () { // Returned values should be the default value for it's data type for ([key, value] of Object.entries(returnedSeller)) { if (key != "active") { - expect(value == 0).is.true || expect(value === ethers.constants.AddressZero).is.true; + expect(value == 0).is.true || expect(value === ZeroAddress).is.true; } else { expect(value).is.false; } @@ -1046,13 +1046,13 @@ describe("SellerHandler", function () { expect(authToken2.isValid()).is.true; // Seller can have either admin address or auth token - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; // Create a seller await accountHandler.connect(authTokenOwner).createSeller(seller, authToken, voucherInitValues); // Create seller 2 - seller2 = mockSeller(other1.address, other1.address, ethers.constants.AddressZero, other1.address); + seller2 = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); expect(seller2.isValid()).is.true; contractURI = `https://ipfs.io/ipfs/QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ`; @@ -1062,8 +1062,8 @@ describe("SellerHandler", function () { // Create seller 3 seller3 = mockSeller( other5.address, - ethers.constants.AddressZero, - ethers.constants.AddressZero, + ZeroAddress, + ZeroAddress, treasury.address ); expect(seller3.isValid()).is.true; @@ -1127,8 +1127,8 @@ describe("SellerHandler", function () { // Create seller 4 seller4 = mockSeller( rando.address, - ethers.constants.AddressZero, - ethers.constants.AddressZero, + ZeroAddress, + ZeroAddress, treasury.address ); expect(seller4.isValid()).is.true; @@ -1183,8 +1183,8 @@ describe("SellerHandler", function () { // Create seller 4 seller4 = mockSeller( rando.address, - ethers.constants.AddressZero, - ethers.constants.AddressZero, + ZeroAddress, + ZeroAddress, treasury.address ); expect(seller4.isValid()).is.true; @@ -1245,7 +1245,7 @@ describe("SellerHandler", function () { // Returned values should be the default value for it's data type for ([key, value] of Object.entries(returnedSeller)) { if (key != "active") { - expect(value == 0).is.true || expect(value === ethers.constants.AddressZero).is.true; + expect(value == 0).is.true || expect(value === ZeroAddress).is.true; } else { expect(value).is.false; } @@ -1262,10 +1262,10 @@ describe("SellerHandler", function () { beforeEach(async function () { pendingSellerUpdate = seller.clone(); pendingSellerUpdate.id = "0"; - pendingSellerUpdate.treasury = ethers.constants.AddressZero; - pendingSellerUpdate.clerk = ethers.constants.AddressZero; - pendingSellerUpdate.admin = ethers.constants.AddressZero; - pendingSellerUpdate.assistant = ethers.constants.AddressZero; + pendingSellerUpdate.treasury = ZeroAddress; + pendingSellerUpdate.clerk = ZeroAddress; + pendingSellerUpdate.admin = ZeroAddress; + pendingSellerUpdate.assistant = ZeroAddress; pendingSellerUpdate.active = false; pendingSellerUpdate.metadataUri = ""; pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); @@ -1280,13 +1280,13 @@ describe("SellerHandler", function () { // Treasury and metadataURI are only values that can be update without address owner authorization sellerStruct = seller.toStruct(); - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; seller.assistant = other1.address; expect(seller.isValid()).is.true; pendingSellerUpdate = seller.clone(); pendingSellerUpdate.id = "0"; - pendingSellerUpdate.treasury = ethers.constants.AddressZero; + pendingSellerUpdate.treasury = ZeroAddress; pendingSellerUpdate.metadataUri = ""; pendingSellerUpdate.active = false; expect(pendingSellerUpdate.isValid()).is.true; @@ -1320,11 +1320,11 @@ describe("SellerHandler", function () { // Voucher clone contract const bosonVoucherCloneAddress = calculateContractAddress(exchangeHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", bosonVoucherCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", bosonVoucherCloneAddress); await expect(tx).to.emit(bosonVoucher, "OwnershipTransferred").withArgs(assistant.address, other1.address); - pendingSellerUpdate.assistant = ethers.constants.AddressZero; + pendingSellerUpdate.assistant = ZeroAddress; pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); seller.admin = admin.address; sellerStruct = seller.toStruct(); @@ -1348,7 +1348,7 @@ describe("SellerHandler", function () { pendingAuthToken = emptyAuthToken; pendingAuthTokenStruct = pendingAuthToken.toStruct(); - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; sellerStruct = seller.toStruct(); // Check auth token update @@ -1373,7 +1373,7 @@ describe("SellerHandler", function () { // Voucher clone contract const bosonVoucherCloneAddress = calculateContractAddress(exchangeHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", bosonVoucherCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", bosonVoucherCloneAddress); // Since assistant stayed the same yet, clone contract ownership should not be transferred immediately await expect(tx).to.not.emit(bosonVoucher, "OwnershipTransferred"); @@ -1384,7 +1384,7 @@ describe("SellerHandler", function () { it("should update state of all fields except Id and active flag", async function () { seller.assistant = other1.address; - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; seller.treasury = other4.address; seller.active = false; @@ -1436,7 +1436,7 @@ describe("SellerHandler", function () { // Voucher clone contract const bosonVoucherCloneAddress = calculateContractAddress(exchangeHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", bosonVoucherCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", bosonVoucherCloneAddress); expect(await bosonVoucher.owner()).to.equal(seller.assistant, "Wrong voucher clone owner"); }); @@ -1444,8 +1444,8 @@ describe("SellerHandler", function () { it("should update state from auth token to empty auth token", async function () { seller2 = mockSeller( other1.address, - ethers.constants.AddressZero, - ethers.constants.AddressZero, + ZeroAddress, + ZeroAddress, other1.address ); expect(seller2.isValid()).is.true; @@ -1497,7 +1497,7 @@ describe("SellerHandler", function () { [exists] = await accountHandler.connect(rando).getSellerByAddress(other1.address); expect(exists).to.be.false; - [exists] = await accountHandler.connect(rando).getSellerByAddress(ethers.constants.AddressZero); + [exists] = await accountHandler.connect(rando).getSellerByAddress(ZeroAddress); expect(exists).to.be.false; [exists] = await accountHandler.connect(rando).getSellerByAddress(other3.address); @@ -1512,7 +1512,7 @@ describe("SellerHandler", function () { // Voucher clone contract const bosonVoucherCloneAddress = calculateContractAddress(exchangeHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", bosonVoucherCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", bosonVoucherCloneAddress); expect(await bosonVoucher.owner()).to.equal(seller.assistant, "Wrong voucher clone owner"); }); @@ -1520,8 +1520,8 @@ describe("SellerHandler", function () { it("should update state from auth token to new auth token", async function () { seller2 = mockSeller( other1.address, - ethers.constants.AddressZero, - ethers.constants.AddressZero, + ZeroAddress, + ZeroAddress, other1.address ); expect(seller2.isValid()).is.true; @@ -1534,7 +1534,7 @@ describe("SellerHandler", function () { await accountHandler.connect(newAuthTokenOwner).createSeller(seller2, authToken, voucherInitValues); seller2.assistant = other5.address; - seller2.admin = ethers.constants.AddressZero; + seller2.admin = ZeroAddress; seller2.treasury = other7.address; seller2.active = false; @@ -1575,7 +1575,7 @@ describe("SellerHandler", function () { [exists] = await accountHandler.connect(rando).getSellerByAddress(other1.address); expect(exists).to.be.false; - [exists] = await accountHandler.connect(rando).getSellerByAddress(ethers.constants.AddressZero); + [exists] = await accountHandler.connect(rando).getSellerByAddress(ZeroAddress); expect(exists).to.be.false; [exists] = await accountHandler.connect(rando).getSellerByAddress(other3.address); @@ -1590,7 +1590,7 @@ describe("SellerHandler", function () { // Voucher clone contract const bosonVoucherCloneAddress = calculateContractAddress(exchangeHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", bosonVoucherCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", bosonVoucherCloneAddress); expect(await bosonVoucher.owner()).to.equal(seller.assistant, "Wrong voucher clone owner"); }); @@ -1628,8 +1628,8 @@ describe("SellerHandler", function () { // Configure another seller seller2 = mockSeller( other1.address, - ethers.constants.AddressZero, - ethers.constants.AddressZero, + ZeroAddress, + ZeroAddress, other1.address ); expect(seller2.isValid()).is.true; @@ -1648,7 +1648,7 @@ describe("SellerHandler", function () { //Update seller2 seller2.assistant = rando.address; - seller2.admin = ethers.constants.AddressZero; + seller2.admin = ZeroAddress; seller2.treasury = rando.address; seller2.active = false; @@ -1719,7 +1719,7 @@ describe("SellerHandler", function () { .to.emit(accountHandler, "SellerUpdatePending") .withArgs(seller.id, pendingSellerUpdateStruct, emptyAuthTokenStruct, admin.address); - pendingSellerUpdate.admin = ethers.constants.AddressZero; + pendingSellerUpdate.admin = ZeroAddress; pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); // Approve update @@ -1747,7 +1747,7 @@ describe("SellerHandler", function () { .to.emit(accountHandler, "SellerUpdatePending") .withArgs(seller.id, pendingSellerUpdateStruct, emptyAuthTokenStruct, other2.address); - pendingSellerUpdate.admin = ethers.constants.AddressZero; + pendingSellerUpdate.admin = ZeroAddress; pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); // Approve update @@ -1769,7 +1769,7 @@ describe("SellerHandler", function () { }); it("should be able to only update with new auth token", async function () { - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; sellerStruct = seller.toStruct(); // Update seller, testing for the event @@ -1808,7 +1808,7 @@ describe("SellerHandler", function () { .withArgs(seller.id, pendingSellerUpdateStruct, emptyAuthTokenStruct, newAuthTokenOwner.address); sellerStruct = seller.toStruct(); - pendingSellerUpdate.assistant = ethers.constants.AddressZero; + pendingSellerUpdate.assistant = ZeroAddress; pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); // Approve update @@ -1840,7 +1840,7 @@ describe("SellerHandler", function () { pendingSellerUpdate = seller.clone(); pendingSellerUpdate.active = false; pendingSellerUpdate.id = "0"; - pendingSellerUpdate.treasury = ethers.constants.AddressZero; + pendingSellerUpdate.treasury = ZeroAddress; pendingSellerUpdate.metadataUri = ""; pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); @@ -1893,7 +1893,7 @@ describe("SellerHandler", function () { pendingSellerUpdate = seller.clone(); pendingSellerUpdate.id = "0"; pendingSellerUpdate.active = false; - pendingSellerUpdate.treasury = ethers.constants.AddressZero; + pendingSellerUpdate.treasury = ZeroAddress; pendingSellerUpdate.metadataUri = ""; pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); @@ -1916,9 +1916,9 @@ describe("SellerHandler", function () { sellerStruct = seller.toStruct(); // Nothing pending left - pendingSellerUpdate.admin = ethers.constants.AddressZero; - pendingSellerUpdate.clerk = ethers.constants.AddressZero; - pendingSellerUpdate.assistant = ethers.constants.AddressZero; + pendingSellerUpdate.admin = ZeroAddress; + pendingSellerUpdate.clerk = ZeroAddress; + pendingSellerUpdate.assistant = ZeroAddress; pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); // Approve update @@ -1975,8 +1975,8 @@ describe("SellerHandler", function () { }); it("addresses are the zero address", async function () { - seller.assistant = ethers.constants.AddressZero; - seller.treasury = ethers.constants.AddressZero; + seller.assistant = ZeroAddress; + seller.treasury = ZeroAddress; // Attempt to update a seller, expecting revert await expect(accountHandler.connect(authTokenOwner).updateSeller(seller, emptyAuthToken)).to.revertedWith( @@ -1985,7 +1985,7 @@ describe("SellerHandler", function () { }); it("Assistant is the zero address", async function () { - seller.assistant = ethers.constants.AddressZero; + seller.assistant = ZeroAddress; // Attempt to update a seller, expecting revert await expect(accountHandler.connect(authTokenOwner).updateSeller(seller, emptyAuthToken)).to.revertedWith( @@ -2003,7 +2003,7 @@ describe("SellerHandler", function () { }); it("Treasury is the zero address", async function () { - seller.treasury = ethers.constants.AddressZero; + seller.treasury = ZeroAddress; // Attempt to update a seller, expecting revert await expect(accountHandler.connect(authTokenOwner).updateSeller(seller, emptyAuthToken)).to.revertedWith( @@ -2082,7 +2082,7 @@ describe("SellerHandler", function () { }); it("admin address is zero address and AuthTokenType is None", async function () { - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; // Attempt to Create a seller, expecting revert await expect(accountHandler.connect(admin).updateSeller(seller, emptyAuthToken)).to.revertedWith( @@ -2092,7 +2092,7 @@ describe("SellerHandler", function () { it("authToken is not unique to this seller", async function () { // Set admin == zero address because seller will be updated with auth token - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; // Update seller 1 to have auth token await accountHandler.connect(admin).updateSeller(seller, authToken); @@ -2100,13 +2100,13 @@ describe("SellerHandler", function () { await accountHandler.connect(authTokenOwner).optInToSellerUpdate(seller.id, [SellerUpdateFields.AuthToken]); //Set seller 2's auth token to empty - seller2 = mockSeller(other1.address, other1.address, ethers.constants.AddressZero, other1.address); + seller2 = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); expect(seller2.isValid()).is.true; // Create a seller with auth token await accountHandler.connect(other1).createSeller(seller2, emptyAuthToken, voucherInitValues); - seller2.admin = ethers.constants.AddressZero; + seller2.admin = ZeroAddress; // Attempt to update seller2 with non-unique authToken used by seller 1 await expect(accountHandler.connect(other1).updateSeller(seller2, authToken)).to.revertedWith( @@ -2116,7 +2116,7 @@ describe("SellerHandler", function () { it("authTokenType is Custom", async function () { // Set admin == zero address because seller will be created with auth token - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; authToken.tokenType = AuthTokenType.Custom; @@ -2131,8 +2131,8 @@ describe("SellerHandler", function () { //Create seller 2 with auth token seller2 = mockSeller( other1.address, - ethers.constants.AddressZero, - ethers.constants.AddressZero, + ZeroAddress, + ZeroAddress, other1.address ); expect(seller2.isValid()).is.true; @@ -2161,8 +2161,8 @@ describe("SellerHandler", function () { //Create seller 2 with auth token seller2 = mockSeller( other1.address, - ethers.constants.AddressZero, - ethers.constants.AddressZero, + ZeroAddress, + ZeroAddress, other1.address ); expect(seller2.isValid()).is.true; @@ -2189,10 +2189,10 @@ describe("SellerHandler", function () { beforeEach(async function () { pendingSellerUpdate = seller.clone(); pendingSellerUpdate.id = "0"; - pendingSellerUpdate.treasury = ethers.constants.AddressZero; - pendingSellerUpdate.clerk = ethers.constants.AddressZero; - pendingSellerUpdate.admin = ethers.constants.AddressZero; - pendingSellerUpdate.assistant = ethers.constants.AddressZero; + pendingSellerUpdate.treasury = ZeroAddress; + pendingSellerUpdate.clerk = ZeroAddress; + pendingSellerUpdate.admin = ZeroAddress; + pendingSellerUpdate.assistant = ZeroAddress; pendingSellerUpdate.active = false; pendingSellerUpdate.metadataUri = ""; pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); @@ -2260,7 +2260,7 @@ describe("SellerHandler", function () { }); it("Should update assistant and auth token in a single call when addresses are the same ", async function () { - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; seller.assistant = authTokenOwner.address; sellerStruct = seller.toStruct(); @@ -2283,7 +2283,7 @@ describe("SellerHandler", function () { }); it("New auth token owner should opt-in to update seller", async function () { - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; sellerStruct = seller.toStruct(); await accountHandler.connect(admin).updateSeller(seller, authToken); @@ -2304,7 +2304,7 @@ describe("SellerHandler", function () { it("Auth token can be used again if it was previously removed", async function () { // Update a seller to use auth token - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; await accountHandler.connect(admin).updateSeller(seller, authToken); await accountHandler.connect(authTokenOwner).optInToSellerUpdate(seller.id, [SellerUpdateFields.AuthToken]); @@ -2314,7 +2314,7 @@ describe("SellerHandler", function () { await accountHandler.connect(other1).optInToSellerUpdate(seller.id, [SellerUpdateFields.Admin]); // Update back to auth token - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; sellerStruct = seller.toStruct(); await accountHandler.connect(other1).updateSeller(seller, authToken); await expect( @@ -2336,9 +2336,9 @@ describe("SellerHandler", function () { pendingSellerUpdate = seller.clone(); pendingSellerUpdate.id = "0"; - pendingSellerUpdate.treasury = ethers.constants.AddressZero; - pendingSellerUpdate.clerk = ethers.constants.AddressZero; - pendingSellerUpdate.admin = ethers.constants.AddressZero; + pendingSellerUpdate.treasury = ZeroAddress; + pendingSellerUpdate.clerk = ZeroAddress; + pendingSellerUpdate.admin = ZeroAddress; pendingSellerUpdate.active = false; pendingSellerUpdate.metadataUri = ""; pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); @@ -2351,7 +2351,7 @@ describe("SellerHandler", function () { sellerStruct = seller.toStruct(); const pendingSellerUpdate2 = pendingSellerUpdate.clone(); - pendingSellerUpdate2.assistant = ethers.constants.AddressZero; + pendingSellerUpdate2.assistant = ZeroAddress; const pendingSellerUpdate2Struct = pendingSellerUpdate2.toStruct(); await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); @@ -2372,7 +2372,7 @@ describe("SellerHandler", function () { ); // Set admin == zero address because seller will be created with auth token - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; sellerStruct = seller.toStruct(); await expect(accountHandler.connect(admin).updateSeller(seller, authToken)) @@ -2457,7 +2457,7 @@ describe("SellerHandler", function () { it("authToken is not unique to this seller", async function () { // Set admin == zero address because seller will be created with auth token - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; // Request auth token update for seller 1 await accountHandler.connect(admin).updateSeller(seller, authToken); @@ -2469,8 +2469,8 @@ describe("SellerHandler", function () { const newAuthTokenOwner = rando; seller2 = mockSeller( newAuthTokenOwner.address, - ethers.constants.AddressZero, - ethers.constants.AddressZero, + ZeroAddress, + ZeroAddress, newAuthTokenOwner.address ); expect(seller2.isValid()).is.true; @@ -2505,7 +2505,7 @@ describe("SellerHandler", function () { }); it("Should revert if the caller is not the new auth token owner", async function () { - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; await accountHandler.connect(admin).updateSeller(seller, authToken); @@ -2533,7 +2533,7 @@ describe("SellerHandler", function () { await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); // Create seller with same admin - seller2 = mockSeller(other1.address, other1.address, ethers.constants.AddressZero, other1.address); + seller2 = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); expect(seller2.isValid()).is.true; await accountHandler.connect(other1).createSeller(seller2, emptyAuthToken, voucherInitValues); @@ -2550,7 +2550,7 @@ describe("SellerHandler", function () { await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); // Create seller with same assistant - seller2 = mockSeller(other1.address, other1.address, ethers.constants.AddressZero, other1.address); + seller2 = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); expect(seller2.isValid()).is.true; await accountHandler.connect(other1).createSeller(seller2, emptyAuthToken, voucherInitValues); diff --git a/test/protocol/TwinHandlerTest.js b/test/protocol/TwinHandlerTest.js index 6bb404c33..9df71aadc 100644 --- a/test/protocol/TwinHandlerTest.js +++ b/test/protocol/TwinHandlerTest.js @@ -63,7 +63,7 @@ describe("IBosonTwinHandler", function () { // make all account the same assistant = admin; - clerk = { address: ethers.constants.AddressZero }; + clerk = { address: ZeroAddress }; // Deploy the mock tokens [bosonToken, foreign721, foreign1155, fallbackError] = await deployMockTokens(); @@ -252,7 +252,7 @@ describe("IBosonTwinHandler", function () { }); it("It is possible to add an ERC721 with unlimited supply if token is not used yet", async function () { - twin.supplyAvailable = ethers.constants.MaxUint256.toString(); + twin.supplyAvailable = constants.MaxUint256.toString(); twin.amount = "0"; twin.tokenId = "0"; twin.tokenAddress = foreign721.address; @@ -277,7 +277,7 @@ describe("IBosonTwinHandler", function () { }); it("It is possible to add ERC721 even if another ERC721 with unlimited supply exists", async function () { - twin.supplyAvailable = ethers.constants.MaxUint256.toString(); + twin.supplyAvailable = constants.MaxUint256.toString(); twin.amount = "0"; twin.tokenId = "0"; twin.tokenAddress = foreign721.address; @@ -490,7 +490,7 @@ describe("IBosonTwinHandler", function () { }); it("token address has been used in another twin with unlimited supply", async function () { - twin.supplyAvailable = ethers.constants.MaxUint256; + twin.supplyAvailable = constants.MaxUint256; twin.tokenType = TokenType.NonFungibleToken; twin.tokenAddress = foreign721.address; twin.amount = "0"; @@ -508,11 +508,11 @@ describe("IBosonTwinHandler", function () { }); it("Supply range overflow", async function () { - twin.supplyAvailable = ethers.constants.MaxUint256.div(10).mul(8).toString(); + twin.supplyAvailable = constants.MaxUint256/10*8.toString(); twin.tokenType = TokenType.NonFungibleToken; twin.tokenAddress = foreign721.address; twin.amount = "0"; - twin.tokenId = ethers.constants.MaxUint256.sub(twin.supplyAvailable).add(1).toString(); + twin.tokenId = constants.MaxUint256-twin.supplyAvailable+1.toString(); await foreign721.connect(assistant).setApprovalForAll(twinHandler.address, true); @@ -523,11 +523,11 @@ describe("IBosonTwinHandler", function () { }); it("Token with unlimited supply with starting tokenId to high", async function () { - twin.supplyAvailable = ethers.constants.MaxUint256.toString(); + twin.supplyAvailable = constants.MaxUint256.toString(); twin.tokenType = TokenType.NonFungibleToken; twin.tokenAddress = foreign721.address; twin.amount = "0"; - twin.tokenId = ethers.constants.MaxUint256.add(1).div(2).add(1).toString(); + twin.tokenId = constants.MaxUint256+1/2+1.toString(); await foreign721.connect(assistant).setApprovalForAll(twinHandler.address, true); @@ -539,7 +539,7 @@ describe("IBosonTwinHandler", function () { context("Token address is unsupported", async function () { it("Token address is a zero address", async function () { - twin.tokenAddress = ethers.constants.AddressZero; + twin.tokenAddress = ZeroAddress; await expect(twinHandler.connect(assistant).createTwin(twin)).to.be.revertedWith( RevertReasons.UNSUPPORTED_TOKEN @@ -771,7 +771,7 @@ describe("IBosonTwinHandler", function () { context("👉 getNextTwinId()", async function () { beforeEach(async function () { // Create another valid seller. - seller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); expect(seller.isValid()).is.true; // AuthToken diff --git a/test/protocol/clients/BeaconClientProxy.js b/test/protocol/clients/BeaconClientProxy.js index 42ee8923d..20037f986 100644 --- a/test/protocol/clients/BeaconClientProxy.js +++ b/test/protocol/clients/BeaconClientProxy.js @@ -11,7 +11,7 @@ describe("BeaconClientProxy", function () { beforeEach(async function () { // Set signers (fake protocol address to test issue and burn voucher without protocol dependencie) - [protocol, rando] = await ethers.getSigners(); + [protocol, rando] = await getSigners(); // deploy proxy const protocolClientArgs = [protocol.address]; diff --git a/test/protocol/clients/BosonVoucherTest.js b/test/protocol/clients/BosonVoucherTest.js index b4b9e9894..b9649440b 100644 --- a/test/protocol/clients/BosonVoucherTest.js +++ b/test/protocol/clients/BosonVoucherTest.js @@ -33,7 +33,7 @@ const { } = require("../../util/utils.js"); const { deployMockTokens } = require("../../../scripts/util/deploy-mock-tokens"); const { deployMockContract } = require("@ethereum-waffle/mock-contract"); -const FormatTypes = ethers.utils.FormatTypes; +const FormatTypes = FormatTypes; describe("IBosonVoucher", function () { let interfaceIds; @@ -70,7 +70,7 @@ describe("IBosonVoucher", function () { interfaceIds = { IBosonVoucher, IERC721, IERC2981 }; // Mock forwarder to test metatx - const MockForwarder = await ethers.getContractFactory("MockForwarder"); + const MockForwarder = await getContractFactory("MockForwarder"); forwarder = await MockForwarder.deploy(); @@ -94,8 +94,8 @@ describe("IBosonVoucher", function () { // make all account the same assistant = admin; assistantDR = adminDR; - clerk = clerkDR = { address: ethers.constants.AddressZero }; - [deployer] = await ethers.getSigners(); + clerk = clerkDR = { address: ZeroAddress }; + [deployer] = await getSigners(); // Grant protocol role to eoa so it's easier to test await accessController.grantRole(Role.PROTOCOL, protocol.address); @@ -105,7 +105,7 @@ describe("IBosonVoucher", function () { // prepare the VoucherInitValues voucherInitValues = mockVoucherInitValues(); - const bosonVoucherInit = await ethers.getContractAt("BosonVoucher", bosonVoucher.address); + const bosonVoucherInit = await getContractAt("BosonVoucher", bosonVoucher.address); await bosonVoucherInit.initializeVoucher(sellerId, assistant.address, voucherInitValues); @@ -141,18 +141,18 @@ describe("IBosonVoucher", function () { context("General", async function () { it("Contract can receive native token", async function () { - const balanceBefore = await ethers.provider.getBalance(bosonVoucher.address); + const balanceBefore = await provider.getBalance(bosonVoucher.address); - const amount = ethers.utils.parseUnits("1", "ether"); + const amount = parseUnits("1", "ether"); await admin.sendTransaction({ to: bosonVoucher.address, value: amount }); - const balanceAfter = await ethers.provider.getBalance(bosonVoucher.address); - expect(balanceAfter.sub(balanceBefore)).to.eq(amount); + const balanceAfter = await provider.getBalance(bosonVoucher.address); + expect(balanceAfter-balanceBefore).to.eq(amount); }); it("Cannot initialize voucher twice", async function () { - const initalizableClone = await ethers.getContractAt("IInitializableVoucherClone", bosonVoucher.address); + const initalizableClone = await getContractAt("IInitializableVoucherClone", bosonVoucher.address); await expect(initalizableClone.initializeVoucher(2, assistant.address, voucherInitValues)).to.be.revertedWith( RevertReasons.INITIALIZABLE_ALREADY_INITIALIZED ); @@ -179,7 +179,7 @@ describe("IBosonVoucher", function () { const balanceAfter = await bosonVoucher.balanceOf(buyer.address); - expect(balanceAfter.sub(balanceBefore)).eq(1); + expect(balanceAfter-balanceBefore).eq(1); }); it("should issue a voucher if it does not overlap with range", async function () { @@ -196,12 +196,12 @@ describe("IBosonVoucher", function () { // Token id just below the range await expect(() => - bosonVoucher.connect(protocol).issueVoucher(tokenId.sub(1), buyerWallet) + bosonVoucher.connect(protocol).issueVoucher(tokenId-1, buyerWallet) ).to.changeTokenBalance(bosonVoucher, buyer, 1); // Token id just above the range await expect(() => - bosonVoucher.connect(protocol).issueVoucher(tokenId.add(length), buyerWallet) + bosonVoucher.connect(protocol).issueVoucher(tokenId+length, buyerWallet) ).to.changeTokenBalance(bosonVoucher, buyer, 1); }); @@ -220,7 +220,7 @@ describe("IBosonVoucher", function () { await bosonVoucher.connect(rando).issueVoucher(0, buyerWallet); const balanceAfter = await bosonVoucher.balanceOf(buyer.address); - expect(balanceAfter.sub(balanceBefore)).eq(1); + expect(balanceAfter-balanceBefore).eq(1); }); it("issueVoucher should revert if exchange id falls within a pre-minted offer's range", async function () { @@ -359,8 +359,8 @@ describe("IBosonVoucher", function () { it("Range length is too large, i.e., would cause an overflow", async function () { // Set such numbers that would cause an overflow - start = ethers.constants.MaxUint256.div(2).add(2); - length = ethers.constants.MaxUint256.div(2); + start = constants.MaxUint256/2+2; + length = constants.MaxUint256/2; // Try to reserve range, it should fail await expect( @@ -427,7 +427,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(ethers.constants.AddressZero, assistant.address, start.add(i)); + .withArgs(ZeroAddress, assistant.address, start+i); } }); @@ -437,7 +437,7 @@ describe("IBosonVoucher", function () { start = deriveTokenId(offerId, start); - await expect(tx).to.emit(bosonVoucher, "VouchersPreMinted").withArgs(offerId, start, start.add(amount).sub(1)); + await expect(tx).to.emit(bosonVoucher, "VouchersPreMinted").withArgs(offerId, start, start+amount-1); }); context("Owner range is contract", async function () { @@ -467,7 +467,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(ethers.constants.AddressZero, bosonVoucher.address, start.add(i)); + .withArgs(ZeroAddress, bosonVoucher.address, start+i); } }); @@ -480,19 +480,19 @@ describe("IBosonVoucher", function () { // Expect a correct owner for all preminted tokens start = deriveTokenId(offerId, start); for (let i = 0; i < Number(amount); i++) { - let tokenId = start.add(i); + let tokenId = start+i; let tokenOwner = await bosonVoucher.ownerOf(tokenId); assert.equal(tokenOwner, bosonVoucher.address, `Wrong token owner for token ${tokenId}`); } // Token that is inside a range, but wasn't preminted yet should not have an owner - await expect(bosonVoucher.ownerOf(start.add(amount).add(1))).to.be.revertedWith( + await expect(bosonVoucher.ownerOf(start+amount+1)).to.be.revertedWith( RevertReasons.ERC721_NON_EXISTENT ); // Contract's balance should be updated for the total mint amount let contractBalanceAfter = await bosonVoucher.balanceOf(bosonVoucher.address); - assert.equal(contractBalanceAfter.toNumber(), contractBalanceBefore.add(amount).toNumber(), "Balance mismatch"); + assert.equal(contractBalanceAfter.toNumber(), contractBalanceBefore+amount.toNumber(), "Balance mismatch"); // Get available premints from contract const availablePremints = await bosonVoucher.getAvailablePreMints(offerId); @@ -509,19 +509,19 @@ describe("IBosonVoucher", function () { // Expect a correct owner for all preminted tokens start = deriveTokenId(offerId, start); for (let i = 0; i < Number(amount); i++) { - let tokenId = start.add(i); + let tokenId = start+i; let tokenOwner = await bosonVoucher.ownerOf(tokenId); assert.equal(tokenOwner, assistant.address, `Wrong token owner for token ${tokenId}`); } // Token that is inside a range, but wasn't preminted yet should not have an owner - await expect(bosonVoucher.ownerOf(start.add(amount).add(1))).to.be.revertedWith( + await expect(bosonVoucher.ownerOf(start+amount+1)).to.be.revertedWith( RevertReasons.ERC721_NON_EXISTENT ); // Seller's balance should be updated for the total mint amount let sellerBalanceAfter = await bosonVoucher.balanceOf(assistant.address); - assert.equal(sellerBalanceAfter.toNumber(), sellerBalanceBefore.add(amount).toNumber(), "Balance mismatch"); + assert.equal(sellerBalanceAfter.toNumber(), sellerBalanceBefore+amount.toNumber(), "Balance mismatch"); // Get available premints from contract const availablePremints = await bosonVoucher.getAvailablePreMints(offerId); @@ -567,7 +567,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(ethers.constants.AddressZero, assistant.address, start.add(i)); + .withArgs(ZeroAddress, assistant.address, start+i); } }); @@ -615,7 +615,7 @@ describe("IBosonVoucher", function () { it("Offer already expired", async function () { // Skip to after offer expiration - await setNextBlockTimestamp(ethers.BigNumber.from(offerDates.validUntil).add(1).toHexString()); + await setNextBlockTimestamp(BigInt(offerDates.validUntil)+1.toHexString()); // Try to premint, it should fail await expect(bosonVoucher.connect(assistant).preMint(offerId, amount)).to.be.revertedWith( @@ -689,7 +689,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(assistant.address, ethers.constants.AddressZero, start.add(i)); + .withArgs(assistant.address, ZeroAddress, start+i); } }); @@ -702,13 +702,13 @@ describe("IBosonVoucher", function () { // All burned tokens should not have an owner const startId = deriveTokenId(offerId, start); for (let i = 0; i < Number(amount); i++) { - let tokenId = startId.add(i); + let tokenId = startId+i; await expect(bosonVoucher.ownerOf(tokenId)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); } // Seller's balance should be decreased for the total burn amount let sellerBalanceAfter = await bosonVoucher.balanceOf(assistant.address); - assert.equal(sellerBalanceAfter.toNumber(), sellerBalanceBefore.sub(amount).toNumber(), "Balance mismatch"); + assert.equal(sellerBalanceAfter.toNumber(), sellerBalanceBefore-amount.toNumber(), "Balance mismatch"); // Get available premints from contract const availablePremints = await bosonVoucher.getAvailablePreMints(offerId); @@ -716,7 +716,7 @@ describe("IBosonVoucher", function () { // Last burned id should be updated const tokenIdStart = deriveTokenId(offerId, start); - const lastBurnedId = tokenIdStart.add(amount - 1); + const lastBurnedId = tokenIdStart+amount - 1; const range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), assistant.address); const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); @@ -743,7 +743,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(assistant.address, ethers.constants.AddressZero, tokenIdStart.add(i)); + .withArgs(assistant.address, ZeroAddress, tokenIdStart+i); } }); @@ -785,7 +785,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(bosonVoucher.address, ethers.constants.AddressZero, tokenIdStart.add(i)); + .withArgs(bosonVoucher.address, ZeroAddress, tokenIdStart+i); } }); }); @@ -799,7 +799,7 @@ describe("IBosonVoucher", function () { // Last burned id should be updated const tokenIdStart = deriveTokenId(offerId, start); - const lastBurnedId = tokenIdStart.add(amount - 1); + const lastBurnedId = tokenIdStart+amount - 1; const range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), assistant.address); const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); @@ -835,7 +835,7 @@ describe("IBosonVoucher", function () { // Last burned id should be updated const tokenIdStart = deriveTokenId(offerId, start); - let lastBurnedId = tokenIdStart.add(maxPremintedVouchers - 1); + let lastBurnedId = tokenIdStart+maxPremintedVouchers - 1; let range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), assistant.address); let returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); @@ -851,14 +851,14 @@ describe("IBosonVoucher", function () { ); // Last burned id should be updated - lastBurnedId = tokenIdStart.add(amount - 1); + lastBurnedId = tokenIdStart+amount - 1; range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), assistant.address); returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); // All burned tokens should not have an owner for (let i = 0; i < Number(amount); i++) { - let tokenId = tokenIdStart.add(i); + let tokenId = tokenIdStart+i; await expect(bosonVoucher.ownerOf(tokenId)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); } @@ -893,7 +893,7 @@ describe("IBosonVoucher", function () { // All burned tokens should not have an owner, but commited ones should const startId = deriveTokenId(offerId, start); for (let i = 0; i < Number(amount); i++) { - let tokenId = startId.add(i).toString(); + let tokenId = startId+i.toString(); if (committedVouchers.includes(tokenId)) { // Check that owner is buyer. expect(await bosonVoucher.ownerOf(tokenId)).to.equal(buyer.address); @@ -901,14 +901,14 @@ describe("IBosonVoucher", function () { // Check that Transfer event was emitted and owner does not exist anymore await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(assistant.address, ethers.constants.AddressZero, tokenId); + .withArgs(assistant.address, ZeroAddress, tokenId); await expect(bosonVoucher.ownerOf(tokenId)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); } } // Last burned id should be updated const tokenIdStart = deriveTokenId(offerId, start); - const lastBurnedId = tokenIdStart.add(amount - 1); + const lastBurnedId = tokenIdStart+amount - 1; const range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), assistant.address); const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); @@ -921,7 +921,7 @@ describe("IBosonVoucher", function () { .withArgs(offerId) .returns(true, offer, offerDates, offerDurations, disputeResolutionTerms, offerFees); // skip to after offer expiration - await setNextBlockTimestamp(ethers.BigNumber.from(offerDates.validUntil).add(1).toHexString()); + await setNextBlockTimestamp(BigInt(offerDates.validUntil)+1.toHexString()); // Burn tokens, test for event const tx = await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); @@ -934,7 +934,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(assistant.address, ethers.constants.AddressZero, start.add(i)); + .withArgs(assistant.address, ZeroAddress, start+i); } }); @@ -1072,7 +1072,7 @@ describe("IBosonVoucher", function () { it("Should be 0 if offer is expired", async function () { // Skip to after offer expiry - await setNextBlockTimestamp(ethers.BigNumber.from(offerDates.validUntil).add(1).toHexString()); + await setNextBlockTimestamp(BigInt(offerDates.validUntil)+1.toHexString()); // Get available premints from contract let availablePremints = await bosonVoucher.getAvailablePreMints(offerId); @@ -1123,7 +1123,7 @@ describe("IBosonVoucher", function () { it("Get empty range if offer has no reserved ranges", async function () { // Set invalid offer and empty range offerId = "20"; - range = new Range("0", "0", "0", "0", ethers.constants.AddressZero); + range = new Range("0", "0", "0", "0", ZeroAddress); // Get range object from contract const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); @@ -1217,8 +1217,8 @@ describe("IBosonVoucher", function () { it("Returns seller if token is preminted and not transferred yet", async function () { // Token owner should be the seller for all preminted tokens let startTokenId = deriveTokenId(offerId, start); - let endTokenId = startTokenId.add(amount); - for (let i = startTokenId; i.lt(endTokenId); i = i.add(1)) { + let endTokenId = startTokenId+amount; + for (let i = startTokenId; i.lt(endTokenId); i = i+1) { let tokenOwner = await bosonVoucher.ownerOf(i); assert.equal(tokenOwner, assistant.address, `Token owner mismatch ${i.toString()}`); } @@ -1307,8 +1307,8 @@ describe("IBosonVoucher", function () { // First range - preminted tokens let startTokenId = deriveTokenId(offerId, start); - let endTokenId = startTokenId.add(amount); - for (let i = startTokenId; i.lt(endTokenId); i = i.add(1)) { + let endTokenId = startTokenId+amount; + for (let i = startTokenId; i.lt(endTokenId); i = i+1) { let tokenOwner = await bosonVoucher.ownerOf(i); assert.equal(tokenOwner, assistant.address, `Token owner mismatch ${i.toString()}`); } @@ -1317,14 +1317,14 @@ describe("IBosonVoucher", function () { startTokenId = endTokenId; let endExchangeId = Number(start) + Number(length); endTokenId = deriveTokenId(offerId, endExchangeId); - for (let i = startTokenId; i.lt(endTokenId); i = i.add(1)) { + for (let i = startTokenId; i.lt(endTokenId); i = i+1) { await expect(bosonVoucher.connect(rando).ownerOf(i)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); } // Second range - preminted tokens startTokenId = deriveTokenId(nextOfferId, endExchangeId); - endTokenId = startTokenId.add(nextAmount); - for (let i = startTokenId; i.lt(endTokenId); i = i.add(1)) { + endTokenId = startTokenId+nextAmount; + for (let i = startTokenId; i.lt(endTokenId); i = i+1) { let tokenOwner = await bosonVoucher.ownerOf(i); assert.equal(tokenOwner, assistant.address, `Token owner mismatch ${i.toString()}`); } @@ -1333,7 +1333,7 @@ describe("IBosonVoucher", function () { startTokenId = endTokenId; endExchangeId += Number(nextLength); endTokenId = deriveTokenId(nextOfferId, endExchangeId); - for (let i = startTokenId; i.lt(endTokenId); i = i.add(1)) { + for (let i = startTokenId; i.lt(endTokenId); i = i+1) { await expect(bosonVoucher.connect(rando).ownerOf(i)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); } }); @@ -1351,7 +1351,7 @@ describe("IBosonVoucher", function () { let endTokenId = deriveTokenId(offerId, Number(start) + Number(length)); // None of reserved but not preminted tokens should have an owner - for (let i = startTokenId; i.lt(endTokenId); i = i.add(1)) { + for (let i = startTokenId; i.lt(endTokenId); i = i+1) { await expect(bosonVoucher.connect(rando).ownerOf(i)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); } }); @@ -1458,7 +1458,7 @@ describe("IBosonVoucher", function () { ); // Create DisputeResolverFee array so offer creation will succeed - disputeResolverFees = [new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0")]; + disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", "0")]; const sellerAllowList = []; // Register the dispute resolver @@ -1488,7 +1488,7 @@ describe("IBosonVoucher", function () { ); await fundsHandler .connect(admin) - .depositFunds(seller.id, ethers.constants.AddressZero, offer.sellerDeposit, { + .depositFunds(seller.id, ZeroAddress, offer.sellerDeposit, { value: offer.sellerDeposit, }); await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offer.id, { value: offer.price }); @@ -1499,7 +1499,7 @@ describe("IBosonVoucher", function () { // Update boson voucher address to actual seller's voucher const voucherAddress = calculateContractAddress(accountHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("BosonVoucher", voucherAddress); + bosonVoucher = await getContractAt("BosonVoucher", voucherAddress); }); it("Should emit a Transfer event", async function () { @@ -1587,8 +1587,8 @@ describe("IBosonVoucher", function () { // Reserve range to assistant await offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, assistant.address); // Pool needs to cover both seller deposit and price - const pool = ethers.BigNumber.from(offer.sellerDeposit).add(offer.price); - await fundsHandler.connect(admin).depositFunds(seller.id, ethers.constants.AddressZero, pool, { + const pool = BigInt(offer.sellerDeposit)+offer.price; + await fundsHandler.connect(admin).depositFunds(seller.id, ZeroAddress, pool, { value: pool, }); @@ -1601,7 +1601,7 @@ describe("IBosonVoucher", function () { // Update boson voucher address to actual seller's voucher const voucherAddress = calculateContractAddress(accountHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("BosonVoucher", voucherAddress); + bosonVoucher = await getContractAt("BosonVoucher", voucherAddress); // amount to premint await bosonVoucher.connect(assistant).preMint(offerId, offer.quantityAvailable); @@ -1637,7 +1637,7 @@ describe("IBosonVoucher", function () { // Get the block timestamp of the confirmed tx const blockNumber = tx.blockNumber; - const block = await ethers.provider.getBlock(blockNumber); + const block = await provider.getBlock(blockNumber); // Prepare exchange and voucher for validation const exchange = mockExchange({ id: exchangeId, offerId, buyerId: randoBuyer.id, finalizedDate: "0" }); @@ -1713,7 +1713,7 @@ describe("IBosonVoucher", function () { [selector](assistant.address, buyer.address, tokenId, ...additionalArgs); // Redeem voucher, effectively burning it - await setNextBlockTimestamp(ethers.BigNumber.from(voucherRedeemableFrom).toHexString()); + await setNextBlockTimestamp(BigInt(voucherRedeemableFrom).toHexString()); await exchangeHandler.connect(buyer).redeemVoucher(exchangeId); // Transfer should fail, since voucher has been burned @@ -1747,7 +1747,7 @@ describe("IBosonVoucher", function () { it("Transfer preminted voucher, where offer has expired", async function () { // Skip past offer expiry - await setNextBlockTimestamp(ethers.BigNumber.from(offerValid).toHexString()); + await setNextBlockTimestamp(BigInt(offerValid).toHexString()); // Transfer should fail, since protocol reverts await expect( @@ -1761,7 +1761,7 @@ describe("IBosonVoucher", function () { [selector](assistant.address, rando.address, tokenId, ...additionalArgs); // next token id. Make sure that assistant is the owner - tokenId = tokenId.add(1); + tokenId = tokenId+1; let tokenOwner = await bosonVoucher.ownerOf(tokenId.toString()); assert.equal(tokenOwner, assistant.address, "Seller is not the owner"); @@ -1791,14 +1791,14 @@ describe("IBosonVoucher", function () { // Update boson voucher address to actual seller's voucher const voucherAddress = calculateContractAddress(accountHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("BosonVoucher", voucherAddress); + bosonVoucher = await getContractAt("BosonVoucher", voucherAddress); // Reserve range to contract await offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, bosonVoucher.address); // Pool needs to cover both seller deposit and price - const pool = ethers.BigNumber.from(offer.sellerDeposit).add(offer.price); - await fundsHandler.connect(admin).depositFunds(seller.id, ethers.constants.AddressZero, pool, { + const pool = BigInt(offer.sellerDeposit)+offer.price; + await fundsHandler.connect(admin).depositFunds(seller.id, ZeroAddress, pool, { value: pool, }); @@ -1842,7 +1842,7 @@ describe("IBosonVoucher", function () { const balanceAfter = await bosonVoucher.balanceOf(buyer.address); - expect(balanceBefore.sub(balanceAfter)).eq(1); + expect(balanceBefore-balanceAfter).eq(1); }); it("should revert if caller does not have PROTOCOL role", async function () { @@ -1862,7 +1862,7 @@ describe("IBosonVoucher", function () { await bosonVoucher.connect(protocol).burnVoucher(0); const balanceAfter = await bosonVoucher.balanceOf(buyer.address); - expect(balanceBefore.sub(balanceAfter)).eq(1); + expect(balanceBefore-balanceAfter).eq(1); }); }); @@ -1896,7 +1896,7 @@ describe("IBosonVoucher", function () { expect(disputeResolver.isValid()).is.true; //Create DisputeResolverFee array so offer creation will succeed - disputeResolverFees = [new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0")]; + disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", "0")]; // Make empty seller list, so every seller is allowed const sellerAllowList = []; @@ -1914,15 +1914,15 @@ describe("IBosonVoucher", function () { .connect(assistant) .createOffer(offer.toStruct(), offerDates.toStruct(), offerDurations.toStruct(), disputeResolverId, agentId); - const pool = ethers.BigNumber.from(offer.sellerDeposit).add(offer.price); + const pool = BigInt(offer.sellerDeposit)+offer.price; - await fundsHandler.connect(admin).depositFunds(seller.id, ethers.constants.AddressZero, pool, { value: pool }); + await fundsHandler.connect(admin).depositFunds(seller.id, ZeroAddress, pool, { value: pool }); metadataUri = offer.metadataUri; // Update boson voucher address to actual seller's voucher const voucherAddress = calculateContractAddress(accountHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("BosonVoucher", voucherAddress); + bosonVoucher = await getContractAt("BosonVoucher", voucherAddress); }); afterEach(async function () { @@ -1972,7 +1972,7 @@ describe("IBosonVoucher", function () { context("transferOwnership()", function () { it("should emit OwnershipTransferred", async function () { - const ownable = await ethers.getContractAt("OwnableUpgradeable", bosonVoucher.address); + const ownable = await getContractAt("OwnableUpgradeable", bosonVoucher.address); await expect(bosonVoucher.connect(protocol).transferOwnership(rando.address)) .to.emit(ownable, "OwnershipTransferred") .withArgs(assistant.address, rando.address); @@ -1981,7 +1981,7 @@ describe("IBosonVoucher", function () { it("should transfer ownership with success", async function () { await bosonVoucher.connect(protocol).transferOwnership(assistant.address); - const ownable = await ethers.getContractAt("OwnableUpgradeable", bosonVoucher.address); + const ownable = await getContractAt("OwnableUpgradeable", bosonVoucher.address); const owner = await ownable.owner(); expect(owner).eq(assistant.address, "Wrong owner"); @@ -2008,7 +2008,7 @@ describe("IBosonVoucher", function () { // successfully transfer to assistant await bosonVoucher.connect(protocol).transferOwnership(assistant.address); - const ownable = await ethers.getContractAt("OwnableUpgradeable", bosonVoucher.address); + const ownable = await getContractAt("OwnableUpgradeable", bosonVoucher.address); // owner tries to renounce ownership, it should fail await expect(ownable.connect(assistant).renounceOwnership()).to.be.revertedWith(RevertReasons.ACCESS_DENIED); @@ -2016,7 +2016,7 @@ describe("IBosonVoucher", function () { it("Transferring ownership to 0 is not allowed", async function () { // try to transfer ownership to address 0, should fail - await expect(bosonVoucher.connect(protocol).transferOwnership(ethers.constants.AddressZero)).to.be.revertedWith( + await expect(bosonVoucher.connect(protocol).transferOwnership(ZeroAddress)).to.be.revertedWith( RevertReasons.OWNABLE_ZERO_ADDRESS ); }); @@ -2086,7 +2086,7 @@ describe("IBosonVoucher", function () { expect(disputeResolver.isValid()).is.true; //Create DisputeResolverFee array so offer creation will succeed - disputeResolverFees = [new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0")]; + disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", "0")]; // Make empty seller list, so every seller is allowed const sellerAllowList = []; @@ -2102,7 +2102,7 @@ describe("IBosonVoucher", function () { .createOffer(offer.toStruct(), offerDates.toStruct(), offerDurations.toStruct(), disputeResolverId, agentId); await fundsHandler .connect(admin) - .depositFunds(seller.id, ethers.constants.AddressZero, offer.sellerDeposit, { value: offer.sellerDeposit }); + .depositFunds(seller.id, ZeroAddress, offer.sellerDeposit, { value: offer.sellerDeposit }); await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offer.id, { value: offer.price }); exchangeId = "1"; @@ -2256,7 +2256,7 @@ describe("IBosonVoucher", function () { const [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(exchangeId, offerPrice); // Receiver and amount should be 0 - assert.equal(receiver, ethers.constants.AddressZero, "Recipient address is incorrect"); + assert.equal(receiver, ZeroAddress, "Recipient address is incorrect"); assert.equal(royaltyAmount.toNumber(), 0, "Royalty amount is incorrect"); }); }); @@ -2268,7 +2268,7 @@ describe("IBosonVoucher", function () { voucherInitValues = new VoucherInitValues("ContractURI", royaltyPercentage); // create another seller - seller = mockSeller(rando.address, rando.address, ethers.constants.AddressZero, rando.address); + seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); seller.id = "2"; // royalty percentage too high, expectig revert @@ -2312,7 +2312,7 @@ describe("IBosonVoucher", function () { beforeEach(async function () { // Deploy a random contract - const MockSimpleContract = await ethers.getContractFactory("MockSimpleContract"); + const MockSimpleContract = await getContractFactory("MockSimpleContract"); mockSimpleContract = await MockSimpleContract.deploy(); await mockSimpleContract.deployed(); @@ -2332,7 +2332,7 @@ describe("IBosonVoucher", function () { context("💔 Revert Reasons", async function () { it("_to is the zero address", async function () { await expect( - bosonVoucher.connect(assistant).callExternalContract(ethers.constants.AddressZero, calldata) + bosonVoucher.connect(assistant).callExternalContract(ZeroAddress, calldata) ).to.be.revertedWith(RevertReasons.INVALID_ADDRESS); }); @@ -2355,7 +2355,7 @@ describe("IBosonVoucher", function () { }); it("Owner tries to invoke method to transfer funds", async function () { - const erc20 = await ethers.getContractFactory("Foreign20"); + const erc20 = await getContractFactory("Foreign20"); // transfer calldata = erc20.interface.encodeFunctionData("transfer", [assistant.address, 20]); @@ -2376,7 +2376,7 @@ describe("IBosonVoucher", function () { ); // DAI - const dai = await ethers.getContractAt("DAIAliases", ethers.constants.AddressZero); + const dai = await getContractAt("DAIAliases", ZeroAddress); // push calldata = dai.interface.encodeFunctionData("push", [assistant.address, 20]); @@ -2411,7 +2411,7 @@ describe("IBosonVoucher", function () { it("should revert if operator is zero address", async function () { // Expect revert if random user attempts to set approval await expect( - bosonVoucher.connect(assistant).setApprovalForAllToContract(ethers.constants.AddressZero, true) + bosonVoucher.connect(assistant).setApprovalForAllToContract(ZeroAddress, true) ).to.revertedWith(RevertReasons.INVALID_ADDRESS); }); }); @@ -2438,12 +2438,12 @@ describe("IBosonVoucher", function () { let expectedAvailableFunds = new FundsList([]); expect(sellersFundsBefore).to.eql(expectedAvailableFunds); - const amount = ethers.utils.parseUnits("1", "ether"); + const amount = parseUnits("1", "ether"); await admin.sendTransaction({ to: bosonVoucher.address, value: amount }); await expect(() => - bosonVoucher.connect(rando).withdrawToProtocol([ethers.constants.AddressZero]) - ).to.changeEtherBalances([bosonVoucher, fundsHandler], [amount.mul(-1), amount]); + bosonVoucher.connect(rando).withdrawToProtocol([ZeroAddress]) + ).to.changeEtherBalances([bosonVoucher, fundsHandler], [amount*-1, amount]); }); it("Can withdraw ERC20", async function () { @@ -2452,14 +2452,14 @@ describe("IBosonVoucher", function () { let expectedAvailableFunds = new FundsList([]); expect(sellersFundsBefore).to.eql(expectedAvailableFunds); - const amount = ethers.utils.parseUnits("1", "ether"); + const amount = parseUnits("1", "ether"); await foreign20.connect(deployer).mint(deployer.address, amount); await foreign20.connect(deployer).transfer(bosonVoucher.address, amount); await expect(() => bosonVoucher.connect(rando).withdrawToProtocol([foreign20.address])).to.changeTokenBalances( foreign20, [bosonVoucher, fundsHandler], - [amount.mul(-1), amount] + [amount*-1, amount] ); // Seller's available balance should increase @@ -2474,17 +2474,17 @@ describe("IBosonVoucher", function () { let expectedAvailableFunds = new FundsList([]); expect(sellersFundsBefore).to.eql(expectedAvailableFunds); - const amount = ethers.utils.parseUnits("1", "ether"); + const amount = parseUnits("1", "ether"); await admin.sendTransaction({ to: bosonVoucher.address, value: amount }); await foreign20.connect(deployer).mint(deployer.address, amount); await foreign20.connect(deployer).transfer(bosonVoucher.address, amount); let tx; await expect(() => { - tx = bosonVoucher.connect(rando).withdrawToProtocol([ethers.constants.AddressZero, foreign20.address]); + tx = bosonVoucher.connect(rando).withdrawToProtocol([ZeroAddress, foreign20.address]); return tx; - }).to.changeTokenBalances(foreign20, [bosonVoucher, fundsHandler], [amount.mul(-1), amount]); - await expect(() => tx).to.changeEtherBalances([bosonVoucher, fundsHandler], [amount.mul(-1), amount]); + }).to.changeTokenBalances(foreign20, [bosonVoucher, fundsHandler], [amount*-1, amount]); + await expect(() => tx).to.changeEtherBalances([bosonVoucher, fundsHandler], [amount*-1, amount]); }); }); diff --git a/test/protocol/clients/ClientExternalAddressesTest.js b/test/protocol/clients/ClientExternalAddressesTest.js index 1ebf0354a..b5c8df6fb 100644 --- a/test/protocol/clients/ClientExternalAddressesTest.js +++ b/test/protocol/clients/ClientExternalAddressesTest.js @@ -25,7 +25,7 @@ describe("IClientExternalAddresses", function () { extraReturnValues: { beacon }, } = await setupTestEnvironment(contracts)); - [deployer] = await ethers.getSigners(); + [deployer] = await getSigners(); // Get snapshot id snapshotId = await getSnapshot(); @@ -69,7 +69,7 @@ describe("IClientExternalAddresses", function () { it("implementation address is the zero address", async function () { // Attempt to set new implementation, expecting revert - await expect(beacon.connect(deployer).setImplementation(ethers.constants.AddressZero)).to.revertedWith( + await expect(beacon.connect(deployer).setImplementation(ZeroAddress)).to.revertedWith( RevertReasons.INVALID_ADDRESS ); }); @@ -107,7 +107,7 @@ describe("IClientExternalAddresses", function () { it("protocol address is the zero address", async function () { // Attempt to set new protocol address, expecting revert - await expect(beacon.connect(deployer).setProtocolAddress(ethers.constants.AddressZero)).to.revertedWith( + await expect(beacon.connect(deployer).setProtocolAddress(ZeroAddress)).to.revertedWith( RevertReasons.INVALID_ADDRESS ); }); @@ -119,12 +119,12 @@ describe("IClientExternalAddresses", function () { it("_protocolAddress address is the zero address", async function () { // Deploy Protocol Client implementation contracts const protocolClientImpls = await deployProtocolClientImpls( - [ethers.constants.AddressZero], + [ZeroAddress], maxPriorityFeePerGas ); // Deploy Protocol Client beacon contracts - const protocolClientArgs = [ethers.constants.AddressZero]; + const protocolClientArgs = [ZeroAddress]; await expect( deployProtocolClientBeacons(protocolClientImpls, protocolClientArgs, maxPriorityFeePerGas) ).to.revertedWith(RevertReasons.INVALID_ADDRESS); @@ -135,9 +135,9 @@ describe("IClientExternalAddresses", function () { const protocolClientArgs = [protocolDiamondAddress]; // Deploy the ClientBeacon for BosonVoucher - const ClientBeacon = await ethers.getContractFactory("BosonClientBeacon"); + const ClientBeacon = await getContractFactory("BosonClientBeacon"); await expect( - ClientBeacon.deploy(...protocolClientArgs, ethers.constants.AddressZero, { gasLimit }) + ClientBeacon.deploy(...protocolClientArgs, ZeroAddress, { gasLimit }) ).to.revertedWith(RevertReasons.INVALID_ADDRESS); }); }); diff --git a/test/upgrade/01_generic.js b/test/upgrade/01_generic.js index 88bbeef46..2dae360e9 100644 --- a/test/upgrade/01_generic.js +++ b/test/upgrade/01_generic.js @@ -153,7 +153,7 @@ function getGenericContext( const offerPrice = offer.price; const buyer = preUpgradeEntities.buyers[1]; let msgValue; - if (offer.exchangeToken == ethers.constants.AddressZero) { + if (offer.exchangeToken == ZeroAddress) { msgValue = offerPrice; } else { // approve token transfer @@ -172,7 +172,7 @@ function getGenericContext( // Get the block timestamp of the confirmed tx const blockNumber = tx.blockNumber; - const block = await ethers.provider.getBlock(blockNumber); + const block = await provider.getBlock(blockNumber); // Set expected voucher values const voucher = mockVoucher({ @@ -270,7 +270,7 @@ function getGenericContext( // Get the block timestamp of the confirmed tx const blockNumber = tx.blockNumber; - const block = await ethers.provider.getBlock(blockNumber); + const block = await provider.getBlock(blockNumber); // Set expected voucher values const voucher = mockVoucher({ diff --git a/test/upgrade/2.0.0-2.1.0.js b/test/upgrade/2.0.0-2.1.0.js index b2b6d9bb8..f7e3b9094 100644 --- a/test/upgrade/2.0.0-2.1.0.js +++ b/test/upgrade/2.0.0-2.1.0.js @@ -37,7 +37,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation before(async function () { try { // Make accounts available - [deployer, rando, admin, assistant, clerk, treasury] = await ethers.getSigners(); + [deployer, rando, admin, assistant, clerk, treasury] = await getSigners(); ({ protocolDiamondAddress, protocolContracts, mockContracts } = await deploySuite(deployer, version)); @@ -245,7 +245,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation const pendingSellerUpdate = seller.clone(); pendingSellerUpdate.id = "0"; - pendingSellerUpdate.treasury = ethers.constants.AddressZero; + pendingSellerUpdate.treasury = ZeroAddress; pendingSellerUpdate.active = false; const expectedSeller = oldSeller.seller.clone(); @@ -280,7 +280,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Update seller assistant tx = await accountHandler.connect(assistant).optInToSellerUpdate(seller.id, [SellerUpdateFields.Assistant]); - pendingSellerUpdate.assistant = ethers.constants.AddressZero; + pendingSellerUpdate.assistant = ZeroAddress; expectedSeller.assistant = seller.assistant; // Check assistant update @@ -298,7 +298,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Update seller clerk tx = await accountHandler.connect(clerk).optInToSellerUpdate(seller.id, [SellerUpdateFields.Clerk]); - pendingSellerUpdate.clerk = ethers.constants.AddressZero; + pendingSellerUpdate.clerk = ZeroAddress; expectedSeller.clerk = seller.clerk; // Check assistant update @@ -316,7 +316,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Update seller admin tx = await accountHandler.connect(admin).optInToSellerUpdate(seller.id, [SellerUpdateFields.Admin]); - pendingSellerUpdate.admin = ethers.constants.AddressZero; + pendingSellerUpdate.admin = ZeroAddress; expectedSeller.admin = seller.admin; // Check assistant update @@ -352,7 +352,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation disputeResolverPendingUpdate.id = "0"; disputeResolverPendingUpdate.escalationResponsePeriod = "0"; disputeResolverPendingUpdate.metadataUri = ""; - disputeResolverPendingUpdate.treasury = ethers.constants.AddressZero; + disputeResolverPendingUpdate.treasury = ZeroAddress; const expectedDisputeResolver = oldDisputeResolver.disputeResolver.clone(); expectedDisputeResolver.escalationResponsePeriod = disputeResolver.escalationResponsePeriod; @@ -366,7 +366,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Approve assistant update expectedDisputeResolver.assistant = disputeResolver.assistant; - disputeResolverPendingUpdate.assistant = ethers.constants.AddressZero; + disputeResolverPendingUpdate.assistant = ZeroAddress; await expect( accountHandler @@ -383,7 +383,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Approve admin update expectedDisputeResolver.admin = disputeResolver.admin; - disputeResolverPendingUpdate.admin = ethers.constants.AddressZero; + disputeResolverPendingUpdate.admin = ZeroAddress; await expect( accountHandler @@ -400,7 +400,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Approve clerk update expectedDisputeResolver.clerk = disputeResolver.clerk; - disputeResolverPendingUpdate.clerk = ethers.constants.AddressZero; + disputeResolverPendingUpdate.clerk = ZeroAddress; await expect( accountHandler diff --git a/test/upgrade/2.1.0-2.2.0.js b/test/upgrade/2.1.0-2.2.0.js index e0bbfc5f6..63b206e69 100644 --- a/test/upgrade/2.1.0-2.2.0.js +++ b/test/upgrade/2.1.0-2.2.0.js @@ -63,7 +63,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation before(async function () { try { // Make accounts available - [deployer, rando, , assistant] = await ethers.getSigners(); + [deployer, rando, , assistant] = await getSigners(); ({ protocolDiamondAddress, protocolContracts, mockContracts } = await deploySuite(deployer, newVersion)); ({ twinHandler, disputeHandler } = protocolContracts); @@ -136,7 +136,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation preUpgradeEntities ); - snapshot = await ethers.provider.send("evm_snapshot", []); + snapshot = await provider.send("evm_snapshot", []); // This context is placed in an uncommon place due to order of test execution. // Generic context needs values that are set in "before", however "before" is executed before tests, not before suites @@ -167,8 +167,8 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation afterEach(async function () { // Revert to state right after the upgrade. // This is used so the lengthly setup (deploy+upgrade) is done only once. - await ethers.provider.send("evm_revert", [snapshot]); - snapshot = await ethers.provider.send("evm_snapshot", []); + await provider.send("evm_revert", [snapshot]); + snapshot = await provider.send("evm_snapshot", []); }); after(async function () { @@ -191,7 +191,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation const { contracts } = readContracts(31337, "hardhat", "upgrade-test"); const orchestrationHandler1 = contracts.find((i) => i.name === "OrchestrationHandlerFacet1"); - const diamondLoupe = await ethers.getContractAt("DiamondLoupeFacet", protocolDiamondAddress); + const diamondLoupe = await getContractAt("DiamondLoupeFacet", protocolDiamondAddress); for (const selector of selectors) { expect(await diamondLoupe.facetAddress(selector)).to.equal(orchestrationHandler1.address); @@ -233,7 +233,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Voucher contract const expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, sellers.length + 1); - const bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + const bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); // Validate voucher name and symbol expect(await bosonVoucher.name()).to.equal( @@ -309,7 +309,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation const offer = preUpgradeEntities.offers.find((o) => o.offer.id == exchange.offerId); const seller = preUpgradeEntities.sellers.find((s) => s.seller.id == offer.offer.sellerId); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", seller.voucherContractAddress); + bosonVoucher = await getContractAt("IBosonVoucher", seller.voucherContractAddress); tokenId = exchange.exchangeId; sellerWallet = seller.wallet; }); @@ -325,7 +325,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Voucher burned event await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(buyerWallet.address, ethers.constants.AddressZero, tokenId); + .withArgs(buyerWallet.address, ZeroAddress, tokenId); }); it("Cancel old voucher", async function () { @@ -339,7 +339,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Voucher burned event await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(buyerWallet.address, ethers.constants.AddressZero, tokenId); + .withArgs(buyerWallet.address, ZeroAddress, tokenId); }); it("Revoke old voucher", async function () { @@ -353,7 +353,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Voucher burned event await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(buyerWallet.address, ethers.constants.AddressZero, tokenId); + .withArgs(buyerWallet.address, ZeroAddress, tokenId); }); }); @@ -371,7 +371,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation const offer = preUpgradeEntities.offers.find((o) => o.offer.id == offerId); const seller = preUpgradeEntities.sellers.find((s) => s.seller.id == offer.offer.sellerId); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", seller.voucherContractAddress); + bosonVoucher = await getContractAt("IBosonVoucher", seller.voucherContractAddress); tokenId = deriveTokenId(offerId, exchangeId); sellerWallet = seller.wallet; }); @@ -387,7 +387,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Voucher burned event await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(buyerWallet.address, ethers.constants.AddressZero, tokenId); + .withArgs(buyerWallet.address, ZeroAddress, tokenId); }); it("Cancel new voucher", async function () { @@ -401,7 +401,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Voucher burned event await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(buyerWallet.address, ethers.constants.AddressZero, tokenId); + .withArgs(buyerWallet.address, ZeroAddress, tokenId); }); it("Revoke new voucher", async function () { @@ -415,7 +415,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Voucher burned event await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(buyerWallet.address, ethers.constants.AddressZero, tokenId); + .withArgs(buyerWallet.address, ZeroAddress, tokenId); }); }); @@ -445,7 +445,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation MetaTransaction: metaTransactionType, }; - nonce = parseInt(ethers.utils.randomBytes(8)); + nonce = parseInt(randomBytes(8)); // Prepare the message message = { @@ -690,11 +690,11 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation await expect(tx).to.emit(orchestrationHandler, "OfferCreated"); // Voucher clone contract - let bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + let bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged"); await expect(tx).to.emit(bosonVoucher, "RoyaltyPercentageChanged"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); // Different ABI + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); // Different ABI await expect(tx).to.emit(bosonVoucher, "OwnershipTransferred"); }); @@ -725,11 +725,11 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation await expect(tx).to.emit(orchestrationHandler, "GroupCreated"); // Voucher clone contract - let bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + let bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged"); await expect(tx).to.emit(bosonVoucher, "RoyaltyPercentageChanged"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "OwnershipTransferred"); }); @@ -767,11 +767,11 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation await expect(tx).to.emit(orchestrationHandler, "BundleCreated"); // Voucher clone contract - let bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + let bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged"); await expect(tx).to.emit(bosonVoucher, "RoyaltyPercentageChanged"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "OwnershipTransferred"); }); @@ -806,11 +806,11 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation await expect(tx).to.emit(orchestrationHandler, "BundleCreated"); // Voucher clone contract - let bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + let bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged"); await expect(tx).to.emit(bosonVoucher, "RoyaltyPercentageChanged"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "OwnershipTransferred"); }); }); @@ -963,12 +963,12 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation await expect(tx).to.emit(orchestrationHandler, "RangeReserved"); // Voucher clone contract - let bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + let bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged"); await expect(tx).to.emit(bosonVoucher, "RoyaltyPercentageChanged"); await expect(tx).to.emit(bosonVoucher, "RangeReserved"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); // Different ABI + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); // Different ABI await expect(tx).to.emit(bosonVoucher, "OwnershipTransferred"); }); @@ -1002,12 +1002,12 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation await expect(tx).to.emit(orchestrationHandler, "GroupCreated"); // Voucher clone contract - let bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + let bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged"); await expect(tx).to.emit(bosonVoucher, "RoyaltyPercentageChanged"); await expect(tx).to.emit(bosonVoucher, "RangeReserved"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "OwnershipTransferred"); }); @@ -1048,12 +1048,12 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation await expect(tx).to.emit(orchestrationHandler, "BundleCreated"); // Voucher clone contract - let bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + let bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged"); await expect(tx).to.emit(bosonVoucher, "RoyaltyPercentageChanged"); await expect(tx).to.emit(bosonVoucher, "RangeReserved"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "OwnershipTransferred"); }); @@ -1091,12 +1091,12 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation await expect(tx).to.emit(orchestrationHandler, "BundleCreated"); // Voucher clone contract - let bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + let bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "ContractURIChanged"); await expect(tx).to.emit(bosonVoucher, "RoyaltyPercentageChanged"); await expect(tx).to.emit(bosonVoucher, "RangeReserved"); - bosonVoucher = await ethers.getContractAt("OwnableUpgradeable", expectedCloneAddress); + bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); await expect(tx).to.emit(bosonVoucher, "OwnershipTransferred"); }); }); @@ -1121,7 +1121,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Voucher clone contract const expectedCloneAddress = calculateContractAddress(accountHandler.address, "1"); - bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); }); it("👉 createPremintedOfferWithCondition", async function () { @@ -1271,7 +1271,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Boson voucher contract address const sellerIndex = sellers.findIndex((s) => s.id === seller.id); const voucherCloneAddress = calculateContractAddress(accountHandler.address, sellerIndex + 1); - const bosonVoucher = await ethers.getContractAt("BosonVoucher", voucherCloneAddress); + const bosonVoucher = await getContractAt("BosonVoucher", voucherCloneAddress); await bosonVoucher.connect(assistant).preMint(offer.id, offer.quantityAvailable); // Commit to preminted offer, testing for the event @@ -1293,7 +1293,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Voucher contract const sellerIndex = sellers.findIndex((s) => s.id === seller.id); const expectedCloneAddress = calculateContractAddress(accountHandler.address, sellerIndex + 1); - const bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + const bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect( offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, bosonVoucher.address) @@ -1356,7 +1356,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Find voucher contract const sellerIndex = sellers.findIndex((s) => s.id === seller.id); const expectedCloneAddress = calculateContractAddress(accountHandler.address, sellerIndex + 1); - const bosonVoucher = await ethers.getContractAt("IBosonVoucher", expectedCloneAddress); + const bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); // Premint await bosonVoucher.connect(assistant).preMint(offerId, 1); diff --git a/test/upgrade/2.2.0-2.2.1.js b/test/upgrade/2.2.0-2.2.1.js index 149d49410..d5217ace5 100644 --- a/test/upgrade/2.2.0-2.2.1.js +++ b/test/upgrade/2.2.0-2.2.1.js @@ -36,7 +36,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation before(async function () { try { // Make accounts available - [deployer, rando] = await ethers.getSigners(); + [deployer, rando] = await getSigners(); let contractsBefore; @@ -86,7 +86,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation contractsAfter = { ...contractsBefore }; for (const [handlerName, interfaceName] of Object.entries(newHandlers)) { - contractsAfter[handlerName] = await ethers.getContractAt(interfaceName, protocolDiamondAddress); + contractsAfter[handlerName] = await getContractAt(interfaceName, protocolDiamondAddress); } ({ accountHandler } = contractsAfter); diff --git a/test/upgrade/clients/01_generic.js b/test/upgrade/clients/01_generic.js index a986e43b9..649ffc5b1 100644 --- a/test/upgrade/clients/01_generic.js +++ b/test/upgrade/clients/01_generic.js @@ -80,7 +80,7 @@ function getGenericContext( // loop matches the loop in populateVoucherContract for (let j = i; j < buyers.length; j++) { const offer = preUpgradeEntities.offers[i + j].offer; - const sellerId = ethers.BigNumber.from(offer.sellerId).toHexString(); + const sellerId = BigInt(offer.sellerId).toHexString(); // Find the voucher data for the seller const voucherData = voucherContractStateAfterUpgradeAndActions.find( @@ -91,7 +91,7 @@ function getGenericContext( const buyerIndex = entities.findIndex((e) => e.wallet.address == buyerWallet.address); // Update the balance of the buyer - voucherData.balanceOf[buyerIndex] = voucherData.balanceOf[buyerIndex].sub(1); + voucherData.balanceOf[buyerIndex] = voucherData.balanceOf[buyerIndex]-1; } } diff --git a/test/upgrade/clients/BosonVoucher-2.1.0-2.2.0.js b/test/upgrade/clients/BosonVoucher-2.1.0-2.2.0.js index d2449bf2b..555d73e90 100644 --- a/test/upgrade/clients/BosonVoucher-2.1.0-2.2.0.js +++ b/test/upgrade/clients/BosonVoucher-2.1.0-2.2.0.js @@ -61,7 +61,7 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio before(async function () { try { // Make accounts available - [deployer, assistant, rando] = await ethers.getSigners(); + [deployer, assistant, rando] = await getSigners(); // temporary update config, so compiler outputs storage layout for (const compiler of hre.config.solidity.compilers) { @@ -160,7 +160,7 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio const seller = mockSeller( assistant.address, assistant.address, - ethers.constants.AddressZero, + ZeroAddress, assistant.address, true ); @@ -180,7 +180,7 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio true, true ); - const disputeResolverFees = [new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0")]; + const disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", "0")]; const sellerAllowList = []; await accountHandler .connect(assistant) @@ -197,13 +197,13 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio await fundsHandler .connect(assistant) - .depositFunds(sellerId, ethers.constants.AddressZero, offer.sellerDeposit, { value: offer.sellerDeposit }); + .depositFunds(sellerId, ZeroAddress, offer.sellerDeposit, { value: offer.sellerDeposit }); start = await exchangeHandler.getNextExchangeId(); length = "80"; amount = "50"; // amount to mint - bosonVoucher = await ethers.getContractAt( + bosonVoucher = await getContractAt( "BosonVoucher", calculateContractAddress(exchangeHandler.address, preUpgradeEntities.sellers.length + 1) ); @@ -253,7 +253,7 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio } = preUpgradeEntities.sellers[sellersLength - 1]; // reassign assistant because signer must be on provider default accounts in order to call eth_signTypedData_v4 - assistant = (await ethers.getSigners())[2]; + assistant = (await getSigners())[2]; seller.assistant = assistant.address; await accountHandler.connect(wallet).updateSeller(seller, authToken); await accountHandler.connect(assistant).optInToSellerUpdate(seller.id, [SellerUpdateFields.Assistant]); @@ -262,7 +262,7 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio await offerHandler.connect(assistant).reserveRange(offerId, length, assistant.address); // Get last seller voucher - bosonVoucher = await ethers.getContractAt( + bosonVoucher = await getContractAt( "BosonVoucher", calculateContractAddress(exchangeHandler.address, sellersLength) ); @@ -338,7 +338,7 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio it("callExternalContract()", async function () { // Deploy a random contract - const MockSimpleContract = await ethers.getContractFactory("MockSimpleContract"); + const MockSimpleContract = await getContractFactory("MockSimpleContract"); const mockSimpleContract = await MockSimpleContract.deploy(); await mockSimpleContract.deployed(); @@ -358,28 +358,28 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio context("withdrawToProtocol()", async function () { beforeEach(async function () { - // For some reason, ethers.getContractAt and changeEtherBalances don't work together, so we need to explicitly instantiate the contract - bosonVoucher = new ethers.Contract(bosonVoucher.address, bosonVoucher.interface, deployer); + // For some reason, getContractAt and changeEtherBalances don't work together, so we need to explicitly instantiate the contract + bosonVoucher = new Contract(bosonVoucher.address, bosonVoucher.interface, deployer); }); it("Can withdraw native token", async function () { // Sellers initial available funds const sellersFundsBefore = FundsList.fromStruct(await fundsHandler.getAvailableFunds(sellerId)); let expectedAvailableFunds = new FundsList([ - new Funds(ethers.constants.AddressZero, "Native currency", offer.sellerDeposit), + new Funds(ZeroAddress, "Native currency", offer.sellerDeposit), ]); expect(sellersFundsBefore).to.eql(expectedAvailableFunds); - const amount = ethers.utils.parseUnits("1", "ether"); + const amount = parseUnits("1", "ether"); await deployer.sendTransaction({ to: bosonVoucher.address, value: amount }); await expect(() => - bosonVoucher.connect(rando).withdrawToProtocol([ethers.constants.AddressZero]) - ).to.changeEtherBalances([bosonVoucher, fundsHandler], [amount.mul(-1), amount]); + bosonVoucher.connect(rando).withdrawToProtocol([ZeroAddress]) + ).to.changeEtherBalances([bosonVoucher, fundsHandler], [amount*-1, amount]); // Seller's available balance should increase expectedAvailableFunds = new FundsList([ - new Funds(ethers.constants.AddressZero, "Native currency", amount.add(offer.sellerDeposit).toString()), + new Funds(ZeroAddress, "Native currency", amount+offer.sellerDeposit.toString()), ]); const sellerFundsAfter = FundsList.fromStruct(await fundsHandler.getAvailableFunds(sellerId)); expect(sellerFundsAfter).to.eql(expectedAvailableFunds); @@ -389,20 +389,20 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio // Sellers initial available funds const sellersFundsBefore = FundsList.fromStruct(await fundsHandler.getAvailableFunds(sellerId)); let expectedAvailableFunds = new FundsList([ - new Funds(ethers.constants.AddressZero, "Native currency", offer.sellerDeposit), + new Funds(ZeroAddress, "Native currency", offer.sellerDeposit), ]); expect(sellersFundsBefore).to.eql(expectedAvailableFunds); const [foreign20] = await deployMockTokens(["Foreign20"]); - const amount = ethers.utils.parseUnits("1", "ether"); + const amount = parseUnits("1", "ether"); await foreign20.connect(deployer).mint(deployer.address, amount); await foreign20.connect(deployer).transfer(bosonVoucher.address, amount); await expect(() => bosonVoucher.connect(rando).withdrawToProtocol([foreign20.address])).to.changeTokenBalances( foreign20, [bosonVoucher, fundsHandler], - [amount.mul(-1), amount] + [amount*-1, amount] ); // Seller's available balance should increase diff --git a/test/util/constants.js b/test/util/constants.js index f02445bee..18dd46800 100644 --- a/test/util/constants.js +++ b/test/util/constants.js @@ -11,7 +11,7 @@ const VOUCHER_NAME = "Boson Voucher (rNFT)"; const VOUCHER_SYMBOL = "BOSON_VOUCHER_RNFT"; const SEAPORT_ADDRESS = "0x00000000000001ad428e4906aE43D8F9852d0dD6"; // 1.4 const tipMultiplier = BigInt(environments.tipMultiplier); -const tipSuggestion = "1500000000"; // ethers.js always returns this constant, it does not vary per block +const tipSuggestion = "1500000000"; // js always returns this constant, it does not vary per block const maxPriorityFeePerGas = BigInt(tipSuggestion)*tipMultiplier; exports.oneDay = oneDay; diff --git a/test/util/mock.js b/test/util/mock.js index fdf913b81..f1f077122 100644 --- a/test/util/mock.js +++ b/test/util/mock.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { ZeroAddress, provider, parseUnits } = hre.ethers; const decache = require("decache"); const Condition = require("../../scripts/domain/Condition"); @@ -50,14 +50,12 @@ function mockOfferDurations() { async function mockOfferDates() { // Get the current block info - const blockNumber = await ethers.provider.getBlockNumber(); - const block = await ethers.provider.getBlock(blockNumber); + const blockNumber = await provider.getBlockNumber(); + const block = await provider.getBlock(blockNumber); - const validFrom = ethers.BigNumber.from(block.timestamp).toString(); // valid from now - const validUntil = ethers.BigNumber.from(block.timestamp) - .add(oneMonth * 6) - .toString(); // until 6 months - const voucherRedeemableFrom = ethers.BigNumber.from(block.timestamp).add(oneWeek).toString(); // redeemable in 1 week + const validFrom = BigInt(block.timestamp).toString(); // valid from now + const validUntil = BigInt(block.timestamp) + BigInt(oneMonth) * BigInt(6); // until 6 months + const voucherRedeemableFrom = BigInt(block.timestamp)+ BigInt(oneWeek); // redeemable in 1 week const voucherRedeemableUntil = "0"; // mocks use voucher valid duration rather than fixed date, override in tests as needed // Create a valid offerDates, then set fields in tests directly @@ -68,12 +66,12 @@ async function mockOfferDates() { async function mockOffer() { const id = "1"; const sellerId = "1"; // argument sent to contract for createOffer will be ignored - const price = ethers.utils.parseUnits("1.5", "ether").toString(); - const sellerDeposit = ethers.utils.parseUnits("0.25", "ether").toString(); + const price = parseUnits("1.5", "ether").toString(); + const sellerDeposit = parseUnits("0.25", "ether").toString(); const protocolFee = applyPercentage(price, "200"); - const buyerCancelPenalty = ethers.utils.parseUnits("0.05", "ether").toString(); + const buyerCancelPenalty = parseUnits("0.05", "ether").toString(); const quantityAvailable = "1"; - const exchangeToken = ethers.constants.AddressZero.toString(); // Zero addy ~ chain base currency + const exchangeToken = ZeroAddress.toString(); // Zero addy ~ chain base currency const metadataHash = "QmYXc12ov6F2MZVZwPs5XeCBbf61cW3wKRk8h3D5NTYj4T"; // not an actual metadataHash, just some data for tests const metadataUri = `https://ipfs.io/ipfs/${metadataHash}`; const voided = false; @@ -221,7 +219,7 @@ async function mockReceipt() { const buyerId = "1"; const sellerId = "2"; const agentId = "3"; - const twinReceipt = mockTwinReceipt(ethers.constants.AddressZero); + const twinReceipt = mockTwinReceipt(ZeroAddress); return new Receipt( exchange.id, @@ -251,7 +249,7 @@ function mockCondition({ method, tokenType, tokenAddress, tokenId, threshold, ma return new Condition( method ?? EvaluationMethod.Threshold, tokenType ?? TokenType.FungibleToken, - tokenAddress ?? ethers.constants.AddressZero, + tokenAddress ?? ZeroAddress, tokenId ?? "0", threshold ?? "1", maxCommits ?? "1" diff --git a/test/util/upgrade.js b/test/util/upgrade.js index 9979ef44c..49b5a6708 100644 --- a/test/util/upgrade.js +++ b/test/util/upgrade.js @@ -3,7 +3,7 @@ const _ = require("lodash"); const { getStorageAt } = require("@nomicfoundation/hardhat-network-helpers"); const hre = require("hardhat"); const ethers = hre.ethers; -const { keccak256, formatBytes32String } = ethers.utils; +const { keccak256, formatBytes32String } = utils; const AuthToken = require("../../scripts/domain/AuthToken"); const { getMetaTransactionsHandlerFacetInitArgs } = require("../../scripts/config/facet-deploy.js"); const AuthTokenType = require("../../scripts/domain/AuthTokenType"); @@ -104,12 +104,12 @@ async function deploySuite(deployer, newVersion) { }); // Read contract info from file - const chainId = (await hre.ethers.provider.getNetwork()).chainId; + const chainId = (await hre.provider.getNetwork()).chainId; const contractsFile = readContracts(chainId, "hardhat", "upgrade-test"); // Get AccessController abstraction const accessControllerInfo = contractsFile.contracts.find((i) => i.name === "AccessController"); - const accessController = await ethers.getContractAt("AccessController", accessControllerInfo.address); + const accessController = await getContractAt("AccessController", accessControllerInfo.address); // Temporarily grant UPGRADER role to deployer account await accessController.grantRole(Role.UPGRADER, deployer.address); @@ -121,20 +121,20 @@ async function deploySuite(deployer, newVersion) { await accessController.grantRole(Role.PROTOCOL, protocolDiamondAddress); // Cast Diamond to interfaces - const accountHandler = await ethers.getContractAt("IBosonAccountHandler", protocolDiamondAddress); - const bundleHandler = await ethers.getContractAt("IBosonBundleHandler", protocolDiamondAddress); - const disputeHandler = await ethers.getContractAt("IBosonDisputeHandler", protocolDiamondAddress); - const exchangeHandler = await ethers.getContractAt("IBosonExchangeHandler", protocolDiamondAddress); - const fundsHandler = await ethers.getContractAt("IBosonFundsHandler", protocolDiamondAddress); - const groupHandler = await ethers.getContractAt("IBosonGroupHandler", protocolDiamondAddress); - const offerHandler = await ethers.getContractAt("IBosonOfferHandler", protocolDiamondAddress); - const orchestrationHandler = await ethers.getContractAt("IBosonOrchestrationHandler", protocolDiamondAddress); - const twinHandler = await ethers.getContractAt("IBosonTwinHandler", protocolDiamondAddress); - const pauseHandler = await ethers.getContractAt("IBosonPauseHandler", protocolDiamondAddress); - const metaTransactionsHandler = await ethers.getContractAt("IBosonMetaTransactionsHandler", protocolDiamondAddress); - const configHandler = await ethers.getContractAt("IBosonConfigHandler", protocolDiamondAddress); - const ERC165Facet = await ethers.getContractAt("ERC165Facet", protocolDiamondAddress); - const protocolInitializationHandler = await ethers.getContractAt( + const accountHandler = await getContractAt("IBosonAccountHandler", protocolDiamondAddress); + const bundleHandler = await getContractAt("IBosonBundleHandler", protocolDiamondAddress); + const disputeHandler = await getContractAt("IBosonDisputeHandler", protocolDiamondAddress); + const exchangeHandler = await getContractAt("IBosonExchangeHandler", protocolDiamondAddress); + const fundsHandler = await getContractAt("IBosonFundsHandler", protocolDiamondAddress); + const groupHandler = await getContractAt("IBosonGroupHandler", protocolDiamondAddress); + const offerHandler = await getContractAt("IBosonOfferHandler", protocolDiamondAddress); + const orchestrationHandler = await getContractAt("IBosonOrchestrationHandler", protocolDiamondAddress); + const twinHandler = await getContractAt("IBosonTwinHandler", protocolDiamondAddress); + const pauseHandler = await getContractAt("IBosonPauseHandler", protocolDiamondAddress); + const metaTransactionsHandler = await getContractAt("IBosonMetaTransactionsHandler", protocolDiamondAddress); + const configHandler = await getContractAt("IBosonConfigHandler", protocolDiamondAddress); + const ERC165Facet = await getContractAt("ERC165Facet", protocolDiamondAddress); + const protocolInitializationHandler = await getContractAt( "IBosonProtocolInitializationHandler", protocolDiamondAddress ); @@ -223,7 +223,7 @@ async function upgradeSuite(protocolDiamondAddress, upgradedInterfaces, override // Cast to updated interface let newHandlers = {}; for (const [handlerName, interfaceName] of Object.entries(upgradedInterfaces)) { - newHandlers[handlerName] = await ethers.getContractAt(interfaceName, protocolDiamondAddress); + newHandlers[handlerName] = await getContractAt(interfaceName, protocolDiamondAddress); } return newHandlers; @@ -242,7 +242,7 @@ async function upgradeClients() { await hre.run("compile"); // Mock forwarder to test metatx - const MockForwarder = await ethers.getContractFactory("MockForwarder"); + const MockForwarder = await getContractFactory("MockForwarder"); const forwarder = await MockForwarder.deploy(); @@ -328,13 +328,13 @@ async function populateProtocolContract( let voucherIndex = 1; for (const entity of entities) { - const wallet = ethers.Wallet.createRandom(); - const connectedWallet = wallet.connect(ethers.provider); + const wallet = Wallet.createRandom(); + const connectedWallet = wallet.connect(provider); //Fund the new wallet let tx = { to: connectedWallet.address, // Convert currency unit from ether to wei - value: ethers.utils.parseEther("10"), + value: parseEther("10"), }; await deployer.sendTransaction(tx); @@ -343,7 +343,7 @@ async function populateProtocolContract( case entityType.DR: { const clerkAddress = versionsWithClerkRole.includes(isBefore ? versionTags.oldVersion : versionTags.newVersion) ? wallet.address - : ethers.constants.AddressZero; + : ZeroAddress; const disputeResolver = mockDisputeResolver( wallet.address, wallet.address, @@ -353,7 +353,7 @@ async function populateProtocolContract( true ); const disputeResolverFees = [ - new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0"), + new DisputeResolverFee(ZeroAddress, "Native", "0"), new DisputeResolverFee(mockToken.address, "MockToken", "0"), ]; const sellerAllowList = []; @@ -380,7 +380,7 @@ async function populateProtocolContract( case entityType.SELLER: { const clerkAddress = versionsWithClerkRole.includes(isBefore ? versionTags.oldVersion : versionTags.newVersion) ? wallet.address - : ethers.constants.AddressZero; + : ZeroAddress; const seller = mockSeller(wallet.address, wallet.address, clerkAddress, wallet.address, true); const id = (seller.id = nextAccountId.toString()); @@ -392,7 +392,7 @@ async function populateProtocolContract( authToken = mockAuthToken(); } else { // use auth token - seller.admin = ethers.constants.AddressZero; + seller.admin = ZeroAddress; await mockAuthERC721Contract.connect(connectedWallet).mint(101 * id, 1); authToken = new AuthToken(`${101 * id}`, AuthTokenType.Lens); } @@ -470,11 +470,11 @@ async function populateProtocolContract( // Set unique offer dates based on offer id const now = offerDates.validFrom; - offerDates.validFrom = ethers.BigNumber.from(now) - .add(oneMonth + offerId * 1000) + offerDates.validFrom = BigInt(now) + +oneMonth + offerId * 1000 .toString(); - offerDates.validUntil = ethers.BigNumber.from(now) - .add(oneMonth * 6 * (offerId + 1)) + offerDates.validUntil = BigInt(now) + +oneMonth * 6 * (offerId + 1) .toString(); // Set unique offerDurations based on offer id @@ -495,8 +495,8 @@ async function populateProtocolContract( sellers[j].offerIds.push(offerId); // Deposit seller funds so the commit will succeed - const sellerPool = ethers.BigNumber.from(offer.quantityAvailable).mul(offer.price).toString(); - const msgValue = offer.exchangeToken == ethers.constants.AddressZero ? sellerPool : "0"; + const sellerPool = BigInt(offer.quantityAvailable)*offer.price.toString(); + const msgValue = offer.exchangeToken == ZeroAddress ? sellerPool : "0"; await fundsHandler .connect(sellers[j].wallet) .depositFunds(sellers[j].seller.id, offer.exchangeToken, sellerPool, { value: msgValue }); @@ -534,7 +534,7 @@ async function populateProtocolContract( await mockTwinTokens[1].connect(seller.wallet).setApprovalForAll(protocolDiamondAddress, true); // create multiple ranges - const twin721 = mockTwin(ethers.constants.AddressZero, TokenType.NonFungibleToken); + const twin721 = mockTwin(ZeroAddress, TokenType.NonFungibleToken); twin721.amount = "0"; // min supply available for twin721 is the total amount to cover all offers bundled @@ -610,7 +610,7 @@ async function populateProtocolContract( const offerPrice = offer.price; const buyerWallet = buyers[j].wallet; let msgValue; - if (offer.exchangeToken == ethers.constants.AddressZero) { + if (offer.exchangeToken == ZeroAddress) { msgValue = offerPrice; } else { // approve token transfer @@ -669,7 +669,7 @@ async function getProtocolContractState( { mockToken, mockTwinTokens }, { DRs, sellers, buyers, agents, offers, exchanges, bundles, groups, twins } ) { - rando = (await ethers.getSigners())[10]; // random account making the calls + rando = (await getSigners())[10]; // random account making the calls const [ accountContractState, @@ -1033,18 +1033,18 @@ async function getMetaTxPrivateContractState(protocolDiamondAddress) { */ // starting slot - const metaTxStorageSlot = keccak256(ethers.utils.toUtf8Bytes("boson.protocol.metaTransactions")); - const metaTxStorageSlotNumber = ethers.BigNumber.from(metaTxStorageSlot); + const metaTxStorageSlot = keccak256(toUtf8Bytes("boson.protocol.metaTransactions")); + const metaTxStorageSlotNumber = BigInt(metaTxStorageSlot); // current sender address + isMetaTransaction (they are packed since they are shorter than one slot) // should be always be 0x - const inTransactionInfo = await getStorageAt(protocolDiamondAddress, metaTxStorageSlotNumber.add("0")); + const inTransactionInfo = await getStorageAt(protocolDiamondAddress, metaTxStorageSlotNumber+"0"); // domain separator - const domainSeparator = await getStorageAt(protocolDiamondAddress, metaTxStorageSlotNumber.add("1")); + const domainSeparator = await getStorageAt(protocolDiamondAddress, metaTxStorageSlotNumber+"1"); // cached chain id - const cachedChainId = await getStorageAt(protocolDiamondAddress, metaTxStorageSlotNumber.add("3")); + const cachedChainId = await getStorageAt(protocolDiamondAddress, metaTxStorageSlotNumber+"3"); // input type const inputTypeKeys = [ @@ -1061,7 +1061,7 @@ async function getMetaTxPrivateContractState(protocolDiamondAddress) { const inputTypesState = []; for (const inputTypeKey of inputTypeKeys) { - const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber.add("4"), inputTypeKey, paddingType.NONE); + const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber+"4", inputTypeKey, paddingType.NONE); inputTypesState.push(await getStorageAt(protocolDiamondAddress, storageSlot)); } @@ -1077,11 +1077,11 @@ async function getMetaTxPrivateContractState(protocolDiamondAddress) { const hashInfoState = []; for (const hashInfoType of Object.values(hashInfoTypes)) { - const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber.add("5"), hashInfoType, paddingType.START); + const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber+"5", hashInfoType, paddingType.START); // get also hashFunction hashInfoState.push({ typeHash: await getStorageAt(protocolDiamondAddress, storageSlot), - functionPointer: await getStorageAt(protocolDiamondAddress, ethers.BigNumber.from(storageSlot).add(1)), + functionPointer: await getStorageAt(protocolDiamondAddress, BigInt(storageSlot)+1), }); } const isAllowlistedState = {}; @@ -1108,7 +1108,7 @@ async function getMetaTxPrivateContractState(protocolDiamondAddress) { const selectors = await getMetaTransactionsHandlerFacetInitArgs(facets); for (const selector of Object.values(selectors)) { - const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber.add("6"), selector, paddingType.START); + const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber+"6", selector, paddingType.START); isAllowlistedState[selector] = await getStorageAt(protocolDiamondAddress, storageSlot); } @@ -1127,15 +1127,15 @@ async function getProtocolStatusPrivateContractState(protocolDiamondAddress) { */ // starting slot - const protocolStatusStorageSlot = keccak256(ethers.utils.toUtf8Bytes("boson.protocol.initializers")); - const protocolStatusStorageSlotNumber = ethers.BigNumber.from(protocolStatusStorageSlot); + const protocolStatusStorageSlot = keccak256(toUtf8Bytes("boson.protocol.initializers")); + const protocolStatusStorageSlotNumber = BigInt(protocolStatusStorageSlot); // pause scenario - const pauseScenario = await getStorageAt(protocolDiamondAddress, protocolStatusStorageSlotNumber.add("0")); + const pauseScenario = await getStorageAt(protocolDiamondAddress, protocolStatusStorageSlotNumber+"0"); // reentrancy status // default: NOT_ENTERED = 1 - const reentrancyStatus = await getStorageAt(protocolDiamondAddress, protocolStatusStorageSlotNumber.add("1")); + const reentrancyStatus = await getStorageAt(protocolDiamondAddress, protocolStatusStorageSlotNumber+"1"); // initializedInterfaces if (!preUpgradeInterfaceIds) { @@ -1146,7 +1146,7 @@ async function getProtocolStatusPrivateContractState(protocolDiamondAddress) { const initializedInterfacesState = []; for (const interfaceId of Object.values(preUpgradeInterfaceIds)) { const storageSlot = getMappingStoragePosition( - protocolStatusStorageSlotNumber.add("2"), + protocolStatusStorageSlotNumber+"2", interfaceId, paddingType.END ); @@ -1159,7 +1159,7 @@ async function getProtocolStatusPrivateContractState(protocolDiamondAddress) { const initializedVersionsState = []; for (const version of preUpgradeVersions) { - const storageSlot = getMappingStoragePosition(protocolStatusStorageSlotNumber.add("3"), version, paddingType.END); + const storageSlot = getMappingStoragePosition(protocolStatusStorageSlotNumber+"3", version, paddingType.END); initializedVersionsState.push(await getStorageAt(protocolDiamondAddress, storageSlot)); } @@ -1210,8 +1210,8 @@ async function getProtocolLookupsPrivateContractState( */ // starting slot - const protocolLookupsSlot = keccak256(ethers.utils.toUtf8Bytes("boson.protocol.lookups")); - const protocolLookupsSlotNumber = ethers.BigNumber.from(protocolLookupsSlot); + const protocolLookupsSlot = keccak256(toUtf8Bytes("boson.protocol.lookups")); + const protocolLookupsSlotNumber = BigInt(protocolLookupsSlot); // exchangeIdsByOffer and groupIdByOffer let exchangeIdsByOfferState = []; @@ -1220,13 +1220,13 @@ async function getProtocolLookupsPrivateContractState( const id = Number(offer.offer.id); // exchangeIdsByOffer let exchangeIdsByOffer = []; - const arraySlot = ethers.BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber.add("0"), id, paddingType.START) + const arraySlot = BigNumber.from( + getMappingStoragePosition(protocolLookupsSlotNumber+"0", id, paddingType.START) ); - const arrayLength = ethers.BigNumber.from(await getStorageAt(protocolDiamondAddress, arraySlot)).toNumber(); - const arrayStart = ethers.BigNumber.from(keccak256(arraySlot)); + const arrayLength = BigInt(await getStorageAt(protocolDiamondAddress, arraySlot)).toNumber(); + const arrayStart = BigInt(keccak256(arraySlot)); for (let i = 0; i < arrayLength; i++) { - exchangeIdsByOffer.push(await getStorageAt(protocolDiamondAddress, arrayStart.add(i))); + exchangeIdsByOffer.push(await getStorageAt(protocolDiamondAddress, arrayStart+i)); } exchangeIdsByOfferState.push(exchangeIdsByOffer); @@ -1234,7 +1234,7 @@ async function getProtocolLookupsPrivateContractState( groupIdByOfferState.push( await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(protocolLookupsSlotNumber.add("3"), id, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber+"3", id, paddingType.START) ) ); } @@ -1253,7 +1253,7 @@ async function getProtocolLookupsPrivateContractState( buyerIdByWallet.push( await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(protocolLookupsSlotNumber.add("8"), accountAddress, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber+"8", accountAddress, paddingType.START) ) ); @@ -1261,13 +1261,13 @@ async function getProtocolLookupsPrivateContractState( agentIdByWallet.push( await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(protocolLookupsSlotNumber.add("13"), accountAddress, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber+"13", accountAddress, paddingType.START) ) ); // conditionalCommitsByAddress - const firstMappingStorageSlot = ethers.BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber.add("19"), accountAddress, paddingType.START) + const firstMappingStorageSlot = BigNumber.from( + getMappingStoragePosition(protocolLookupsSlotNumber+"19", accountAddress, paddingType.START) ); let commitsPerGroup = []; for (const group of groups) { @@ -1294,13 +1294,13 @@ async function getProtocolLookupsPrivateContractState( // loop over all ids even where no data is expected for (const id of accountIds) { // disputeResolverFeeTokenIndex - let firstMappingStorageSlot = ethers.BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber.add("12"), id, paddingType.START) + let firstMappingStorageSlot = BigNumber.from( + getMappingStoragePosition(protocolLookupsSlotNumber+"12", id, paddingType.START) ); disputeResolverFeeTokenIndex.push({ native: await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(firstMappingStorageSlot, ethers.constants.AddressZero, paddingType.START) + getMappingStoragePosition(firstMappingStorageSlot, ZeroAddress, paddingType.START) ), mockToken: await getStorageAt( protocolDiamondAddress, @@ -1309,13 +1309,13 @@ async function getProtocolLookupsPrivateContractState( }); // tokenIndexByAccount - firstMappingStorageSlot = ethers.BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber.add("16"), id, paddingType.START) + firstMappingStorageSlot = BigNumber.from( + getMappingStoragePosition(protocolLookupsSlotNumber+"16", id, paddingType.START) ); tokenIndexByAccount.push({ native: await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(firstMappingStorageSlot, ethers.constants.AddressZero, paddingType.START) + getMappingStoragePosition(firstMappingStorageSlot, ZeroAddress, paddingType.START) ), mockToken: await getStorageAt( protocolDiamondAddress, @@ -1327,7 +1327,7 @@ async function getProtocolLookupsPrivateContractState( cloneAddress.push( await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(protocolLookupsSlotNumber.add("17"), id, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber+"17", id, paddingType.START) ) ); @@ -1335,7 +1335,7 @@ async function getProtocolLookupsPrivateContractState( voucherCount.push( await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(protocolLookupsSlotNumber.add("18"), id, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber+"18", id, paddingType.START) ) ); } @@ -1343,20 +1343,20 @@ async function getProtocolLookupsPrivateContractState( // twinRangesBySeller let twinRangesBySeller = []; for (const id of accountIds) { - const firstMappingStorageSlot = ethers.BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber.add("22"), id, paddingType.START) + const firstMappingStorageSlot = BigNumber.from( + getMappingStoragePosition(protocolLookupsSlotNumber+"22", id, paddingType.START) ); let ranges = {}; for (let mockTwin of mockTwinTokens) { ranges[mockTwin.address] = []; const arraySlot = getMappingStoragePosition(firstMappingStorageSlot, mockTwin.address, paddingType.START); - const arrayLength = ethers.BigNumber.from(await getStorageAt(protocolDiamondAddress, arraySlot)).toNumber(); - const arrayStart = ethers.BigNumber.from(keccak256(arraySlot)); + const arrayLength = BigInt(await getStorageAt(protocolDiamondAddress, arraySlot)).toNumber(); + const arrayStart = BigInt(keccak256(arraySlot)); for (let i = 0; i < arrayLength * 2; i = i + 2) { // each BosonTypes.TokenRange has length 2 ranges[mockTwin.address].push({ - start: await getStorageAt(protocolDiamondAddress, arrayStart.add(i)), - end: await getStorageAt(protocolDiamondAddress, arrayStart.add(i + 1)), + start: await getStorageAt(protocolDiamondAddress, arrayStart+i), + end: await getStorageAt(protocolDiamondAddress, arrayStart+i + 1), }); } } @@ -1366,17 +1366,17 @@ async function getProtocolLookupsPrivateContractState( // twinIdsByTokenAddressAndBySeller let twinIdsByTokenAddressAndBySeller = []; for (const id of accountIds) { - const firstMappingStorageSlot = ethers.BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber.add("23"), id, paddingType.START) + const firstMappingStorageSlot = BigNumber.from( + getMappingStoragePosition(protocolLookupsSlotNumber+"23", id, paddingType.START) ); let twinIds = {}; for (let mockTwin of mockTwinTokens) { twinIds[mockTwin.address] = []; const arraySlot = getMappingStoragePosition(firstMappingStorageSlot, mockTwin.address, paddingType.START); - const arrayLength = ethers.BigNumber.from(await getStorageAt(protocolDiamondAddress, arraySlot)).toNumber(); - const arrayStart = ethers.BigNumber.from(keccak256(arraySlot)); + const arrayLength = BigInt(await getStorageAt(protocolDiamondAddress, arraySlot)).toNumber(); + const arrayStart = BigInt(keccak256(arraySlot)); for (let i = 0; i < arrayLength; i++) { - twinIds[mockTwin.address].push(await getStorageAt(protocolDiamondAddress, arrayStart.add(i))); + twinIds[mockTwin.address].push(await getStorageAt(protocolDiamondAddress, arrayStart+i)); } } twinIdsByTokenAddressAndBySeller.push(twinIds); @@ -1385,10 +1385,10 @@ async function getProtocolLookupsPrivateContractState( // allowedSellerIndex let allowedSellerIndex = []; for (const DR of DRs) { - const firstMappingStorageSlot = ethers.BigNumber.from( + const firstMappingStorageSlot = BigNumber.from( getMappingStoragePosition( - protocolLookupsSlotNumber.add("26"), - ethers.BigNumber.from(DR.disputeResolver.id).toHexString(), + protocolLookupsSlotNumber+"26", + BigInt(DR.disputeResolver.id).toHexString(), paddingType.START ) ); @@ -1399,7 +1399,7 @@ async function getProtocolLookupsPrivateContractState( protocolDiamondAddress, getMappingStoragePosition( firstMappingStorageSlot, - ethers.BigNumber.from(seller.seller.id).toHexString(), + BigInt(seller.seller.id).toHexString(), paddingType.START ) ) @@ -1412,8 +1412,8 @@ async function getProtocolLookupsPrivateContractState( let offerIdIndexByGroup = []; for (const group of groups) { const id = group.id; - const firstMappingStorageSlot = ethers.BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber.add("28"), id, paddingType.START) + const firstMappingStorageSlot = BigNumber.from( + getMappingStoragePosition(protocolLookupsSlotNumber+"28", id, paddingType.START) ); let offerInidices = []; for (const offer of offers) { @@ -1436,37 +1436,37 @@ async function getProtocolLookupsPrivateContractState( // Although pending address/auth token update is not yet defined in 2.0.0, we can check that storage slots are empty for (const id of accountIds) { // pendingAddressUpdatesBySeller - let structStorageSlot = ethers.BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber.add("29"), id, paddingType.START) + let structStorageSlot = BigNumber.from( + getMappingStoragePosition(protocolLookupsSlotNumber+"29", id, paddingType.START) ); let structFields = []; for (let i = 0; i < 5; i++) { // BosonTypes.Seller has 6 fields, but last bool is packed in one slot with previous field - structFields.push(await getStorageAt(protocolDiamondAddress, structStorageSlot.add(i))); + structFields.push(await getStorageAt(protocolDiamondAddress, structStorageSlot+i)); } pendingAddressUpdatesBySeller.push(structFields); // pendingAuthTokenUpdatesBySeller - structStorageSlot = ethers.BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber.add("30"), id, paddingType.START) + structStorageSlot = BigNumber.from( + getMappingStoragePosition(protocolLookupsSlotNumber+"30", id, paddingType.START) ); structFields = []; for (let i = 0; i < 2; i++) { // BosonTypes.AuthToken has 2 fields - structFields.push(await getStorageAt(protocolDiamondAddress, structStorageSlot.add(i))); + structFields.push(await getStorageAt(protocolDiamondAddress, structStorageSlot+i)); } pendingAuthTokenUpdatesBySeller.push(structFields); // pendingAddressUpdatesByDisputeResolver - structStorageSlot = ethers.BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber.add("31"), id, paddingType.START) + structStorageSlot = BigNumber.from( + getMappingStoragePosition(protocolLookupsSlotNumber+"31", id, paddingType.START) ); structFields = []; for (let i = 0; i < 8; i++) { // BosonTypes.DisputeResolver has 8 fields - structFields.push(await getStorageAt(protocolDiamondAddress, structStorageSlot.add(i))); + structFields.push(await getStorageAt(protocolDiamondAddress, structStorageSlot+i)); } - structFields[6] = await getStorageAt(protocolDiamondAddress, keccak256(structStorageSlot.add(6))); // represents field string metadataUri. Technically this value represents the length of the string, but since it should be 0, we don't do further decoding + structFields[6] = await getStorageAt(protocolDiamondAddress, keccak256(structStorageSlot+6)); // represents field string metadataUri. Technically this value represents the length of the string, but since it should be 0, we don't do further decoding pendingAddressUpdatesByDisputeResolver.push(structFields); } @@ -1571,13 +1571,13 @@ async function populateVoucherContract( let nextAccountId = await accountHandler.getNextAccountId(); for (const entity of entities) { - const wallet = ethers.Wallet.createRandom(); - const connectedWallet = wallet.connect(ethers.provider); + const wallet = Wallet.createRandom(); + const connectedWallet = wallet.connect(provider); //Fund the new wallet let tx = { to: connectedWallet.address, // Convert currency unit from ether to wei - value: ethers.utils.parseEther("10"), + value: parseEther("10"), }; await deployer.sendTransaction(tx); @@ -1593,7 +1593,7 @@ async function populateVoucherContract( true ); const disputeResolverFees = [ - new DisputeResolverFee(ethers.constants.AddressZero, "Native", "0"), + new DisputeResolverFee(ZeroAddress, "Native", "0"), new DisputeResolverFee(mockToken.address, "MockToken", "0"), ]; const sellerAllowList = []; @@ -1630,7 +1630,7 @@ async function populateVoucherContract( // calculate voucher contract address and cast it to contract instance const voucherContractAddress = calculateContractAddress(accountHandler.address, voucherIndex++); - const bosonVoucher = await ethers.getContractAt("BosonVoucher", voucherContractAddress); + const bosonVoucher = await getContractAt("BosonVoucher", voucherContractAddress); sellers.push({ wallet: connectedWallet, @@ -1683,11 +1683,11 @@ async function populateVoucherContract( // Set unique offer dates based on offer id const now = offerDates.validFrom; - offerDates.validFrom = ethers.BigNumber.from(now) - .add(oneMonth + offerId * 1000) + offerDates.validFrom = BigInt(now) + +oneMonth + offerId * 1000 .toString(); - offerDates.validUntil = ethers.BigNumber.from(now) - .add(oneMonth * 6 * (offerId + 1)) + offerDates.validUntil = BigInt(now) + +oneMonth * 6 * (offerId + 1) .toString(); // Set unique offerDurations based on offer id @@ -1708,8 +1708,8 @@ async function populateVoucherContract( sellers[j].offerIds.push(offerId); // Deposit seller funds so the commit will succeed - const sellerPool = ethers.BigNumber.from(offer.quantityAvailable).mul(offer.price).toString(); - const msgValue = offer.exchangeToken == ethers.constants.AddressZero ? sellerPool : "0"; + const sellerPool = BigInt(offer.quantityAvailable)*offer.price.toString(); + const msgValue = offer.exchangeToken == ZeroAddress ? sellerPool : "0"; await fundsHandler .connect(sellers[j].wallet) .depositFunds(sellers[j].seller.id, offer.exchangeToken, sellerPool, { value: msgValue }); @@ -1727,7 +1727,7 @@ async function populateVoucherContract( const offerPrice = offer.price; const buyerWallet = buyers[j].wallet; let msgValue; - if (offer.exchangeToken == ethers.constants.AddressZero) { + if (offer.exchangeToken == ZeroAddress) { msgValue = offerPrice; } else { // approve token transfer diff --git a/test/util/utils.js b/test/util/utils.js index 0447b5562..5797baebf 100644 --- a/test/util/utils.js +++ b/test/util/utils.js @@ -1,7 +1,6 @@ const { ethers } = require("hardhat"); -const { utils, provider, BigNumber } = ethers; +const { utils, provider, BigNumber, keccak256, RLP } = ethers; const { getFacets } = require("../../scripts/config/facet-deploy.js"); -const { keccak256, RLP } = utils; const { oneWeek, oneMonth, maxPriorityFeePerGas } = require("./constants"); const Role = require("../../scripts/domain/Role"); const { expect } = require("chai"); @@ -175,7 +174,7 @@ async function prepareDataSignatureParameters( if (type == "Protocol") { //hardhat default chain id is 31337 - domainData.salt = utils.hexZeroPad(BigNumber.from(31337).toHexString(), 32); + domainData.salt = utils.hexZeroPad(BigInt(31337).toHexString(), 32); } else { const { chainId } = await provider.getNetwork(); domainData.chainId = chainId; @@ -210,18 +209,18 @@ async function prepareDataSignatureParameters( } function calculateVoucherExpiry(block, voucherRedeemableFromDate, voucherValidDuration) { - const startDate = BigNumber.from(block.timestamp).gte(BigNumber.from(voucherRedeemableFromDate)) - ? BigNumber.from(block.timestamp) - : BigNumber.from(voucherRedeemableFromDate); - return startDate.add(BigNumber.from(voucherValidDuration)).toString(); + const startDate = BigInt(block.timestamp)>BigInt(voucherRedeemableFromDate) + ? BigInt(block.timestamp) + : BigInt(voucherRedeemableFromDate); + return startDate+BigInt(voucherValidDuration).toString(); } function applyPercentage(base, percentage) { - return BigNumber.from(base).mul(percentage).div("10000").toString(); +return BigInt(base)*BigInt(percentage)/BigInt(10000); } function calculateContractAddress(senderAddress, senderNonce) { - const nonce = BigNumber.from(senderNonce); + const nonce = BigInt(senderNonce); const nonceHex = nonce.eq(0) ? "0x" : nonce.toHexString(); const input_arr = [senderAddress, nonceHex]; @@ -315,7 +314,7 @@ async function setupTestEnvironment(contracts, { bosonTokenAddress, forwarderAdd "MetaTransactionsHandlerFacet", ]; - const signers = await ethers.getSigners(); + const signers = await getSigners(); const [deployer, protocolTreasury, bosonToken, pauser] = signers; // Deploy the Protocol Diamond @@ -344,7 +343,7 @@ async function setupTestEnvironment(contracts, { bosonTokenAddress, forwarderAdd // set protocolFees const protocolFeePercentage = "200"; // 2 % - const protocolFeeFlatBoson = ethers.utils.parseUnits("0.01", "ether").toString(); + const protocolFeeFlatBoson = parseUnits("0.01", "ether").toString(); const buyerEscalationDepositPercentage = "1000"; // 10% // Add config Handler, so ids start at 1, and so voucher address can be found @@ -389,7 +388,7 @@ async function setupTestEnvironment(contracts, { bosonTokenAddress, forwarderAdd let contractInstances = {}; for (const contract of Object.keys(contracts)) { - contractInstances[contract] = await ethers.getContractAt(contracts[contract], protocolDiamond.address); + contractInstances[contract] = await getContractAt(contracts[contract], protocolDiamond.address); } const extraReturnValues = { accessController, bosonVoucher, voucherImplementation, beacon }; @@ -404,15 +403,15 @@ async function setupTestEnvironment(contracts, { bosonTokenAddress, forwarderAdd } async function getSnapshot() { - return await ethers.provider.send("evm_snapshot", []); + return await provider.send("evm_snapshot", []); } async function revertToSnapshot(snapshotId) { - return await ethers.provider.send("evm_revert", [snapshotId]); + return await provider.send("evm_revert", [snapshotId]); } function deriveTokenId(offerId, exchangeId) { - return ethers.BigNumber.from(offerId).shl(128).add(exchangeId); + return BigInt(offerId).shl(128)+exchangeId; } exports.setNextBlockTimestamp = setNextBlockTimestamp; From 195a1abee347afedbefd378b4ef03cfc285b3f0d Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Thu, 15 Jun 2023 17:18:34 -0300 Subject: [PATCH 04/32] Remediate BigNumbers and contracts functions --- scripts/util/deploy-protocol-diamond.js | 14 +++++++------- scripts/util/diamond-utils.js | 22 +++++++++++++--------- scripts/util/utils.js | 4 ++-- scripts/util/validations.js | 2 -- test/protocol/BundleHandlerTest.js | 9 +++++---- test/util/utils.js | 2 +- 6 files changed, 28 insertions(+), 25 deletions(-) diff --git a/scripts/util/deploy-protocol-diamond.js b/scripts/util/deploy-protocol-diamond.js index 35cc88a43..1b1b1b4b8 100644 --- a/scripts/util/deploy-protocol-diamond.js +++ b/scripts/util/deploy-protocol-diamond.js @@ -1,7 +1,7 @@ const { getFacetAddCut } = require("./diamond-utils.js"); const { getInterfaceIds } = require("../config/supported-interfaces.js"); const hre = require("hardhat"); -const ethers = hre.ethers; +const { getContractFactory, provider } = hre.ethers; const environments = require("../../environments"); const confirmations = hre.network.name === "hardhat" ? 1 : environments.confirmations; const { getFees } = require("./utils"); @@ -29,26 +29,26 @@ async function deployProtocolDiamond(maxPriorityFeePerGas) { // Deploy the AccessController contract const AccessController = await getContractFactory("AccessController"); const accessController = await AccessController.deploy(await getFees(maxPriorityFeePerGas)); - await accessController.deployTransaction.wait(confirmations); + await accessController.deploymentTransaction().wait(confirmations); // Diamond Loupe Facet const DiamondLoupeFacet = await getContractFactory("DiamondLoupeFacet"); const dlf = await DiamondLoupeFacet.deploy(await getFees(maxPriorityFeePerGas)); - await dlf.deployTransaction.wait(confirmations); + await dlf.deploymentTransaction().wait(confirmations); // Diamond Cut Facet const DiamondCutFacet = await getContractFactory("DiamondCutFacet"); const dcf = await DiamondCutFacet.deploy(await getFees(maxPriorityFeePerGas)); - await dcf.deployTransaction.wait(confirmations); + await dcf.deploymentTransaction().wait(confirmations); // ERC165 Facet const ERC165Facet = await getContractFactory("ERC165Facet"); const erc165f = await ERC165Facet.deploy(await getFees(maxPriorityFeePerGas)); - await erc165f.deployTransaction.wait(confirmations); + await erc165f.deploymentTransaction().wait(confirmations); // Arguments for Diamond constructor const diamondArgs = [ - accessController.address, + accessController.getAddress(), [getFacetAddCut(dlf), getFacetAddCut(dcf), getFacetAddCut(erc165f)], interfaces, ]; @@ -56,7 +56,7 @@ async function deployProtocolDiamond(maxPriorityFeePerGas) { // Deploy Protocol Diamond const ProtocolDiamond = await getContractFactory("ProtocolDiamond"); const protocolDiamond = await ProtocolDiamond.deploy(...diamondArgs, await getFees(maxPriorityFeePerGas)); - await protocolDiamond.deployTransaction.wait(confirmations); + await protocolDiamond.deploymentTransaction().wait(confirmations); return [protocolDiamond, dlf, dcf, erc165f, accessController, diamondArgs]; } diff --git a/scripts/util/diamond-utils.js b/scripts/util/diamond-utils.js index a85765e84..2f9f64d49 100644 --- a/scripts/util/diamond-utils.js +++ b/scripts/util/diamond-utils.js @@ -1,10 +1,14 @@ const hre = require("hardhat"); +const { keccak256, toUtf8Bytes, getContractAt, ZeroAddress } = hre.ethers;; const environments = "../../environments.js"; const confirmations = hre.network.name === "hardhat" ? 1 : environments.confirmations; const FacetCutAction = require("../domain/FacetCutAction"); const { interfacesWithMultipleArtifacts } = require("./constants"); const { getFees } = require("./utils"); -const { keccak256, toUtf8Bytes } = hre.ethers;; + +function removeNativeFunctions(interface) { + return Object.keys(interface).filter(key => !["deploy", "fragments", "fallback", "receive"].includes(key)); +} /** * Utilities for testing and interacting with Diamond @@ -13,7 +17,7 @@ const { keccak256, toUtf8Bytes } = hre.ethers;; */ // get function selectors from ABI function getSelectors(contract, returnSignatureToNameMapping = false) { - const signatures = Object.keys(contract.interface.functions); + const signatures =removeNativeFunctions(contract.interface); let signatureToNameMapping = {}; const selectors = signatures.reduce((acc, val) => { if (val !== "init(bytes)") { @@ -32,14 +36,14 @@ function getSelectors(contract, returnSignatureToNameMapping = false) { // get interface id async function getInterfaceId(contractName, skipBaseCheck = false, isFullPath = false) { - const contract = await getContractAt(contractName, ZeroAddress); - const signatures = Object.keys(contract.interface.functions); + const contract = await getContractAt(contractName, ZeroAddress); + const signatures = removeNativeFunctions(contract.interface); const selectors = signatures.reduce((acc, val) => { - acc.push(BigInt(contract.interface.getSighash(val))); + acc.push(BigInt(contract[val].getSighash())); return acc; }, []); - let interfaceId = selectors.reduce((pv, cv) => pv.xor(cv), BigInt("0x00000000")); + let interfaceId = selectors.reduce((pv, cv) => pv ^ cv, BigInt(0x00000000)); // If contract inherits other contracts, their interfaces must be xor-ed if (!skipBaseCheck) { @@ -61,7 +65,7 @@ async function getInterfaceId(contractName, skipBaseCheck = false, isFullPath = isFullPath = interfacesWithMultipleArtifacts.includes(baseName); - const baseContractInterfaceId = BigNumber.from( + const baseContractInterfaceId = BigInt( await getInterfaceId( interfacesWithMultipleArtifacts.includes(baseName) ? `contracts/interfaces/${baseName}.sol:${baseName}` @@ -72,10 +76,10 @@ async function getInterfaceId(contractName, skipBaseCheck = false, isFullPath = ); // Remove interface id of base contracts - interfaceId = interfaceId.xor(baseContractInterfaceId); + interfaceId = interfaceId ^baseContractInterfaceId; } } - return interfaceId.isZero() ? "0x00000000" : hexZeroPad(interfaceId.toHexString(), 4); + return interfaceId == 0n ? "0x00000000" : hexZeroPad(interfaceId.toHexString(), 4); } // get function selector from function signature diff --git a/scripts/util/utils.js b/scripts/util/utils.js index d22d2ef7e..54504958e 100644 --- a/scripts/util/utils.js +++ b/scripts/util/utils.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { provider } = hre.ethers; const fs = require("fs"); const addressesDirPath = __dirname + `/../../addresses`; @@ -63,7 +63,7 @@ async function getMaxFeePerGas(maxPriorityFeePerGas) { async function getFees() { // maxPriorityFeePerGas TODO add back as an argument when js supports 1559 on polygon const { gasPrice } = await provider.getFeeData(); - const newGasPrice = gasPrice.mul(BigInt("2")); + const newGasPrice = gasPrice * BigInt("2"); // return { maxPriorityFeePerGas, maxFeePerGas: await getMaxFeePerGas(maxPriorityFeePerGas) }; // TODO use when js supports 1559 on polygon return { gasPrice: newGasPrice }; } diff --git a/scripts/util/validations.js b/scripts/util/validations.js index ccee6799d..8fc5f2ab4 100644 --- a/scripts/util/validations.js +++ b/scripts/util/validations.js @@ -17,8 +17,6 @@ function bigNumberIsValid(bigNumber, { optional, gt, lte, empty } = {}) { if (optional && (bigNumber == undefined || bigNumber == null)) { valid = true; - } else if (typeof bigNumber !== "string") { - valid = false; } else if (empty && bigNumber === "") { valid = true; } else { diff --git a/test/protocol/BundleHandlerTest.js b/test/protocol/BundleHandlerTest.js index f894cb069..41934a893 100644 --- a/test/protocol/BundleHandlerTest.js +++ b/test/protocol/BundleHandlerTest.js @@ -1,4 +1,5 @@ const { ethers } = require("hardhat"); +const { MaxUnit256, getContractAt } = ethers; const { expect, assert } = require("chai"); const Bundle = require("../../scripts/domain/Bundle"); @@ -294,7 +295,7 @@ describe("IBosonBundleHandler", function () { it("If sum of offers' quantities is more than maxUint256, total quantity is maxUint256", async function () { // create two offers with close to unlimited supply const newOffer = offer.clone(); - newOffer.quantityAvailable = constants.MaxUint256/10*9.toString(); + newOffer.quantityAvailable = MaxUint256/10*9; const newOffer2 = newOffer.clone(); const newOfferId = "6"; const newOfferId2 = "7"; @@ -309,7 +310,7 @@ describe("IBosonBundleHandler", function () { // create a twin with almost unlimited supply twin = mockTwin(bosonToken.address); - twin.supplyAvailable = constants.MaxUint256-1.toString(); + twin.supplyAvailable = MaxUint256-1; expect(twin.isValid()).is.true; // Approving the twinHandler contract to transfer seller's tokens @@ -326,7 +327,7 @@ describe("IBosonBundleHandler", function () { // create a twin with unlimited supply twin = mockTwin(bosonToken.address); - twin.supplyAvailable = constants.MaxUint256.toString(); + twin.supplyAvailable = MaxUint256; expect(twin.isValid()).is.true; // Approving the twinHandler contract to transfer seller's tokens @@ -564,7 +565,7 @@ describe("IBosonBundleHandler", function () { it("Offers quantity is unlimited but twin supply is not", async function () { const newOffer = offer.clone(); - newOffer.quantityAvailable = constants.MaxUint256.toString(); + newOffer.quantityAvailable = MaxUint256; let expectedNewOfferId = "6"; await offerHandler diff --git a/test/util/utils.js b/test/util/utils.js index 5797baebf..d8f19fbd6 100644 --- a/test/util/utils.js +++ b/test/util/utils.js @@ -1,5 +1,5 @@ const { ethers } = require("hardhat"); -const { utils, provider, BigNumber, keccak256, RLP } = ethers; +const { utils, provider, BigNumber, keccak256, RLP, getSigners } = ethers; const { getFacets } = require("../../scripts/config/facet-deploy.js"); const { oneWeek, oneMonth, maxPriorityFeePerGas } = require("./constants"); const Role = require("../../scripts/domain/Role"); From 03b1fbe77153edfabbec31a7a7dc87813822985f Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Fri, 16 Jun 2023 14:21:25 -0300 Subject: [PATCH 05/32] remedianting address to getAddress --- scripts/deploy-suite.js | 40 +- scripts/manage-roles.js | 14 +- scripts/upgrade-clients.js | 4 +- scripts/upgrade-facets.js | 12 +- scripts/util/cast-protocol-client-proxies.js | 2 +- scripts/util/create-dispute-resolver.js | 4 +- scripts/util/deploy-mock-tokens.js | 6 +- .../util/deploy-protocol-client-beacons.js | 2 +- .../util/deploy-protocol-client-proxies.js | 2 +- .../util/deploy-protocol-handler-facets.js | 2 +- scripts/util/diamond-utils.js | 12 +- scripts/util/estimate-limits.js | 204 ++--- scripts/util/report-verify-deployments.js | 6 +- test/access/AccessControllerTest.js | 196 ++--- test/example/SnapshotGateTest.js | 92 +-- .../01-update-account-roles-addresses.js | 124 ++-- test/integration/02-Upgraded-facet.js | 128 ++-- ...DR-removes-the-seller-from-allowed-list.js | 34 +- test/integration/04-DR-removes-fees.js | 44 +- test/integration/seaport/fixtures.js | 4 +- .../seaport/seaport-integration.js | 20 +- test/protocol/AccountHandlerTest.js | 18 +- test/protocol/AgentHandlerTest.js | 44 +- test/protocol/BundleHandlerTest.js | 36 +- test/protocol/BuyerHandlerTest.js | 62 +- test/protocol/ConfigHandlerTest.js | 176 ++--- test/protocol/DisputeHandlerTest.js | 140 ++-- test/protocol/DisputeResolverHandlerTest.js | 330 ++++----- test/protocol/ExchangeHandlerTest.js | 552 +++++++------- test/protocol/FundsHandlerTest.js | 700 +++++++++--------- test/protocol/GroupHandlerTest.js | 32 +- test/protocol/MetaTransactionsHandlerTest.js | 560 +++++++------- test/protocol/OfferHandlerTest.js | 224 +++--- test/protocol/OrchestrationHandlerTest.js | 546 +++++++------- test/protocol/PauseHandlerTest.js | 6 +- test/protocol/ProtocolDiamondTest.js | 144 ++-- .../ProtocolInitializationHandlerTest.js | 82 +- test/protocol/SellerHandlerTest.js | 402 +++++----- test/protocol/TwinHandlerTest.js | 120 +-- test/protocol/clients/BeaconClientProxy.js | 4 +- test/protocol/clients/BosonVoucherTest.js | 412 +++++------ .../clients/ClientExternalAddressesTest.js | 8 +- test/upgrade/01_generic.js | 16 +- test/upgrade/2.0.0-2.1.0.js | 50 +- test/upgrade/2.1.0-2.2.0.js | 132 ++-- test/upgrade/2.2.0-2.2.1.js | 6 +- test/upgrade/clients/01_generic.js | 2 +- .../clients/BosonVoucher-2.1.0-2.2.0.js | 62 +- test/util/upgrade.js | 98 +-- test/util/utils.js | 26 +- 50 files changed, 2971 insertions(+), 2971 deletions(-) diff --git a/scripts/deploy-suite.js b/scripts/deploy-suite.js index d8f1d0b1b..3eb2e67b2 100644 --- a/scripts/deploy-suite.js +++ b/scripts/deploy-suite.js @@ -73,7 +73,7 @@ async function main(env, facetConfig) { process.exit(1); } - console.log("🔱 Deployer account: ", deployer ? deployer.address : "not found" && process.exit()); + console.log("🔱 Deployer account: ", deployer ? await deployer.getAddress() : "not found" && process.exit()); console.log(divider); console.log(`💎 Deploying AccessController, ProtocolDiamond, and Diamond utility facets...`); @@ -82,18 +82,18 @@ async function main(env, facetConfig) { const [protocolDiamond, dlf, dcf, erc165f, accessController, diamondArgs] = await deployProtocolDiamond( maxPriorityFeePerGas ); - deploymentComplete("AccessController", accessController.address, [], "", contracts); - deploymentComplete("DiamondLoupeFacet", dlf.address, [], interfaceIdFromFacetName("DiamondLoupeFacet"), contracts); - deploymentComplete("DiamondCutFacet", dcf.address, [], interfaceIdFromFacetName("DiamondCutFacet"), contracts); - deploymentComplete("ERC165Facet", erc165f.address, [], interfaceIdFromFacetName("ERC165Facet"), contracts); - deploymentComplete("ProtocolDiamond", protocolDiamond.address, diamondArgs, "", contracts); + deploymentComplete("AccessController", await accessController.getAddress(), [], "", contracts); + deploymentComplete("DiamondLoupeFacet", await dlf.getAddress(), [], interfaceIdFromFacetName("DiamondLoupeFacet"), contracts); + deploymentComplete("DiamondCutFacet", await dcf.getAddress(), [], interfaceIdFromFacetName("DiamondCutFacet"), contracts); + deploymentComplete("ERC165Facet", await erc165f.getAddress(), [], interfaceIdFromFacetName("ERC165Facet"), contracts); + deploymentComplete("ProtocolDiamond", await protocolDiamond.getAddress(), diamondArgs, "", contracts); console.log(`\n💎 Granting UPGRADER role...`); // Temporarily grant UPGRADER role to deployer account transactionResponse = await accessController.grantRole( Role.UPGRADER, - deployer.address, + await deployer.getAddress(), await getFees(maxPriorityFeePerGas) ); await transactionResponse.wait(confirmations); @@ -113,12 +113,12 @@ async function main(env, facetConfig) { } const { version } = packageFile; - let { deployedFacets } = await deployAndCutFacets(protocolDiamond.address, facetData, maxPriorityFeePerGas, version); + let { deployedFacets } = await deployAndCutFacets(await protocolDiamond.getAddress(), facetData, maxPriorityFeePerGas, version); for (const deployedFacet of deployedFacets) { deploymentComplete( deployedFacet.name, - deployedFacet.contract.address, + deployedFacet.await contract.getAddress(), deployedFacet.constructorArgs, interfaceIdFromFacetName(deployedFacet.name), contracts @@ -128,7 +128,7 @@ async function main(env, facetConfig) { console.log(`\n⧉ Deploying Protocol Client implementation/proxy pairs...`); // Deploy the Protocol Client implementation/proxy pairs - const protocolClientArgs = [protocolDiamond.address]; + const protocolClientArgs = [await protocolDiamond.getAddress()]; const clientImplementationArgs = Object.values(clientConfig).map( (config) => process.env.FORWARDER_ADDRESS || config[network] ); @@ -142,27 +142,27 @@ async function main(env, facetConfig) { const [bosonVoucherProxy] = proxies; // Gather the complete args that were used to create the proxies - const bosonVoucherProxyArgs = [...protocolClientArgs, bosonVoucherImpl.address]; + const bosonVoucherProxyArgs = [...protocolClientArgs, await bosonVoucherImpl.getAddress()]; // Report and prepare for verification - deploymentComplete("BosonVoucher Logic", bosonVoucherImpl.address, [], "", contracts); - deploymentComplete("BosonVoucher Beacon", bosonClientBeacon.address, bosonVoucherProxyArgs, "", contracts); - deploymentComplete("BosonVoucher Proxy", bosonVoucherProxy.address, [], "", contracts); + deploymentComplete("BosonVoucher Logic", await bosonVoucherImpl.getAddress(), [], "", contracts); + deploymentComplete("BosonVoucher Beacon", await bosonClientBeacon.getAddress(), bosonVoucherProxyArgs, "", contracts); + deploymentComplete("BosonVoucher Proxy", await bosonVoucherProxy.getAddress(), [], "", contracts); console.log(`\n🌐️Configuring and granting roles...`); // Cast Diamond to the IBosonConfigHandler interface for further interaction with it - const bosonConfigHandler = await getContractAt("IBosonConfigHandler", protocolDiamond.address); + const bosonConfigHandler = await getContractAt("IBosonConfigHandler", await protocolDiamond.getAddress()); // Add Voucher addresses to protocol config transactionResponse = await bosonConfigHandler.setVoucherBeaconAddress( - bosonClientBeacon.address, + await bosonClientBeacon.getAddress(), await getFees(maxPriorityFeePerGas) ); await transactionResponse.wait(confirmations); transactionResponse = await bosonConfigHandler.setBeaconProxyAddress( - bosonVoucherProxy.address, + await bosonVoucherProxy.getAddress(), await getFees(maxPriorityFeePerGas) ); await transactionResponse.wait(confirmations); @@ -192,7 +192,7 @@ async function main(env, facetConfig) { // Renounce temporarily granted UPGRADER role for deployer account transactionResponse = await accessController.renounceRole( Role.UPGRADER, - deployer.address, + await deployer.getAddress(), await getFees(maxPriorityFeePerGas) ); await transactionResponse.wait(confirmations); @@ -200,12 +200,12 @@ async function main(env, facetConfig) { // Grant PROTOCOL role to the ProtocolDiamond contract transactionResponse = await accessController.grantRole( Role.PROTOCOL, - protocolDiamond.address, + await protocolDiamond.getAddress(), await getFees(maxPriorityFeePerGas) ); await transactionResponse.wait(confirmations); - if (adminAddress.toLowerCase() != deployer.address.toLowerCase()) { + if (adminAddress.toLowerCase() != await deployer.getAddress().toLowerCase()) { // Grant ADMIN role to the specified admin address // Skip this step if adminAddress is the deployer transactionResponse = await accessController.grantRole( diff --git a/scripts/manage-roles.js b/scripts/manage-roles.js index 414c27e01..42b57c912 100644 --- a/scripts/manage-roles.js +++ b/scripts/manage-roles.js @@ -49,7 +49,7 @@ async function main(env) { const accessControllerInfo = contractsFile.contracts.find((i) => i.name === "AccessController"); // Get AccessController abstraction - const accessController = await getContractAt("AccessController", accessControllerInfo.address); + const accessController = await getContractAt("AccessController", await accessControllerInfo.getAddress()); // Loop through assignments for this network const assignments = Object.entries(RoleAssignments[network]); @@ -63,19 +63,19 @@ async function main(env) { let contractInfo; contractInfo = contractsFile.contracts.find((i) => i.name === name); - config.address = name === "AdminAddress" ? environments[network].adminAddress : contractInfo.address; + await config.getAddress() = name === "AdminAddress" ? environments[network].adminAddress : await contractInfo.getAddress(); - console.log(` 👉 ${config.address}`); + console.log(` 👉 ${await config.getAddress()}`); // Loop through assigned roles for address for (let j = 0; j < config.roles.length; j++) { // Check if role already assigned const role = config.roles[j]; - const hasRole = await accessController.hasRole(role, config.address); + const hasRole = await accessController.hasRole(role, await config.getAddress()); // Grant role if not already granted if (!hasRole) { - await accessController.grantRole(role, config.address); + await accessController.grantRole(role, await config.getAddress()); } // Report status @@ -88,11 +88,11 @@ async function main(env) { for (let j = 0; j < unassigned.length; j++) { // Check if role currently assigned const role = Role[unassigned[j]]; - const hasRole = await accessController.hasRole(role, config.address); + const hasRole = await accessController.hasRole(role, await config.getAddress()); // Revoke role if previously granted if (hasRole) { - await accessController.revokeRole(role, config.address); + await accessController.revokeRole(role, await config.getAddress()); } // Report status diff --git a/scripts/upgrade-clients.js b/scripts/upgrade-clients.js index e7bcd3c89..86a93359b 100644 --- a/scripts/upgrade-clients.js +++ b/scripts/upgrade-clients.js @@ -84,11 +84,11 @@ async function main(env, clientConfig, version) { const beacon = await getContractAt("BosonClientBeacon", beaconAddress); await beacon .connect(adminSigner) - .setImplementation(bosonVoucherImplementation.address, await getFees(maxPriorityFeePerGas)); + .setImplementation(await bosonVoucherImplementation.getAddress(), await getFees(maxPriorityFeePerGas)); // Remove old entry from contracts contracts = contracts.filter((i) => i.name !== "BosonVoucher Logic"); - deploymentComplete("BosonVoucher Logic", bosonVoucherImplementation.address, clientImplementationArgs, "", contracts); + deploymentComplete("BosonVoucher Logic", await bosonVoucherImplementation.getAddress(), clientImplementationArgs, "", contracts); const contractsPath = await writeContracts(contracts, env, version); console.log(divider); diff --git a/scripts/upgrade-facets.js b/scripts/upgrade-facets.js index 438694ca1..5a1879d3f 100644 --- a/scripts/upgrade-facets.js +++ b/scripts/upgrade-facets.js @@ -147,7 +147,7 @@ async function main(env, facetConfig, version) { let registeredSelectors; if (oldFacet) { // Facet exists, so all selectors should be removed - registeredSelectors = await diamondLoupe.facetFunctionSelectors(oldFacet.address); + registeredSelectors = await diamondLoupe.facetFunctionSelectors(await oldFacet.getAddress()); } else { // Facet does not exist, skip next steps continue; @@ -191,7 +191,7 @@ async function main(env, facetConfig, version) { let registeredSelectors; if (oldFacet) { // Facet already exists and is only upgraded - registeredSelectors = await diamondLoupe.facetFunctionSelectors(oldFacet.address); + registeredSelectors = await diamondLoupe.facetFunctionSelectors(await oldFacet.getAddress()); } else { // Facet is new registeredSelectors = []; @@ -203,7 +203,7 @@ async function main(env, facetConfig, version) { const newFacetInterfaceId = interfaceIdFromFacetName(newFacet.name); deploymentComplete( newFacet.name, - newFacet.contract.address, + newFacet.await contract.getAddress(), newFacet.constructorArgs, newFacetInterfaceId, contracts @@ -262,7 +262,7 @@ async function main(env, facetConfig, version) { } } - const newFacetAddress = newFacet.contract.address; + const newFacetAddress = newFacet.await contract.getAddress(); if (selectorsToAdd.length > 0) { deployedFacets[index].cut.push([newFacetAddress, FacetCutAction.Add, selectorsToAdd]); } @@ -317,10 +317,10 @@ async function main(env, facetConfig, version) { ); await cutDiamond( - diamondCutFacet.address, + await diamondCutFacet.getAddress(), maxPriorityFeePerGas, deployedFacets, - protocolInitializationFacet.address, + await protocolInitializationFacet.getAddress(), initializeCalldata, facetCutRemove ); diff --git a/scripts/util/cast-protocol-client-proxies.js b/scripts/util/cast-protocol-client-proxies.js index da40b197d..8fecc8e4e 100644 --- a/scripts/util/cast-protocol-client-proxies.js +++ b/scripts/util/cast-protocol-client-proxies.js @@ -25,7 +25,7 @@ async function castProtocolClientProxies(protocolClientProxies) { [bosonVoucherProxy] = protocolClientProxies; // Cast the Proxies to the appropriate interfaces for further interaction - const bosonVoucher = await getContractAt("IBosonVoucher", bosonVoucherProxy.address); + const bosonVoucher = await getContractAt("IBosonVoucher", await bosonVoucherProxy.getAddress()); return [bosonVoucher]; } diff --git a/scripts/util/create-dispute-resolver.js b/scripts/util/create-dispute-resolver.js index 8aaf22281..9a57bbd37 100644 --- a/scripts/util/create-dispute-resolver.js +++ b/scripts/util/create-dispute-resolver.js @@ -84,8 +84,8 @@ const createDisputeResolver = async (path) => { // create dispute resolver with callers account let initialDisputeResolver = { ...disputeResolver }; - initialDisputeResolver.admin = disputeResolverSigner.address; - initialDisputeResolver.assistant = disputeResolverSigner.address; + initialDisputeResolver.admin = await disputeResolverSigner.getAddress(); + initialDisputeResolver.assistant = await disputeResolverSigner.getAddress(); initialDisputeResolver.clerk = ZeroAddress; tx = await accountHandler diff --git a/scripts/util/deploy-mock-tokens.js b/scripts/util/deploy-mock-tokens.js index c159c4dbf..de3927c1e 100644 --- a/scripts/util/deploy-mock-tokens.js +++ b/scripts/util/deploy-mock-tokens.js @@ -42,13 +42,13 @@ async function deployAndMintMockNFTAuthTokens() { let lensTokenContractFactory = await getContractFactory("MockNFTAuth721"); const lensTokenContract = await lensTokenContractFactory.deploy(); await lensTokenContract.deployTransaction.wait(confirmations); - console.log(`✅ Mock Lens NFT Token deployed to: ${lensTokenContract.address}`); + console.log(`✅ Mock Lens NFT Token deployed to: ${await lensTokenContract.getAddress()}`); //Deploy a mock NFT to represent the ENS NFT let ensTokenContractFactory = await getContractFactory("MockNFTAuth721"); const ensTokenContract = await ensTokenContractFactory.deploy(); await ensTokenContract.deployTransaction.wait(confirmations); - console.log(`✅ Mock ENS NFT Token deployed to: ${ensTokenContract.address}`); + console.log(`✅ Mock ENS NFT Token deployed to: ${await ensTokenContract.getAddress()}`); if (network == "test" || network == "localhost") { //We want to mint auth tokens to specific addresses @@ -90,7 +90,7 @@ async function deployAndMintMockNFTAuthTokens() { ensTokenId++; } return { - addresses: [lensTokenContract.address, ensTokenContract.address], + addresses: [await lensTokenContract.getAddress(), await ensTokenContract.getAddress()], }; } diff --git a/scripts/util/deploy-protocol-client-beacons.js b/scripts/util/deploy-protocol-client-beacons.js index c69e370f9..824674d67 100644 --- a/scripts/util/deploy-protocol-client-beacons.js +++ b/scripts/util/deploy-protocol-client-beacons.js @@ -31,7 +31,7 @@ async function deployProtocolClientBeacons(protocolClients, protocolClientArgs, const ClientBeacon = await getContractFactory("BosonClientBeacon"); const clientBeacon = await ClientBeacon.deploy( ...protocolClientArgs, - bosonVoucherImpl.address, + await bosonVoucherImpl.getAddress(), await getFees(maxPriorityFeePerGas) ); await clientBeacon.deployTransaction.wait(confirmations); diff --git a/scripts/util/deploy-protocol-client-proxies.js b/scripts/util/deploy-protocol-client-proxies.js index 953f01650..68fb3b0c3 100644 --- a/scripts/util/deploy-protocol-client-proxies.js +++ b/scripts/util/deploy-protocol-client-proxies.js @@ -35,7 +35,7 @@ async function deployProtocolClientProxies(protocolClients, maxPriorityFeePerGas // init instead of constructors let transactionResponse = await clientProxy.initialize( - bosonClientBeacon.address, + await bosonClientBeacon.getAddress(), await getFees(maxPriorityFeePerGas) ); await transactionResponse.wait(confirmations); diff --git a/scripts/util/deploy-protocol-handler-facets.js b/scripts/util/deploy-protocol-handler-facets.js index dffb3be04..02aa7aa7c 100644 --- a/scripts/util/deploy-protocol-handler-facets.js +++ b/scripts/util/deploy-protocol-handler-facets.js @@ -58,7 +58,7 @@ async function deployAndCutFacets( diamond, maxPriorityFeePerGas, deployedFacets, - initializationFacet.address, + await initializationFacet.getAddress(), initializeCalldata ); diff --git a/scripts/util/diamond-utils.js b/scripts/util/diamond-utils.js index 2f9f64d49..bc25445ae 100644 --- a/scripts/util/diamond-utils.js +++ b/scripts/util/diamond-utils.js @@ -139,19 +139,19 @@ function findAddressPositionInFacets(facetAddress, facets) { } } -function getFacetAddCut(facet, omitFunctions = []) { +async function getFacetAddCut(facet, omitFunctions = []) { let selectors = omitFunctions.length ? getSelectors(facet).remove(omitFunctions) : getSelectors(facet); - return [facet.address, FacetCutAction.Add, selectors]; + return [await facet.getAddress(), FacetCutAction.Add, selectors]; } -function getFacetReplaceCut(facet, omitFunctions = []) { +async function getFacetReplaceCut(facet, omitFunctions = []) { let selectors = omitFunctions.length ? getSelectors(facet).remove(omitFunctions) : getSelectors(facet); - return [facet.address, FacetCutAction.Replace, selectors]; + return [await facet.getAddress(), FacetCutAction.Replace, selectors]; } function getFacetRemoveCut(facet, omitFunctions = []) { let selectors = omitFunctions.length ? getSelectors(facet).remove(omitFunctions) : getSelectors(facet); - return [facet.address, FacetCutAction.Remove, selectors]; + return [await facet.getAddress(), FacetCutAction.Remove, selectors]; } async function getStateModifyingFunctions(facetNames, omitFunctions = [], onlyFunctions = []) { @@ -203,7 +203,7 @@ function getInitializeCalldata( interfacesToAdd = [] ) { version = formatBytes32String(version); - const addresses = facetsToInitialize.map((f) => f.contract.address); + const addresses = facetsToInitialize.map((f) => f.await contract.getAddress()); const calldata = facetsToInitialize.map((f) => f.initialize); return initializationFacet.interface.encodeFunctionData("initialize", [ diff --git a/scripts/util/estimate-limits.js b/scripts/util/estimate-limits.js index e2a745c61..9d64c1e5b 100644 --- a/scripts/util/estimate-limits.js +++ b/scripts/util/estimate-limits.js @@ -92,38 +92,38 @@ setupEnvironment["maxAllowedSellers"] = async function (sellerCount = 10) { //Fund the new wallet let tx = { - to: connectedWallet.address, + to: await connectedWallet.getAddress(), // Convert currency unit from ether to wei value: parseEther("1"), }; await other1.sendTransaction(tx); - const seller = mockSeller(wallet.address, wallet.address, wallet.address, wallet.address); + const seller = mockSeller(await wallet.getAddress(), await wallet.getAddress(), await wallet.getAddress(), await wallet.getAddress()); await accountHandler.connect(connectedWallet).createSeller(seller, emptyAuthToken, voucherInitValues); } //Create DisputeResolverFee array const disputeResolverFees = [ - new DisputeResolverFee(other1.address, "MockToken1", "0"), - new DisputeResolverFee(other2.address, "MockToken2", "0"), - new DisputeResolverFee(other3.address, "MockToken3", "0"), + new DisputeResolverFee(await other1.getAddress(), "MockToken1", "0"), + new DisputeResolverFee(await other2.getAddress(), "MockToken2", "0"), + new DisputeResolverFee(await other3.getAddress(), "MockToken3", "0"), ]; const sellerAllowList = [...Array(sellerCount + 1).keys()].slice(1); // Dispute resolver 2 - used in "addSellersToAllowList" - const disputeResolver2 = mockDisputeResolver(dr2.address, dr2.address, dr2.address, dr2.address); + const disputeResolver2 = mockDisputeResolver(await dr2.getAddress(), await dr2.getAddress(), await dr2.getAddress(), await dr2.getAddress()); await accountHandler.connect(dr2).createDisputeResolver(disputeResolver2, disputeResolverFees, []); const args_2 = [disputeResolver2.id, sellerAllowList]; const arrayIndex_2 = 1; // Dispute resolver 3 - used in "removeSellersFromAllowList" - const disputeResolver3 = mockDisputeResolver(dr3.address, dr3.address, dr3.address, dr3.address); + const disputeResolver3 = mockDisputeResolver(await dr3.getAddress(), await dr3.getAddress(), await dr3.getAddress(), await dr3.getAddress()); await accountHandler.connect(dr3).createDisputeResolver(disputeResolver3, disputeResolverFees, sellerAllowList); const args_3 = [disputeResolver3.id, sellerAllowList]; const arrayIndex_3 = 1; - const disputeResolver1 = mockDisputeResolver(dr1.address, dr1.address, dr1.address, dr1.address); + const disputeResolver1 = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress()); const args_1 = [disputeResolver1, disputeResolverFees, sellerAllowList]; const arrayIndex_1 = 2; @@ -145,23 +145,23 @@ setupEnvironment["maxFeesPerDisputeResolver"] = async function (feesCount = 10) let disputeResolverFees = []; for (let i = 0; i < feesCount; i++) { const wallet = Wallet.createRandom(); - disputeResolverFees.push(new DisputeResolverFee(wallet.address, `MockToken${i}`, "0")); + disputeResolverFees.push(new DisputeResolverFee(await wallet.getAddress(), `MockToken${i}`, "0")); } // Dispute resolver 2 - used in "addFeesToDisputeResolver" - const disputeResolver2 = mockDisputeResolver(dr2.address, dr2.address, dr2.address, dr2.address); + const disputeResolver2 = mockDisputeResolver(await dr2.getAddress(), await dr2.getAddress(), await dr2.getAddress(), await dr2.getAddress()); await accountHandler.connect(dr2).createDisputeResolver(disputeResolver2, [], []); const args_2 = [disputeResolver2.id, disputeResolverFees]; const arrayIndex_2 = 1; // Dispute resolver 3 - used in "removeFeesFromDisputeResolver" - const disputeResolver3 = mockDisputeResolver(dr3.address, dr3.address, dr3.address, dr3.address); + const disputeResolver3 = mockDisputeResolver(await dr3.getAddress(), await dr3.getAddress(), await dr3.getAddress(), await dr3.getAddress()); await accountHandler.connect(dr3).createDisputeResolver(disputeResolver3, disputeResolverFees, [], { gasLimit }); const feeTokenAddressesToRemove = disputeResolverFees.map((DRfee) => DRfee.tokenAddress); const args_3 = [disputeResolver3.id, feeTokenAddressesToRemove]; const arrayIndex_3 = 1; - const disputeResolver1 = mockDisputeResolver(dr1.address, dr1.address, dr1.address, dr1.address); + const disputeResolver1 = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress()); const args_1 = [disputeResolver1, disputeResolverFees, []]; const arrayIndex_1 = 1; @@ -184,10 +184,10 @@ setupEnvironment["maxOffersPerBatch"] = async function (offerCount = 10) { const agentId = "0"; // agent id is optional while creating an offer const seller1 = mockSeller( - sellerWallet1.address, - sellerWallet1.address, - sellerWallet1.address, - sellerWallet1.address + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress() ); const voucherInitValues = mockVoucherInitValues(); const emptyAuthToken = mockAuthToken(); @@ -196,23 +196,23 @@ setupEnvironment["maxOffersPerBatch"] = async function (offerCount = 10) { // Seller 2 - used in "voidOfferBatch" const seller2 = mockSeller( - sellerWallet2.address, - sellerWallet2.address, - sellerWallet2.address, - sellerWallet2.address + await sellerWallet2.getAddress(), + await sellerWallet2.getAddress(), + await sellerWallet2.getAddress(), + await sellerWallet2.getAddress() ); await accountHandler.connect(sellerWallet2).createSeller(seller2, emptyAuthToken, voucherInitValues); // Seller 3 - used in "extendOfferBatch" const seller3 = mockSeller( - sellerWallet3.address, - sellerWallet3.address, - sellerWallet3.address, - sellerWallet3.address + await sellerWallet3.getAddress(), + await sellerWallet3.getAddress(), + await sellerWallet3.getAddress(), + await sellerWallet3.getAddress() ); await accountHandler.connect(sellerWallet3).createSeller(seller3, emptyAuthToken, voucherInitValues); - const disputeResolver = mockDisputeResolver(dr1.address, dr1.address, dr1.address, dr1.address, true); + const disputeResolver = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), true); await accountHandler .connect(dr1) .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); @@ -268,10 +268,10 @@ setupEnvironment["maxOffersPerGroup"] = async function (offerCount = 10) { const agentId = "0"; // agent id is optional while creating an offer const seller1 = mockSeller( - sellerWallet1.address, - sellerWallet1.address, - sellerWallet1.address, - sellerWallet1.address + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress() ); const voucherInitValues = mockVoucherInitValues(); const emptyAuthToken = mockAuthToken(); @@ -280,23 +280,23 @@ setupEnvironment["maxOffersPerGroup"] = async function (offerCount = 10) { // Seller 2 - used in "addOffersToGroup" const seller2 = mockSeller( - sellerWallet2.address, - sellerWallet2.address, - sellerWallet2.address, - sellerWallet2.address + await sellerWallet2.getAddress(), + await sellerWallet2.getAddress(), + await sellerWallet2.getAddress(), + await sellerWallet2.getAddress() ); await accountHandler.connect(sellerWallet2).createSeller(seller2, emptyAuthToken, voucherInitValues); // Seller 3 - used in "removeOffersFromGroup" const seller3 = mockSeller( - sellerWallet3.address, - sellerWallet3.address, - sellerWallet3.address, - sellerWallet3.address + await sellerWallet3.getAddress(), + await sellerWallet3.getAddress(), + await sellerWallet3.getAddress(), + await sellerWallet3.getAddress() ); await accountHandler.connect(sellerWallet3).createSeller(seller3, emptyAuthToken, voucherInitValues); - const disputeResolver = mockDisputeResolver(dr1.address, dr1.address, dr1.address, dr1.address, true); + const disputeResolver = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), true); await accountHandler .connect(dr1) .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); @@ -357,17 +357,17 @@ setupEnvironment["maxOffersPerBundle"] = async function (offerCount = 10) { const agentId = "0"; // agent id is optional while creating an offer const seller1 = mockSeller( - sellerWallet1.address, - sellerWallet1.address, - sellerWallet1.address, - sellerWallet1.address + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress() ); const voucherInitValues = mockVoucherInitValues(); const emptyAuthToken = mockAuthToken(); await accountHandler.connect(sellerWallet1).createSeller(seller1, emptyAuthToken, voucherInitValues); - const disputeResolver = mockDisputeResolver(dr1.address, dr1.address, dr1.address, dr1.address, true); + const disputeResolver = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), true); await accountHandler .connect(dr1) .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); @@ -384,11 +384,11 @@ setupEnvironment["maxOffersPerBundle"] = async function (offerCount = 10) { // Create a valid twin. const [bosonToken] = await deployMockTokens(); - const twin = mockTwin(bosonToken.address); + const twin = mockTwin(await bosonToken.getAddress()); twin.supplyAvailable = BigInt(twin.amount).mul(offerCount); // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(sellerWallet1).approve(twinHandler.address, twin.supplyAvailable); // approving the twin handler + await bosonToken.connect(sellerWallet1).approve(await twinHandler.getAddress(), twin.supplyAvailable); // approving the twin handler // Create a twin. await twinHandler.connect(sellerWallet1).createTwin(twin); @@ -417,27 +417,27 @@ setupEnvironment["maxTwinsPerBundle"] = async function (twinCount = 10) { const agentId = "0"; // agent id is optional while creating an offer const seller1 = mockSeller( - sellerWallet1.address, - sellerWallet1.address, - sellerWallet1.address, - sellerWallet1.address + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress() ); const voucherInitValues = mockVoucherInitValues(); const emptyAuthToken = mockAuthToken(); await accountHandler.connect(sellerWallet1).createSeller(seller1, emptyAuthToken, voucherInitValues); - const disputeResolver = mockDisputeResolver(dr1.address, dr1.address, dr1.address, dr1.address, true); + const disputeResolver = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), true); await accountHandler .connect(dr1) .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); for (let i = 0; i < twinCount; i++) { const [twinContract] = await deployMockTokens(["Foreign20"]); - const twin = mockTwin(twinContract.address); + const twin = mockTwin(await twinContract.getAddress()); // Approving the twinHandler contract to transfer seller's tokens - await twinContract.connect(sellerWallet1).approve(twinHandler.address, twin.supplyAvailable); // approving the twin handler + await twinContract.connect(sellerWallet1).approve(await twinHandler.getAddress(), twin.supplyAvailable); // approving the twin handler // Create a twin. await twinHandler.connect(sellerWallet1).createTwin(twin); @@ -474,17 +474,17 @@ setupEnvironment["maxExchangesPerBatch"] = async function (exchangesCount = 10) const agentId = "0"; // agent id is optional while creating an offer const seller1 = mockSeller( - sellerWallet1.address, - sellerWallet1.address, - sellerWallet1.address, - sellerWallet1.address + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress() ); const voucherInitValues = mockVoucherInitValues(); const emptyAuthToken = mockAuthToken(); await accountHandler.connect(sellerWallet1).createSeller(seller1, emptyAuthToken, voucherInitValues); - const disputeResolver = mockDisputeResolver(dr1.address, dr1.address, dr1.address, dr1.address, true); + const disputeResolver = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), true); await accountHandler .connect(dr1) .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); @@ -504,7 +504,7 @@ setupEnvironment["maxExchangesPerBatch"] = async function (exchangesCount = 10) await setNextBlockTimestamp(Number(offerDates.voucherRedeemableFrom)); for (let i = 1; i < exchangesCount + 1; i++) { // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offer.id, { value: offer.price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offer.id, { value: offer.price }); // Redeem voucher await exchangeHandler.connect(buyer).redeemVoucher(i); @@ -536,17 +536,17 @@ setupEnvironment["maxDisputesPerBatch"] = async function (exchangesCount = 10) { const agentId = "0"; // agent id is optional while creating an offer const seller1 = mockSeller( - sellerWallet1.address, - sellerWallet1.address, - sellerWallet1.address, - sellerWallet1.address + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress() ); const voucherInitValues = mockVoucherInitValues(); const emptyAuthToken = mockAuthToken(); await accountHandler.connect(sellerWallet1).createSeller(seller1, emptyAuthToken, voucherInitValues); - const disputeResolver = mockDisputeResolver(dr1.address, dr1.address, dr1.address, dr1.address, true); + const disputeResolver = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), true); await accountHandler .connect(dr1) .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); @@ -566,7 +566,7 @@ setupEnvironment["maxDisputesPerBatch"] = async function (exchangesCount = 10) { await setNextBlockTimestamp(Number(offerDates.voucherRedeemableFrom)); for (let i = 1; i < exchangesCount + 1; i++) { // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offer.id, { value: offer.price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offer.id, { value: offer.price }); // Redeem voucher await exchangeHandler.connect(buyer).redeemVoucher(i); @@ -602,17 +602,17 @@ setupEnvironment["maxTokensPerWithdrawal"] = async function (tokenCount = 10) { const agentId = "0"; // agent id is optional while creating an offer const seller1 = mockSeller( - sellerWallet1.address, - sellerWallet1.address, - sellerWallet1.address, - sellerWallet1.address + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress() ); const voucherInitValues = mockVoucherInitValues(); const emptyAuthToken = mockAuthToken(); await accountHandler.connect(sellerWallet1).createSeller(seller1, emptyAuthToken, voucherInitValues); - const disputeResolver = mockDisputeResolver(dr1.address, dr1.address, dr1.address, dr1.address, true); + const disputeResolver = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), true); await accountHandler .connect(dr1) .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); @@ -623,19 +623,19 @@ setupEnvironment["maxTokensPerWithdrawal"] = async function (tokenCount = 10) { for (let i = 1; i < tokenCount + 1; i++) { // create a token const [tokenContract] = await deployMockTokens(["Foreign20"]); - tokenAddresses.push(tokenContract.address); + tokenAddresses.push(await tokenContract.getAddress()); - offer.exchangeToken = tokenContract.address; - await tokenContract.mint(sellerWallet1.address, offer.sellerDeposit); - await tokenContract.mint(buyer.address, offer.price); - await tokenContract.connect(sellerWallet1).approve(protocolDiamond.address, offer.sellerDeposit); - await tokenContract.connect(buyer).approve(protocolDiamond.address, offer.price); - await fundsHandler.connect(sellerWallet1).depositFunds(seller1.id, tokenContract.address, offer.sellerDeposit); + offer.exchangeToken = await tokenContract.getAddress(); + await tokenContract.mint(await sellerWallet1.getAddress(), offer.sellerDeposit); + await tokenContract.mint(await buyer.getAddress(), offer.price); + await tokenContract.connect(sellerWallet1).approve(await protocolDiamond.getAddress(), offer.sellerDeposit); + await tokenContract.connect(buyer).approve(await protocolDiamond.getAddress(), offer.price); + await fundsHandler.connect(sellerWallet1).depositFunds(seller1.id, await tokenContract.getAddress(), offer.sellerDeposit); // add token to DR accepted tokens await accountHandler .connect(dr1) - .addFeesToDisputeResolver(disputeResolver.id, [new DisputeResolverFee(tokenContract.address, `Token${i}`, "0")]); + .addFeesToDisputeResolver(disputeResolver.id, [new DisputeResolverFee(await tokenContract.getAddress(), `Token${i}`, "0")]); // create the offer await offerHandler @@ -643,7 +643,7 @@ setupEnvironment["maxTokensPerWithdrawal"] = async function (tokenCount = 10) { .createOffer(offer, offerDates, offerDurations, disputeResolver.id, agentId); // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, i); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), i); // Redeem voucher await exchangeHandler.connect(buyer).redeemVoucher(i); @@ -658,7 +658,7 @@ setupEnvironment["maxTokensPerWithdrawal"] = async function (tokenCount = 10) { const arrayIndex_1 = [1, 2]; // protocol fee withdrawal - await accessController.grantRole(Role.FEE_COLLECTOR, feeCollector.address); + await accessController.grantRole(Role.FEE_COLLECTOR, await feeCollector.getAddress()); const protocolFee = BigInt(offer.price).mul(protocolFeePercentage).div(10000); const tokenAmounts_2 = new Array(tokenCount).fill(protocolFee); const args_2 = [tokenAddresses, tokenAmounts_2]; @@ -680,17 +680,17 @@ setupEnvironment["maxPremintedVouchers"] = async function (tokenCount = 10) { const agentId = "0"; // agent id is optional while creating an offer const seller1 = mockSeller( - sellerWallet1.address, - sellerWallet1.address, - sellerWallet1.address, - sellerWallet1.address + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress(), + await sellerWallet1.getAddress() ); const voucherInitValues = mockVoucherInitValues(); const emptyAuthToken = mockAuthToken(); await accountHandler.connect(sellerWallet1).createSeller(seller1, emptyAuthToken, voucherInitValues); - const disputeResolver = mockDisputeResolver(dr1.address, dr1.address, dr1.address, dr1.address, true); + const disputeResolver = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), true); await accountHandler .connect(dr1) .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); @@ -705,7 +705,7 @@ setupEnvironment["maxPremintedVouchers"] = async function (tokenCount = 10) { await offerHandler.connect(sellerWallet1).reserveRange(offer.id, length); // update bosonVoucher address - handlers.IBosonVoucher = bosonVoucher.attach(calculateContractAddress(accountHandler.address, seller1.id)); + handlers.IBosonVoucher = bosonVoucher.attach(calculateContractAddress(await accountHandler.getAddress(), seller1.id)); // make an empty array of length tokenCount const amounts = new Array(tokenCount); @@ -848,17 +848,17 @@ async function setupCommonEnvironment() { [protocolDiamond, , , , accessController] = await deployProtocolDiamond(); // Temporarily grant UPGRADER role to deployer account - await accessController.grantRole(Role.UPGRADER, deployer.address); + await accessController.grantRole(Role.UPGRADER, await deployer.getAddress()); // Grant PROTOCOL role to ProtocolDiamond address and renounces admin - await accessController.grantRole(Role.PROTOCOL, protocolDiamond.address); + await accessController.grantRole(Role.PROTOCOL, await protocolDiamond.getAddress()); // Grant ADMIN role to and address that can call restricted functions. // This ADMIN role is a protocol-level role. It is not the same an admin address for an account type - await accessController.grantRole(Role.ADMIN, protocolAdmin.address); + await accessController.grantRole(Role.ADMIN, await protocolAdmin.getAddress()); // Deploy the Protocol client implementation/proxy pairs (currently just the Boson Voucher) - const protocolClientArgs = [protocolDiamond.address]; + const protocolClientArgs = [await protocolDiamond.getAddress()]; const [, beacons, proxies, bv] = await deployProtocolClients(protocolClientArgs, gasLimit); const [beacon] = beacons; const [proxy] = proxies; @@ -873,10 +873,10 @@ async function setupCommonEnvironment() { const protocolConfig = [ // Protocol addresses { - treasury: rando.address, - token: rando.address, - voucherBeacon: beacon.address, - beaconProxy: proxy.address, + treasury: await rando.getAddress(), + token: await rando.getAddress(), + voucherBeacon: await beacon.getAddress(), + beaconProxy: await proxy.getAddress(), }, // Protocol limits { @@ -922,16 +922,16 @@ async function setupCommonEnvironment() { const facetsToDeploy = await getFacetsWithArgs(facetNames, protocolConfig); // Cut the protocol handler facets into the Diamond - await deployAndCutFacets(protocolDiamond.address, facetsToDeploy, gasLimit); + await deployAndCutFacets(await protocolDiamond.getAddress(), facetsToDeploy, gasLimit); // Cast Diamond to handlers - accountHandler = await getContractAt("IBosonAccountHandler", protocolDiamond.address); - bundleHandler = await getContractAt("IBosonBundleHandler", protocolDiamond.address); - disputeHandler = await getContractAt("IBosonDisputeHandler", protocolDiamond.address); - exchangeHandler = await getContractAt("IBosonExchangeHandler", protocolDiamond.address); - fundsHandler = await getContractAt("IBosonFundsHandler", protocolDiamond.address); - groupHandler = await getContractAt("IBosonGroupHandler", protocolDiamond.address); - offerHandler = await getContractAt("IBosonOfferHandler", protocolDiamond.address); - twinHandler = await getContractAt("IBosonTwinHandler", protocolDiamond.address); + accountHandler = await getContractAt("IBosonAccountHandler", await protocolDiamond.getAddress()); + bundleHandler = await getContractAt("IBosonBundleHandler", await protocolDiamond.getAddress()); + disputeHandler = await getContractAt("IBosonDisputeHandler", await protocolDiamond.getAddress()); + exchangeHandler = await getContractAt("IBosonExchangeHandler", await protocolDiamond.getAddress()); + fundsHandler = await getContractAt("IBosonFundsHandler", await protocolDiamond.getAddress()); + groupHandler = await getContractAt("IBosonGroupHandler", await protocolDiamond.getAddress()); + offerHandler = await getContractAt("IBosonOfferHandler", await protocolDiamond.getAddress()); + twinHandler = await getContractAt("IBosonTwinHandler", await protocolDiamond.getAddress()); handlers = { IBosonAccountHandler: accountHandler, diff --git a/scripts/util/report-verify-deployments.js b/scripts/util/report-verify-deployments.js index 93e0f13ee..62c44e60c 100644 --- a/scripts/util/report-verify-deployments.js +++ b/scripts/util/report-verify-deployments.js @@ -15,12 +15,12 @@ async function verifyOnBlockExplorer(contract) { if (contract.name == "BosonVoucher Beacon") { await hre.run("verify:verify", { contract: "contracts/protocol/clients/proxy/BosonClientBeacon.sol:BosonClientBeacon", - address: contract.address, + address: await contract.getAddress(), constructorArguments: contract.args, }); } else { await hre.run("verify:verify", { - address: contract.address, + address: await contract.getAddress(), constructorArguments: contract.args, }); } @@ -33,7 +33,7 @@ async function verifyOnTestEnv(contracts) { for (const contract of contracts) { console.log(`\n📋 Verifying on test env ${contract.name}`); try { - const code = await hre.provider.getCode(contract.address); + const code = await hre.provider.getCode(await contract.getAddress()); if (code === "0x0" || code === "0x") { console.log(`❌ Failed to verify ${contract.name} on test env.`); } diff --git a/test/access/AccessControllerTest.js b/test/access/AccessControllerTest.js index 5a3931630..e7e9b9d38 100644 --- a/test/access/AccessControllerTest.js +++ b/test/access/AccessControllerTest.js @@ -44,33 +44,33 @@ describe("AccessController", function () { context("📋 Deployer is limited to initial ADMIN role", async function () { it("Deployer should have ADMIN role", async function () { // Check role - expect(await accessController.hasRole(Role.ADMIN, deployer.address), "Deployer doesn't have ADMIN role").is.true; + expect(await accessController.hasRole(Role.ADMIN, await deployer.getAddress()), "Deployer doesn't have ADMIN role").is.true; }); it("Deployer should not have PROTOCOL role", async function () { // Check role - expect(await accessController.hasRole(Role.PROTOCOL, deployer.address), "Deployer has PROTOCOL role").is.false; + expect(await accessController.hasRole(Role.PROTOCOL, await deployer.getAddress()), "Deployer has PROTOCOL role").is.false; }); it("Deployer should not have UPGRADER role", async function () { // Check role - expect(await accessController.hasRole(Role.UPGRADER, deployer.address), "Deployer has UPGRADER role").is.false; + expect(await accessController.hasRole(Role.UPGRADER, await deployer.getAddress()), "Deployer has UPGRADER role").is.false; }); it("Deployer should not have PAUSER role", async function () { // Check role - expect(await accessController.hasRole(Role.PAUSER, deployer.address), "Deployer has PAUSER role").is.false; + expect(await accessController.hasRole(Role.PAUSER, await deployer.getAddress()), "Deployer has PAUSER role").is.false; }); it("Deployer should not have CLIENT role", async function () { // Check role - expect(await accessController.hasRole(Role.CLIENT, deployer.address), "Deployer has CLIENT role").is.false; + expect(await accessController.hasRole(Role.CLIENT, await deployer.getAddress()), "Deployer has CLIENT role").is.false; }); it("Deployer should not have FEE_COLLECTOR role", async function () { // Check role expect( - await accessController.hasRole(Role.FEE_COLLECTOR, deployer.address), + await accessController.hasRole(Role.FEE_COLLECTOR, await deployer.getAddress()), "Deployer has FEE_COLLECTOR role" ).is.false; }); @@ -80,7 +80,7 @@ describe("AccessController", function () { let role = keccak256(toUtf8Bytes("random")); // Check role - expect(await accessController.hasRole(role, deployer.address), "Deployer has a random role").is.false; + expect(await accessController.hasRole(role, await deployer.getAddress()), "Deployer has a random role").is.false; }); }); @@ -137,78 +137,78 @@ describe("AccessController", function () { context("📋 Any ADMIN can grant all other roles", async function () { beforeEach(async function () { // Deployer grants ADMIN to another admin address - await accessController.grantRole(Role.ADMIN, admin.address); - expect(await accessController.hasRole(Role.ADMIN, admin.address)).is.true; + await accessController.grantRole(Role.ADMIN, await admin.getAddress()); + expect(await accessController.hasRole(Role.ADMIN, await admin.getAddress())).is.true; }); it("ADMIN role should be able to grant ADMIN role", async function () { // Grant Role, expecting the event - await expect(accessController.connect(admin).grantRole(Role.ADMIN, associate.address)) + await expect(accessController.connect(admin).grantRole(Role.ADMIN, await associate.getAddress())) .to.emit(accessController, "RoleGranted") - .withArgs(Role.ADMIN, associate.address, admin.address); + .withArgs(Role.ADMIN, await associate.getAddress(), await admin.getAddress()); // Test expect( - await accessController.hasRole(Role.ADMIN, associate.address), + await accessController.hasRole(Role.ADMIN, await associate.getAddress()), "ADMIN role can't grant ADMIN role" ).is.true; }); it("ADMIN role should be able to grant PROTOCOL role", async function () { // Grant Role, expecting the event - await expect(accessController.connect(admin).grantRole(Role.PROTOCOL, protocol.address)) + await expect(accessController.connect(admin).grantRole(Role.PROTOCOL, await protocol.getAddress())) .to.emit(accessController, "RoleGranted") - .withArgs(Role.PROTOCOL, protocol.address, admin.address); + .withArgs(Role.PROTOCOL, await protocol.getAddress(), await admin.getAddress()); // Test expect( - await accessController.hasRole(Role.PROTOCOL, protocol.address), + await accessController.hasRole(Role.PROTOCOL, await protocol.getAddress()), "ADMIN role can't grant PROTOCOL role" ).is.true; }); it("ADMIN role should be able to grant UPGRADER role", async function () { // Grant Role, expecting the event - await expect(accessController.connect(admin).grantRole(Role.UPGRADER, upgrader.address)) + await expect(accessController.connect(admin).grantRole(Role.UPGRADER, await upgrader.getAddress())) .to.emit(accessController, "RoleGranted") - .withArgs(Role.UPGRADER, upgrader.address, admin.address); + .withArgs(Role.UPGRADER, await upgrader.getAddress(), await admin.getAddress()); // Test expect( - await accessController.hasRole(Role.UPGRADER, upgrader.address), + await accessController.hasRole(Role.UPGRADER, await upgrader.getAddress()), "ADMIN role can't grant UPGRADER role" ).is.true; }); it("ADMIN role should be able to grant PAUSER role", async function () { // Grant Role, expecting the event - await expect(accessController.connect(admin).grantRole(Role.PAUSER, pauser.address)) + await expect(accessController.connect(admin).grantRole(Role.PAUSER, await pauser.getAddress())) .to.emit(accessController, "RoleGranted") - .withArgs(Role.PAUSER, pauser.address, admin.address); + .withArgs(Role.PAUSER, await pauser.getAddress(), await admin.getAddress()); // Test - expect(await accessController.hasRole(Role.PAUSER, pauser.address), "ADMIN role can't grant PAUSER role").is.true; + expect(await accessController.hasRole(Role.PAUSER, await pauser.getAddress()), "ADMIN role can't grant PAUSER role").is.true; }); it("ADMIN role should be able to grant CLIENT role", async function () { // Grant Role, expecting the event - await expect(accessController.connect(admin).grantRole(Role.CLIENT, client.address)) + await expect(accessController.connect(admin).grantRole(Role.CLIENT, await client.getAddress())) .to.emit(accessController, "RoleGranted") - .withArgs(Role.CLIENT, client.address, admin.address); + .withArgs(Role.CLIENT, await client.getAddress(), await admin.getAddress()); // Test - expect(await accessController.hasRole(Role.CLIENT, client.address), "ADMIN role can't grant CLIENT role").is.true; + expect(await accessController.hasRole(Role.CLIENT, await client.getAddress()), "ADMIN role can't grant CLIENT role").is.true; }); it("ADMIN role should be able to grant FEE_COLLECTOR role", async function () { // Grant Role, expecting the event - await expect(accessController.connect(admin).grantRole(Role.FEE_COLLECTOR, feeCollector.address)) + await expect(accessController.connect(admin).grantRole(Role.FEE_COLLECTOR, await feeCollector.getAddress())) .to.emit(accessController, "RoleGranted") - .withArgs(Role.FEE_COLLECTOR, feeCollector.address, admin.address); + .withArgs(Role.FEE_COLLECTOR, await feeCollector.getAddress(), await admin.getAddress()); // Test expect( - await accessController.hasRole(Role.FEE_COLLECTOR, feeCollector.address), + await accessController.hasRole(Role.FEE_COLLECTOR, await feeCollector.getAddress()), "ADMIN role can't grant FEE_COLLECTOR role" ).is.true; }); @@ -217,254 +217,254 @@ describe("AccessController", function () { context("📋 Any ADMIN can revoke all other roles", async function () { beforeEach(async function () { // Deployer grants roles to other addresses - await accessController.connect(deployer).grantRole(Role.ADMIN, admin.address); - await accessController.connect(deployer).grantRole(Role.PROTOCOL, protocol.address); - await accessController.connect(deployer).grantRole(Role.UPGRADER, upgrader.address); - await accessController.connect(deployer).grantRole(Role.PAUSER, pauser.address); - await accessController.connect(deployer).grantRole(Role.CLIENT, client.address); - await accessController.connect(deployer).grantRole(Role.FEE_COLLECTOR, feeCollector.address); + await accessController.connect(deployer).grantRole(Role.ADMIN, await admin.getAddress()); + await accessController.connect(deployer).grantRole(Role.PROTOCOL, await protocol.getAddress()); + await accessController.connect(deployer).grantRole(Role.UPGRADER, await upgrader.getAddress()); + await accessController.connect(deployer).grantRole(Role.PAUSER, await pauser.getAddress()); + await accessController.connect(deployer).grantRole(Role.CLIENT, await client.getAddress()); + await accessController.connect(deployer).grantRole(Role.FEE_COLLECTOR, await feeCollector.getAddress()); }); it("ADMIN role should be able to revoke ADMIN role", async function () { // Revoke Role, expecting the event - await expect(accessController.connect(admin).revokeRole(Role.ADMIN, deployer.address)) + await expect(accessController.connect(admin).revokeRole(Role.ADMIN, await deployer.getAddress())) .to.emit(accessController, "RoleRevoked") - .withArgs(Role.ADMIN, deployer.address, admin.address); + .withArgs(Role.ADMIN, await deployer.getAddress(), await admin.getAddress()); // Test expect( - await accessController.hasRole(Role.ADMIN, deployer.address), + await accessController.hasRole(Role.ADMIN, await deployer.getAddress()), "ADMIN role can't revoke ADMIN role" ).is.false; }); it("ADMIN role should be able to revoke PROTOCOL role", async function () { // Revoke Role, expecting the event - await expect(accessController.connect(admin).revokeRole(Role.PROTOCOL, protocol.address)) + await expect(accessController.connect(admin).revokeRole(Role.PROTOCOL, await protocol.getAddress())) .to.emit(accessController, "RoleRevoked") - .withArgs(Role.PROTOCOL, protocol.address, admin.address); + .withArgs(Role.PROTOCOL, await protocol.getAddress(), await admin.getAddress()); // Test expect( - await accessController.hasRole(Role.PROTOCOL, protocol.address), + await accessController.hasRole(Role.PROTOCOL, await protocol.getAddress()), "ADMIN role can't revoke PROTOCOL role" ).is.false; }); it("ADMIN role should be able to revoke UPGRADER role", async function () { // Revoke Role, expecting the event - await expect(accessController.connect(admin).revokeRole(Role.UPGRADER, upgrader.address)) + await expect(accessController.connect(admin).revokeRole(Role.UPGRADER, await upgrader.getAddress())) .to.emit(accessController, "RoleRevoked") - .withArgs(Role.UPGRADER, upgrader.address, admin.address); + .withArgs(Role.UPGRADER, await upgrader.getAddress(), await admin.getAddress()); // Test expect( - await accessController.hasRole(Role.UPGRADER, upgrader.address), + await accessController.hasRole(Role.UPGRADER, await upgrader.getAddress()), "ADMIN role can't revoke UPGRADER role" ).is.false; }); it("ADMIN role should be able to revoke PAUSER role", async function () { // Revoke Role, expecting the event - await expect(accessController.connect(admin).revokeRole(Role.PAUSER, pauser.address)) + await expect(accessController.connect(admin).revokeRole(Role.PAUSER, await pauser.getAddress())) .to.emit(accessController, "RoleRevoked") - .withArgs(Role.PAUSER, pauser.address, admin.address); + .withArgs(Role.PAUSER, await pauser.getAddress(), await admin.getAddress()); // Test expect( - await accessController.hasRole(Role.PAUSER, pauser.address), + await accessController.hasRole(Role.PAUSER, await pauser.getAddress()), "ADMIN role can't revoke PAUSER role" ).is.false; }); it("ADMIN role should be able to revoke CLIENT role", async function () { // Revoke Role, expecting the event - await expect(accessController.connect(admin).revokeRole(Role.CLIENT, client.address)) + await expect(accessController.connect(admin).revokeRole(Role.CLIENT, await client.getAddress())) .to.emit(accessController, "RoleRevoked") - .withArgs(Role.CLIENT, client.address, admin.address); + .withArgs(Role.CLIENT, await client.getAddress(), await admin.getAddress()); // Test expect( - await accessController.hasRole(Role.CLIENT, client.address), + await accessController.hasRole(Role.CLIENT, await client.getAddress()), "ADMIN role can't revoke CLIENT role" ).is.false; }); it("ADMIN role should be able to revoke FEE_COLLECTOR role", async function () { // Revoke Role, expecting the event - await expect(accessController.connect(admin).revokeRole(Role.FEE_COLLECTOR, feeCollector.address)) + await expect(accessController.connect(admin).revokeRole(Role.FEE_COLLECTOR, await feeCollector.getAddress())) .to.emit(accessController, "RoleRevoked") - .withArgs(Role.FEE_COLLECTOR, feeCollector.address, admin.address); + .withArgs(Role.FEE_COLLECTOR, await feeCollector.getAddress(), await admin.getAddress()); // Test expect( - await accessController.hasRole(Role.FEE_COLLECTOR, feeCollector.address), + await accessController.hasRole(Role.FEE_COLLECTOR, await feeCollector.getAddress()), "ADMIN role can't revoke FEE_COLLECTOR role" ).is.false; }); it("Should not emit 'RoleRevoked' event if revoking a role that was not granted", async function () { // Revoke Role, should not emit the event - await expect(accessController.connect(admin).revokeRole(Role.ADMIN, rando.address)).to.not.emit( + await expect(accessController.connect(admin).revokeRole(Role.ADMIN, await rando.getAddress())).to.not.emit( accessController, "RoleRevoked" ); // Test - expect(await accessController.hasRole(Role.ADMIN, rando.address)).is.false; + expect(await accessController.hasRole(Role.ADMIN, await rando.getAddress())).is.false; }); }); context("📋 Any roled address can renounce its roles", async function () { beforeEach(async function () { // Deployer grants roles to other addresses - await accessController.connect(deployer).grantRole(Role.ADMIN, admin.address); - await accessController.connect(deployer).grantRole(Role.PROTOCOL, protocol.address); - await accessController.connect(deployer).grantRole(Role.UPGRADER, upgrader.address); - await accessController.connect(deployer).grantRole(Role.PAUSER, pauser.address); - await accessController.connect(deployer).grantRole(Role.CLIENT, client.address); - await accessController.connect(deployer).grantRole(Role.FEE_COLLECTOR, feeCollector.address); + await accessController.connect(deployer).grantRole(Role.ADMIN, await admin.getAddress()); + await accessController.connect(deployer).grantRole(Role.PROTOCOL, await protocol.getAddress()); + await accessController.connect(deployer).grantRole(Role.UPGRADER, await upgrader.getAddress()); + await accessController.connect(deployer).grantRole(Role.PAUSER, await pauser.getAddress()); + await accessController.connect(deployer).grantRole(Role.CLIENT, await client.getAddress()); + await accessController.connect(deployer).grantRole(Role.FEE_COLLECTOR, await feeCollector.getAddress()); }); it("ADMIN role should be able to renounce ADMIN role", async function () { // Renounce Role, expecting the event - await expect(accessController.connect(admin).renounceRole(Role.ADMIN, admin.address)) + await expect(accessController.connect(admin).renounceRole(Role.ADMIN, await admin.getAddress())) .to.emit(accessController, "RoleRevoked") - .withArgs(Role.ADMIN, admin.address, admin.address); + .withArgs(Role.ADMIN, await admin.getAddress(), await admin.getAddress()); // Test expect( - await accessController.hasRole(Role.ADMIN, admin.address), + await accessController.hasRole(Role.ADMIN, await admin.getAddress()), "ADMIN role can't renounce ADMIN role" ).is.false; }); it("PROTOCOL role should be able to renounce PROTOCOL role", async function () { // Renounce Role, expecting the event - await expect(accessController.connect(protocol).renounceRole(Role.PROTOCOL, protocol.address)) + await expect(accessController.connect(protocol).renounceRole(Role.PROTOCOL, await protocol.getAddress())) .to.emit(accessController, "RoleRevoked") - .withArgs(Role.PROTOCOL, protocol.address, protocol.address); + .withArgs(Role.PROTOCOL, await protocol.getAddress(), await protocol.getAddress()); // Test expect( - await accessController.hasRole(Role.PROTOCOL, protocol.address), + await accessController.hasRole(Role.PROTOCOL, await protocol.getAddress()), "PROTOCOL role can't renounce PROTOCOL role" ).is.false; }); it("UPGRADER role should be able to renounce UPGRADER role", async function () { // Renounce Role, expecting the event - await expect(accessController.connect(upgrader).renounceRole(Role.UPGRADER, upgrader.address)) + await expect(accessController.connect(upgrader).renounceRole(Role.UPGRADER, await upgrader.getAddress())) .to.emit(accessController, "RoleRevoked") - .withArgs(Role.UPGRADER, upgrader.address, upgrader.address); + .withArgs(Role.UPGRADER, await upgrader.getAddress(), await upgrader.getAddress()); // Test expect( - await accessController.hasRole(Role.UPGRADER, upgrader.address), + await accessController.hasRole(Role.UPGRADER, await upgrader.getAddress()), "UPGRADER role can't renounce UPGRADER role" ).is.false; }); it("PAUSER role should be able to renounce PAUSER role", async function () { // Renounce Role, expecting the event - await expect(accessController.connect(pauser).renounceRole(Role.PAUSER, pauser.address)) + await expect(accessController.connect(pauser).renounceRole(Role.PAUSER, await pauser.getAddress())) .to.emit(accessController, "RoleRevoked") - .withArgs(Role.PAUSER, pauser.address, pauser.address); + .withArgs(Role.PAUSER, await pauser.getAddress(), await pauser.getAddress()); // Test expect( - await accessController.hasRole(Role.PAUSER, pauser.address), + await accessController.hasRole(Role.PAUSER, await pauser.getAddress()), "PAUSER role can't renounce PAUSER role" ).is.false; }); it("CLIENT role should be able to renounce CLIENT role", async function () { // Renounce Role, expecting the event - await expect(accessController.connect(client).renounceRole(Role.CLIENT, client.address)) + await expect(accessController.connect(client).renounceRole(Role.CLIENT, await client.getAddress())) .to.emit(accessController, "RoleRevoked") - .withArgs(Role.CLIENT, client.address, client.address); + .withArgs(Role.CLIENT, await client.getAddress(), await client.getAddress()); // Test expect( - await accessController.hasRole(Role.CLIENT, client.address), + await accessController.hasRole(Role.CLIENT, await client.getAddress()), "CLIENT role can't renounce CLIENT role" ).is.false; }); it("FEE_COLLECTOR role should be able to renounce FEE_COLLECTOR role", async function () { // Renounce Role, expecting the event - await expect(accessController.connect(feeCollector).renounceRole(Role.FEE_COLLECTOR, feeCollector.address)) + await expect(accessController.connect(feeCollector).renounceRole(Role.FEE_COLLECTOR, await feeCollector.getAddress())) .to.emit(accessController, "RoleRevoked") - .withArgs(Role.FEE_COLLECTOR, feeCollector.address, feeCollector.address); + .withArgs(Role.FEE_COLLECTOR, await feeCollector.getAddress(), await feeCollector.getAddress()); // Test expect( - await accessController.hasRole(Role.FEE_COLLECTOR, feeCollector.address), + await accessController.hasRole(Role.FEE_COLLECTOR, await feeCollector.getAddress()), "FEE_COLLECTOR role can't renounce FEE_COLLECTOR role" ).is.false; }); it("Should not emit 'RoleRevoked' event if renouncing a role that was not granted", async function () { // Renounce Role, should not emit the event - await expect(accessController.connect(rando).renounceRole(Role.ADMIN, rando.address)).to.not.emit( + await expect(accessController.connect(rando).renounceRole(Role.ADMIN, await rando.getAddress())).to.not.emit( accessController, "RoleRevoked" ); // Test - expect(await accessController.hasRole(Role.ADMIN, rando.address)).is.false; + expect(await accessController.hasRole(Role.ADMIN, await rando.getAddress())).is.false; }); }); context("📋 Any address can have multiple roles", async function () { beforeEach(async function () { // Deployer grants ADMIN to another address - await accessController.connect(deployer).grantRole(Role.ADMIN, admin.address); + await accessController.connect(deployer).grantRole(Role.ADMIN, await admin.getAddress()); }); it("ADMIN role should be able to grant multiple roles to same address", async function () { // Grant all roles to associate try { - await accessController.connect(admin).grantRole(Role.ADMIN, associate.address); - await accessController.connect(admin).grantRole(Role.PROTOCOL, associate.address); - await accessController.connect(admin).grantRole(Role.UPGRADER, associate.address); - await accessController.connect(admin).grantRole(Role.PAUSER, associate.address); - await accessController.connect(admin).grantRole(Role.CLIENT, associate.address); - await accessController.connect(admin).grantRole(Role.FEE_COLLECTOR, associate.address); + await accessController.connect(admin).grantRole(Role.ADMIN, await associate.getAddress()); + await accessController.connect(admin).grantRole(Role.PROTOCOL, await associate.getAddress()); + await accessController.connect(admin).grantRole(Role.UPGRADER, await associate.getAddress()); + await accessController.connect(admin).grantRole(Role.PAUSER, await associate.getAddress()); + await accessController.connect(admin).grantRole(Role.CLIENT, await associate.getAddress()); + await accessController.connect(admin).grantRole(Role.FEE_COLLECTOR, await associate.getAddress()); } catch (e) {} // Check roles all apply for associate - expect(await accessController.hasRole(Role.ADMIN, associate.address)).is.true; - expect(await accessController.hasRole(Role.PROTOCOL, associate.address)).is.true; - expect(await accessController.hasRole(Role.UPGRADER, associate.address)).is.true; - expect(await accessController.hasRole(Role.PAUSER, associate.address)).is.true; - expect(await accessController.hasRole(Role.CLIENT, associate.address)).is.true; - expect(await accessController.hasRole(Role.FEE_COLLECTOR, associate.address)).is.true; + expect(await accessController.hasRole(Role.ADMIN, await associate.getAddress())).is.true; + expect(await accessController.hasRole(Role.PROTOCOL, await associate.getAddress())).is.true; + expect(await accessController.hasRole(Role.UPGRADER, await associate.getAddress())).is.true; + expect(await accessController.hasRole(Role.PAUSER, await associate.getAddress())).is.true; + expect(await accessController.hasRole(Role.CLIENT, await associate.getAddress())).is.true; + expect(await accessController.hasRole(Role.FEE_COLLECTOR, await associate.getAddress())).is.true; }); }); context("💔 Revert Reasons", async function () { it("Caller is different from account to be renounced", async function () { // Renounce Role, expecting revert - await expect(accessController.connect(admin).renounceRole(Role.ADMIN, deployer.address)).to.be.revertedWith( + await expect(accessController.connect(admin).renounceRole(Role.ADMIN, await deployer.getAddress())).to.be.revertedWith( RevertReasons.CAN_ONLY_REVOKE_SELF ); }); it("Should revert if caller tries to grantRole but doesn't have ADMIN role", async function () { // Grant Role, expecting revert - await expect(accessController.connect(rando).grantRole(Role.ADMIN, rando.address)).to.be.revertedWith( - `AccessControl: account ${rando.address.toLowerCase()} is missing role ${Role.ADMIN}` + await expect(accessController.connect(rando).grantRole(Role.ADMIN, await rando.getAddress())).to.be.revertedWith( + `AccessControl: account ${await rando.getAddress().toLowerCase()} is missing role ${Role.ADMIN}` ); }); it("Should revert if caller tries to revokeRole but doesn't have ADMIN role", async function () { // Grant role - await accessController.connect(deployer).grantRole(Role.PAUSER, pauser.address); + await accessController.connect(deployer).grantRole(Role.PAUSER, await pauser.getAddress()); // Revoke Role, expecting revert - await expect(accessController.connect(rando).revokeRole(Role.PAUSER, pauser.address)).to.be.revertedWith( - `AccessControl: account ${rando.address.toLowerCase()} is missing role ${Role.ADMIN}` + await expect(accessController.connect(rando).revokeRole(Role.PAUSER, await pauser.getAddress())).to.be.revertedWith( + `AccessControl: account ${await rando.getAddress().toLowerCase()} is missing role ${Role.ADMIN}` ); }); }); diff --git a/test/example/SnapshotGateTest.js b/test/example/SnapshotGateTest.js index 58a06185d..f8ad69bdf 100644 --- a/test/example/SnapshotGateTest.js +++ b/test/example/SnapshotGateTest.js @@ -91,16 +91,16 @@ describe("SnapshotGate", function () { [protocolDiamond, , , , accessController] = await deployProtocolDiamond(maxPriorityFeePerGas); // Temporarily grant UPGRADER role to deployer account - await accessController.grantRole(Role.UPGRADER, deployer.address); + await accessController.grantRole(Role.UPGRADER, await deployer.getAddress()); // Grant PROTOCOL role to ProtocolDiamond address and renounces admin - await accessController.grantRole(Role.PROTOCOL, protocolDiamond.address); + await accessController.grantRole(Role.PROTOCOL, await protocolDiamond.getAddress()); // Temporarily grant PAUSER role to pauser account - await accessController.grantRole(Role.PAUSER, pauser.address); + await accessController.grantRole(Role.PAUSER, await pauser.getAddress()); // Deploy the Protocol client implementation/proxy pairs (currently just the Boson Voucher) - const protocolClientArgs = [protocolDiamond.address]; + const protocolClientArgs = [await protocolDiamond.getAddress()]; const [, beacons, proxies] = await deployProtocolClients(protocolClientArgs, maxPriorityFeePerGas); const [beacon] = beacons; const [proxy] = proxies; @@ -114,10 +114,10 @@ describe("SnapshotGate", function () { const protocolConfig = [ // Protocol addresses { - treasury: protocolTreasury.address, - token: bosonToken.address, - voucherBeacon: beacon.address, - beaconProxy: proxy.address, + treasury: await protocolTreasury.getAddress(), + token: await bosonToken.getAddress(), + voucherBeacon: await beacon.getAddress(), + beaconProxy: await proxy.getAddress(), }, // Protocol limits { @@ -159,23 +159,23 @@ describe("SnapshotGate", function () { const facetsToDeploy = await getFacetsWithArgs(facetNames, protocolConfig); // Cut the protocol handler facets into the Diamond - await deployAndCutFacets(protocolDiamond.address, facetsToDeploy, maxPriorityFeePerGas); + await deployAndCutFacets(await protocolDiamond.getAddress(), facetsToDeploy, maxPriorityFeePerGas); // Cast Diamond to IBosonAccountHandler. Use this interface to call all individual account handlers - accountHandler = await getContractAt("IBosonAccountHandler", protocolDiamond.address); + accountHandler = await getContractAt("IBosonAccountHandler", await protocolDiamond.getAddress()); // Cast Diamond to IBosonOfferHandler - offerHandler = await getContractAt("IBosonOfferHandler", protocolDiamond.address); + offerHandler = await getContractAt("IBosonOfferHandler", await protocolDiamond.getAddress()); // Cast Diamond to IGroupHandler - groupHandler = await getContractAt("IBosonGroupHandler", protocolDiamond.address); + groupHandler = await getContractAt("IBosonGroupHandler", await protocolDiamond.getAddress()); // Cast Diamond to IBosonExchangeHandler - exchangeHandler = await getContractAt("IBosonExchangeHandler", protocolDiamond.address); + exchangeHandler = await getContractAt("IBosonExchangeHandler", await protocolDiamond.getAddress()); // Deploy the SnapshotGate example sellerId = "1"; - [snapshotGate] = await deploySnapshotGateExample(["SnapshotGateToken", "SGT", protocolDiamond.address, sellerId]); + [snapshotGate] = await deploySnapshotGateExample(["SnapshotGateToken", "SGT", await protocolDiamond.getAddress(), sellerId]); // Deploy the mock tokens [foreign20] = await deployMockTokens(["Foreign20"]); @@ -186,11 +186,11 @@ describe("SnapshotGate", function () { agentId = "0"; // agent id is optional while creating an offer // Create a valid seller - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); expect(seller.isValid()).is.true; // Create a second seller - seller2 = mockSeller(assistant2.address, assistant2.address, ZeroAddress, assistant2.address); + seller2 = mockSeller(await assistant2.getAddress(), await assistant2.getAddress(), ZeroAddress, await assistant2.getAddress()); expect(seller2.isValid()).is.true; // AuthToken @@ -209,10 +209,10 @@ describe("SnapshotGate", function () { // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -220,7 +220,7 @@ describe("SnapshotGate", function () { // Create DisputeResolverFee array so offer creation will succeed disputeResolverFees = [ new DisputeResolverFee(ZeroAddress, "Native", "0"), - new DisputeResolverFee(foreign20.address, "Foriegn20", "0"), + new DisputeResolverFee(await foreign20.getAddress(), "Foriegn20", "0"), ]; // Make empty seller list, so every seller is allowed @@ -243,19 +243,19 @@ describe("SnapshotGate", function () { ]; holderByAddress = { - [holder1.address]: holder1, - [holder2.address]: holder2, - [holder3.address]: holder3, - [holder4.address]: holder4, - [holder5.address]: holder5, + [await holder1.getAddress()]: holder1, + [await holder2.getAddress()]: holder2, + [await holder3.getAddress()]: holder3, + [await holder4.getAddress()]: holder4, + [await holder5.getAddress()]: holder5, }; // Each holder will have a random amount of each token for (let holder of holders) { // Mint a bunch of exchange tokens for the holder and approve the gate to transfer them const amountToMint = "15000000000000000000"; - await foreign20.connect(holder).mint(holder.address, amountToMint); - await foreign20.connect(holder).approve(snapshotGate.address, amountToMint); + await foreign20.connect(holder).mint(await holder.getAddress(), amountToMint); + await foreign20.connect(holder).approve(await snapshotGate.getAddress(), amountToMint); // Create snapshot entry for holder / token for (let i = 1; i <= snapshotTokenCount; i++) { @@ -270,7 +270,7 @@ describe("SnapshotGate", function () { // Add snapshot entry snapshot.push({ - owner: holder.address, + owner: await holder.getAddress(), tokenId: i.toString(), amount: balance.toString(), }); @@ -301,7 +301,7 @@ describe("SnapshotGate", function () { // Set price in ERC-20 token if on second pass if (j > 0) { - offer.exchangeToken = foreign20.address; + offer.exchangeToken = await foreign20.getAddress(); offer.buyerCancelPenalty = "0"; } @@ -325,7 +325,7 @@ describe("SnapshotGate", function () { // Create Condition condition = mockCondition({ - tokenAddress: snapshotGate.address, + tokenAddress: await snapshotGate.getAddress(), threshold: "0", maxCommits: tokenSupply, tokenType: TokenType.NonFungibleToken, @@ -387,7 +387,7 @@ describe("SnapshotGate", function () { const event = getEvent(txReceipt, snapshotGate, "SnapshotAppended"); // Check executedBy - expect(event.executedBy.toString()).to.equal(deployer.address.toString()); + expect(event.executedBy.toString()).to.equal(await deployer.getAddress().toString()); // Verify batch contents emitted match what was sent for (let i = 0; i < batch.length; i++) { @@ -410,7 +410,7 @@ describe("SnapshotGate", function () { let event = getEvent(txReceipt, snapshotGate, "SnapshotAppended"); // Check executedBy - expect(event.executedBy.toString()).to.equal(deployer.address.toString()); + expect(event.executedBy.toString()).to.equal(await deployer.getAddress().toString()); // Verify batch contents emitted match what was sent for (let i = 0; i < batch1.length; i++) { @@ -426,7 +426,7 @@ describe("SnapshotGate", function () { event = getEvent(txReceipt, snapshotGate, "SnapshotAppended"); // Check executedBy - expect(event.executedBy.toString()).to.equal(deployer.address.toString()); + expect(event.executedBy.toString()).to.equal(await deployer.getAddress().toString()); // Verify batch contents emitted match what was sent for (let i = 0; i < batch2.length; i++) { @@ -446,7 +446,7 @@ describe("SnapshotGate", function () { for (let i = 1; i <= snapshotTokenCount; i++) { const tokenId = i.toString(); const owner = await snapshotGate.ownerOf(tokenId); - expect(owner).to.equal(snapshotGate.address); + expect(owner).to.equal(await snapshotGate.getAddress()); } }); @@ -459,7 +459,7 @@ describe("SnapshotGate", function () { for (let i = 1; i <= snapshotTokenCount; i++) { const tokenId = i.toString(); const owner = await snapshotGate.ownerOf(tokenId); - expect(owner).to.equal(snapshotGate.address); + expect(owner).to.equal(await snapshotGate.getAddress()); } }); @@ -496,7 +496,7 @@ describe("SnapshotGate", function () { it("should emit a SnapshotFrozen event", async function () { await expect(snapshotGate.connect(deployer).freezeSnapshot()) .to.emit(snapshotGate, "SnapshotFrozen") - .withArgs(deployer.address); + .withArgs(await deployer.getAddress()); }); it("should store true value for snapshotFrozen", async function () { @@ -548,7 +548,7 @@ describe("SnapshotGate", function () { snapshotGate.connect(holder).commitToGatedOffer(entry.owner, offerId, entry.tokenId, { value: price }) ) .to.emit(snapshotGate, "SnapshotTokenCommitted") - .withArgs(entry.owner, offerId, entry.tokenId, holder.address); + .withArgs(entry.owner, offerId, entry.tokenId, await holder.getAddress()); }); it("should emit a SnapshotTokenCommitted event when price is in ERC20 token", async function () { @@ -570,7 +570,7 @@ describe("SnapshotGate", function () { // Commit to the offer await expect(snapshotGate.connect(holder).commitToGatedOffer(entry.owner, offerId, entry.tokenId)) .to.emit(snapshotGate, "SnapshotTokenCommitted") - .withArgs(entry.owner, offerId, entry.tokenId, holder.address); + .withArgs(entry.owner, offerId, entry.tokenId, await holder.getAddress()); }); context("💔 Revert Reasons", async function () { @@ -592,7 +592,7 @@ describe("SnapshotGate", function () { // Commit to the offer await expect( - snapshotGate.connect(caller).commitToGatedOffer(caller.address, offerId, entry.tokenId, { value: price }) + snapshotGate.connect(caller).commitToGatedOffer(await caller.getAddress(), offerId, entry.tokenId, { value: price }) ).to.revertedWith("Invalid offer id"); }); @@ -611,7 +611,7 @@ describe("SnapshotGate", function () { // Commit to the offer await expect( - snapshotGate.connect(caller).commitToGatedOffer(caller.address, offerId, entry.tokenId, { value: price }) + snapshotGate.connect(caller).commitToGatedOffer(await caller.getAddress(), offerId, entry.tokenId, { value: price }) ).to.revertedWith("Snapshot is not frozen"); }); @@ -633,7 +633,7 @@ describe("SnapshotGate", function () { // Commit to the offer await expect( - snapshotGate.connect(caller).commitToGatedOffer(caller.address, offerId, entry.tokenId, { value: price }) + snapshotGate.connect(caller).commitToGatedOffer(await caller.getAddress(), offerId, entry.tokenId, { value: price }) ).to.revertedWith("Buyer held no balance of the given token id at time of snapshot"); }); @@ -711,7 +711,7 @@ describe("SnapshotGate", function () { await expect( snapshotGate .connect(caller) - .commitToGatedOffer(caller.address, otherSellerOfferId, entry.tokenId, { value: price }) + .commitToGatedOffer(await caller.getAddress(), otherSellerOfferId, entry.tokenId, { value: price }) ).to.revertedWith("Offer is from another seller"); }); @@ -757,7 +757,7 @@ describe("SnapshotGate", function () { let holder = holderByAddress[entry.owner]; // Zero out the gate's approval to transfer the holder's payment ERC20 tokens - await foreign20.connect(holder).approve(snapshotGate.address, "0"); + await foreign20.connect(holder).approve(await snapshotGate.getAddress(), "0"); // Commit to the offer await expect( @@ -850,7 +850,7 @@ describe("SnapshotGate", function () { for (let i = 1; i <= snapshotTokenCount; i++) { const tokenId = i.toString(); const owner = await snapshotGate.connect(rando).ownerOf(tokenId); - expect(owner).to.equal(snapshotGate.address); + expect(owner).to.equal(await snapshotGate.getAddress()); } }); @@ -890,7 +890,7 @@ describe("SnapshotGate", function () { let holder = holderByAddress[entry.owner]; // Check that holder cannot commit directly to the offer on the protocol itself - await expect(exchangeHandler.connect(holder).commitToOffer(holder.address, offerId)).to.revertedWith( + await expect(exchangeHandler.connect(holder).commitToOffer(await holder.getAddress(), offerId)).to.revertedWith( "Caller cannot commit" ); }); diff --git a/test/integration/01-update-account-roles-addresses.js b/test/integration/01-update-account-roles-addresses.js index e6e651047..582f7b506 100644 --- a/test/integration/01-update-account-roles-addresses.js +++ b/test/integration/01-update-account-roles-addresses.js @@ -75,24 +75,24 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { let expectedCloneAddress, emptyAuthToken, voucherInitValues; beforeEach(async function () { - expectedCloneAddress = calculateContractAddress(accountHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "1"); emptyAuthToken = mockAuthToken(); expect(emptyAuthToken.isValid()).is.true; voucherInitValues = mockVoucherInitValues(); expect(voucherInitValues.isValid()).is.true; // Create a seller account - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); await expect(accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues)) .to.emit(accountHandler, "SellerCreated") - .withArgs(seller.id, seller.toStruct(), expectedCloneAddress, emptyAuthToken.toStruct(), admin.address); + .withArgs(seller.id, seller.toStruct(), expectedCloneAddress, emptyAuthToken.toStruct(), await admin.getAddress()); // Create a dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -111,7 +111,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { .connect(adminDR) .createDisputeResolver(disputeResolver, disputeResolverFees, sellerAllowList); - agentAccount = mockAgent(agent.address); + agentAccount = mockAgent(await agent.getAddress()); expect(agentAccount.isValid()).is.true; // Create an agent @@ -138,17 +138,17 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { .depositFunds(seller.id, ZeroAddress, offer.sellerDeposit, { value: offer.sellerDeposit }); // Create a buyer account - buyerAccount = mockBuyer(buyer.address); + buyerAccount = mockBuyer(await buyer.getAddress()); expect(await accountHandler.createBuyer(buyerAccount)) .to.emit(accountHandler, "BuyerCreated") - .withArgs(buyerAccount.id, buyerAccount.toStruct(), buyer.address); + .withArgs(buyerAccount.id, buyerAccount.toStruct(), await buyer.getAddress()); // Set time forward to the offer's voucherRedeemableFrom await setNextBlockTimestamp(Number(offerDates.voucherRedeemableFrom)); // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offer.id, { value: offer.price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offer.id, { value: offer.price }); exchangeId = "1"; @@ -164,14 +164,14 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { }); it("Seller should be able to revoke the voucher after updating assistant address", async function () { - seller.assistant = rando.address; + seller.assistant = await rando.getAddress(); expect(seller.isValid()).is.true; - sellerPendingUpdate.assistant = rando.address; + sellerPendingUpdate.assistant = await rando.getAddress(); // Update the seller wallet, testing for the event await expect(accountHandler.connect(admin).updateSeller(seller, emptyAuthToken)) .to.emit(accountHandler, "SellerUpdatePending") - .withArgs(seller.id, sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), admin.address); + .withArgs(seller.id, sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), await admin.getAddress()); sellerPendingUpdate.assistant = ZeroAddress; @@ -184,24 +184,24 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), emptyAuthToken.toStruct(), - rando.address + await rando.getAddress() ); // Revoke the voucher await expect(exchangeHandler.connect(rando).revokeVoucher(exchangeId)) .to.emit(exchangeHandler, "VoucherRevoked") - .withArgs(offer.id, exchangeId, rando.address); + .withArgs(offer.id, exchangeId, await rando.getAddress()); }); it("Seller should be able to extend the voucher after updating assistant address", async function () { - seller.assistant = rando.address; + seller.assistant = await rando.getAddress(); expect(seller.isValid()).is.true; - sellerPendingUpdate.assistant = rando.address; + sellerPendingUpdate.assistant = await rando.getAddress(); // Update the seller wallet, testing for the event await expect(accountHandler.connect(admin).updateSeller(seller, emptyAuthToken)) .to.emit(accountHandler, "SellerUpdatePending") - .withArgs(seller.id, sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), admin.address); + .withArgs(seller.id, sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), await admin.getAddress()); sellerPendingUpdate.assistant = ZeroAddress; @@ -214,14 +214,14 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), emptyAuthToken.toStruct(), - rando.address + await rando.getAddress() ); // Extend the voucher const newValidUntil = offerDates.validUntil * 12; await expect(exchangeHandler.connect(rando).extendVoucher(exchangeId, newValidUntil)) .to.emit(exchangeHandler, "VoucherExtended") - .withArgs(offer.id, exchangeId, newValidUntil, rando.address); + .withArgs(offer.id, exchangeId, newValidUntil, await rando.getAddress()); }); context("After cancel actions", function () { @@ -237,13 +237,13 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { }); it("Buyer should be able to withdraw funds after updating wallet address", async function () { - buyerAccount.wallet = rando.address; + buyerAccount.wallet = await rando.getAddress(); expect(buyerAccount.isValid()).is.true; // Update the buyer wallet, testing for the event await expect(accountHandler.connect(buyer).updateBuyer(buyerAccount)) .to.emit(accountHandler, "BuyerUpdated") - .withArgs(buyerAccount.id, buyerAccount.toStruct(), buyer.address); + .withArgs(buyerAccount.id, buyerAccount.toStruct(), await buyer.getAddress()); // Attempt to withdraw funds with old buyer wallet, should fail await expect( @@ -255,18 +255,18 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { fundsHandler.connect(rando).withdrawFunds(buyerAccount.id, [ZeroAddress], [buyerPayoff]) ) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(buyerAccount.id, rando.address, ZeroAddress, buyerPayoff, rando.address); + .withArgs(buyerAccount.id, await rando.getAddress(), ZeroAddress, buyerPayoff, await rando.getAddress()); }); it("Seller should be able to withdraw funds after updating assistant address", async function () { - seller.assistant = rando.address; + seller.assistant = await rando.getAddress(); expect(seller.isValid()).is.true; - sellerPendingUpdate.assistant = rando.address; + sellerPendingUpdate.assistant = await rando.getAddress(); // Update the seller wallet, testing for the event await expect(accountHandler.connect(admin).updateSeller(seller, emptyAuthToken)) .to.emit(accountHandler, "SellerUpdatePending") - .withArgs(seller.id, sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), admin.address); + .withArgs(seller.id, sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), await admin.getAddress()); sellerPendingUpdate.assistant = ZeroAddress; @@ -279,7 +279,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), emptyAuthToken.toStruct(), - rando.address + await rando.getAddress() ); // Attempt to withdraw funds with old seller assistant, should fail @@ -292,7 +292,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { fundsHandler.connect(rando).withdrawFunds(seller.id, [ZeroAddress], [sellerPayoff]) ) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(seller.id, treasury.address, ZeroAddress, sellerPayoff, rando.address); + .withArgs(seller.id, await treasury.getAddress(), ZeroAddress, sellerPayoff, await rando.getAddress()); }); }); @@ -308,13 +308,13 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { // Complete the exchange await exchangeHandler.connect(buyer).completeExchange(exchangeId); - agentAccount.wallet = rando.address; + agentAccount.wallet = await rando.getAddress(); expect(agentAccount.isValid()).is.true; // Update the agent wallet, testing for the event await expect(accountHandler.connect(agent).updateAgent(agentAccount)) .to.emit(accountHandler, "AgentUpdated") - .withArgs(agentAccount.id, agentAccount.toStruct(), agent.address); + .withArgs(agentAccount.id, agentAccount.toStruct(), await agent.getAddress()); const agentPayoff = applyPercentage(offer.price, agentAccount.feePercentage); @@ -328,17 +328,17 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { fundsHandler.connect(rando).withdrawFunds(agentAccount.id, [ZeroAddress], [agentPayoff]) ) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(agentAccount.id, rando.address, ZeroAddress, agentPayoff, rando.address); + .withArgs(agentAccount.id, await rando.getAddress(), ZeroAddress, agentPayoff, await rando.getAddress()); }); it("Buyer should be able to raise dispute after updating wallet address", async function () { - buyerAccount.wallet = rando.address; + buyerAccount.wallet = await rando.getAddress(); expect(buyerAccount.isValid()).is.true; // Update the buyer wallet, testing for the event await expect(accountHandler.connect(buyer).updateBuyer(buyerAccount)) .to.emit(accountHandler, "BuyerUpdated") - .withArgs(buyerAccount.id, buyerAccount.toStruct(), buyer.address); + .withArgs(buyerAccount.id, buyerAccount.toStruct(), await buyer.getAddress()); // Attempt to raise a dispute with old buyer wallet, should fail await expect(disputeHandler.connect(buyer).raiseDispute(exchangeId)).to.revertedWith( @@ -348,23 +348,23 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { // Attempt to raise a dispute with new buyer wallet, should succeed await expect(disputeHandler.connect(rando).raiseDispute(exchangeId)) .to.emit(disputeHandler, "DisputeRaised") - .withArgs(exchangeId, buyerAccount.id, seller.id, rando.address); + .withArgs(exchangeId, buyerAccount.id, seller.id, await rando.getAddress()); }); it("Buyer should be able to complete exchange before dispute period is over after updating wallet address", async function () { - buyerAccount.wallet = rando.address; + buyerAccount.wallet = await rando.getAddress(); expect(buyerAccount.isValid()).is.true; // Update the buyer wallet, testing for the event await expect(accountHandler.connect(buyer).updateBuyer(buyerAccount)) .to.emit(accountHandler, "BuyerUpdated") - .withArgs(buyerAccount.id, buyerAccount.toStruct(), buyer.address); + .withArgs(buyerAccount.id, buyerAccount.toStruct(), await buyer.getAddress()); // Complete the exchange, expecting event const tx = await exchangeHandler.connect(rando).completeExchange(exchangeId); await expect(tx) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offer.id, buyerAccount.id, exchangeId, rando.address); + .withArgs(offer.id, buyerAccount.id, exchangeId, await rando.getAddress()); const block = await provider.getBlock(tx.blockNumber); const disputePeriodEnd = redeemedDate+BigInt(offerDurations.disputePeriod); @@ -398,14 +398,14 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { }); it("Seller should be able to resolve dispute after updating assistant address", async function () { - seller.assistant = rando.address; + seller.assistant = await rando.getAddress(); expect(seller.isValid()).is.true; - sellerPendingUpdate.assistant = rando.address; + sellerPendingUpdate.assistant = await rando.getAddress(); // Update the seller wallet, testing for the event await expect(accountHandler.connect(admin).updateSeller(seller, emptyAuthToken)) .to.emit(accountHandler, "SellerUpdatePending") - .withArgs(seller.id, sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), admin.address); + .withArgs(seller.id, sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), await admin.getAddress()); sellerPendingUpdate.assistant = ZeroAddress; @@ -418,7 +418,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), emptyAuthToken.toStruct(), - rando.address + await rando.getAddress() ); // Collect the signature components @@ -427,7 +427,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { customSignatureType, "Resolution", message, - disputeHandler.address + await disputeHandler.getAddress() ); // Attempt to resolve a dispute with old seller assistant, should fail @@ -438,17 +438,17 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { // Attempt to resolve a dispute with new seller assistant, should succeed await expect(disputeHandler.connect(rando).resolveDispute(exchangeId, buyerPercent, r, s, v)) .to.emit(disputeHandler, "DisputeResolved") - .withArgs(exchangeId, buyerPercent, rando.address); + .withArgs(exchangeId, buyerPercent, await rando.getAddress()); }); it("Buyer should be able to resolve dispute after updating wallet address", async function () { - buyerAccount.wallet = rando.address; + buyerAccount.wallet = await rando.getAddress(); expect(buyerAccount.isValid()).is.true; // Update the buyer wallet, testing for the event await expect(accountHandler.connect(buyer).updateBuyer(buyerAccount)) .to.emit(accountHandler, "BuyerUpdated") - .withArgs(buyerAccount.id, buyerAccount.toStruct(), buyer.address); + .withArgs(buyerAccount.id, buyerAccount.toStruct(), await buyer.getAddress()); // Collect the signature components const { r, s, v } = await prepareDataSignatureParameters( @@ -456,7 +456,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { customSignatureType, "Resolution", message, - disputeHandler.address + await disputeHandler.getAddress() ); // Attempt to resolve a dispute with old buyer wallet, should fail @@ -467,17 +467,17 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { // Attempt to resolve a dispute with new buyer wallet, should succeed await expect(disputeHandler.connect(rando).resolveDispute(exchangeId, buyerPercent, r, s, v)) .to.emit(disputeHandler, "DisputeResolved") - .withArgs(exchangeId, buyerPercent, rando.address); + .withArgs(exchangeId, buyerPercent, await rando.getAddress()); }); it("If the buyer wallet address was changed, the seller should not be able to resolve a dispute with the old signature", async function () { - buyerAccount.wallet = rando.address; + buyerAccount.wallet = await rando.getAddress(); expect(buyerAccount.isValid()).is.true; // Update the buyer wallet, testing for the event await expect(accountHandler.connect(buyer).updateBuyer(buyerAccount)) .to.emit(accountHandler, "BuyerUpdated") - .withArgs(buyerAccount.id, buyerAccount.toStruct(), buyer.address); + .withArgs(buyerAccount.id, buyerAccount.toStruct(), await buyer.getAddress()); // Collect the signature components const { r, s, v } = await prepareDataSignatureParameters( @@ -485,7 +485,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { customSignatureType, "Resolution", message, - disputeHandler.address + await disputeHandler.getAddress() ); // Attempt to resolve a dispute with old buyer wallet, should fail @@ -495,14 +495,14 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { }); it("If the seller assistant address was changed, the buyer should not be able to resolve a dispute with the old signature", async function () { - seller.assistant = rando.address; + seller.assistant = await rando.getAddress(); expect(seller.isValid()).is.true; - sellerPendingUpdate.assistant = rando.address; + sellerPendingUpdate.assistant = await rando.getAddress(); // Update the seller wallet, testing for the event await expect(accountHandler.connect(admin).updateSeller(seller, emptyAuthToken)) .to.emit(accountHandler, "SellerUpdatePending") - .withArgs(seller.id, sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), admin.address); + .withArgs(seller.id, sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), await admin.getAddress()); sellerPendingUpdate.assistant = ZeroAddress; @@ -515,7 +515,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { sellerPendingUpdate.toStruct(), emptyAuthToken.toStruct(), emptyAuthToken.toStruct(), - rando.address + await rando.getAddress() ); // Collect the signature components @@ -524,7 +524,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { customSignatureType, "Resolution", message, - disputeHandler.address + await disputeHandler.getAddress() ); // Attempt to resolve a dispute with old buyer wallet, should fail @@ -534,13 +534,13 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { }); it("Buyer should be able to retract dispute after updating wallet address", async function () { - buyerAccount.wallet = rando.address; + buyerAccount.wallet = await rando.getAddress(); expect(buyerAccount.isValid()).is.true; // Update the buyer wallet, testing for the event await expect(accountHandler.connect(buyer).updateBuyer(buyerAccount)) .to.emit(accountHandler, "BuyerUpdated") - .withArgs(buyerAccount.id, buyerAccount.toStruct(), buyer.address); + .withArgs(buyerAccount.id, buyerAccount.toStruct(), await buyer.getAddress()); // Attempt to retract a dispute with old buyer, should fail await expect(disputeHandler.connect(buyer).retractDispute(exchangeId)).to.be.revertedWith( @@ -550,7 +550,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { // Attempt to retract a dispute with new buyer, should succeed await expect(disputeHandler.connect(rando).retractDispute(exchangeId)) .to.emit(disputeHandler, "DisputeRetracted") - .withArgs(exchangeId, rando.address); + .withArgs(exchangeId, await rando.getAddress()); }); context("After escalte dispute actions", function () { @@ -563,7 +563,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { // Escalate the dispute await disputeHandler.connect(buyer).escalateDispute(exchangeId, { value: buyerEscalationDepositNative }); - disputeResolver.assistant = rando.address; + disputeResolver.assistant = await rando.getAddress(); expect(disputeResolver.isValid()).is.true; // Update the dispute resolver assistant @@ -584,7 +584,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { // Attempt to decide a dispute with new dispute resolver assistant, should fail await expect(disputeHandler.connect(rando).decideDispute(exchangeId, buyerPercent)) .to.emit(disputeHandler, "DisputeDecided") - .withArgs(exchangeId, buyerPercent, rando.address); + .withArgs(exchangeId, buyerPercent, await rando.getAddress()); }); it("Dispute resolver should be able to refuse to decide a dispute after change the assistant address", async function () { @@ -596,7 +596,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { // Attempt to refuse a dispute with new dispute resolver assistant, should fail await expect(disputeHandler.connect(rando).refuseEscalatedDispute(exchangeId)) .to.emit(disputeHandler, "EscalatedDisputeRefused") - .withArgs(exchangeId, rando.address); + .withArgs(exchangeId, await rando.getAddress()); }); }); }); diff --git a/test/integration/02-Upgraded-facet.js b/test/integration/02-Upgraded-facet.js index a76f5dd29..77cbcb113 100644 --- a/test/integration/02-Upgraded-facet.js +++ b/test/integration/02-Upgraded-facet.js @@ -85,7 +85,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation beforeEach(async function () { // Create a valid seller, then set fields in tests directly - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); expect(seller.isValid()).is.true; // VoucherInitValues @@ -101,7 +101,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation [mockToken] = await deployMockTokens(["Foreign20"]); // top up assistants account - await mockToken.mint(assistant.address, "1000000"); + await mockToken.mint(await assistant.getAddress(), "1000000"); // approve protocol to transfer the tokens await mockToken.connect(assistant).approve(protocolDiamondAddress, "1000000"); @@ -125,7 +125,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Define the facet cut const facetCuts = [ { - facetAddress: mockExchangeHandlerFacet.address, + facetAddress: await mockExchangeHandlerFacet.getAddress(), action: FacetCutAction.Replace, functionSelectors: getSelectors(mockExchangeHandlerFacet), }, @@ -149,10 +149,10 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation beforeEach(async function () { // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -214,7 +214,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation context("👉 completeExchange()", async function () { beforeEach(async function () { // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Upgrade Exchange handler facet await upgradeExchangeHandlerFacet("MockExchangeHandlerFacet"); @@ -230,7 +230,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Complete the exchange, expecting event await expect(mockExchangeHandlerUpgrade.connect(buyer).completeExchange(exchange.id)) .to.emit(mockExchangeHandlerUpgrade, "ExchangeCompleted2") - .withArgs(offerId, buyerId, exchange.id, buyer.address); + .withArgs(offerId, buyerId, exchange.id, await buyer.getAddress()); }); }); @@ -241,7 +241,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation for (exchangeId = 1; exchangeId <= 5; exchangeId++) { // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); } // Upgrade Exchange handler facet @@ -258,30 +258,30 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation const tx = await mockExchangeHandlerUpgrade.connect(buyer).completeExchangeBatch(exchangesToComplete); await expect(tx) .to.emit(mockExchangeHandlerUpgrade, "ExchangeCompleted2") - .withArgs(offerId, buyerId, exchangesToComplete[0], buyer.address); + .withArgs(offerId, buyerId, exchangesToComplete[0], await buyer.getAddress()); await expect(tx) .to.emit(mockExchangeHandlerUpgrade, "ExchangeCompleted2") - .withArgs(offerId, buyerId, exchangesToComplete[1], buyer.address); + .withArgs(offerId, buyerId, exchangesToComplete[1], await buyer.getAddress()); await expect(tx) .to.emit(mockExchangeHandlerUpgrade, "ExchangeCompleted2") - .withArgs(offerId, buyerId, exchangesToComplete[2], buyer.address); + .withArgs(offerId, buyerId, exchangesToComplete[2], await buyer.getAddress()); await expect(tx) .to.emit(mockExchangeHandlerUpgrade, "ExchangeCompleted2") - .withArgs(offerId, buyerId, exchangesToComplete[3], buyer.address); + .withArgs(offerId, buyerId, exchangesToComplete[3], await buyer.getAddress()); await expect(tx) .to.emit(mockExchangeHandlerUpgrade, "ExchangeCompleted2") - .withArgs(offerId, buyerId, exchangesToComplete[4], buyer.address); + .withArgs(offerId, buyerId, exchangesToComplete[4], await buyer.getAddress()); }); }); context("👉 revokeVoucher()", async function () { it("should emit an VoucherRevoked2 event when seller's assistant calls", async function () { // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Upgrade Exchange handler facet await upgradeExchangeHandlerFacet("MockExchangeHandlerFacet"); @@ -289,14 +289,14 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Revoke the voucher, expecting event await expect(mockExchangeHandlerUpgrade.connect(assistant).revokeVoucher(exchange.id)) .to.emit(mockExchangeHandlerUpgrade, "VoucherRevoked2") - .withArgs(offerId, exchange.id, assistant.address); + .withArgs(offerId, exchange.id, await assistant.getAddress()); }); }); context("👉 cancelVoucher()", async function () { it("should emit an VoucherCanceled2 event when original buyer calls", async function () { // Commit to offer, retrieving the event - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Upgrade Exchange handler facet await upgradeExchangeHandlerFacet("MockExchangeHandlerFacet"); @@ -304,14 +304,14 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Cancel the voucher, expecting event await expect(mockExchangeHandlerUpgrade.connect(buyer).cancelVoucher(exchange.id)) .to.emit(mockExchangeHandlerUpgrade, "VoucherCanceled2") - .withArgs(offerId, exchange.id, buyer.address); + .withArgs(offerId, exchange.id, await buyer.getAddress()); }); }); context("👉 expireVoucher()", async function () { it("should emit an VoucherExpired2 event when anyone calls and voucher has expired", async function () { // Commit to offer, retrieving the event - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Upgrade Exchange handler facet await upgradeExchangeHandlerFacet("MockExchangeHandlerFacet"); @@ -322,14 +322,14 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Expire the voucher, expecting event await expect(mockExchangeHandlerUpgrade.connect(rando).expireVoucher(exchange.id)) .to.emit(mockExchangeHandlerUpgrade, "VoucherExpired2") - .withArgs(offerId, exchange.id, rando.address); + .withArgs(offerId, exchange.id, await rando.getAddress()); }); }); context("👉 redeemVoucher()", async function () { it("should emit a VoucherRedeemed2 event when buyer calls", async function () { // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Upgrade Exchange handler facet await upgradeExchangeHandlerFacet("MockExchangeHandlerFacet"); @@ -340,14 +340,14 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Redeem the voucher, expecting event await expect(mockExchangeHandlerUpgrade.connect(buyer).redeemVoucher(exchange.id)) .to.emit(mockExchangeHandlerUpgrade, "VoucherRedeemed2") - .withArgs(offerId, exchange.id, buyer.address); + .withArgs(offerId, exchange.id, await buyer.getAddress()); }); }); context("👉 extendVoucher()", async function () { it("should emit an VoucherExtended2 event when seller's assistant calls", async function () { // Commit to offer - const tx = await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + const tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Get the block timestamp of the confirmed tx const blockNumber = tx.blockNumber; @@ -368,7 +368,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Extend the voucher, expecting event await expect(mockExchangeHandlerUpgrade.connect(assistant).extendVoucher(exchange.id, validUntilDate)) .to.emit(mockExchangeHandlerUpgrade, "VoucherExtended2") - .withArgs(offerId, exchange.id, validUntilDate, assistant.address); + .withArgs(offerId, exchange.id, validUntilDate, await assistant.getAddress()); }); }); }); @@ -378,10 +378,10 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation beforeEach(async function () { // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -440,7 +440,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation exchangeId = "1"; // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Set time forward to the offer's voucherRedeemableFrom await setNextBlockTimestamp(Number(voucherRedeemableFrom)); @@ -460,7 +460,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Raise a dispute, testing for the event await expect(disputeHandler.connect(buyer).raiseDispute(exchangeId)) .to.emit(disputeHandler, "DisputeRaised") - .withArgs(exchangeId, buyerId, seller.id, buyer.address); + .withArgs(exchangeId, buyerId, seller.id, await buyer.getAddress()); }); }); @@ -472,7 +472,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Retract the dispute, testing for the event await expect(disputeHandler.connect(buyer).retractDispute(exchangeId)) .to.emit(disputeHandler, "DisputeRetracted") - .withArgs(exchangeId, buyer.address); + .withArgs(exchangeId, await buyer.getAddress()); }); }); @@ -493,7 +493,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Extend the dispute timeout, testing for the event await expect(disputeHandler.connect(assistant).extendDisputeTimeout(exchangeId, newDisputeTimeout)) .to.emit(disputeHandler, "DisputeTimeoutExtended") - .withArgs(exchangeId, newDisputeTimeout, assistant.address); + .withArgs(exchangeId, newDisputeTimeout, await assistant.getAddress()); }); }); @@ -514,7 +514,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Expire the dispute, testing for the event await expect(disputeHandler.connect(rando).expireDispute(exchangeId)) .to.emit(disputeHandler, "DisputeExpired") - .withArgs(exchangeId, rando.address); + .withArgs(exchangeId, await rando.getAddress()); }); }); @@ -549,13 +549,13 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation customSignatureType, "Resolution", message, - disputeHandler.address + await disputeHandler.getAddress() ); // Resolve the dispute, testing for the event await expect(disputeHandler.connect(buyer).resolveDispute(exchangeId, buyerPercentBasisPoints, r, s, v)) .to.emit(disputeHandler, "DisputeResolved") - .withArgs(exchangeId, buyerPercentBasisPoints, buyer.address); + .withArgs(exchangeId, buyerPercentBasisPoints, await buyer.getAddress()); }); }); @@ -567,13 +567,13 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation customSignatureType, "Resolution", message, - disputeHandler.address + await disputeHandler.getAddress() ); // Resolve the dispute, testing for the event await expect(disputeHandler.connect(assistant).resolveDispute(exchangeId, buyerPercentBasisPoints, r, s, v)) .to.emit(disputeHandler, "DisputeResolved") - .withArgs(exchangeId, buyerPercentBasisPoints, assistant.address); + .withArgs(exchangeId, buyerPercentBasisPoints, await assistant.getAddress()); }); }); }); @@ -588,7 +588,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation disputeHandler.connect(buyer).escalateDispute(exchangeId, { value: buyerEscalationDepositNative }) ) .to.emit(disputeHandler, "DisputeEscalated") - .withArgs(exchangeId, disputeResolverId, buyer.address); + .withArgs(exchangeId, disputeResolverId, await buyer.getAddress()); }); }); @@ -606,7 +606,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Escalate the dispute, testing for the event await expect(disputeHandler.connect(assistantDR).decideDispute(exchangeId, buyerPercentBasisPoints)) .to.emit(disputeHandler, "DisputeDecided") - .withArgs(exchangeId, buyerPercentBasisPoints, assistantDR.address); + .withArgs(exchangeId, buyerPercentBasisPoints, await assistantDR.getAddress()); }); }); @@ -631,7 +631,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Expire the escalated dispute, testing for the event await expect(disputeHandler.connect(rando).expireEscalatedDispute(exchangeId)) .to.emit(disputeHandler, "EscalatedDisputeExpired") - .withArgs(exchangeId, rando.address); + .withArgs(exchangeId, await rando.getAddress()); }); }); @@ -646,7 +646,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Refuse the escalated dispute, testing for the event await expect(disputeHandler.connect(assistantDR).refuseEscalatedDispute(exchangeId)) .to.emit(disputeHandler, "EscalatedDisputeRefused") - .withArgs(exchangeId, assistantDR.address); + .withArgs(exchangeId, await assistantDR.getAddress()); }); }); }); @@ -666,10 +666,10 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -677,7 +677,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation //Create DisputeResolverFee array so offer creation will succeed const disputeResolverFees = [ new DisputeResolverFee(ZeroAddress, "Native", "0"), - new DisputeResolverFee(mockToken.address, "mockToken", "0"), + new DisputeResolverFee(await mockToken.getAddress(), "mockToken", "0"), ]; // Make empty seller list, so every seller is allowed @@ -696,7 +696,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation offerToken = offer.clone(); offerToken.id = "2"; - offerToken.exchangeToken = mockToken.address; + offerToken.exchangeToken = await mockToken.getAddress(); // Check if domais are valid expect(offerNative.isValid()).is.true; @@ -722,7 +722,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation sellerDeposit = offerToken.sellerDeposit; // top up seller's and buyer's account - await Promise.all([mockToken.mint(assistant.address, sellerDeposit), mockToken.mint(buyer.address, price)]); + await Promise.all([mockToken.mint(await assistant.getAddress(), sellerDeposit), mockToken.mint(await buyer.getAddress(), price)]); // approve protocol to transfer the tokens await Promise.all([ @@ -732,15 +732,15 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // deposit to seller's pool await Promise.all([ - fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, sellerDeposit), + fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), sellerDeposit), fundsHandler .connect(assistant) .depositFunds(seller.id, ZeroAddress, sellerDeposit, { value: sellerDeposit }), ]); // commit to both offers - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerToken.id); - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerNative.id, { value: offerNative.price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerNative.id, { value: offerNative.price }); buyerId = accountId.next().value; }); @@ -770,8 +770,8 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Withdraw funds, testing for the event // Withdraw tokens - const tokenListSeller = [mockToken.address, ZeroAddress]; - const tokenListBuyer = [ZeroAddress, mockToken.address]; + const tokenListSeller = [await mockToken.getAddress(), ZeroAddress]; + const tokenListBuyer = [ZeroAddress, await mockToken.getAddress()]; // Withdraw amounts const tokenAmountsSeller = [sellerPayoff, BigInt(sellerPayoff)/"2".toString()]; @@ -783,33 +783,33 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation .withdrawFunds(seller.id, tokenListSeller, tokenAmountsSeller); await expect(tx) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(seller.id, treasury.address, mockToken.address, sellerPayoff, assistant.address); + .withArgs(seller.id, await treasury.getAddress(), await mockToken.getAddress(), sellerPayoff, await assistant.getAddress()); await expect(tx) .to.emit(fundsHandler, "FundsWithdrawn") .withArgs( seller.id, - treasury.address, + await treasury.getAddress(), constants.Zero, BigInt(sellerPayoff)/"2", - assistant.address + await assistant.getAddress() ); // buyer withdrawal const tx2 = await fundsHandler.connect(buyer).withdrawFunds(buyerId, tokenListBuyer, tokenAmountsBuyer); await expect(tx2) - .to.emit(fundsHandler, "FundsWithdrawn", buyer.address) + .to.emit(fundsHandler, "FundsWithdrawn", await buyer.getAddress()) .withArgs( buyerId, - buyer.address, - mockToken.address, + await buyer.getAddress(), + await mockToken.getAddress(), BigInt(buyerPayoff)/"5", - buyer.address + await buyer.getAddress() ); await expect(tx2) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(buyerId, buyer.address, constants.Zero, buyerPayoff, buyer.address); + .withArgs(buyerId, await buyer.getAddress(), constants.Zero, buyerPayoff, await buyer.getAddress()); }); }); @@ -832,8 +832,8 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Withdraw funds, testing for the event // Withdraw tokens - const tokenListSeller = [mockToken.address, ZeroAddress]; - const tokenListBuyer = [ZeroAddress, mockToken.address]; + const tokenListSeller = [await mockToken.getAddress(), ZeroAddress]; + const tokenListBuyer = [ZeroAddress, await mockToken.getAddress()]; // Withdraw amounts const tokenAmountsSeller = [sellerPayoff, BigInt(sellerPayoff)/"2".toString()]; diff --git a/test/integration/03-DR-removes-the-seller-from-allowed-list.js b/test/integration/03-DR-removes-the-seller-from-allowed-list.js index 03c27179b..c7c8b98a5 100644 --- a/test/integration/03-DR-removes-the-seller-from-allowed-list.js +++ b/test/integration/03-DR-removes-the-seller-from-allowed-list.js @@ -74,10 +74,10 @@ describe("[@skip-on-coverage] DR removes sellers from the approved seller list", const agentId = "0"; // agent id is optional while creating an offer // Create a valid seller - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); expect(seller.isValid()).is.true; - const seller2 = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); + const seller2 = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); expect(seller2.isValid()).is.true; // VoucherInitValues @@ -96,10 +96,10 @@ describe("[@skip-on-coverage] DR removes sellers from the approved seller list", // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -149,7 +149,7 @@ describe("[@skip-on-coverage] DR removes sellers from the approved seller list", for (exchangeId = 1; exchangeId <= 3; exchangeId++) { // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Redeem voucher await exchangeHandler.connect(buyer).redeemVoucher(exchangeId); @@ -180,7 +180,7 @@ describe("[@skip-on-coverage] DR removes sellers from the approved seller list", // Decide the dispute await expect(disputeHandler.connect(assistantDR).decideDispute(exchangeId, buyerPercentBasisPoints)) .to.emit(disputeHandler, "DisputeDecided") - .withArgs(exchangeId, buyerPercentBasisPoints, assistantDR.address); + .withArgs(exchangeId, buyerPercentBasisPoints, await assistantDR.getAddress()); // Remove an approved seller let allowedSellersToRemove = ["1"]; @@ -190,12 +190,12 @@ describe("[@skip-on-coverage] DR removes sellers from the approved seller list", accountHandler.connect(adminDR).removeSellersFromAllowList(disputeResolverId, allowedSellersToRemove) ) .to.emit(accountHandler, "AllowedSellersRemoved") - .withArgs(disputeResolverId, allowedSellersToRemove, adminDR.address); + .withArgs(disputeResolverId, allowedSellersToRemove, await adminDR.getAddress()); // Decide the dispute await expect(disputeHandler.connect(assistantDR).decideDispute(exchangeId, buyerPercentBasisPoints)) .to.emit(disputeHandler, "DisputeDecided") - .withArgs(exchangeId, buyerPercentBasisPoints, assistantDR.address); + .withArgs(exchangeId, buyerPercentBasisPoints, await assistantDR.getAddress()); // Remove another approved seller allowedSellersToRemove = ["2"]; @@ -205,12 +205,12 @@ describe("[@skip-on-coverage] DR removes sellers from the approved seller list", accountHandler.connect(adminDR).removeSellersFromAllowList(disputeResolverId, allowedSellersToRemove) ) .to.emit(accountHandler, "AllowedSellersRemoved") - .withArgs(disputeResolverId, allowedSellersToRemove, adminDR.address); + .withArgs(disputeResolverId, allowedSellersToRemove, await adminDR.getAddress()); // Decide the dispute await expect(disputeHandler.connect(assistantDR).decideDispute(exchangeId, buyerPercentBasisPoints)) .to.emit(disputeHandler, "DisputeDecided") - .withArgs(exchangeId, buyerPercentBasisPoints, assistantDR.address); + .withArgs(exchangeId, buyerPercentBasisPoints, await assistantDR.getAddress()); }); }); @@ -230,7 +230,7 @@ describe("[@skip-on-coverage] DR removes sellers from the approved seller list", // Refuse the escalated dispute, testing for the event await expect(disputeHandler.connect(assistantDR).refuseEscalatedDispute(exchangeId)) .to.emit(disputeHandler, "EscalatedDisputeRefused") - .withArgs(exchangeId, assistantDR.address); + .withArgs(exchangeId, await assistantDR.getAddress()); // Remove an approved seller let allowedSellersToRemove = ["1"]; @@ -240,12 +240,12 @@ describe("[@skip-on-coverage] DR removes sellers from the approved seller list", accountHandler.connect(adminDR).removeSellersFromAllowList(disputeResolverId, allowedSellersToRemove) ) .to.emit(accountHandler, "AllowedSellersRemoved") - .withArgs(disputeResolverId, allowedSellersToRemove, adminDR.address); + .withArgs(disputeResolverId, allowedSellersToRemove, await adminDR.getAddress()); // Refuse the escalated dispute, testing for the event await expect(disputeHandler.connect(assistantDR).refuseEscalatedDispute(exchangeId)) .to.emit(disputeHandler, "EscalatedDisputeRefused") - .withArgs(exchangeId, assistantDR.address); + .withArgs(exchangeId, await assistantDR.getAddress()); // Remove another approved seller allowedSellersToRemove = ["2"]; @@ -255,12 +255,12 @@ describe("[@skip-on-coverage] DR removes sellers from the approved seller list", accountHandler.connect(adminDR).removeSellersFromAllowList(disputeResolverId, allowedSellersToRemove) ) .to.emit(accountHandler, "AllowedSellersRemoved") - .withArgs(disputeResolverId, allowedSellersToRemove, adminDR.address); + .withArgs(disputeResolverId, allowedSellersToRemove, await adminDR.getAddress()); // Refuse the escalated dispute, testing for the event await expect(disputeHandler.connect(assistantDR).refuseEscalatedDispute(exchangeId)) .to.emit(disputeHandler, "EscalatedDisputeRefused") - .withArgs(exchangeId, assistantDR.address); + .withArgs(exchangeId, await assistantDR.getAddress()); }); }); }); diff --git a/test/integration/04-DR-removes-fees.js b/test/integration/04-DR-removes-fees.js index b130f5ab8..17ed61145 100644 --- a/test/integration/04-DR-removes-fees.js +++ b/test/integration/04-DR-removes-fees.js @@ -59,24 +59,24 @@ describe("[@skip-on-coverage] DR removes fee", function () { assistantDR = adminDR; clerk = clerkDR = { address: ZeroAddress }; - expectedCloneAddress = calculateContractAddress(accountHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "1"); emptyAuthToken = mockAuthToken(); expect(emptyAuthToken.isValid()).is.true; voucherInitValues = mockVoucherInitValues(); expect(voucherInitValues.isValid()).is.true; // Create a seller account - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); expect(await accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues)) .to.emit(accountHandler, "SellerCreated") - .withArgs(seller.id, seller.toStruct(), expectedCloneAddress, emptyAuthToken.toStruct(), admin.address); + .withArgs(seller.id, seller.toStruct(), expectedCloneAddress, emptyAuthToken.toStruct(), await admin.getAddress()); // Create a dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -112,18 +112,18 @@ describe("[@skip-on-coverage] DR removes fee", function () { }); // Create a buyer account - buyerAccount = mockBuyer(buyer.address); + buyerAccount = mockBuyer(await buyer.getAddress()); expect(await accountHandler.createBuyer(buyerAccount)) .to.emit(accountHandler, "BuyerCreated") - .withArgs(buyerAccount.id, buyerAccount.toStruct(), buyer.address); + .withArgs(buyerAccount.id, buyerAccount.toStruct(), await buyer.getAddress()); // Set time forward to the offer's voucherRedeemableFrom await setNextBlockTimestamp(Number(offerDates.voucherRedeemableFrom)); for (exchangeId = 1; exchangeId <= 2; exchangeId++) { // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offer.id, { value: offer.price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offer.id, { value: offer.price }); // Redeem voucher await exchangeHandler.connect(buyer).redeemVoucher(exchangeId); @@ -144,10 +144,10 @@ describe("[@skip-on-coverage] DR removes fee", function () { accountHandler.connect(adminDR).removeFeesFromDisputeResolver(disputeResolver.id, [ZeroAddress]) ) .to.emit(accountHandler, "DisputeResolverFeesRemoved") - .withArgs(disputeResolver.id, [ZeroAddress], adminDR.address); + .withArgs(disputeResolver.id, [ZeroAddress], await adminDR.getAddress()); // Commit to offer - const tx = await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offer.id, { value: offer.price }); + const tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offer.id, { value: offer.price }); const blockTimestamp = (await provider.getBlock(tx.blockNumber)).timestamp; // Mock voucher @@ -164,7 +164,7 @@ describe("[@skip-on-coverage] DR removes fee", function () { // Check if offer was committed await expect(tx) .to.emit(exchangeHandler, "BuyerCommitted") - .withArgs(offer.id, buyerAccount.id, exchangeId, exchange.toStruct(), voucher.toStruct(), buyer.address); + .withArgs(offer.id, buyerAccount.id, exchangeId, exchange.toStruct(), voucher.toStruct(), await buyer.getAddress()); }); context("👉 After raise dispute actions", async function () { @@ -182,7 +182,7 @@ describe("[@skip-on-coverage] DR removes fee", function () { exchangeId = "1"; await expect(disputeHandler.connect(buyer).escalateDispute(exchangeId, { value: buyerEscalationDepositNative })) .to.emit(disputeHandler, "DisputeEscalated") - .withArgs(exchangeId, disputeResolver.id, buyer.address); + .withArgs(exchangeId, disputeResolver.id, await buyer.getAddress()); // Removes fee await expect( @@ -191,13 +191,13 @@ describe("[@skip-on-coverage] DR removes fee", function () { .removeFeesFromDisputeResolver(disputeResolver.id, [ZeroAddress]) ) .to.emit(accountHandler, "DisputeResolverFeesRemoved") - .withArgs(disputeResolver.id, [ZeroAddress], adminDR.address); + .withArgs(disputeResolver.id, [ZeroAddress], await adminDR.getAddress()); // Escalate dispute after removing fee exchangeId = "2"; await expect(disputeHandler.connect(buyer).escalateDispute(exchangeId, { value: buyerEscalationDepositNative })) .to.emit(disputeHandler, "DisputeEscalated") - .withArgs(exchangeId, disputeResolver.id, buyer.address); + .withArgs(exchangeId, disputeResolver.id, await buyer.getAddress()); }); context("👉 After escalate dispute actions", async function () { @@ -222,7 +222,7 @@ describe("[@skip-on-coverage] DR removes fee", function () { // Decide the dispute befor removing fee await expect(disputeHandler.connect(assistantDR).decideDispute(exchangeId, buyerPercentBasisPoints)) .to.emit(disputeHandler, "DisputeDecided") - .withArgs(exchangeId, buyerPercentBasisPoints, assistantDR.address); + .withArgs(exchangeId, buyerPercentBasisPoints, await assistantDR.getAddress()); // Removes fee await expect( @@ -231,13 +231,13 @@ describe("[@skip-on-coverage] DR removes fee", function () { .removeFeesFromDisputeResolver(disputeResolver.id, [ZeroAddress]) ) .to.emit(accountHandler, "DisputeResolverFeesRemoved") - .withArgs(disputeResolver.id, [ZeroAddress], adminDR.address); + .withArgs(disputeResolver.id, [ZeroAddress], await adminDR.getAddress()); // Decide the dispute after removing fee exchangeId = "2"; await expect(disputeHandler.connect(assistantDR).decideDispute(exchangeId, buyerPercentBasisPoints)) .to.emit(disputeHandler, "DisputeDecided") - .withArgs(exchangeId, buyerPercentBasisPoints, assistantDR.address); + .withArgs(exchangeId, buyerPercentBasisPoints, await assistantDR.getAddress()); }); it("DR should be able to refuse to decide dispute even when DR removes fee", async function () { @@ -245,7 +245,7 @@ describe("[@skip-on-coverage] DR removes fee", function () { exchangeId = "1"; await expect(disputeHandler.connect(assistantDR).refuseEscalatedDispute(exchangeId)) .to.emit(disputeHandler, "EscalatedDisputeRefused") - .withArgs(exchangeId, assistantDR.address); + .withArgs(exchangeId, await assistantDR.getAddress()); // Removes fee await expect( @@ -254,13 +254,13 @@ describe("[@skip-on-coverage] DR removes fee", function () { .removeFeesFromDisputeResolver(disputeResolver.id, [ZeroAddress]) ) .to.emit(accountHandler, "DisputeResolverFeesRemoved") - .withArgs(disputeResolver.id, [ZeroAddress], adminDR.address); + .withArgs(disputeResolver.id, [ZeroAddress], await adminDR.getAddress()); // Refuse to decide the dispute after removing fee exchangeId = "2"; await expect(disputeHandler.connect(assistantDR).refuseEscalatedDispute(exchangeId)) .to.emit(disputeHandler, "EscalatedDisputeRefused") - .withArgs(exchangeId, assistantDR.address); + .withArgs(exchangeId, await assistantDR.getAddress()); }); }); }); diff --git a/test/integration/seaport/fixtures.js b/test/integration/seaport/fixtures.js index 412fed8a4..6280b5219 100644 --- a/test/integration/seaport/fixtures.js +++ b/test/integration/seaport/fixtures.js @@ -40,7 +40,7 @@ const seaportFixtures = async (seaport) => { conduitKey = constants.HashZero ) { const parameters = { - offerer: offerer.address, + offerer: await offerer.getAddress(), zone: zone?.address ?? constants.AddressZero, offer, consideration, @@ -53,7 +53,7 @@ const seaportFixtures = async (seaport) => { totalOriginalConsiderationItems: BigNumber.from(consideration.length), }; - const counter = await seaport.getCounter(offerer.address); + const counter = await seaport.getCounter(await offerer.getAddress()); const orderComponents = { ...parameters, counter }; const orderHash = await getAndVerifyOrderHash(orderComponents); diff --git a/test/integration/seaport/seaport-integration.js b/test/integration/seaport/seaport-integration.js index 359307f40..7adeb1004 100644 --- a/test/integration/seaport/seaport-integration.js +++ b/test/integration/seaport/seaport-integration.js @@ -44,13 +44,13 @@ describe("[@skip-on-coverage] Seaport integration", function () { contractInstances: { accountHandler, offerHandler, fundsHandler }, } = await setupTestEnvironment(contracts)); - const seller = mockSeller(assistant.address, assistant.address, ZeroAddress, assistant.address); + const seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), ZeroAddress, await assistant.getAddress()); const emptyAuthToken = mockAuthToken(); const voucherInitValues = mockVoucherInitValues(); await accountHandler.connect(assistant).createSeller(seller, emptyAuthToken, voucherInitValues); - const disputeResolver = mockDisputeResolver(DR.address, DR.address, ZeroAddress, DR.address, true); + const disputeResolver = mockDisputeResolver(await DR.getAddress(), await DR.getAddress(), ZeroAddress, await DR.getAddress(), true); const disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", "0")]; const sellerAllowList = []; @@ -64,7 +64,7 @@ describe("[@skip-on-coverage] Seaport integration", function () { .connect(assistant) .createOffer(offer.toStruct(), offerDates.toStruct(), offerDurations.toStruct(), disputeResolverId, "0"); - const voucherAddress = calculateContractAddress(accountHandler.address, seller.id); + const voucherAddress = calculateContractAddress(await accountHandler.getAddress(), seller.id); bosonVoucher = await getContractAt("BosonVoucher", voucherAddress); // Pool needs to cover both seller deposit and price @@ -74,13 +74,13 @@ describe("[@skip-on-coverage] Seaport integration", function () { }); // Pre mint range - await offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, bosonVoucher.address); + await offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, await bosonVoucher.getAddress()); await bosonVoucher.connect(assistant).preMint(offer.id, offer.quantityAvailable); // Create seaport offer which tokenId 1 const endDate = "0xff00000000000000000000000000"; - const seaportOffer = seaportFixtures.getTestVoucher(1, bosonVoucher.address, 1, 1); - const consideration = seaportFixtures.getTestToken(0, undefined, 1, 2, bosonVoucher.address); + const seaportOffer = seaportFixtures.getTestVoucher(1, await bosonVoucher.getAddress(), 1, 1); + const consideration = seaportFixtures.getTestToken(0, undefined, 1, 2, await bosonVoucher.getAddress()); ({ order, orderHash, value } = await seaportFixtures.getOrder( bosonVoucher, undefined, @@ -96,7 +96,7 @@ describe("[@skip-on-coverage] Seaport integration", function () { }); it("Voucher contract can be used to call seaport validate", async function () { - const tx = await bosonVoucher.connect(assistant).callExternalContract(seaport.address, calldata); + const tx = await bosonVoucher.connect(assistant).callExternalContract(await seaport.getAddress(), calldata); const receipt = await tx.wait(); const [, orderParameters] = getEvent(receipt, seaport, "OrderValidated"); @@ -105,8 +105,8 @@ describe("[@skip-on-coverage] Seaport integration", function () { }); it("Seaport is allowed to transfer vouchers", async function () { - await bosonVoucher.connect(assistant).callExternalContract(seaport.address, calldata); - await bosonVoucher.connect(assistant).setApprovalForAllToContract(seaport.address, true); + await bosonVoucher.connect(assistant).callExternalContract(await seaport.getAddress(), calldata); + await bosonVoucher.connect(assistant).setApprovalForAllToContract(await seaport.getAddress(), true); let totalFilled, isValidated; @@ -131,7 +131,7 @@ describe("[@skip-on-coverage] Seaport integration", function () { const orders = [objectToArray(order)]; calldata = seaport.interface.encodeFunctionData("validate", [orders]); - await expect(bosonVoucher.connect(assistant).callExternalContract(seaport.address, calldata)).to.be.revertedWith( + await expect(bosonVoucher.connect(assistant).callExternalContract(await seaport.getAddress(), calldata)).to.be.revertedWith( "0x466aa616" ); //MissingOriginalConsiderationItems }); diff --git a/test/protocol/AccountHandlerTest.js b/test/protocol/AccountHandlerTest.js index 70e31728f..134eeb7ab 100644 --- a/test/protocol/AccountHandlerTest.js +++ b/test/protocol/AccountHandlerTest.js @@ -82,7 +82,7 @@ describe("IBosonAccountHandler", function () { nextAccountId = "1"; // Create a valid seller, then set fields in tests directly - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); expect(seller.isValid()).is.true; // VoucherInitValues @@ -94,26 +94,26 @@ describe("IBosonAccountHandler", function () { expect(emptyAuthToken.isValid()).is.true; // Create a valid buyer - buyer = mockBuyer(other1.address); + buyer = mockBuyer(await other1.getAddress()); expect(buyer.isValid()).is.true; // Create a valid dispute resolver - disputeResolver = mockDisputeResolver(assistant.address, admin.address, clerk.address, treasury.address); + disputeResolver = mockDisputeResolver(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); expect(disputeResolver.isValid()).is.true; //Create DisputeResolverFee array disputeResolverFees = [ - new DisputeResolverFee(other1.address, "MockToken1", "0"), - new DisputeResolverFee(other2.address, "MockToken2", "0"), - new DisputeResolverFee(other3.address, "MockToken3", "0"), + new DisputeResolverFee(await other1.getAddress(), "MockToken1", "0"), + new DisputeResolverFee(await other2.getAddress(), "MockToken2", "0"), + new DisputeResolverFee(await other3.getAddress(), "MockToken3", "0"), ]; // Make a sellerAllowList sellerAllowList = ["1"]; // Create a valid agent, then set fields in tests directly - agent = mockAgent(other1.address); + agent = mockAgent(await other1.getAddress()); expect(agent.isValid()).is.true; }); @@ -148,8 +148,8 @@ describe("IBosonAccountHandler", function () { it("should be incremented after a seller is created", async function () { //addresses need to be unique to seller Id, so setting them to random addresses here - seller.assistant = rando.address; - seller.admin = rando.address; + seller.assistant = await rando.getAddress(); + seller.admin = await rando.getAddress(); seller.clerk = ZeroAddress; // Create another seller diff --git a/test/protocol/AgentHandlerTest.js b/test/protocol/AgentHandlerTest.js index 79bde804e..c2421e4a4 100644 --- a/test/protocol/AgentHandlerTest.js +++ b/test/protocol/AgentHandlerTest.js @@ -51,7 +51,7 @@ describe("AgentHandler", function () { invalidAccountId = "666"; // Create a valid agent, then set fields in tests directly - agent = mockAgent(other1.address); + agent = mockAgent(await other1.getAddress()); expect(agent.isValid()).is.true; // How that agent looks as a returned struct @@ -68,7 +68,7 @@ describe("AgentHandler", function () { // Create an agent, testing for the event await expect(accountHandler.connect(rando).createAgent(agent)) .to.emit(accountHandler, "AgentCreated") - .withArgs(agent.id, agentStruct, rando.address); + .withArgs(agent.id, agentStruct, await rando.getAddress()); }); it("should update state", async function () { @@ -93,7 +93,7 @@ describe("AgentHandler", function () { // Create an agent, testing for the event await expect(accountHandler.connect(rando).createAgent(agent)) .to.emit(accountHandler, "AgentCreated") - .withArgs(nextAccountId, agentStruct, rando.address); + .withArgs(nextAccountId, agentStruct, await rando.getAddress()); // wrong agent id should not exist [exists] = await accountHandler.connect(rando).getAgent(agent.id); @@ -115,7 +115,7 @@ describe("AgentHandler", function () { // Create an agent, testing for the event await expect(accountHandler.connect(rando).createAgent(agent)) .to.emit(accountHandler, "AgentCreated") - .withArgs(nextAccountId, agentStruct, rando.address); + .withArgs(nextAccountId, agentStruct, await rando.getAddress()); // Get the agent as a struct [, agentStruct] = await accountHandler.connect(rando).getAgent(agent.id); @@ -141,7 +141,7 @@ describe("AgentHandler", function () { // Create an agent, testing for the event await expect(accountHandler.connect(rando).createAgent(agent)) .to.emit(accountHandler, "AgentCreated") - .withArgs(nextAccountId, agentStruct, rando.address); + .withArgs(nextAccountId, agentStruct, await rando.getAddress()); // Get the agent as a struct [, agentStruct] = await accountHandler.connect(rando).getAgent(agent.id); @@ -212,7 +212,7 @@ describe("AgentHandler", function () { }); it("should emit an AgentUpdated event with correct values if values change", async function () { - agent.wallet = other2.address; + agent.wallet = await other2.getAddress(); agent.active = false; agent.feePercentage = "3000"; //30% expect(agent.isValid()).is.true; @@ -226,18 +226,18 @@ describe("AgentHandler", function () { //Update a agent, testing for the event await expect(accountHandler.connect(other1).updateAgent(agent)) .to.emit(accountHandler, "AgentUpdated") - .withArgs(agent.id, expectedAgentStruct, other1.address); + .withArgs(agent.id, expectedAgentStruct, await other1.getAddress()); }); it("should emit an AgentUpdated event with correct values if values stay the same", async function () { //Update a agent, testing for the event await expect(accountHandler.connect(other1).updateAgent(agent)) .to.emit(accountHandler, "AgentUpdated") - .withArgs(agent.id, agentStruct, other1.address); + .withArgs(agent.id, agentStruct, await other1.getAddress()); }); it("should update state of all fields except Id and active flag", async function () { - agent.wallet = other2.address; + agent.wallet = await other2.getAddress(); agent.active = false; agent.feePercentage = "3000"; //30% expect(agent.isValid()).is.true; @@ -300,7 +300,7 @@ describe("AgentHandler", function () { }); it("should update only wallet address", async function () { - agent.wallet = other2.address; + agent.wallet = await other2.getAddress(); expect(agent.isValid()).is.true; agentStruct = agent.toStruct(); @@ -323,7 +323,7 @@ describe("AgentHandler", function () { it("should update the correct agent", async function () { // Confgiure another agent id2 = nextAccountId++; - agent2 = mockAgent(other3.address); + agent2 = mockAgent(await other3.getAddress()); agent2.id = id2.toString(); expect(agent2.isValid()).is.true; @@ -332,10 +332,10 @@ describe("AgentHandler", function () { //Create agent2, testing for the event await expect(accountHandler.connect(rando).createAgent(agent2)) .to.emit(accountHandler, "AgentCreated") - .withArgs(agent2.id, agent2Struct, rando.address); + .withArgs(agent2.id, agent2Struct, await rando.getAddress()); //Update first agent - agent.wallet = other2.address; + agent.wallet = await other2.getAddress(); agent.feePercentage = "3000"; //30% expect(agent.isValid()).is.true; @@ -366,21 +366,21 @@ describe("AgentHandler", function () { }); it("should be able to only update second time with new wallet address", async function () { - agent.wallet = other2.address; + agent.wallet = await other2.getAddress(); agentStruct = agent.toStruct(); // Update agent, testing for the event await expect(accountHandler.connect(other1).updateAgent(agent)) .to.emit(accountHandler, "AgentUpdated") - .withArgs(agent.id, agentStruct, other1.address); + .withArgs(agent.id, agentStruct, await other1.getAddress()); - agent.wallet = other3.address; + agent.wallet = await other3.getAddress(); agentStruct = agent.toStruct(); // Update agent, testing for the event await expect(accountHandler.connect(other2).updateAgent(agent)) .to.emit(accountHandler, "AgentUpdated") - .withArgs(agent.id, agentStruct, other2.address); + .withArgs(agent.id, agentStruct, await other2.getAddress()); // Attempt to update the agent with original wallet address, expecting revert await expect(accountHandler.connect(other1).updateAgent(agent)).to.revertedWith(RevertReasons.NOT_AGENT_WALLET); @@ -394,7 +394,7 @@ describe("AgentHandler", function () { // Update agent, testing for the event await expect(accountHandler.connect(other1).updateAgent(agent)) .to.emit(accountHandler, "AgentUpdated") - .withArgs(agent.id, agentStruct, other1.address); + .withArgs(agent.id, agentStruct, await other1.getAddress()); // Get the agent as a struct [, agentStruct] = await accountHandler.connect(rando).getAgent(id); @@ -418,7 +418,7 @@ describe("AgentHandler", function () { // Update agent, testing for the event await expect(accountHandler.connect(other1).updateAgent(agent)) .to.emit(accountHandler, "AgentUpdated") - .withArgs(agent.id, agentStruct, other1.address); + .withArgs(agent.id, agentStruct, await other1.getAddress()); // Get the agent as a struct [, agentStruct] = await accountHandler.connect(rando).getAgent(id); @@ -486,7 +486,7 @@ describe("AgentHandler", function () { it("wallet address is not unique to this agent Id", async function () { id = await accountHandler.connect(rando).getNextAccountId(); - agent2 = mockAgent(other2.address); + agent2 = mockAgent(await other2.getAddress()); agent2.id = id.toString(); agent2Struct = agent2.toStruct(); @@ -494,10 +494,10 @@ describe("AgentHandler", function () { //Create second agent, testing for the event await expect(accountHandler.connect(rando).createAgent(agent2)) .to.emit(accountHandler, "AgentCreated") - .withArgs(agent2.id, agent2Struct, rando.address); + .withArgs(agent2.id, agent2Struct, await rando.getAddress()); //Set wallet address value to be same as first agent created in Agent Methods beforeEach - agent2.wallet = other1.address; //already being used by agent 1 + agent2.wallet = await other1.getAddress(); //already being used by agent 1 // Attempt to update agent 2 with non-unique wallet address, expecting revert await expect(accountHandler.connect(other2).updateAgent(agent2)).to.revertedWith( diff --git a/test/protocol/BundleHandlerTest.js b/test/protocol/BundleHandlerTest.js index 41934a893..d8893a537 100644 --- a/test/protocol/BundleHandlerTest.js +++ b/test/protocol/BundleHandlerTest.js @@ -131,7 +131,7 @@ describe("IBosonBundleHandler", function () { agentId = "0"; // agent id is optional while creating an offer // Create a valid seller, then set fields in tests directly - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); expect(seller.isValid()).is.true; // VoucherInitValues @@ -146,10 +146,10 @@ describe("IBosonBundleHandler", function () { // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -168,11 +168,11 @@ describe("IBosonBundleHandler", function () { // create 5 twins for (let i = 0; i < 5; i++) { // Create a valid twin. - twin = mockTwin(bosonToken.address); + twin = mockTwin(await bosonToken.getAddress()); expect(twin.isValid()).is.true; // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler // Create a twin. await twinHandler.connect(assistant).createTwin(twin); @@ -283,12 +283,12 @@ describe("IBosonBundleHandler", function () { expect(bundleInstance.isValid()).to.be.true; //Get seller id by assistant which created the bundle - const [, sellerStruct] = await accountHandler.connect(rando).getSellerByAddress(assistant.address); + const [, sellerStruct] = await accountHandler.connect(rando).getSellerByAddress(await assistant.getAddress()); let expectedSellerId = sellerStruct.id; assert.equal(event.bundleId.toString(), nextBundleId, "Bundle Id is incorrect"); assert.equal(event.sellerId.toString(), expectedSellerId.toString(), "Seller Id is incorrect"); - assert.equal(event.executedBy.toString(), assistant.address, "Executed by is incorrect"); + assert.equal(event.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); assert.equal(bundleInstance.toStruct().toString(), bundleStruct.toString(), "Bundle struct is incorrect"); }); @@ -309,12 +309,12 @@ describe("IBosonBundleHandler", function () { .createOffer(newOffer2, offerDates, offerDurations, disputeResolverId, agentId); // create a twin with almost unlimited supply - twin = mockTwin(bosonToken.address); + twin = mockTwin(await bosonToken.getAddress()); twin.supplyAvailable = MaxUint256-1; expect(twin.isValid()).is.true; // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, twin.supplyAvailable); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), twin.supplyAvailable); // approving the twin handler // Create a twin with id 6 await twinHandler.connect(assistant).createTwin(twin); @@ -326,12 +326,12 @@ describe("IBosonBundleHandler", function () { ); // create a twin with unlimited supply - twin = mockTwin(bosonToken.address); + twin = mockTwin(await bosonToken.getAddress()); twin.supplyAvailable = MaxUint256; expect(twin.isValid()).is.true; // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, twin.supplyAvailable); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), twin.supplyAvailable); // approving the twin handler // Create a twin with id 7 await twinHandler.connect(assistant).createTwin(twin); @@ -387,7 +387,7 @@ describe("IBosonBundleHandler", function () { it("Caller is not the seller of all offers", async function () { // create another seller and an offer let expectedNewOfferId = "6"; - seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); const tx = await offerHandler @@ -427,10 +427,10 @@ describe("IBosonBundleHandler", function () { it("Caller is not the seller of all twins", async function () { // create another seller and a twin let expectedNewTwinId = "6"; - seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); - await bosonToken.connect(rando).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(rando).approve(await twinHandler.getAddress(), 1); // approving the twin handler const tx = await twinHandler.connect(rando).createTwin(twin); // creates a twin with id 6 const txReceipt = await tx.wait(); const event = getEvent(txReceipt, twinHandler, "TwinCreated"); @@ -524,7 +524,7 @@ describe("IBosonBundleHandler", function () { // Commit to an offer let offerIdToCommit = bundle.offerIds[0]; - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerIdToCommit, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerIdToCommit, { value: price }); // Attempt to Create a bundle, expecting revert await expect(bundleHandler.connect(assistant).createBundle(bundle)).to.revertedWith( @@ -710,7 +710,7 @@ describe("IBosonBundleHandler", function () { context("👉 getBundleIdByTwin()", async function () { beforeEach(async function () { // Create a twin with id 6 - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler await twinHandler.connect(assistant).createTwin(twin); // Create a bundle diff --git a/test/protocol/BuyerHandlerTest.js b/test/protocol/BuyerHandlerTest.js index eb09c08f7..a4686fb66 100644 --- a/test/protocol/BuyerHandlerTest.js +++ b/test/protocol/BuyerHandlerTest.js @@ -72,7 +72,7 @@ describe("BuyerHandler", function () { invalidAccountId = "666"; // Create a valid buyer, then set fields in tests directly - buyer = mockBuyer(other1.address); + buyer = mockBuyer(await other1.getAddress()); expect(buyer.isValid()).is.true; // How that buyer looks as a returned struct @@ -89,7 +89,7 @@ describe("BuyerHandler", function () { // Create a buyer, testing for the event await expect(accountHandler.connect(rando).createBuyer(buyer)) .to.emit(accountHandler, "BuyerCreated") - .withArgs(buyer.id, buyerStruct, rando.address); + .withArgs(buyer.id, buyerStruct, await rando.getAddress()); }); it("should update state", async function () { @@ -112,7 +112,7 @@ describe("BuyerHandler", function () { // Create a buyer, testing for the event await expect(accountHandler.connect(rando).createBuyer({ ...buyer, id: invalidAccountId })) .to.emit(accountHandler, "BuyerCreated") - .withArgs(buyer.id, buyerStruct, rando.address); + .withArgs(buyer.id, buyerStruct, await rando.getAddress()); // wrong buyer id should not exist [exists] = await accountHandler.connect(rando).getBuyer(invalidAccountId); @@ -165,7 +165,7 @@ describe("BuyerHandler", function () { }); it("should emit a BuyerUpdated event with correct values if values change", async function () { - buyer.wallet = other2.address; + buyer.wallet = await other2.getAddress(); buyer.active = false; expect(buyer.isValid()).is.true; @@ -178,18 +178,18 @@ describe("BuyerHandler", function () { //Update a buyer, testing for the event await expect(accountHandler.connect(other1).updateBuyer(buyer)) .to.emit(accountHandler, "BuyerUpdated") - .withArgs(buyer.id, expectedBuyerStruct, other1.address); + .withArgs(buyer.id, expectedBuyerStruct, await other1.getAddress()); }); it("should emit a BuyerUpdated event with correct values if values stay the same", async function () { //Update a buyer, testing for the event await expect(accountHandler.connect(other1).updateBuyer(buyer)) .to.emit(accountHandler, "BuyerUpdated") - .withArgs(buyer.id, buyerStruct, other1.address); + .withArgs(buyer.id, buyerStruct, await other1.getAddress()); }); it("should update state of all fields except Id and active flag", async function () { - buyer.wallet = other2.address; + buyer.wallet = await other2.getAddress(); buyer.active = false; expect(buyer.isValid()).is.true; @@ -230,7 +230,7 @@ describe("BuyerHandler", function () { }); it("should update only wallet address", async function () { - buyer.wallet = other2.address; + buyer.wallet = await other2.getAddress(); expect(buyer.isValid()).is.true; buyerStruct = buyer.toStruct(); @@ -252,7 +252,7 @@ describe("BuyerHandler", function () { it("should update the correct buyer", async function () { // Confgiure another buyer - buyer2 = mockBuyer(other3.address); + buyer2 = mockBuyer(await other3.getAddress()); expect(buyer2.isValid()).is.true; buyer2Struct = buyer2.toStruct(); @@ -260,10 +260,10 @@ describe("BuyerHandler", function () { //Create buyer2, testing for the event await expect(accountHandler.connect(rando).createBuyer(buyer2)) .to.emit(accountHandler, "BuyerCreated") - .withArgs(buyer2.id, buyer2Struct, rando.address); + .withArgs(buyer2.id, buyer2Struct, await rando.getAddress()); //Update first buyer - buyer.wallet = other2.address; + buyer.wallet = await other2.getAddress(); expect(buyer.isValid()).is.true; buyerStruct = buyer.toStruct(); @@ -295,21 +295,21 @@ describe("BuyerHandler", function () { }); it("should be able to only update second time with new wallet address", async function () { - buyer.wallet = other2.address; + buyer.wallet = await other2.getAddress(); buyerStruct = buyer.toStruct(); // Update buyer, testing for the event await expect(accountHandler.connect(other1).updateBuyer(buyer)) .to.emit(accountHandler, "BuyerUpdated") - .withArgs(buyer.id, buyerStruct, other1.address); + .withArgs(buyer.id, buyerStruct, await other1.getAddress()); - buyer.wallet = other3.address; + buyer.wallet = await other3.getAddress(); buyerStruct = buyer.toStruct(); // Update buyer, testing for the event await expect(accountHandler.connect(other2).updateBuyer(buyer)) .to.emit(accountHandler, "BuyerUpdated") - .withArgs(buyer.id, buyerStruct, other2.address); + .withArgs(buyer.id, buyerStruct, await other2.getAddress()); // Attempt to update the buyer with original wallet address, expecting revert await expect(accountHandler.connect(other1).updateBuyer(buyer)).to.revertedWith(RevertReasons.NOT_BUYER_WALLET); @@ -323,7 +323,7 @@ describe("BuyerHandler", function () { let agentId = "0"; // agent id is optional while creating an offer // Create a valid seller - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); seller.id = id.toString(); expect(seller.isValid()).is.true; @@ -338,15 +338,15 @@ describe("BuyerHandler", function () { // Create a seller await accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues); - [exists] = await accountHandler.connect(rando).getSellerByAddress(assistant.address); + [exists] = await accountHandler.connect(rando).getSellerByAddress(await assistant.getAddress()); expect(exists).is.true; // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistant.address, - admin.address, - clerk.address, - treasury.address, + await assistant.getAddress(), + await admin.getAddress(), + await clerk.getAddress(), + await treasury.getAddress(), true ); disputeResolver.id = id+1.toString(); @@ -354,9 +354,9 @@ describe("BuyerHandler", function () { //Create DisputeResolverFee array disputeResolverFees = [ - new DisputeResolverFee(other1.address, "MockToken1", "0"), - new DisputeResolverFee(other2.address, "MockToken2", "0"), - new DisputeResolverFee(other3.address, "MockToken3", "0"), + new DisputeResolverFee(await other1.getAddress(), "MockToken1", "0"), + new DisputeResolverFee(await other2.getAddress(), "MockToken2", "0"), + new DisputeResolverFee(await other3.getAddress(), "MockToken3", "0"), new DisputeResolverFee(ZeroAddress, "Native", "0"), ]; @@ -390,11 +390,11 @@ describe("BuyerHandler", function () { .depositFunds(seller.id, ZeroAddress, sellerDeposit, { value: sellerDeposit }); //Commit to offer - await exchangeHandler.connect(other1).commitToOffer(other1.address, offerId, { value: offer.price }); + await exchangeHandler.connect(other1).commitToOffer(await other1.getAddress(), offerId, { value: offer.price }); - const bosonVoucherCloneAddress = calculateContractAddress(exchangeHandler.address, "1"); + const bosonVoucherCloneAddress = calculateContractAddress(await exchangeHandler.getAddress(), "1"); bosonVoucher = await getContractAt("IBosonVoucher", bosonVoucherCloneAddress); - const balance = await bosonVoucher.connect(rando).balanceOf(other1.address); + const balance = await bosonVoucher.connect(rando).balanceOf(await other1.getAddress()); expect(balance).equal(1); }); @@ -444,17 +444,17 @@ describe("BuyerHandler", function () { it("wallet address is unique to this seller Id", async function () { id = await accountHandler.connect(rando).getNextAccountId(); - buyer2 = mockBuyer(other2.address); + buyer2 = mockBuyer(await other2.getAddress()); buyer2.id = id.toString(); buyer2Struct = buyer2.toStruct(); //Create second buyer, testing for the event await expect(accountHandler.connect(rando).createBuyer(buyer2)) .to.emit(accountHandler, "BuyerCreated") - .withArgs(buyer2.id, buyer2Struct, rando.address); + .withArgs(buyer2.id, buyer2Struct, await rando.getAddress()); //Set wallet address value to be same as first buyer created in Buyer Methods beforeEach - buyer2.wallet = other1.address; //already being used by buyer 1 + buyer2.wallet = await other1.getAddress(); //already being used by buyer 1 // Attempt to update buyer 2 with non-unique wallet address, expecting revert await expect(accountHandler.connect(other2).updateBuyer(buyer2)).to.revertedWith( @@ -463,7 +463,7 @@ describe("BuyerHandler", function () { }); it("current buyer wallet address has outstanding vouchers", async function () { - buyer.wallet = other4.address; + buyer.wallet = await other4.getAddress(); // Attempt to update the buyer, expecting revert await expect(accountHandler.connect(other1).updateBuyer(buyer)).to.revertedWith( diff --git a/test/protocol/ConfigHandlerTest.js b/test/protocol/ConfigHandlerTest.js index d9a8fbff6..925f885fc 100644 --- a/test/protocol/ConfigHandlerTest.js +++ b/test/protocol/ConfigHandlerTest.js @@ -49,7 +49,7 @@ describe("IBosonConfigHandler", function () { [protocolDiamond, , , , accessController] = await deployProtocolDiamond(maxPriorityFeePerGas); // Temporarily grant UPGRADER role to deployer account - await accessController.grantRole(Role.UPGRADER, deployer.address); + await accessController.grantRole(Role.UPGRADER, await deployer.getAddress()); // Set protocol config protocolFeePercentage = 12; @@ -72,10 +72,10 @@ describe("IBosonConfigHandler", function () { maxPremintedVouchers = 10000; // Cast Diamond to IERC165 - erc165 = await getContractAt("ERC165Facet", protocolDiamond.address); + erc165 = await getContractAt("ERC165Facet", await protocolDiamond.getAddress()); // Cast Diamond to IBosonConfigHandler - configHandler = await getContractAt("IBosonConfigHandler", protocolDiamond.address); + configHandler = await getContractAt("IBosonConfigHandler", await protocolDiamond.getAddress()); // Get snapshot id snapshotId = await getSnapshot(); @@ -92,10 +92,10 @@ describe("IBosonConfigHandler", function () { const protocolConfig = [ // Protocol addresses { - token: token.address, - treasury: treasury.address, - voucherBeacon: beacon.address, - beaconProxy: proxy.address, + token: await token.getAddress(), + treasury: await treasury.getAddress(), + voucherBeacon: await beacon.getAddress(), + beaconProxy: await proxy.getAddress(), }, // Protocol limits { @@ -129,94 +129,94 @@ describe("IBosonConfigHandler", function () { // Cut the protocol handler facets into the Diamond const { cutTransaction } = await deployAndCutFacets( - protocolDiamond.address, + await protocolDiamond.getAddress(), facetsToDeploy, maxPriorityFeePerGas ); await expect(cutTransaction) .to.emit(configHandler, "TokenAddressChanged") - .withArgs(token.address, deployer.address); + .withArgs(await token.getAddress(), await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "TreasuryAddressChanged") - .withArgs(treasury.address, deployer.address); + .withArgs(await treasury.getAddress(), await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "VoucherBeaconAddressChanged") - .withArgs(beacon.address, deployer.address); + .withArgs(await beacon.getAddress(), await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "BeaconProxyAddressChanged") - .withArgs(proxy.address, deployer.address); + .withArgs(await proxy.getAddress(), await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "ProtocolFeePercentageChanged") - .withArgs(protocolFeePercentage, deployer.address); + .withArgs(protocolFeePercentage, await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "ProtocolFeeFlatBosonChanged") - .withArgs(protocolFeeFlatBoson, deployer.address); + .withArgs(protocolFeeFlatBoson, await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "MaxExchangesPerBatchChanged") - .withArgs(maxExchangesPerBatch, deployer.address); + .withArgs(maxExchangesPerBatch, await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "MaxOffersPerGroupChanged") - .withArgs(maxOffersPerGroup, deployer.address); + .withArgs(maxOffersPerGroup, await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "MaxTwinsPerBundleChanged") - .withArgs(maxTwinsPerBundle, deployer.address); + .withArgs(maxTwinsPerBundle, await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "MaxOffersPerBundleChanged") - .withArgs(maxOffersPerBundle, deployer.address); + .withArgs(maxOffersPerBundle, await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "MaxOffersPerBatchChanged") - .withArgs(maxOffersPerBatch, deployer.address); + .withArgs(maxOffersPerBatch, await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "MaxTokensPerWithdrawalChanged") - .withArgs(maxTokensPerWithdrawal, deployer.address); + .withArgs(maxTokensPerWithdrawal, await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "MaxFeesPerDisputeResolverChanged") - .withArgs(maxFeesPerDisputeResolver, deployer.address); + .withArgs(maxFeesPerDisputeResolver, await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "MaxEscalationResponsePeriodChanged") - .withArgs(maxEscalationResponsePeriod, deployer.address); + .withArgs(maxEscalationResponsePeriod, await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "MaxDisputesPerBatchChanged") - .withArgs(maxDisputesPerBatch, deployer.address); + .withArgs(maxDisputesPerBatch, await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "MaxAllowedSellersChanged") - .withArgs(maxAllowedSellers, deployer.address); + .withArgs(maxAllowedSellers, await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "BuyerEscalationFeePercentageChanged") - .withArgs(buyerEscalationDepositPercentage, deployer.address); + .withArgs(buyerEscalationDepositPercentage, await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "MaxRoyaltyPercentageChanged") - .withArgs(maxRoyaltyPecentage, deployer.address); + .withArgs(maxRoyaltyPecentage, await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "MaxResolutionPeriodChanged") - .withArgs(maxResolutionPeriod, deployer.address); + .withArgs(maxResolutionPeriod, await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "MinDisputePeriodChanged") - .withArgs(minDisputePeriod, deployer.address); + .withArgs(minDisputePeriod, await deployer.getAddress()); await expect(cutTransaction) .to.emit(configHandler, "MaxPremintedVouchersChanged") - .withArgs(maxPremintedVouchers, deployer.address); + .withArgs(maxPremintedVouchers, await deployer.getAddress()); }); }); }); @@ -227,10 +227,10 @@ describe("IBosonConfigHandler", function () { const protocolConfig = [ // Protocol addresses { - treasury: treasury.address, - token: token.address, - voucherBeacon: beacon.address, - beaconProxy: proxy.address, + treasury: await treasury.getAddress(), + token: await token.getAddress(), + voucherBeacon: await beacon.getAddress(), + beaconProxy: await proxy.getAddress(), }, // Protocol limits { @@ -262,7 +262,7 @@ describe("IBosonConfigHandler", function () { const facetsToDeploy = await getFacetsWithArgs(facetNames, protocolConfig); // Cut the protocol handler facets into the Diamond - await deployAndCutFacets(protocolDiamond.address, facetsToDeploy, maxPriorityFeePerGas); + await deployAndCutFacets(await protocolDiamond.getAddress(), facetsToDeploy, maxPriorityFeePerGas); // Update id snapshotId = await getSnapshot(); @@ -294,7 +294,7 @@ describe("IBosonConfigHandler", function () { // Set new max offer per group, testing for the event await expect(configHandler.connect(deployer).setMaxOffersPerGroup(maxOffersPerGroup)) .to.emit(configHandler, "MaxOffersPerGroupChanged") - .withArgs(maxOffersPerGroup, deployer.address); + .withArgs(maxOffersPerGroup, await deployer.getAddress()); }); it("should update state", async function () { @@ -334,7 +334,7 @@ describe("IBosonConfigHandler", function () { // Set new max twin per bundle, testing for the event await expect(configHandler.connect(deployer).setMaxTwinsPerBundle(maxTwinsPerBundle)) .to.emit(configHandler, "MaxTwinsPerBundleChanged") - .withArgs(maxTwinsPerBundle, deployer.address); + .withArgs(maxTwinsPerBundle, await deployer.getAddress()); }); it("should update state", async function () { @@ -374,7 +374,7 @@ describe("IBosonConfigHandler", function () { // Set new max offer per bundle, testing for the event await expect(configHandler.connect(deployer).setMaxOffersPerBundle(maxOffersPerBundle)) .to.emit(configHandler, "MaxOffersPerBundleChanged") - .withArgs(maxOffersPerBundle, deployer.address); + .withArgs(maxOffersPerBundle, await deployer.getAddress()); }); it("should update state", async function () { @@ -414,7 +414,7 @@ describe("IBosonConfigHandler", function () { // Set new max offer per batch, testing for the event await expect(configHandler.connect(deployer).setMaxOffersPerBatch(maxOffersPerBatch)) .to.emit(configHandler, "MaxOffersPerBatchChanged") - .withArgs(maxOffersPerBatch, deployer.address); + .withArgs(maxOffersPerBatch, await deployer.getAddress()); }); it("should update state", async function () { @@ -454,7 +454,7 @@ describe("IBosonConfigHandler", function () { // Set new max tokens per withdrawal, testing for the event await expect(configHandler.connect(deployer).setMaxTokensPerWithdrawal(maxTokensPerWithdrawal)) .to.emit(configHandler, "MaxTokensPerWithdrawalChanged") - .withArgs(maxTokensPerWithdrawal, deployer.address); + .withArgs(maxTokensPerWithdrawal, await deployer.getAddress()); }); it("should update state", async function () { @@ -492,23 +492,23 @@ describe("IBosonConfigHandler", function () { it("should emit a TokenAddressChanged event", async function () { // Set new token address, testing for the event - await expect(configHandler.connect(deployer).setTokenAddress(token.address)) + await expect(configHandler.connect(deployer).setTokenAddress(await token.getAddress())) .to.emit(configHandler, "TokenAddressChanged") - .withArgs(token.address, deployer.address); + .withArgs(await token.getAddress(), await deployer.getAddress()); }); it("should update state", async function () { // Set new token address - await configHandler.connect(deployer).setTokenAddress(token.address); + await configHandler.connect(deployer).setTokenAddress(await token.getAddress()); // Verify that new value is stored - expect(await configHandler.connect(rando).getTokenAddress()).to.equal(token.address); + expect(await configHandler.connect(rando).getTokenAddress()).to.equal(await token.getAddress()); }); context("💔 Revert Reasons", async function () { it("caller is not the admin", async function () { // Attempt to set new token address, expecting revert - await expect(configHandler.connect(rando).setTokenAddress(token.address)).to.revertedWith( + await expect(configHandler.connect(rando).setTokenAddress(await token.getAddress())).to.revertedWith( RevertReasons.ACCESS_DENIED ); }); @@ -531,23 +531,23 @@ describe("IBosonConfigHandler", function () { it("should emit a TreasuryAddressChanged event", async function () { // Set new treasury address, testing for the event - await expect(configHandler.connect(deployer).setTreasuryAddress(treasury.address)) + await expect(configHandler.connect(deployer).setTreasuryAddress(await treasury.getAddress())) .to.emit(configHandler, "TreasuryAddressChanged") - .withArgs(treasury.address, deployer.address); + .withArgs(await treasury.getAddress(), await deployer.getAddress()); }); it("should update state", async function () { // Set new treasury address - await configHandler.connect(deployer).setTreasuryAddress(treasury.address); + await configHandler.connect(deployer).setTreasuryAddress(await treasury.getAddress()); // Verify that new value is stored - expect(await configHandler.connect(rando).getTreasuryAddress()).to.equal(treasury.address); + expect(await configHandler.connect(rando).getTreasuryAddress()).to.equal(await treasury.getAddress()); }); context("💔 Revert Reasons", async function () { it("caller is not the admin", async function () { // Attempt to set new treasury address, expecting revert - await expect(configHandler.connect(rando).setTreasuryAddress(treasury.address)).to.revertedWith( + await expect(configHandler.connect(rando).setTreasuryAddress(await treasury.getAddress())).to.revertedWith( RevertReasons.ACCESS_DENIED ); }); @@ -570,23 +570,23 @@ describe("IBosonConfigHandler", function () { it("should emit a VoucherAddressChanged event", async function () { // Set new beacon address, testing for the event - await expect(configHandler.connect(deployer).setVoucherBeaconAddress(beacon.address)) + await expect(configHandler.connect(deployer).setVoucherBeaconAddress(await beacon.getAddress())) .to.emit(configHandler, "VoucherBeaconAddressChanged") - .withArgs(beacon.address, deployer.address); + .withArgs(await beacon.getAddress(), await deployer.getAddress()); }); it("should update state", async function () { // Set new beacon address - await configHandler.connect(deployer).setVoucherBeaconAddress(beacon.address); + await configHandler.connect(deployer).setVoucherBeaconAddress(await beacon.getAddress()); // Verify that new value is stored - expect(await configHandler.connect(rando).getVoucherBeaconAddress()).to.equal(beacon.address); + expect(await configHandler.connect(rando).getVoucherBeaconAddress()).to.equal(await beacon.getAddress()); }); context("💔 Revert Reasons", async function () { it("caller is not the admin", async function () { // Attempt to set new beacon address, expecting revert - await expect(configHandler.connect(rando).setVoucherBeaconAddress(beacon.address)).to.revertedWith( + await expect(configHandler.connect(rando).setVoucherBeaconAddress(await beacon.getAddress())).to.revertedWith( RevertReasons.ACCESS_DENIED ); }); @@ -609,23 +609,23 @@ describe("IBosonConfigHandler", function () { it("should emit a VoucherAddressChanged event", async function () { // Set new proxy address, testing for the event - await expect(configHandler.connect(deployer).setBeaconProxyAddress(proxy.address)) + await expect(configHandler.connect(deployer).setBeaconProxyAddress(await proxy.getAddress())) .to.emit(configHandler, "BeaconProxyAddressChanged") - .withArgs(proxy.address, deployer.address); + .withArgs(await proxy.getAddress(), await deployer.getAddress()); }); it("should update state", async function () { // Set new proxy address - await configHandler.connect(deployer).setBeaconProxyAddress(proxy.address); + await configHandler.connect(deployer).setBeaconProxyAddress(await proxy.getAddress()); // Verify that new value is stored - expect(await configHandler.connect(rando).getBeaconProxyAddress()).to.equal(proxy.address); + expect(await configHandler.connect(rando).getBeaconProxyAddress()).to.equal(await proxy.getAddress()); }); context("💔 Revert Reasons", async function () { it("caller is not the admin", async function () { // Attempt to set new proxy address, expecting revert - await expect(configHandler.connect(rando).setBeaconProxyAddress(proxy.address)).to.revertedWith( + await expect(configHandler.connect(rando).setBeaconProxyAddress(await proxy.getAddress())).to.revertedWith( RevertReasons.ACCESS_DENIED ); }); @@ -650,7 +650,7 @@ describe("IBosonConfigHandler", function () { // Set new protocol fee precentage address, testing for the event await expect(configHandler.connect(deployer).setProtocolFeePercentage(protocolFeePercentage)) .to.emit(configHandler, "ProtocolFeePercentageChanged") - .withArgs(protocolFeePercentage, deployer.address); + .withArgs(protocolFeePercentage, await deployer.getAddress()); }); it("should update state", async function () { @@ -690,7 +690,7 @@ describe("IBosonConfigHandler", function () { // Set new flat boson protocol feel, testing for the event await expect(configHandler.connect(deployer).setProtocolFeeFlatBoson(protocolFeeFlatBoson)) .to.emit(configHandler, "ProtocolFeeFlatBosonChanged") - .withArgs(protocolFeeFlatBoson, deployer.address); + .withArgs(protocolFeeFlatBoson, await deployer.getAddress()); }); it("should update state", async function () { @@ -722,7 +722,7 @@ describe("IBosonConfigHandler", function () { // Set new max disputes per batch, testing for the event await expect(configHandler.connect(deployer).setMaxDisputesPerBatch(maxDisputesPerBatch)) .to.emit(configHandler, "MaxDisputesPerBatchChanged") - .withArgs(maxDisputesPerBatch, deployer.address); + .withArgs(maxDisputesPerBatch, await deployer.getAddress()); }); it("should update state", async function () { @@ -762,7 +762,7 @@ describe("IBosonConfigHandler", function () { // Set max fees per dispute resolver await expect(configHandler.connect(deployer).setMaxFeesPerDisputeResolver(maxFeesPerDisputeResolver)) .to.emit(configHandler, "MaxFeesPerDisputeResolverChanged") - .withArgs(maxFeesPerDisputeResolver, deployer.address); + .withArgs(maxFeesPerDisputeResolver, await deployer.getAddress()); }); it("should update state", async function () { @@ -801,7 +801,7 @@ describe("IBosonConfigHandler", function () { // Set new escalation response period await expect(configHandler.connect(deployer).setMaxEscalationResponsePeriod(maxEscalationResponsePeriod)) .to.emit(configHandler, "MaxEscalationResponsePeriodChanged") - .withArgs(maxEscalationResponsePeriod, deployer.address); + .withArgs(maxEscalationResponsePeriod, await deployer.getAddress()); }); it("should update state", async function () { @@ -844,7 +844,7 @@ describe("IBosonConfigHandler", function () { configHandler.connect(deployer).setBuyerEscalationDepositPercentage(buyerEscalationDepositPercentage) ) .to.emit(configHandler, "BuyerEscalationFeePercentageChanged") - .withArgs(buyerEscalationDepositPercentage, deployer.address); + .withArgs(buyerEscalationDepositPercentage, await deployer.getAddress()); }); it("should update state", async function () { @@ -886,7 +886,7 @@ describe("IBosonConfigHandler", function () { // Set new max allowed sellers, testing for the event await expect(configHandler.connect(deployer).setMaxAllowedSellers(maxAllowedSellers)) .to.emit(configHandler, "MaxAllowedSellersChanged") - .withArgs(maxAllowedSellers, deployer.address); + .withArgs(maxAllowedSellers, await deployer.getAddress()); }); it("should update state", async function () { @@ -925,7 +925,7 @@ describe("IBosonConfigHandler", function () { // set new value for Max Total Offer Fee Percentage, testing for the event await expect(configHandler.connect(deployer).setMaxTotalOfferFeePercentage(maxTotalOfferFeePercentage)) .to.emit(configHandler, "MaxTotalOfferFeePercentageChanged") - .withArgs(maxTotalOfferFeePercentage, deployer.address); + .withArgs(maxTotalOfferFeePercentage, await deployer.getAddress()); }); it("should update state", async function () { @@ -967,7 +967,7 @@ describe("IBosonConfigHandler", function () { // set new value for Max Royalty Percentage, testing for the event await expect(configHandler.connect(deployer).setMaxRoyaltyPecentage(maxRoyaltyPecentage)) .to.emit(configHandler, "MaxRoyaltyPercentageChanged") - .withArgs(maxRoyaltyPecentage, deployer.address); + .withArgs(maxRoyaltyPecentage, await deployer.getAddress()); }); it("should update state", async function () { @@ -1013,19 +1013,19 @@ describe("IBosonConfigHandler", function () { it("should emit an AuthTokenContractChanged event", async function () { // Set new auth token contract, testing for the event await expect( - configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.Lens, authTokenContract.address) + configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.Lens, await authTokenContract.getAddress()) ) .to.emit(configHandler, "AuthTokenContractChanged") - .withArgs(AuthTokenType.Lens, authTokenContract.address, deployer.address); + .withArgs(AuthTokenType.Lens, await authTokenContract.getAddress(), await deployer.getAddress()); }); it("should update state", async function () { // Set new auth token contract, - await configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.ENS, authTokenContract.address); + await configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.ENS, await authTokenContract.getAddress()); // Verify that new value is stored expect(await configHandler.connect(rando).getAuthTokenContract(AuthTokenType.ENS)).to.equal( - authTokenContract.address + await authTokenContract.getAddress() ); }); @@ -1033,21 +1033,21 @@ describe("IBosonConfigHandler", function () { it("caller is not the admin", async function () { // Attempt to set new auth token contract, expecting revert await expect( - configHandler.connect(rando).setAuthTokenContract(AuthTokenType.ENS, authTokenContract.address) + configHandler.connect(rando).setAuthTokenContract(AuthTokenType.ENS, await authTokenContract.getAddress()) ).to.revertedWith(RevertReasons.ACCESS_DENIED); }); it("_authTokenType is None", async function () { // Attempt to set new auth token contract, expecting revert await expect( - configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.None, authTokenContract.address) + configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.None, await authTokenContract.getAddress()) ).to.revertedWith(RevertReasons.INVALID_AUTH_TOKEN_TYPE); }); it("_authTokenType is Custom", async function () { // Attempt to set new auth token contract, expecting revert await expect( - configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.Custom, authTokenContract.address) + configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.Custom, await authTokenContract.getAddress()) ).to.revertedWith(RevertReasons.INVALID_AUTH_TOKEN_TYPE); }); @@ -1071,7 +1071,7 @@ describe("IBosonConfigHandler", function () { // Set new max exchange per batch, testing for the event await expect(configHandler.connect(deployer).setMaxExchangesPerBatch(maxExchangesPerBatch)) .to.emit(configHandler, "MaxExchangesPerBatchChanged") - .withArgs(maxExchangesPerBatch, deployer.address); + .withArgs(maxExchangesPerBatch, await deployer.getAddress()); }); it("should update state", async function () { @@ -1110,7 +1110,7 @@ describe("IBosonConfigHandler", function () { // Set new resolution period await expect(configHandler.connect(deployer).setMaxResolutionPeriod(maxResolutionPeriod)) .to.emit(configHandler, "MaxResolutionPeriodChanged") - .withArgs(maxResolutionPeriod, deployer.address); + .withArgs(maxResolutionPeriod, await deployer.getAddress()); }); it("should update state", async function () { @@ -1149,7 +1149,7 @@ describe("IBosonConfigHandler", function () { // Set new minumum dispute period await expect(configHandler.connect(deployer).setMinDisputePeriod(minDisputePeriod)) .to.emit(configHandler, "MinDisputePeriodChanged") - .withArgs(minDisputePeriod, deployer.address); + .withArgs(minDisputePeriod, await deployer.getAddress()); }); it("should update state", async function () { @@ -1188,7 +1188,7 @@ describe("IBosonConfigHandler", function () { // Set new minumum dispute period await expect(configHandler.connect(deployer).setMaxPremintedVouchers(maxPremintedVouchers)) .to.emit(configHandler, "MaxPremintedVouchersChanged") - .withArgs(maxPremintedVouchers, deployer.address); + .withArgs(maxPremintedVouchers, await deployer.getAddress()); }); it("should update state", async function () { @@ -1225,24 +1225,24 @@ describe("IBosonConfigHandler", function () { it("should emit an AccessControllerAddressChanged event", async function () { // Set new access controller address - await expect(configHandler.connect(deployer).setAccessControllerAddress(newAccessController.address)) + await expect(configHandler.connect(deployer).setAccessControllerAddress(await newAccessController.getAddress())) .to.emit(configHandler, "AccessControllerAddressChanged") - .withArgs(newAccessController.address, deployer.address); + .withArgs(await newAccessController.getAddress(), await deployer.getAddress()); }); it("should update state", async function () { // Set new access controller address - await configHandler.connect(deployer).setAccessControllerAddress(newAccessController.address); + await configHandler.connect(deployer).setAccessControllerAddress(await newAccessController.getAddress()); // Verify that new value is stored - expect(await configHandler.connect(rando).getAccessControllerAddress()).to.equal(newAccessController.address); + expect(await configHandler.connect(rando).getAccessControllerAddress()).to.equal(await newAccessController.getAddress()); }); context("💔 Revert Reasons", async function () { it("caller is not the admin", async function () { // Attempt to set new value, expecting revert await expect( - configHandler.connect(rando).setAccessControllerAddress(newAccessController.address) + configHandler.connect(rando).setAccessControllerAddress(await newAccessController.getAddress()) ).to.revertedWith(RevertReasons.ACCESS_DENIED); }); @@ -1263,16 +1263,16 @@ describe("IBosonConfigHandler", function () { it("Initial values are correct", async function () { // Verify that initial values matches those in constructor expect(await configHandler.connect(rando).getTreasuryAddress()).to.equal( - treasury.address, + await treasury.getAddress(), "Invalid treasury address" ); - expect(await configHandler.connect(rando).getTokenAddress()).to.equal(token.address, "Invalid token address"); + expect(await configHandler.connect(rando).getTokenAddress()).to.equal(await token.getAddress(), "Invalid token address"); expect(await configHandler.connect(rando).getVoucherBeaconAddress()).to.equal( - beacon.address, + await beacon.getAddress(), "Invalid voucher address" ); expect(await configHandler.connect(rando).getBeaconProxyAddress()).to.equal( - proxy.address, + await proxy.getAddress(), "Invalid voucher address" ); expect(await configHandler.connect(rando).getProtocolFeePercentage()).to.equal( diff --git a/test/protocol/DisputeHandlerTest.js b/test/protocol/DisputeHandlerTest.js index 36ddb960f..a2169eb19 100644 --- a/test/protocol/DisputeHandlerTest.js +++ b/test/protocol/DisputeHandlerTest.js @@ -149,7 +149,7 @@ describe("IBosonDisputeHandler", function () { agentId = "0"; // agent id is optional while creating an offer // Create a valid seller - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); expect(seller.isValid()).is.true; // VoucherInitValues @@ -164,10 +164,10 @@ describe("IBosonDisputeHandler", function () { // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -227,7 +227,7 @@ describe("IBosonDisputeHandler", function () { exchangeId = "1"; // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Set time forward to the offer's voucherRedeemableFrom await setNextBlockTimestamp(Number(voucherRedeemableFrom)); @@ -244,7 +244,7 @@ describe("IBosonDisputeHandler", function () { // Raise a dispute, testing for the event await expect(disputeHandler.connect(buyer).raiseDispute(exchangeId)) .to.emit(disputeHandler, "DisputeRaised") - .withArgs(exchangeId, buyerId, seller.id, buyer.address); + .withArgs(exchangeId, buyerId, seller.id, await buyer.getAddress()); }); it("should update state", async function () { @@ -370,7 +370,7 @@ describe("IBosonDisputeHandler", function () { // Retract the dispute, testing for the event await expect(disputeHandler.connect(buyer).retractDispute(exchangeId)) .to.emit(disputeHandler, "DisputeRetracted") - .withArgs(exchangeId, buyer.address); + .withArgs(exchangeId, await buyer.getAddress()); }); it("should update state", async function () { @@ -424,7 +424,7 @@ describe("IBosonDisputeHandler", function () { // Retract the dispute, testing for the event await expect(disputeHandler.connect(buyer).retractDispute(exchangeId)) .to.emit(disputeHandler, "DisputeRetracted") - .withArgs(exchangeId, buyer.address); + .withArgs(exchangeId, await buyer.getAddress()); }); context("💔 Revert Reasons", async function () { @@ -452,7 +452,7 @@ describe("IBosonDisputeHandler", function () { exchangeId++; // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Attempt to retract the dispute, expecting revert await expect(disputeHandler.connect(buyer).retractDispute(exchangeId)).to.revertedWith( @@ -515,7 +515,7 @@ describe("IBosonDisputeHandler", function () { // Extend the dispute timeout, testing for the event await expect(disputeHandler.connect(assistant).extendDisputeTimeout(exchangeId, newDisputeTimeout)) .to.emit(disputeHandler, "DisputeTimeoutExtended") - .withArgs(exchangeId, newDisputeTimeout, assistant.address); + .withArgs(exchangeId, newDisputeTimeout, await assistant.getAddress()); }); it("should update state", async function () { @@ -560,7 +560,7 @@ describe("IBosonDisputeHandler", function () { // Extend the dispute timeout, testing for the event await expect(disputeHandler.connect(assistant).extendDisputeTimeout(exchangeId, newDisputeTimeout)) .to.emit(disputeHandler, "DisputeTimeoutExtended") - .withArgs(exchangeId, newDisputeTimeout, assistant.address); + .withArgs(exchangeId, newDisputeTimeout, await assistant.getAddress()); }); context("💔 Revert Reasons", async function () { @@ -588,7 +588,7 @@ describe("IBosonDisputeHandler", function () { exchangeId++; // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Attempt to extend the dispute timeout, expecting revert await expect( @@ -653,7 +653,7 @@ describe("IBosonDisputeHandler", function () { // Expire the dispute, testing for the event await expect(disputeHandler.connect(rando).expireDispute(exchangeId)) .to.emit(disputeHandler, "DisputeExpired") - .withArgs(exchangeId, rando.address); + .withArgs(exchangeId, await rando.getAddress()); }); it("should update state", async function () { @@ -731,7 +731,7 @@ describe("IBosonDisputeHandler", function () { exchangeId++; // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Attempt to expire the dispute, expecting revert await expect(disputeHandler.connect(rando).expireDispute(exchangeId)).to.revertedWith( @@ -810,7 +810,7 @@ describe("IBosonDisputeHandler", function () { customSignatureType, "Resolution", message, - disputeHandler.address + await disputeHandler.getAddress() )); }); @@ -818,7 +818,7 @@ describe("IBosonDisputeHandler", function () { // Resolve the dispute, testing for the event await expect(disputeHandler.connect(buyer).resolveDispute(exchangeId, buyerPercentBasisPoints, r, s, v)) .to.emit(disputeHandler, "DisputeResolved") - .withArgs(exchangeId, buyerPercentBasisPoints, buyer.address); + .withArgs(exchangeId, buyerPercentBasisPoints, await buyer.getAddress()); }); it("should update state", async function () { @@ -867,7 +867,7 @@ describe("IBosonDisputeHandler", function () { it("Buyer can also have a seller account and this will work", async function () { // Create a valid seller with buyer's wallet - seller = mockSeller(buyer.address, buyer.address, ZeroAddress, buyer.address); + seller = mockSeller(await buyer.getAddress(), await buyer.getAddress(), ZeroAddress, await buyer.getAddress()); expect(seller.isValid()).is.true; await accountHandler.connect(buyer).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -875,7 +875,7 @@ describe("IBosonDisputeHandler", function () { // Resolve the dispute, testing for the event await expect(disputeHandler.connect(buyer).resolveDispute(exchangeId, buyerPercentBasisPoints, r, s, v)) .to.emit(disputeHandler, "DisputeResolved") - .withArgs(exchangeId, buyerPercentBasisPoints, buyer.address); + .withArgs(exchangeId, buyerPercentBasisPoints, await buyer.getAddress()); }); it("Dispute can be mutually resolved even if it's in escalated state", async function () { @@ -885,7 +885,7 @@ describe("IBosonDisputeHandler", function () { // Resolve the dispute, testing for the event await expect(disputeHandler.connect(buyer).resolveDispute(exchangeId, buyerPercentBasisPoints, r, s, v)) .to.emit(disputeHandler, "DisputeResolved") - .withArgs(exchangeId, buyerPercentBasisPoints, buyer.address); + .withArgs(exchangeId, buyerPercentBasisPoints, await buyer.getAddress()); }); it("Dispute can be mutually resolved even if it's in escalated state and past the resolution period", async function () { @@ -905,7 +905,7 @@ describe("IBosonDisputeHandler", function () { // Resolve the dispute, testing for the event await expect(disputeHandler.connect(buyer).resolveDispute(exchangeId, buyerPercentBasisPoints, r, s, v)) .to.emit(disputeHandler, "DisputeResolved") - .withArgs(exchangeId, buyerPercentBasisPoints, buyer.address); + .withArgs(exchangeId, buyerPercentBasisPoints, await buyer.getAddress()); }); it("Dispute can be mutually resolved if it's past original timeout, but it was extended", async function () { @@ -920,7 +920,7 @@ describe("IBosonDisputeHandler", function () { // Resolve the dispute, testing for the event await expect(disputeHandler.connect(buyer).resolveDispute(exchangeId, buyerPercentBasisPoints, r, s, v)) .to.emit(disputeHandler, "DisputeResolved") - .withArgs(exchangeId, buyerPercentBasisPoints, buyer.address); + .withArgs(exchangeId, buyerPercentBasisPoints, await buyer.getAddress()); }); }); @@ -932,7 +932,7 @@ describe("IBosonDisputeHandler", function () { customSignatureType, "Resolution", message, - disputeHandler.address + await disputeHandler.getAddress() )); }); @@ -940,7 +940,7 @@ describe("IBosonDisputeHandler", function () { // Resolve the dispute, testing for the event await expect(disputeHandler.connect(assistant).resolveDispute(exchangeId, buyerPercentBasisPoints, r, s, v)) .to.emit(disputeHandler, "DisputeResolved") - .withArgs(exchangeId, buyerPercentBasisPoints, assistant.address); + .withArgs(exchangeId, buyerPercentBasisPoints, await assistant.getAddress()); }); it("should update state", async function () { @@ -989,14 +989,14 @@ describe("IBosonDisputeHandler", function () { it("Assistant can also have a buyer account and this will work", async function () { // Create a valid buyer with assistant's wallet - let buyer = mockBuyer(assistant.address); + let buyer = mockBuyer(await assistant.getAddress()); expect(buyer.isValid()).is.true; await accountHandler.connect(assistant).createBuyer(buyer); // Resolve the dispute, testing for the event await expect(disputeHandler.connect(assistant).resolveDispute(exchangeId, buyerPercentBasisPoints, r, s, v)) .to.emit(disputeHandler, "DisputeResolved") - .withArgs(exchangeId, buyerPercentBasisPoints, assistant.address); + .withArgs(exchangeId, buyerPercentBasisPoints, await assistant.getAddress()); }); it("Dispute can be mutually resolved even if it's in escalated state", async function () { @@ -1006,7 +1006,7 @@ describe("IBosonDisputeHandler", function () { // Resolve the dispute, testing for the event await expect(disputeHandler.connect(assistant).resolveDispute(exchangeId, buyerPercentBasisPoints, r, s, v)) .to.emit(disputeHandler, "DisputeResolved") - .withArgs(exchangeId, buyerPercentBasisPoints, assistant.address); + .withArgs(exchangeId, buyerPercentBasisPoints, await assistant.getAddress()); }); it("Dispute can be mutually resolved even if it's in escalated state and past the resolution period", async function () { @@ -1026,7 +1026,7 @@ describe("IBosonDisputeHandler", function () { // Resolve the dispute, testing for the event await expect(disputeHandler.connect(assistant).resolveDispute(exchangeId, buyerPercentBasisPoints, r, s, v)) .to.emit(disputeHandler, "DisputeResolved") - .withArgs(exchangeId, buyerPercentBasisPoints, assistant.address); + .withArgs(exchangeId, buyerPercentBasisPoints, await assistant.getAddress()); }); it("Dispute can be mutually resolved if it's past original timeout, but it was extended", async function () { @@ -1041,7 +1041,7 @@ describe("IBosonDisputeHandler", function () { // Resolve the dispute, testing for the event await expect(disputeHandler.connect(assistant).resolveDispute(exchangeId, buyerPercentBasisPoints, r, s, v)) .to.emit(disputeHandler, "DisputeResolved") - .withArgs(exchangeId, buyerPercentBasisPoints, assistant.address); + .withArgs(exchangeId, buyerPercentBasisPoints, await assistant.getAddress()); }); }); @@ -1053,7 +1053,7 @@ describe("IBosonDisputeHandler", function () { customSignatureType, "Resolution", message, - disputeHandler.address + await disputeHandler.getAddress() )); }); @@ -1101,7 +1101,7 @@ describe("IBosonDisputeHandler", function () { exchangeId++; // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Attempt to resolve the dispute, expecting revert await expect( @@ -1118,7 +1118,7 @@ describe("IBosonDisputeHandler", function () { // Wallet with seller account, but not the seller in this exchange // Create a valid seller - seller = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); + seller = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); expect(seller.isValid()).is.true; await accountHandler.connect(other1).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -1129,7 +1129,7 @@ describe("IBosonDisputeHandler", function () { // Wallet with buyer account, but not the buyer in this exchange // Create a valid buyer - let buyer = mockBuyer(other2.address); + let buyer = mockBuyer(await other2.getAddress()); expect(buyer.isValid()).is.true; await accountHandler.connect(other2).createBuyer(buyer); @@ -1146,7 +1146,7 @@ describe("IBosonDisputeHandler", function () { customSignatureType, "Resolution", message, - disputeHandler.address + await disputeHandler.getAddress() )); // Attempt to resolve the dispute, expecting revert @@ -1215,11 +1215,11 @@ describe("IBosonDisputeHandler", function () { await accountHandler .connect(adminDR) .addFeesToDisputeResolver(disputeResolverId, [ - new DisputeResolverFee(mockToken.address, "MockToken", DRFeeToken), + new DisputeResolverFee(await mockToken.getAddress(), "MockToken", DRFeeToken), ]); // create an offer with a mock token contract - offer.exchangeToken = mockToken.address; + offer.exchangeToken = await mockToken.getAddress(); offer.sellerDeposit = offer.price = offer.buyerCancelPenalty = "0"; offer.id++; @@ -1230,11 +1230,11 @@ describe("IBosonDisputeHandler", function () { // mint tokens to buyer and approve the protocol buyerEscalationDepositToken = applyPercentage(DRFeeToken, buyerEscalationDepositPercentage); - await mockToken.mint(buyer.address, buyerEscalationDepositToken); - await mockToken.connect(buyer).approve(disputeHandler.address, buyerEscalationDepositToken); + await mockToken.mint(await buyer.getAddress(), buyerEscalationDepositToken); + await mockToken.connect(buyer).approve(await disputeHandler.getAddress(), buyerEscalationDepositToken); // Commit to offer and put exchange all the way to dispute - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offer.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offer.id); await exchangeHandler.connect(buyer).redeemVoucher(++exchangeId); await disputeHandler.connect(buyer).raiseDispute(exchangeId); @@ -1258,12 +1258,12 @@ describe("IBosonDisputeHandler", function () { disputeHandler.connect(buyer).escalateDispute(exchangeId, { value: buyerEscalationDepositNative }) ) .to.emit(disputeHandler, "DisputeEscalated") - .withArgs(exchangeId, disputeResolverId, buyer.address); + .withArgs(exchangeId, disputeResolverId, await buyer.getAddress()); }); it("should update state", async function () { // Protocol balance before - const escrowBalanceBefore = await provider.getBalance(disputeHandler.address); + const escrowBalanceBefore = await provider.getBalance(await disputeHandler.getAddress()); // Escalate the dispute tx = await disputeHandler.connect(buyer).escalateDispute(exchangeId, { value: buyerEscalationDepositNative }); @@ -1299,7 +1299,7 @@ describe("IBosonDisputeHandler", function () { assert.equal(response, DisputeState.Escalated, "Dispute state is incorrect"); // Protocol balance should increase for buyer escalation deposit - const escrowBalanceAfter = await provider.getBalance(disputeHandler.address); + const escrowBalanceAfter = await provider.getBalance(await disputeHandler.getAddress()); expect(escrowBalanceAfter-escrowBalanceBefore).to.equal( buyerEscalationDepositNative, "Escrow balance mismatch" @@ -1310,15 +1310,15 @@ describe("IBosonDisputeHandler", function () { const mockToken = await createDisputeExchangeWithToken(); // Protocol balance before - const escrowBalanceBefore = await mockToken.balanceOf(disputeHandler.address); + const escrowBalanceBefore = await mockToken.balanceOf(await disputeHandler.getAddress()); // Escalate the dispute, testing for the event await expect(disputeHandler.connect(buyer).escalateDispute(exchangeId)) .to.emit(disputeHandler, "DisputeEscalated") - .withArgs(exchangeId, disputeResolverId, buyer.address); + .withArgs(exchangeId, disputeResolverId, await buyer.getAddress()); // Protocol balance should increase for buyer escalation deposit - const escrowBalanceAfter = await mockToken.balanceOf(disputeHandler.address); + const escrowBalanceAfter = await mockToken.balanceOf(await disputeHandler.getAddress()); expect(escrowBalanceAfter-escrowBalanceBefore).to.equal( buyerEscalationDepositToken, "Escrow balance mismatch" @@ -1350,7 +1350,7 @@ describe("IBosonDisputeHandler", function () { exchangeId++; // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Attempt to escalate the dispute, expecting revert await expect(disputeHandler.connect(buyer).escalateDispute(exchangeId), { @@ -1398,7 +1398,7 @@ describe("IBosonDisputeHandler", function () { .createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId); // Commit to offer and put exchange all the way to dispute - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offer.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offer.id); await exchangeHandler.connect(buyer).redeemVoucher(++exchangeId); await disputeHandler.connect(buyer).raiseDispute(exchangeId); @@ -1446,7 +1446,7 @@ describe("IBosonDisputeHandler", function () { const mockToken = await createDisputeExchangeWithToken(); // get rid of some tokens, so buyer has insufficient funds - await mockToken.connect(buyer).transfer(other1.address, buyerEscalationDepositToken); + await mockToken.connect(buyer).transfer(await other1.getAddress(), buyerEscalationDepositToken); // Attempt to commit to an offer, expecting revert await expect(disputeHandler.connect(buyer).escalateDispute(exchangeId)).to.revertedWith( @@ -1456,7 +1456,7 @@ describe("IBosonDisputeHandler", function () { // not approved await mockToken .connect(buyer) - .approve(protocolDiamond.address, BigInt(buyerEscalationDepositToken)-"1".toString()); + .approve(await protocolDiamond.getAddress(), BigInt(buyerEscalationDepositToken)-"1".toString()); // Attempt to commit to an offer, expecting revert await expect(disputeHandler.connect(buyer).escalateDispute(exchangeId)).to.revertedWith( @@ -1473,12 +1473,12 @@ describe("IBosonDisputeHandler", function () { await accountHandler .connect(adminDR) .addFeesToDisputeResolver(disputeResolverId, [ - new DisputeResolverFee(Foreign20WithFee.address, "Foreign20WithFee", "0"), + new DisputeResolverFee(await Foreign20WithFee.getAddress(), "Foreign20WithFee", "0"), ]); // Create an offer with ERC20 with fees // Prepare an absolute zero offer - offer.exchangeToken = Foreign20WithFee.address; + offer.exchangeToken = await Foreign20WithFee.getAddress(); offer.sellerDeposit = offer.price = offer.buyerCancelPenalty = "0"; offer.id++; @@ -1489,11 +1489,11 @@ describe("IBosonDisputeHandler", function () { // mint tokens and approve buyerEscalationDepositToken = applyPercentage(DRFeeToken, buyerEscalationDepositPercentage); - await Foreign20WithFee.mint(buyer.address, buyerEscalationDepositToken); - await Foreign20WithFee.connect(buyer).approve(protocolDiamond.address, buyerEscalationDepositToken); + await Foreign20WithFee.mint(await buyer.getAddress(), buyerEscalationDepositToken); + await Foreign20WithFee.connect(buyer).approve(await protocolDiamond.getAddress(), buyerEscalationDepositToken); // Commit to offer and put exchange all the way to dispute - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offer.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offer.id); await exchangeHandler.connect(buyer).redeemVoucher(++exchangeId); await disputeHandler.connect(buyer).raiseDispute(exchangeId); @@ -1532,7 +1532,7 @@ describe("IBosonDisputeHandler", function () { // Escalate the dispute, testing for the event await expect(disputeHandler.connect(assistantDR).decideDispute(exchangeId, buyerPercentBasisPoints)) .to.emit(disputeHandler, "DisputeDecided") - .withArgs(exchangeId, buyerPercentBasisPoints, assistantDR.address); + .withArgs(exchangeId, buyerPercentBasisPoints, await assistantDR.getAddress()); }); it("should update state", async function () { @@ -1604,7 +1604,7 @@ describe("IBosonDisputeHandler", function () { exchangeId++; // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Attempt to decide the dispute, expecting revert await expect( @@ -1623,7 +1623,7 @@ describe("IBosonDisputeHandler", function () { exchangeId++; // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Redeem voucher await exchangeHandler.connect(buyer).redeemVoucher(exchangeId); @@ -1676,7 +1676,7 @@ describe("IBosonDisputeHandler", function () { // Expire the escalated dispute, testing for the event await expect(disputeHandler.connect(rando).expireEscalatedDispute(exchangeId)) .to.emit(disputeHandler, "EscalatedDisputeExpired") - .withArgs(exchangeId, rando.address); + .withArgs(exchangeId, await rando.getAddress()); }); it("should update state", async function () { @@ -1754,7 +1754,7 @@ describe("IBosonDisputeHandler", function () { exchangeId++; // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Attempt to expire the escalated dispute, expecting revert await expect(disputeHandler.connect(rando).expireEscalatedDispute(exchangeId)).to.revertedWith( @@ -1773,7 +1773,7 @@ describe("IBosonDisputeHandler", function () { exchangeId++; // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Redeem voucher await exchangeHandler.connect(buyer).redeemVoucher(exchangeId); @@ -1822,7 +1822,7 @@ describe("IBosonDisputeHandler", function () { // Refuse the escalated dispute, testing for the event await expect(disputeHandler.connect(assistantDR).refuseEscalatedDispute(exchangeId)) .to.emit(disputeHandler, "EscalatedDisputeRefused") - .withArgs(exchangeId, assistantDR.address); + .withArgs(exchangeId, await assistantDR.getAddress()); }); it("should update state", async function () { @@ -1894,7 +1894,7 @@ describe("IBosonDisputeHandler", function () { exchangeId++; // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Attempt to refuse the escalated dispute, expecting revert await expect(disputeHandler.connect(assistantDR).refuseEscalatedDispute(exchangeId)).to.revertedWith( @@ -1906,7 +1906,7 @@ describe("IBosonDisputeHandler", function () { exchangeId++; // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Redeem voucher await exchangeHandler.connect(buyer).redeemVoucher(exchangeId); @@ -1999,7 +1999,7 @@ describe("IBosonDisputeHandler", function () { exchangeId++; // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Get the exchange [exists, response] = await exchangeHandler.connect(rando).getExchange(exchangeId); @@ -2125,7 +2125,7 @@ describe("IBosonDisputeHandler", function () { customSignatureType, "Resolution", message, - disputeHandler.address + await disputeHandler.getAddress() )); // Buyer resolves dispute @@ -2294,7 +2294,7 @@ describe("IBosonDisputeHandler", function () { customSignatureType, "Resolution", message, - disputeHandler.address + await disputeHandler.getAddress() )); // Retract dispute @@ -2359,7 +2359,7 @@ describe("IBosonDisputeHandler", function () { for (exchangeId = 1; exchangeId <= 5; exchangeId++) { // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Redeem voucher await exchangeHandler.connect(buyer).redeemVoucher(exchangeId); @@ -2396,11 +2396,11 @@ describe("IBosonDisputeHandler", function () { // Expire the disputes, testing for the event const tx = disputeHandler.connect(rando).expireDisputeBatch(disputesToExpire); - await expect(tx).to.emit(disputeHandler, "DisputeExpired").withArgs("2", rando.address); + await expect(tx).to.emit(disputeHandler, "DisputeExpired").withArgs("2", await rando.getAddress()); - await expect(tx).to.emit(disputeHandler, "DisputeExpired").withArgs("3", rando.address); + await expect(tx).to.emit(disputeHandler, "DisputeExpired").withArgs("3", await rando.getAddress()); - await expect(tx).to.emit(disputeHandler, "DisputeExpired").withArgs("4", rando.address); + await expect(tx).to.emit(disputeHandler, "DisputeExpired").withArgs("4", await rando.getAddress()); }); it("should update state", async function () { diff --git a/test/protocol/DisputeResolverHandlerTest.js b/test/protocol/DisputeResolverHandlerTest.js index e3be8fac1..50ad51c15 100644 --- a/test/protocol/DisputeResolverHandlerTest.js +++ b/test/protocol/DisputeResolverHandlerTest.js @@ -126,9 +126,9 @@ describe("DisputeResolverHandler", function () { expect(emptyAuthToken.isValid()).is.true; // Create two additional sellers and create seller allow list - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); - seller2 = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); - let seller3 = mockSeller(other2.address, other2.address, ZeroAddress, other2.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller2 = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); + let seller3 = mockSeller(await other2.getAddress(), await other2.getAddress(), ZeroAddress, await other2.getAddress()); // VoucherInitValues voucherInitValues = mockVoucherInitValues(); @@ -142,7 +142,7 @@ describe("DisputeResolverHandler", function () { sellerAllowList = ["3", "1"]; // Create a valid dispute resolver, then set fields in tests directly - disputeResolver = mockDisputeResolver(assistant.address, admin.address, clerk.address, treasury.address); + disputeResolver = mockDisputeResolver(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); expect(disputeResolver.isValid()).is.true; // How that dispute resolver looks as a returned struct @@ -162,9 +162,9 @@ describe("DisputeResolverHandler", function () { //Create DisputeResolverFee array disputeResolverFees = [ - new DisputeResolverFee(other1.address, "MockToken1", "0"), - new DisputeResolverFee(other2.address, "MockToken2", "0"), - new DisputeResolverFee(other3.address, "MockToken3", "0"), + new DisputeResolverFee(await other1.getAddress(), "MockToken1", "0"), + new DisputeResolverFee(await other2.getAddress(), "MockToken2", "0"), + new DisputeResolverFee(await other3.getAddress(), "MockToken3", "0"), ]; disputeResolverFeeList = new DisputeResolverFeeList(disputeResolverFees); @@ -194,7 +194,7 @@ describe("DisputeResolverHandler", function () { disputeResolverFeeList, 2, sellerAllowList, - admin.address + await admin.getAddress() ); expect(valid).is.true; }); @@ -213,7 +213,7 @@ describe("DisputeResolverHandler", function () { disputeResolverFeeList, 2, sellerAllowList, - admin.address + await admin.getAddress() ); expect(valid).is.true; }); @@ -328,10 +328,10 @@ describe("DisputeResolverHandler", function () { // Create a dispute resolver 2 disputeResolver2 = mockDisputeResolver( - other1.address, - other1.address, + await other1.getAddress(), + await other1.getAddress(), ZeroAddress, - other1.address, + await other1.getAddress(), true ); expect(disputeResolver2.isValid()).is.true; @@ -381,7 +381,7 @@ describe("DisputeResolverHandler", function () { disputeResolverFeeList, 2, sellerAllowList, - admin.address + await admin.getAddress() ); expect(valid).is.true; @@ -406,16 +406,16 @@ describe("DisputeResolverHandler", function () { disputeResolverFeeList, 2, sellerAllowList, - admin.address + await admin.getAddress() ); expect(valid).is.true; // Create a valid dispute resolver, then set fields in tests directly disputeResolver2 = mockDisputeResolver( - other1.address, - other1.address, + await other1.getAddress(), + await other1.getAddress(), ZeroAddress, - treasury.address, + await treasury.getAddress(), true ); expect(disputeResolver2.isValid()).is.true; @@ -432,7 +432,7 @@ describe("DisputeResolverHandler", function () { disputeResolverFeeList, 2, sellerAllowList, - other1.address + await other1.getAddress() ); expect(valid).is.true; }); @@ -456,7 +456,7 @@ describe("DisputeResolverHandler", function () { accountHandler.connect(admin).createDisputeResolver(disputeResolver, disputeResolverFees, sellerAllowList) ).to.revertedWith(RevertReasons.INVALID_ADDRESS); - disputeResolver.assistant = assistant.address; + disputeResolver.assistant = await assistant.getAddress(); disputeResolver.admin = ZeroAddress; // Attempt to Create a DisputeResolver, expecting revert @@ -464,7 +464,7 @@ describe("DisputeResolverHandler", function () { accountHandler.connect(admin).createDisputeResolver(disputeResolver, disputeResolverFees, sellerAllowList) ).to.revertedWith(RevertReasons.INVALID_ADDRESS); - disputeResolver.admin = admin.address; + disputeResolver.admin = await admin.getAddress(); disputeResolver.treasury = ZeroAddress; // Attempt to Create a DisputeResolver, expecting revert @@ -474,7 +474,7 @@ describe("DisputeResolverHandler", function () { }); it("Supplied clerk is not a zero address", async function () { - disputeResolver.clerk = rando.address; + disputeResolver.clerk = await rando.getAddress(); // Attempt to Create a DisputeResolver, expecting revert await expect( @@ -484,10 +484,10 @@ describe("DisputeResolverHandler", function () { it("Address is not unique to this dispute resolver Id", async function () { disputeResolver2 = mockDisputeResolver( - assistant.address, - assistant.address, + await assistant.getAddress(), + await assistant.getAddress(), ZeroAddress, - assistant.address + await assistant.getAddress() ); expect(disputeResolver2.isValid()).is.true; disputeResolver2Struct = disputeResolver2.toStruct(); @@ -529,10 +529,10 @@ describe("DisputeResolverHandler", function () { it("Duplicate dispute resolver fees", async function () { //Create new DisputeResolverFee array disputeResolverFees2 = [ - new DisputeResolverFee(other1.address, "MockToken1", "0"), - new DisputeResolverFee(other3.address, "MockToken3", "0"), - new DisputeResolverFee(other2.address, "MockToken2", "0"), - new DisputeResolverFee(other2.address, "MockToken2", "0"), + new DisputeResolverFee(await other1.getAddress(), "MockToken1", "0"), + new DisputeResolverFee(await other3.getAddress(), "MockToken3", "0"), + new DisputeResolverFee(await other2.getAddress(), "MockToken2", "0"), + new DisputeResolverFee(await other2.getAddress(), "MockToken2", "0"), ]; // Create a dispute resolver @@ -571,7 +571,7 @@ describe("DisputeResolverHandler", function () { }); it("Caller is not the supplied admin", async function () { - disputeResolver.assistant = rando.address; + disputeResolver.assistant = await rando.getAddress(); // Create a dispute resolver await expect( @@ -580,7 +580,7 @@ describe("DisputeResolverHandler", function () { }); it("Caller is not the supplied assistant", async function () { - disputeResolver.admin = rando.address; + disputeResolver.admin = await rando.getAddress(); // Create a dispute resolver await expect( @@ -612,9 +612,9 @@ describe("DisputeResolverHandler", function () { beforeEach(async function () { //Create DisputeResolverFee array disputeResolverFees = [ - new DisputeResolverFee(other1.address, "MockToken1", "0"), - new DisputeResolverFee(other2.address, "MockToken2", "0"), - new DisputeResolverFee(other3.address, "MockToken3", "0"), + new DisputeResolverFee(await other1.getAddress(), "MockToken1", "0"), + new DisputeResolverFee(await other2.getAddress(), "MockToken2", "0"), + new DisputeResolverFee(await other3.getAddress(), "MockToken3", "0"), ]; sellerAllowList = ["1"]; @@ -669,7 +669,7 @@ describe("DisputeResolverHandler", function () { context("👉 areSellersAllowed()", async function () { beforeEach(async function () { //Create DisputeResolverFee array - disputeResolverFees = [new DisputeResolverFee(other1.address, "MockToken1", "0")]; + disputeResolverFees = [new DisputeResolverFee(await other1.getAddress(), "MockToken1", "0")]; }); it("Dispute resolver allows all sellers", async function () { @@ -737,9 +737,9 @@ describe("DisputeResolverHandler", function () { disputeResolver.escalationResponsePeriod = Number( Number(disputeResolver.escalationResponsePeriod) - oneWeek ).toString(); - disputeResolver.assistant = disputeResolverPendingUpdate.assistant = other1.address; - disputeResolver.admin = disputeResolverPendingUpdate.admin = other2.address; - disputeResolver.treasury = other4.address; + disputeResolver.assistant = disputeResolverPendingUpdate.assistant = await other1.getAddress(); + disputeResolver.admin = disputeResolverPendingUpdate.admin = await other2.getAddress(); + disputeResolver.treasury = await other4.getAddress(); disputeResolver.metadataUri = "https://ipfs.io/ipfs/updatedUri"; disputeResolver.active = true; expect(disputeResolver.isValid()).is.true; @@ -754,11 +754,11 @@ describe("DisputeResolverHandler", function () { // Testing for the DisputeResolverUpdatePending event await expect(tx) .to.emit(accountHandler, "DisputeResolverUpdatePending") - .withArgs(disputeResolver.id, disputeResolverPendingUpdateStruct, admin.address); + .withArgs(disputeResolver.id, disputeResolverPendingUpdateStruct, await admin.getAddress()); // Assistant and admin needs owner approval and won't be updated until then - expectedDisputeResolver.assistant = assistant.address; - expectedDisputeResolver.admin = admin.address; + expectedDisputeResolver.assistant = await assistant.getAddress(); + expectedDisputeResolver.admin = await admin.getAddress(); expectedDisputeResolver.clerk = ZeroAddress; expectedDisputeResolverStruct = expectedDisputeResolver.toStruct(); @@ -769,7 +769,7 @@ describe("DisputeResolverHandler", function () { disputeResolver.id, expectedDisputeResolverStruct, disputeResolverPendingUpdateStruct, - admin.address + await admin.getAddress() ); }); @@ -777,10 +777,10 @@ describe("DisputeResolverHandler", function () { disputeResolver.escalationResponsePeriod = Number( Number(disputeResolver.escalationResponsePeriod) - oneWeek ).toString(); - disputeResolver.assistant = other1.address; - disputeResolver.admin = other2.address; + disputeResolver.assistant = await other1.getAddress(); + disputeResolver.admin = await other2.getAddress(); disputeResolver.clerk = ZeroAddress; - disputeResolver.treasury = other4.address; + disputeResolver.treasury = await other4.getAddress(); disputeResolver.metadataUri = "https://ipfs.io/ipfs/updatedUri"; disputeResolver.active = true; expect(disputeResolver.isValid()).is.true; @@ -822,13 +822,13 @@ describe("DisputeResolverHandler", function () { ); //Check that old addresses are no longer mapped. We don't map the treasury address. - [exists] = await accountHandler.connect(rando).getDisputeResolverByAddress(assistant.address); + [exists] = await accountHandler.connect(rando).getDisputeResolverByAddress(await assistant.getAddress()); expect(exists).to.be.false; - [exists] = await accountHandler.connect(rando).getDisputeResolverByAddress(admin.address); + [exists] = await accountHandler.connect(rando).getDisputeResolverByAddress(await admin.getAddress()); expect(exists).to.be.false; - [exists] = await accountHandler.connect(rando).getDisputeResolverByAddress(clerk.address); + [exists] = await accountHandler.connect(rando).getDisputeResolverByAddress(await clerk.getAddress()); expect(exists).to.be.false; //Check that new addresses are mapped. We don't map the treasury address. @@ -841,7 +841,7 @@ describe("DisputeResolverHandler", function () { it("should ignore active flag passed in", async function () { disputeResolver.active = true; - disputeResolver.assistant = other2.address; + disputeResolver.assistant = await other2.getAddress(); expect(disputeResolver.isValid()).is.true; // Update disupte resolver @@ -879,7 +879,7 @@ describe("DisputeResolverHandler", function () { }); it("should update only one address", async function () { - disputeResolver.assistant = other2.address; + disputeResolver.assistant = await other2.getAddress(); expect(disputeResolver.isValid()).is.true; expectedDisputeResolver = disputeResolver.clone(); @@ -908,10 +908,10 @@ describe("DisputeResolverHandler", function () { it("should update the correct dispute resolver", async function () { // Configure another dispute resolver disputeResolver2 = mockDisputeResolver( - other1.address, - other1.address, + await other1.getAddress(), + await other1.getAddress(), ZeroAddress, - other1.address + await other1.getAddress() ); expect(disputeResolver2.isValid()).is.true; @@ -919,7 +919,7 @@ describe("DisputeResolverHandler", function () { const expectedDisputeResolverStruct2 = expectedDisputeResolver2.toStruct(); //Create DisputeResolverFee array - disputeResolverFees2 = [new DisputeResolverFee(rando.address, "RandomToken", "0")]; + disputeResolverFees2 = [new DisputeResolverFee(await rando.getAddress(), "RandomToken", "0")]; const disputeResolverFeeList2 = new DisputeResolverFeeList(disputeResolverFees2); @@ -935,7 +935,7 @@ describe("DisputeResolverHandler", function () { disputeResolverFeeList2, 2, sellerAllowList, - other1.address + await other1.getAddress() ); expect(valid).is.true; @@ -943,10 +943,10 @@ describe("DisputeResolverHandler", function () { disputeResolver.escalationResponsePeriod = Number( Number(disputeResolver.escalationResponsePeriod) - oneWeek ).toString(); - disputeResolver.assistant = rando.address; - disputeResolver.admin = rando.address; + disputeResolver.assistant = await rando.getAddress(); + disputeResolver.admin = await rando.getAddress(); disputeResolver.clerk = ZeroAddress; - disputeResolver.treasury = rando.address; + disputeResolver.treasury = await rando.getAddress(); disputeResolver.metadataUri = "https://ipfs.io/ipfs/updatedUri"; expect(disputeResolver.isValid()).is.true; @@ -1009,17 +1009,17 @@ describe("DisputeResolverHandler", function () { }); it("should be able to only update second time with new admin address", async function () { - disputeResolver.admin = other2.address; + disputeResolver.admin = await other2.getAddress(); expectedDisputeResolver = disputeResolver.clone(); expectedDisputeResolverStruct = expectedDisputeResolver.toStruct(); - disputeResolverPendingUpdate.admin = other2.address; + disputeResolverPendingUpdate.admin = await other2.getAddress(); disputeResolverPendingUpdateStruct = disputeResolverPendingUpdate.toStruct(); // Update a dispute resolver, testing for the event await expect(accountHandler.connect(admin).updateDisputeResolver(disputeResolver)) .to.emit(accountHandler, "DisputeResolverUpdatePending") - .withArgs(disputeResolver.id, disputeResolverPendingUpdateStruct, admin.address); + .withArgs(disputeResolver.id, disputeResolverPendingUpdateStruct, await admin.getAddress()); disputeResolverPendingUpdate.admin = ZeroAddress; disputeResolverPendingUpdateStruct = disputeResolverPendingUpdate.toStruct(); @@ -1035,20 +1035,20 @@ describe("DisputeResolverHandler", function () { disputeResolver.id, expectedDisputeResolverStruct, disputeResolverPendingUpdateStruct, - other2.address + await other2.getAddress() ); - disputeResolver.admin = other3.address; + disputeResolver.admin = await other3.getAddress(); expectedDisputeResolver = disputeResolver.clone(); expectedDisputeResolverStruct = expectedDisputeResolver.toStruct(); - disputeResolverPendingUpdate.admin = other3.address; + disputeResolverPendingUpdate.admin = await other3.getAddress(); disputeResolverPendingUpdateStruct = disputeResolverPendingUpdate.toStruct(); //Update a dispute resolver, testing for the event await expect(accountHandler.connect(other2).updateDisputeResolver(disputeResolver)) .to.emit(accountHandler, "DisputeResolverUpdatePending") - .withArgs(disputeResolver.id, disputeResolverPendingUpdateStruct, other2.address); + .withArgs(disputeResolver.id, disputeResolverPendingUpdateStruct, await other2.getAddress()); disputeResolverPendingUpdate.admin = ZeroAddress; disputeResolverPendingUpdateStruct = disputeResolverPendingUpdate.toStruct(); @@ -1064,7 +1064,7 @@ describe("DisputeResolverHandler", function () { disputeResolver.id, expectedDisputeResolverStruct, disputeResolverPendingUpdateStruct, - other3.address + await other3.getAddress() ); // Attempt to update the dispute resolver with original admin address, expecting revert @@ -1075,23 +1075,23 @@ describe("DisputeResolverHandler", function () { it("should be possible to use non-unique treasury address", async function () { // Update dispute resolver fields - disputeResolver.assistant = other1.address; - disputeResolver.admin = other2.address; + disputeResolver.assistant = await other1.getAddress(); + disputeResolver.admin = await other2.getAddress(); disputeResolver.clerk = ZeroAddress; disputeResolver.active = true; expect(disputeResolver.isValid()).is.true; expectedDisputeResolverStruct = disputeResolver.toStruct(); - disputeResolverPendingUpdate.assistant = other1.address; - disputeResolverPendingUpdate.admin = other2.address; + disputeResolverPendingUpdate.assistant = await other1.getAddress(); + disputeResolverPendingUpdate.admin = await other2.getAddress(); disputeResolverPendingUpdate.clerk = ZeroAddress; disputeResolverPendingUpdateStruct = disputeResolverPendingUpdate.toStruct(); // Request to update a dispute resolver, testing for the DisputeResolerUpdatePending event await expect(accountHandler.connect(admin).updateDisputeResolver(disputeResolver)) .to.emit(accountHandler, "DisputeResolverUpdatePending") - .withArgs(disputeResolver.id, disputeResolverPendingUpdateStruct, admin.address); + .withArgs(disputeResolver.id, disputeResolverPendingUpdateStruct, await admin.getAddress()); // Approve assistant update await accountHandler @@ -1105,10 +1105,10 @@ describe("DisputeResolverHandler", function () { // Configure another dispute resolver disputeResolver2 = mockDisputeResolver( - rando.address, - rando.address, + await rando.getAddress(), + await rando.getAddress(), ZeroAddress, - rando.address + await rando.getAddress() ); expect(disputeResolver2.isValid()).is.true; @@ -1117,7 +1117,7 @@ describe("DisputeResolverHandler", function () { .connect(rando) .createDisputeResolver(disputeResolver2, disputeResolverFees, sellerAllowList); - disputeResolver2.treasury = treasury.address; + disputeResolver2.treasury = await treasury.getAddress(); disputeResolver2Struct = disputeResolver2.toStruct(); disputeResolverPendingUpdate.admin = ZeroAddress; @@ -1128,26 +1128,26 @@ describe("DisputeResolverHandler", function () { // Update new dispute resolver with same treasury address, testing for the event await expect(accountHandler.connect(rando).updateDisputeResolver(disputeResolver2)) .to.emit(accountHandler, "DisputeResolverUpdateApplied") - .withArgs(disputeResolver2.id, disputeResolver2Struct, disputeResolverPendingUpdateStruct, rando.address); + .withArgs(disputeResolver2.id, disputeResolver2Struct, disputeResolverPendingUpdateStruct, await rando.getAddress()); }); it("should be possible to use the same address for assistant, admin and treasury", async function () { // Update dispute resolver fields - disputeResolver.assistant = other1.address; - disputeResolver.admin = other1.address; + disputeResolver.assistant = await other1.getAddress(); + disputeResolver.admin = await other1.getAddress(); disputeResolver.clerk = ZeroAddress; - disputeResolver.treasury = other1.address; + disputeResolver.treasury = await other1.getAddress(); expect(disputeResolver.isValid()).is.true; // Treasury is the only address that doesn't need owner opt-in expectedDisputeResolver = disputeResolver.clone(); - expectedDisputeResolver.assistant = assistant.address; - expectedDisputeResolver.admin = admin.address; + expectedDisputeResolver.assistant = await assistant.getAddress(); + expectedDisputeResolver.admin = await admin.getAddress(); expectedDisputeResolver.clerk = ZeroAddress; expectedDisputeResolverStruct = expectedDisputeResolver.toStruct(); - disputeResolverPendingUpdate.assistant = other1.address; - disputeResolverPendingUpdate.admin = other1.address; + disputeResolverPendingUpdate.assistant = await other1.getAddress(); + disputeResolverPendingUpdate.admin = await other1.getAddress(); disputeResolverPendingUpdate.clerk = ZeroAddress; disputeResolverPendingUpdateStruct = disputeResolverPendingUpdate.toStruct(); @@ -1161,13 +1161,13 @@ describe("DisputeResolverHandler", function () { disputeResolver.id, expectedDisputeResolverStruct, disputeResolverPendingUpdateStruct, - admin.address + await admin.getAddress() ); // Testing for the DisputeResolverUpdatePending event await expect(tx) .to.emit(accountHandler, "DisputeResolverUpdatePending") - .withArgs(disputeResolver.id, disputeResolverPendingUpdateStruct, admin.address); + .withArgs(disputeResolver.id, disputeResolverPendingUpdateStruct, await admin.getAddress()); expectedDisputeResolver = disputeResolver.clone(); expectedDisputeResolverStruct = expectedDisputeResolver.toStruct(); @@ -1191,7 +1191,7 @@ describe("DisputeResolverHandler", function () { disputeResolver.id, expectedDisputeResolverStruct, disputeResolverPendingUpdateStruct, - other1.address + await other1.getAddress() ); }); @@ -1239,7 +1239,7 @@ describe("DisputeResolverHandler", function () { RevertReasons.INVALID_ADDRESS ); - disputeResolver.assistant = assistant.address; + disputeResolver.assistant = await assistant.getAddress(); disputeResolver.admin = ZeroAddress; // Attempt to update the disputer resolver, expecting revert @@ -1247,7 +1247,7 @@ describe("DisputeResolverHandler", function () { RevertReasons.INVALID_ADDRESS ); - disputeResolver.admin = admin.address; + disputeResolver.admin = await admin.getAddress(); disputeResolver.treasury = ZeroAddress; // Attempt to update the disputer resolver, expecting revert @@ -1257,7 +1257,7 @@ describe("DisputeResolverHandler", function () { }); it("Supplied clerk is not a zero address", async function () { - disputeResolver.clerk = rando.address; + disputeResolver.clerk = await rando.getAddress(); // Attempt to update the disputer resolver, expecting revert await expect(accountHandler.connect(admin).updateDisputeResolver(disputeResolver)).to.revertedWith( @@ -1267,10 +1267,10 @@ describe("DisputeResolverHandler", function () { it("Address is not unique to this dispute resolver Id", async function () { disputeResolver2 = mockDisputeResolver( - other1.address, - other1.address, + await other1.getAddress(), + await other1.getAddress(), ZeroAddress, - other1.address + await other1.getAddress() ); expect(disputeResolver2.isValid()).is.true; disputeResolver2Struct = disputeResolver2.toStruct(); @@ -1279,15 +1279,15 @@ describe("DisputeResolverHandler", function () { .createDisputeResolver(disputeResolver2, disputeResolverFees, sellerAllowList); //Set each address value to be same as disputeResolver2 and expect revert - disputeResolver.assistant = other1.address; + disputeResolver.assistant = await other1.getAddress(); // Attempt to update dispute resolver 1 with non-unique admin address, expecting revert await expect(accountHandler.connect(admin).updateDisputeResolver(disputeResolver)).to.revertedWith( RevertReasons.DISPUTE_RESOLVER_ADDRESS_MUST_BE_UNIQUE ); - disputeResolver.assistant = assistant.address; - disputeResolver.admin = other1.address; + disputeResolver.assistant = await assistant.getAddress(); + disputeResolver.admin = await other1.getAddress(); // Attempt to update dispute resolver 1 with non-unique admin address, expecting revert await expect(accountHandler.connect(admin).updateDisputeResolver(disputeResolver)).to.revertedWith( @@ -1297,10 +1297,10 @@ describe("DisputeResolverHandler", function () { it("Address is not unique to this dispute resolver Id", async function () { disputeResolver2 = mockDisputeResolver( - other1.address, - other1.address, + await other1.getAddress(), + await other1.getAddress(), ZeroAddress, - other1.address + await other1.getAddress() ); expect(disputeResolver2.isValid()).is.true; @@ -1309,7 +1309,7 @@ describe("DisputeResolverHandler", function () { .createDisputeResolver(disputeResolver2, disputeResolverFees, sellerAllowList); //Set dispute resolver 2's admin address to dispute resolver 1's assistant address - disputeResolver2.admin = assistant.address; + disputeResolver2.admin = await assistant.getAddress(); // Attempt to update dispute resolver 1 with non-unique admin address, expecting revert await expect(accountHandler.connect(other1).updateDisputeResolver(disputeResolver2)).to.revertedWith( @@ -1317,8 +1317,8 @@ describe("DisputeResolverHandler", function () { ); //Set dispute resolver 2's assistant address to dispute resolver 1's assistant address - disputeResolver2.admin = other2.address; - disputeResolver2.assistant = assistant.address; + disputeResolver2.admin = await other2.getAddress(); + disputeResolver2.assistant = await assistant.getAddress(); // Attempt to update dispute resolver 1 with non-unique assistant address, expecting revert await expect(accountHandler.connect(other1).updateDisputeResolver(disputeResolver2)).to.revertedWith( @@ -1367,8 +1367,8 @@ describe("DisputeResolverHandler", function () { it("should emit a DisputeResolverFeesAdded event", async function () { const disputeResolverFeesToAdd = [ - new DisputeResolverFee(other4.address, "MockToken4", "0"), - new DisputeResolverFee(other5.address, "MockToken5", "0"), + new DisputeResolverFee(await other4.getAddress(), "MockToken4", "0"), + new DisputeResolverFee(await other5.getAddress(), "MockToken5", "0"), ]; const addedDisputeResolverFeeList = new DisputeResolverFeeList(disputeResolverFeesToAdd); @@ -1385,7 +1385,7 @@ describe("DisputeResolverHandler", function () { addedDisputeResolverFeeList, 1, [], - admin.address + await admin.getAddress() ); expect(valid).is.true; @@ -1393,16 +1393,16 @@ describe("DisputeResolverHandler", function () { it("should update DisputeResolverFee state only", async function () { const disputeResolverFeesToAdd = [ - new DisputeResolverFee(other4.address, "MockToken4", "0"), - new DisputeResolverFee(other5.address, "MockToken5", "0"), + new DisputeResolverFee(await other4.getAddress(), "MockToken4", "0"), + new DisputeResolverFee(await other5.getAddress(), "MockToken5", "0"), ]; const expectedDisputeResovlerFees = (disputeResolverFees = [ - new DisputeResolverFee(other1.address, "MockToken1", "0"), - new DisputeResolverFee(other2.address, "MockToken2", "0"), - new DisputeResolverFee(other3.address, "MockToken3", "0"), - new DisputeResolverFee(other4.address, "MockToken4", "0"), - new DisputeResolverFee(other5.address, "MockToken5", "0"), + new DisputeResolverFee(await other1.getAddress(), "MockToken1", "0"), + new DisputeResolverFee(await other2.getAddress(), "MockToken2", "0"), + new DisputeResolverFee(await other3.getAddress(), "MockToken3", "0"), + new DisputeResolverFee(await other4.getAddress(), "MockToken4", "0"), + new DisputeResolverFee(await other5.getAddress(), "MockToken5", "0"), ]); const expectedDisputeResolverFeeList = new DisputeResolverFeeList(expectedDisputeResovlerFees); @@ -1437,8 +1437,8 @@ describe("DisputeResolverHandler", function () { context("💔 Revert Reasons", async function () { it("The dispute resolvers region of protocol is paused", async function () { const disputeResolverFeesToAdd = [ - new DisputeResolverFee(other4.address, "MockToken4", "400"), - new DisputeResolverFee(other5.address, "MockToken5", "500"), + new DisputeResolverFee(await other4.getAddress(), "MockToken4", "400"), + new DisputeResolverFee(await other5.getAddress(), "MockToken5", "500"), ]; // Pause the dispute resolvers region of the protocol @@ -1495,8 +1495,8 @@ describe("DisputeResolverHandler", function () { it("Duplicate dispute resolver fees", async function () { //Add to DisputeResolverFee array - disputeResolverFees.push(new DisputeResolverFee(other4.address, "MockToken4", "0")); - disputeResolverFees.push(new DisputeResolverFee(other5.address, "MockToken5", "0")); + disputeResolverFees.push(new DisputeResolverFee(await other4.getAddress(), "MockToken4", "0")); + disputeResolverFees.push(new DisputeResolverFee(await other5.getAddress(), "MockToken5", "0")); disputeResolverFeeList = new DisputeResolverFeeList(disputeResolverFees); // Attempt to add fees to the dispute resolver, expecting revert @@ -1506,7 +1506,7 @@ describe("DisputeResolverHandler", function () { }); it("Fee amount is not 0", async function () { - disputeResolverFees = [new DisputeResolverFee(other4.address, "MockToken4", "200")]; + disputeResolverFees = [new DisputeResolverFee(await other4.getAddress(), "MockToken4", "200")]; // Attempt to Create a DR, expecting revert await expect( @@ -1530,17 +1530,17 @@ describe("DisputeResolverHandler", function () { }); it("should emit a DisputeResolverFeesRemoved event", async function () { - feeTokenAddressesToRemove = [other1.address, other2.address, other3.address]; + feeTokenAddressesToRemove = [await other1.getAddress(), await other2.getAddress(), await other3.getAddress()]; await expect( accountHandler.connect(admin).removeFeesFromDisputeResolver(disputeResolver.id, feeTokenAddressesToRemove) ) .to.emit(accountHandler, "DisputeResolverFeesRemoved") - .withArgs(disputeResolver.id, feeTokenAddressesToRemove, admin.address); + .withArgs(disputeResolver.id, feeTokenAddressesToRemove, await admin.getAddress()); }); it("should update the DisputeResolverFee state only if the first DisputeResolverFee is removed", async function () { - feeTokenAddressesToRemove = [other1.address]; + feeTokenAddressesToRemove = [await other1.getAddress()]; // Remove fees from dispute resolver await accountHandler @@ -1564,8 +1564,8 @@ describe("DisputeResolverHandler", function () { } const expectedDisputeResolverFees = [ - new DisputeResolverFee(other3.address, "MockToken3", "0"), - new DisputeResolverFee(other2.address, "MockToken2", "0"), + new DisputeResolverFee(await other3.getAddress(), "MockToken3", "0"), + new DisputeResolverFee(await other2.getAddress(), "MockToken2", "0"), ]; const expectedDisputeResolverFeeList = new DisputeResolverFeeList(expectedDisputeResolverFees); @@ -1577,7 +1577,7 @@ describe("DisputeResolverHandler", function () { }); it("should update state only if the last DisputeResolverFee is removed", async function () { - feeTokenAddressesToRemove = [other3.address]; + feeTokenAddressesToRemove = [await other3.getAddress()]; // Remove fees from dispute resolver await accountHandler @@ -1601,8 +1601,8 @@ describe("DisputeResolverHandler", function () { } const expectedDisputeResolverFees = [ - new DisputeResolverFee(other1.address, "MockToken1", "0"), - new DisputeResolverFee(other2.address, "MockToken2", "0"), + new DisputeResolverFee(await other1.getAddress(), "MockToken1", "0"), + new DisputeResolverFee(await other2.getAddress(), "MockToken2", "0"), ]; const expectedDisputeResolverFeeList = new DisputeResolverFeeList(expectedDisputeResolverFees); @@ -1614,7 +1614,7 @@ describe("DisputeResolverHandler", function () { }); it("should update DisputeResolverFee state only if some DisputeResolverFees are removed", async function () { - feeTokenAddressesToRemove = [other1.address, other3.address]; + feeTokenAddressesToRemove = [await other1.getAddress(), await other3.getAddress()]; // Remove fees from dispute resolver await accountHandler @@ -1637,7 +1637,7 @@ describe("DisputeResolverHandler", function () { expect(JSON.stringify(returnedDisputeResolver[key]) === JSON.stringify(value)).is.true; } - const expectedisputeResolverFees = [new DisputeResolverFee(other2.address, "MockToken2", "0")]; + const expectedisputeResolverFees = [new DisputeResolverFee(await other2.getAddress(), "MockToken2", "0")]; const expectedDisputeResolverFeeList = new DisputeResolverFeeList(expectedisputeResolverFees); assert.equal( @@ -1650,7 +1650,7 @@ describe("DisputeResolverHandler", function () { }); it("should update DisputeResolverFee state only if all DisputeResolverFees are removed", async function () { - const feeTokenAddressesToRemove = [other1.address, other2.address, other3.address]; + const feeTokenAddressesToRemove = [await other1.getAddress(), await other2.getAddress(), await other3.getAddress()]; // Remove fees from dispute resolver await accountHandler @@ -1687,7 +1687,7 @@ describe("DisputeResolverHandler", function () { context("💔 Revert Reasons", async function () { beforeEach(async function () { - feeTokenAddressesToRemove = [other1.address, other2.address, other3.address]; + feeTokenAddressesToRemove = [await other1.getAddress(), await other2.getAddress(), await other3.getAddress()]; }); it("The dispute resolvers region of protocol is paused", async function () { @@ -1744,7 +1744,7 @@ describe("DisputeResolverHandler", function () { }); it("DisputeResolverFee in array does not exist for Dispute Resolver", async function () { - feeTokenAddressesToRemove = [other4.address, other5.address]; + feeTokenAddressesToRemove = [await other4.getAddress(), await other5.getAddress()]; // Attempt to remove fees from the dispute resolver, expecting revert await expect( @@ -1761,7 +1761,7 @@ describe("DisputeResolverHandler", function () { .createDisputeResolver(disputeResolver, disputeResolverFees, sellerAllowList); // make another seller with id = "5" - let seller4 = mockSeller(other3.address, other3.address, ZeroAddress, other3.address); + let seller4 = mockSeller(await other3.getAddress(), await other3.getAddress(), ZeroAddress, await other3.getAddress()); await accountHandler.connect(other3).createSeller(seller4, emptyAuthToken, voucherInitValues); @@ -1783,7 +1783,7 @@ describe("DisputeResolverHandler", function () { // add sellers, test for event await expect(accountHandler.connect(admin).addSellersToAllowList(disputeResolver.id, allowedSellersToAdd)) .to.emit(accountHandler, "AllowedSellersAdded") - .withArgs(disputeResolver.id, allowedSellersToAdd, admin.address); + .withArgs(disputeResolver.id, allowedSellersToAdd, await admin.getAddress()); }); it("should update SellerAllowList state only", async function () { @@ -1924,7 +1924,7 @@ describe("DisputeResolverHandler", function () { .createDisputeResolver(disputeResolver, disputeResolverFees, sellerAllowList); // make another seller with id = "5" - const seller4 = mockSeller(other3.address, other3.address, ZeroAddress, other3.address); + const seller4 = mockSeller(await other3.getAddress(), await other3.getAddress(), ZeroAddress, await other3.getAddress()); // AuthToken emptyAuthToken = mockAuthToken(); @@ -1946,7 +1946,7 @@ describe("DisputeResolverHandler", function () { accountHandler.connect(admin).removeSellersFromAllowList(disputeResolver.id, allowedSellersToRemove) ) .to.emit(accountHandler, "AllowedSellersRemoved") - .withArgs(disputeResolver.id, allowedSellersToRemove, admin.address); + .withArgs(disputeResolver.id, allowedSellersToRemove, await admin.getAddress()); }); it("should update SellerAllowList state only if some Allowed Sellers are removed", async function () { @@ -2018,7 +2018,7 @@ describe("DisputeResolverHandler", function () { expect(returnedSellerAllowList.toString()).to.eql(expectedSellerAllowList.toString(), "Allowed list wrong"); // make another seller with id = "6" - const seller6 = mockSeller(other4.address, other4.address, ZeroAddress, other4.address); + const seller6 = mockSeller(await other4.getAddress(), await other4.getAddress(), ZeroAddress, await other4.getAddress()); await accountHandler.connect(other4).createSeller(seller6, emptyAuthToken, voucherInitValues); // check that mappings of allowed selleres were updated @@ -2084,7 +2084,7 @@ describe("DisputeResolverHandler", function () { it("Seller id is not approved", async function () { // make another seller with id = "6" - const seller6 = mockSeller(other4.address, other4.address, ZeroAddress, other4.address); + const seller6 = mockSeller(await other4.getAddress(), await other4.getAddress(), ZeroAddress, await other4.getAddress()); await accountHandler.connect(other4).createSeller(seller6, emptyAuthToken, voucherInitValues); // seller exists, it's not approved @@ -2117,8 +2117,8 @@ describe("DisputeResolverHandler", function () { }); it("New assistant should opt-in to update disputeResolver", async function () { - disputeResolver.assistant = other1.address; - expectedDisputeResolver.assistant = other1.address; + disputeResolver.assistant = await other1.getAddress(); + expectedDisputeResolver.assistant = await other1.getAddress(); expectedDisputeResolverStruct = expectedDisputeResolver.toStruct(); await accountHandler.connect(admin).updateDisputeResolver(disputeResolver); @@ -2133,13 +2133,13 @@ describe("DisputeResolverHandler", function () { disputeResolver.id, expectedDisputeResolverStruct, disputeResolverPendingUpdateStruct, - other1.address + await other1.getAddress() ); }); it("New admin should opt-in to update disputeResolver", async function () { - disputeResolver.admin = other1.address; - expectedDisputeResolver.admin = other1.address; + disputeResolver.admin = await other1.getAddress(); + expectedDisputeResolver.admin = await other1.getAddress(); expectedDisputeResolverStruct = expectedDisputeResolver.toStruct(); await accountHandler.connect(admin).updateDisputeResolver(disputeResolver); @@ -2154,14 +2154,14 @@ describe("DisputeResolverHandler", function () { disputeResolver.id, expectedDisputeResolverStruct, disputeResolverPendingUpdateStruct, - other1.address + await other1.getAddress() ); }); it("Should update admin and assistant in a single call ", async function () { disputeResolver.clerk = expectedDisputeResolver.clerk = ZeroAddress; - disputeResolver.admin = expectedDisputeResolver.admin = other1.address; - disputeResolver.assistant = expectedDisputeResolver.assistant = other1.address; + disputeResolver.admin = expectedDisputeResolver.admin = await other1.getAddress(); + disputeResolver.assistant = expectedDisputeResolver.assistant = await other1.getAddress(); expectedDisputeResolverStruct = expectedDisputeResolver.toStruct(); await accountHandler.connect(admin).updateDisputeResolver(disputeResolver); @@ -2179,28 +2179,28 @@ describe("DisputeResolverHandler", function () { disputeResolver.id, expectedDisputeResolverStruct, disputeResolverPendingUpdateStruct, - other1.address + await other1.getAddress() ); }); it("If updateDisputeResolver is called twice with no optIn in between, disputeResolverPendingUpdate is populated with the data from second call", async function () { - disputeResolver.assistant = disputeResolverPendingUpdate.assistant = other1.address; + disputeResolver.assistant = disputeResolverPendingUpdate.assistant = await other1.getAddress(); disputeResolverPendingUpdateStruct = disputeResolverPendingUpdate.toStruct(); await expect(accountHandler.connect(admin).updateDisputeResolver(disputeResolver)) .to.emit(accountHandler, "DisputeResolverUpdatePending") - .withArgs(disputeResolver.id, disputeResolverPendingUpdateStruct, admin.address); + .withArgs(disputeResolver.id, disputeResolverPendingUpdateStruct, await admin.getAddress()); const disputeResolverPendingUpdate2 = disputeResolverPendingUpdate.clone(); disputeResolver.assistant = expectedDisputeResolver.assistant = disputeResolverPendingUpdate2.assistant = - other2.address; + await other2.getAddress(); let disputeResolverPendingUpdate2Struct = disputeResolverPendingUpdate2.toStruct(); await expect(accountHandler.connect(admin).updateDisputeResolver(disputeResolver)) .to.emit(accountHandler, "DisputeResolverUpdatePending") - .withArgs(disputeResolver.id, disputeResolverPendingUpdate2Struct, admin.address); + .withArgs(disputeResolver.id, disputeResolverPendingUpdate2Struct, await admin.getAddress()); await expect( accountHandler @@ -2223,12 +2223,12 @@ describe("DisputeResolverHandler", function () { disputeResolver.id, expectedDisputeResolverStruct, disputeResolverPendingUpdate2Struct, - other2.address + await other2.getAddress() ); }); it("Should not emit 'DisputeResolverUpdateApplied' event if caller doesn't specify any field", async function () { - disputeResolver.assistant = other1.address; + disputeResolver.assistant = await other1.getAddress(); await accountHandler.connect(admin).updateDisputeResolver(disputeResolver); await expect(accountHandler.connect(other1).optInToDisputeResolverUpdate(disputeResolver.id, [])).to.not.emit( @@ -2238,7 +2238,7 @@ describe("DisputeResolverHandler", function () { }); it("Should not emit 'DisputeResolverUpdateApplied'event if there is no pending update for specified field", async function () { - disputeResolver.assistant = other1.address; + disputeResolver.assistant = await other1.getAddress(); await accountHandler.connect(admin).updateDisputeResolver(disputeResolver); await expect( @@ -2251,8 +2251,8 @@ describe("DisputeResolverHandler", function () { context("💔 Revert Reasons", async function () { it("There are no pending updates", async function () { disputeResolver.clerk = ZeroAddress; - disputeResolver.admin = other1.address; - disputeResolver.assistant = other1.address; + disputeResolver.admin = await other1.getAddress(); + disputeResolver.assistant = await other1.getAddress(); expectedDisputeResolver = disputeResolver.clone(); expectedDisputeResolver.active = true; expectedDisputeResolverStruct = expectedDisputeResolver.toStruct(); @@ -2273,7 +2273,7 @@ describe("DisputeResolverHandler", function () { disputeResolver.id, expectedDisputeResolverStruct, disputeResolverPendingUpdateStruct, - other1.address + await other1.getAddress() ); await expect( @@ -2282,7 +2282,7 @@ describe("DisputeResolverHandler", function () { }); it("Caller is not the new admin", async function () { - disputeResolver.admin = other1.address; + disputeResolver.admin = await other1.getAddress(); disputeResolverStruct = disputeResolver.toStruct(); await accountHandler.connect(admin).updateDisputeResolver(disputeResolver); @@ -2295,7 +2295,7 @@ describe("DisputeResolverHandler", function () { }); it("Caller is not the new assistant", async function () { - disputeResolver.assistant = other1.address; + disputeResolver.assistant = await other1.getAddress(); disputeResolverStruct = disputeResolver.toStruct(); await accountHandler.connect(admin).updateDisputeResolver(disputeResolver); @@ -2308,7 +2308,7 @@ describe("DisputeResolverHandler", function () { }); it("The DisputeResolvers region of protocol is paused", async function () { - disputeResolver.assistant = other1.address; + disputeResolver.assistant = await other1.getAddress(); await accountHandler.connect(admin).updateDisputeResolver(disputeResolver); @@ -2322,15 +2322,15 @@ describe("DisputeResolverHandler", function () { it("Admin is not unique to this disputeResolver", async function () { // Update disputeResolver admin - disputeResolver.admin = other1.address; + disputeResolver.admin = await other1.getAddress(); await accountHandler.connect(admin).updateDisputeResolver(disputeResolver); // Create disputeResolver with same admin disputeResolver2 = mockDisputeResolver( - other1.address, - other1.address, + await other1.getAddress(), + await other1.getAddress(), ZeroAddress, - other1.address + await other1.getAddress() ); expect(disputeResolver2.isValid()).is.true; @@ -2348,15 +2348,15 @@ describe("DisputeResolverHandler", function () { it("Assistant is not unique to this disputeResolver", async function () { // Update disputeResolver assistant - disputeResolver.assistant = other1.address; + disputeResolver.assistant = await other1.getAddress(); await accountHandler.connect(admin).updateDisputeResolver(disputeResolver); // Create disputeResolver with same assistant disputeResolver2 = mockDisputeResolver( - other1.address, - other1.address, + await other1.getAddress(), + await other1.getAddress(), ZeroAddress, - other1.address + await other1.getAddress() ); expect(disputeResolver2.isValid()).is.true; @@ -2373,7 +2373,7 @@ describe("DisputeResolverHandler", function () { }); it("Dispute resolver tries to update the clerk", async function () { - disputeResolver.assistant = other1.address; + disputeResolver.assistant = await other1.getAddress(); disputeResolverStruct = disputeResolver.toStruct(); await accountHandler.connect(admin).updateDisputeResolver(disputeResolver); diff --git a/test/protocol/ExchangeHandlerTest.js b/test/protocol/ExchangeHandlerTest.js index 77435a03e..2ec7b20c9 100644 --- a/test/protocol/ExchangeHandlerTest.js +++ b/test/protocol/ExchangeHandlerTest.js @@ -180,7 +180,7 @@ describe("IBosonExchangeHandler", function () { // Define the facet cut const facetCuts = [ { - facetAddress: mockMetaTransactionsHandlerFacet.address, + facetAddress: await mockMetaTransactionsHandlerFacet.getAddress(), action: FacetCutAction.Add, functionSelectors: getSelectors(mockMetaTransactionsHandlerFacet), }, @@ -223,7 +223,7 @@ describe("IBosonExchangeHandler", function () { agentId = "0"; // agent id is optional while creating an offer // Create a valid seller - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); expect(seller.isValid()).is.true; // AuthToken @@ -237,14 +237,14 @@ describe("IBosonExchangeHandler", function () { expect(voucherInitValues.isValid()).is.true; await accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues); - expectedCloneAddress = calculateContractAddress(accountHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "1"); // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -310,7 +310,7 @@ describe("IBosonExchangeHandler", function () { context("👉 commitToOffer()", async function () { it("should emit a BuyerCommitted event", async function () { // Commit to offer, retrieving the event - tx = await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); txReceipt = await tx.wait(); event = getEvent(txReceipt, exchangeHandler, "BuyerCommitted"); @@ -342,7 +342,7 @@ describe("IBosonExchangeHandler", function () { it("should increment the next exchange id counter", async function () { // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Get the next exchange id and ensure it was incremented by the creation of the offer nextExchangeId = await exchangeHandler.connect(rando).getNextExchangeId(); @@ -354,13 +354,13 @@ describe("IBosonExchangeHandler", function () { bosonVoucherClone = await getContractAt("IBosonVoucher", expectedCloneAddress); // Create a new seller to get new clone - seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); seller.id = "3"; // buyer is created after seller in this test expect(seller.isValid()).is.true; await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); - expectedCloneAddress = calculateContractAddress(accountHandler.address, "2"); + expectedCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "2"); const bosonVoucherClone2 = await getContractAt("IBosonVoucher", expectedCloneAddress); // Create an offer with new seller @@ -377,39 +377,39 @@ describe("IBosonExchangeHandler", function () { const buyer2 = newOwner; // Commit to offer, creating a new exchange - tx = await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); const tokenId1 = deriveTokenId(offerId, "1"); - const tx2 = await exchangeHandler.connect(deployer).commitToOffer(buyer2.address, ++offerId, { value: price }); + const tx2 = await exchangeHandler.connect(deployer).commitToOffer(await buyer2.getAddress(), ++offerId, { value: price }); const tokenId2 = deriveTokenId(offerId, "2"); await expect(tx) .to.emit(bosonVoucherClone, "Transfer") - .withArgs(constants.Zero, buyer.address, tokenId1); + .withArgs(constants.Zero, await buyer.getAddress(), tokenId1); await expect(tx2) .to.emit(bosonVoucherClone2, "Transfer") - .withArgs(constants.Zero, buyer2.address, tokenId2); + .withArgs(constants.Zero, await buyer2.getAddress(), tokenId2); // buyer should own 1 voucher on the clone1 address and buyer2 should own 1 voucher on clone2 - expect(await bosonVoucherClone.balanceOf(buyer.address)).to.equal("1", "Clone 1: buyer 1 balance should be 1"); - expect(await bosonVoucherClone.balanceOf(buyer2.address)).to.equal("0", "Clone 1: buyer 2 balance should be 0"); - expect(await bosonVoucherClone2.balanceOf(buyer.address)).to.equal("0", "Clone 2: buyer 1 balance should be 0"); - expect(await bosonVoucherClone2.balanceOf(buyer2.address)).to.equal( + expect(await bosonVoucherClone.balanceOf(await buyer.getAddress())).to.equal("1", "Clone 1: buyer 1 balance should be 1"); + expect(await bosonVoucherClone.balanceOf(await buyer2.getAddress())).to.equal("0", "Clone 1: buyer 2 balance should be 0"); + expect(await bosonVoucherClone2.balanceOf(await buyer.getAddress())).to.equal("0", "Clone 2: buyer 1 balance should be 0"); + expect(await bosonVoucherClone2.balanceOf(await buyer2.getAddress())).to.equal( "1", "Clone 2: buyer 2 balance should be 1" ); // Make sure that vouchers belong to correct buyers and that exist on the correct clone - expect(await bosonVoucherClone.ownerOf(tokenId1)).to.equal(buyer.address, "Voucher 1: Wrong buyer address"); + expect(await bosonVoucherClone.ownerOf(tokenId1)).to.equal(await buyer.getAddress(), "Voucher 1: Wrong buyer address"); await expect(bosonVoucherClone.ownerOf(tokenId2)).to.revertedWith(RevertReasons.ERC721_NON_EXISTENT); - expect(await bosonVoucherClone2.ownerOf(tokenId2)).to.equal(buyer2.address, "Voucher 2: Wrong buyer address"); + expect(await bosonVoucherClone2.ownerOf(tokenId2)).to.equal(await buyer2.getAddress(), "Voucher 2: Wrong buyer address"); await expect(bosonVoucherClone2.ownerOf(tokenId1)).to.revertedWith(RevertReasons.ERC721_NON_EXISTENT); // reference boson voucher proxy should not have any vouchers - expect(await bosonVoucher.balanceOf(buyer.address)).to.equal( + expect(await bosonVoucher.balanceOf(await buyer.getAddress())).to.equal( "0", "Reference proxy: buyer 1 balance should be 0" ); - expect(await bosonVoucher.balanceOf(buyer2.address)).to.equal( + expect(await bosonVoucher.balanceOf(await buyer2.getAddress())).to.equal( "0", "Reference proxy: buyer 2 balance should be 0" ); @@ -419,11 +419,11 @@ describe("IBosonExchangeHandler", function () { await expect(bosonVoucher.ownerOf(tokenId2)).to.revertedWith(RevertReasons.ERC721_NON_EXISTENT); // boson voucher implementation should not have any vouchers - expect(await voucherImplementation.balanceOf(buyer.address)).to.equal( + expect(await voucherImplementation.balanceOf(await buyer.getAddress())).to.equal( "0", "Voucher implementation: buyer 1 balance should be 0" ); - expect(await voucherImplementation.balanceOf(buyer2.address)).to.equal( + expect(await voucherImplementation.balanceOf(await buyer2.getAddress())).to.equal( "0", "Voucher implementation: buyer 2 balance should be 0" ); @@ -438,7 +438,7 @@ describe("IBosonExchangeHandler", function () { bosonVoucherClone = await getContractAt("IBosonVoucher", expectedCloneAddress); // Create a new seller to get new clone - seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); seller.id = "3"; // buyer is created after seller in this test expect(seller.isValid()).is.true; @@ -447,7 +447,7 @@ describe("IBosonExchangeHandler", function () { expect(voucherInitValues.isValid()).is.true; await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); - expectedCloneAddress = calculateContractAddress(accountHandler.address, "2"); + expectedCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "2"); const bosonVoucherClone2 = await getContractAt("IBosonVoucher", expectedCloneAddress); // Create an offer with new seller @@ -464,31 +464,31 @@ describe("IBosonExchangeHandler", function () { const buyer2 = newOwner; // Commit to offer, creating a new exchange - tx = await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); const tokenId1 = deriveTokenId(offerId, "1"); - const tx2 = await exchangeHandler.connect(deployer).commitToOffer(buyer2.address, ++offerId, { value: price }); + const tx2 = await exchangeHandler.connect(deployer).commitToOffer(await buyer2.getAddress(), ++offerId, { value: price }); const tokenId2 = deriveTokenId(offerId, "2"); await expect(tx) .to.emit(bosonVoucherClone, "Transfer") - .withArgs(constants.Zero, buyer.address, tokenId1); + .withArgs(constants.Zero, await buyer.getAddress(), tokenId1); await expect(tx2) .to.emit(bosonVoucherClone2, "Transfer") - .withArgs(constants.Zero, buyer2.address, tokenId2); + .withArgs(constants.Zero, await buyer2.getAddress(), tokenId2); // buyer should own 1 voucher on the clone1 address and buyer2 should own 1 voucher on clone2 - expect(await bosonVoucherClone.balanceOf(buyer.address)).to.equal("1", "Clone 1: buyer 1 balance should be 1"); - expect(await bosonVoucherClone.balanceOf(buyer2.address)).to.equal("0", "Clone 1: buyer 2 balance should be 0"); - expect(await bosonVoucherClone2.balanceOf(buyer.address)).to.equal("0", "Clone 2: buyer 1 balance should be 0"); - expect(await bosonVoucherClone2.balanceOf(buyer2.address)).to.equal( + expect(await bosonVoucherClone.balanceOf(await buyer.getAddress())).to.equal("1", "Clone 1: buyer 1 balance should be 1"); + expect(await bosonVoucherClone.balanceOf(await buyer2.getAddress())).to.equal("0", "Clone 1: buyer 2 balance should be 0"); + expect(await bosonVoucherClone2.balanceOf(await buyer.getAddress())).to.equal("0", "Clone 2: buyer 1 balance should be 0"); + expect(await bosonVoucherClone2.balanceOf(await buyer2.getAddress())).to.equal( "1", "Clone 2: buyer 2 balance should be 1" ); // Make sure that vouchers belong to correct buyers and that exist on the correct clone - expect(await bosonVoucherClone.ownerOf(tokenId1)).to.equal(buyer.address, "Voucher 1: Wrong buyer address"); + expect(await bosonVoucherClone.ownerOf(tokenId1)).to.equal(await buyer.getAddress(), "Voucher 1: Wrong buyer address"); await expect(bosonVoucherClone.ownerOf(tokenId2)).to.revertedWith(RevertReasons.ERC721_NON_EXISTENT); - expect(await bosonVoucherClone2.ownerOf(tokenId2)).to.equal(buyer2.address, "Voucher 2: Wrong buyer address"); + expect(await bosonVoucherClone2.ownerOf(tokenId2)).to.equal(await buyer2.getAddress(), "Voucher 2: Wrong buyer address"); await expect(bosonVoucherClone2.ownerOf(tokenId1)).to.revertedWith(RevertReasons.ERC721_NON_EXISTENT); // Make sure that vouchers have correct royalty fee for exchangeId 1 @@ -537,7 +537,7 @@ describe("IBosonExchangeHandler", function () { exchange.offerId = offerId = "2"; // tested against second offer // Commit to offer, retrieving the event - tx = await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); txReceipt = await tx.wait(); event = getEvent(txReceipt, exchangeHandler, "BuyerCommitted"); @@ -569,7 +569,7 @@ describe("IBosonExchangeHandler", function () { it("Should decrement quantityAvailable", async function () { // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Offer qunantityAvailable should be decremented const [, offer] = await offerHandler.connect(rando).getOffer(offerId); @@ -592,7 +592,7 @@ describe("IBosonExchangeHandler", function () { exchange.offerId = offerId = "2"; // first offer is created on beforeEach // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Offer qunantityAvailable should not be decremented [, offer] = await offerHandler.connect(rando).getOffer(offerId); @@ -614,7 +614,7 @@ describe("IBosonExchangeHandler", function () { offer = mo.offer; offer.price = offer.sellerDeposit = offer.buyerCancelPenalty = "0"; // set a dummy token address otherwise protocol token (zero address) and offer token will be the same and we will get the error AGENT_FEE_AMOUNT_TOO_HIGH - offer.exchangeToken = foreign20.address; + offer.exchangeToken = await foreign20.getAddress(); disputeResolverId = agentId = "0"; exchange.offerId = offerId = "2"; // first offer is created on beforeEach @@ -627,7 +627,7 @@ describe("IBosonExchangeHandler", function () { .createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId); // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId); // Seller funds after const sellerFundsAfter = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -644,7 +644,7 @@ describe("IBosonExchangeHandler", function () { // Attempt to create an exchange, expecting revert await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.revertedWith(RevertReasons.REGION_PAUSED); }); @@ -654,7 +654,7 @@ describe("IBosonExchangeHandler", function () { // Attempt to create a buyer, expecting revert await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.revertedWith(RevertReasons.REGION_PAUSED); }); @@ -671,7 +671,7 @@ describe("IBosonExchangeHandler", function () { // Attempt to commit, expecting revert await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.revertedWith(RevertReasons.NO_SUCH_OFFER); }); @@ -681,7 +681,7 @@ describe("IBosonExchangeHandler", function () { // Attempt to commit to the voided offer, expecting revert await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.revertedWith(RevertReasons.OFFER_HAS_BEEN_VOIDED); }); @@ -703,7 +703,7 @@ describe("IBosonExchangeHandler", function () { // Attempt to commit to the not availabe offer, expecting revert await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, ++offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), ++offerId, { value: price }) ).to.revertedWith(RevertReasons.OFFER_NOT_AVAILABLE); }); @@ -713,7 +713,7 @@ describe("IBosonExchangeHandler", function () { // Attempt to commit to the expired offer, expecting revert await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.revertedWith(RevertReasons.OFFER_HAS_EXPIRED); }); @@ -724,11 +724,11 @@ describe("IBosonExchangeHandler", function () { .connect(assistant) .createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId); // Commit to offer, so it's not availble anymore - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, ++offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), ++offerId, { value: price }); // Attempt to commit to the sold out offer, expecting revert await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.revertedWith(RevertReasons.OFFER_SOLD_OUT); }); }); @@ -738,10 +738,10 @@ describe("IBosonExchangeHandler", function () { let tokenId; beforeEach(async function () { // Reserve range - await offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, assistant.address); + await offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, await assistant.getAddress()); // expected address of the first clone - const voucherCloneAddress = calculateContractAddress(accountHandler.address, "1"); + const voucherCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "1"); bosonVoucher = await getContractAt("BosonVoucher", voucherCloneAddress); await bosonVoucher.connect(assistant).preMint(offer.id, offer.quantityAvailable); @@ -751,7 +751,7 @@ describe("IBosonExchangeHandler", function () { it("should emit a BuyerCommitted event", async function () { // Commit to preminted offer, retrieving the event - tx = await bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId); + tx = await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); txReceipt = await tx.wait(); event = getEvent(txReceipt, exchangeHandler, "BuyerCommitted"); @@ -786,7 +786,7 @@ describe("IBosonExchangeHandler", function () { let nextExchangeIdBefore = await exchangeHandler.connect(rando).getNextExchangeId(); // Commit to preminted offer, creating a new exchange - await bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId); + await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); // Get the next exchange id and ensure it was incremented by the creation of the offer nextExchangeId = await exchangeHandler.connect(rando).getNextExchangeId(); @@ -801,7 +801,7 @@ describe("IBosonExchangeHandler", function () { await expect(bosonVoucher.ownerOf(nextExchangeId)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); // Commit to preminted offer, creating a new exchange - await bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId); + await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); // Voucher with nextExchangeId still should not exist await expect(bosonVoucher.ownerOf(nextExchangeId)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); @@ -818,11 +818,11 @@ describe("IBosonExchangeHandler", function () { assert.equal(royaltyAmount.toString(), "0", "Royalty amount is incorrect"); // Commit to preminted offer, creating a new exchange - await bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId); + await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); // After voucher is transferred, it should have royalty fee [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(tokenId, offer.price); - assert.equal(receiver, treasury.address, "Recipient address is incorrect"); + assert.equal(receiver, await treasury.getAddress(), "Recipient address is incorrect"); assert.equal( royaltyAmount.toString(), applyPercentage(offer.price, royaltyPercentage), @@ -836,7 +836,7 @@ describe("IBosonExchangeHandler", function () { const quantityAvailableBefore = offer.quantityAvailable; // Commit to preminted offer - await bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId); + await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); // Offer qunantityAvailable should be decremented [, offer] = await offerHandler.connect(rando).getOffer(offerId); @@ -865,11 +865,11 @@ describe("IBosonExchangeHandler", function () { .depositFunds(seller.id, ZeroAddress, offer.sellerDeposit, { value: offer.sellerDeposit }); // reserve half of the offer, so it's still possible to commit directly - await offerHandler.connect(assistant).reserveRange(offerId, rangeLength, assistant.address); + await offerHandler.connect(assistant).reserveRange(offerId, rangeLength, await assistant.getAddress()); // Commit to offer directly await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: offer.price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: offer.price }) ).to.emit(exchangeHandler, "BuyerCommitted"); }); @@ -880,7 +880,7 @@ describe("IBosonExchangeHandler", function () { // Attempt to create an exchange, expecting revert await expect( - bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId) + bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) ).to.revertedWith(RevertReasons.REGION_PAUSED); }); @@ -890,31 +890,31 @@ describe("IBosonExchangeHandler", function () { // Attempt to create a buyer, expecting revert await expect( - bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId) + bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) ).to.revertedWith(RevertReasons.REGION_PAUSED); }); it("Caller is not the voucher contract, owned by the seller", async function () { // Attempt to commit to preminted offer, expecting revert await expect( - exchangeHandler.connect(rando).commitToPreMintedOffer(buyer.address, offerId, tokenId) + exchangeHandler.connect(rando).commitToPreMintedOffer(await buyer.getAddress(), offerId, tokenId) ).to.revertedWith(RevertReasons.ACCESS_DENIED); }); it("Exchange exists already", async function () { // Commit to preminted offer, creating a new exchange - await bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId); + await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); // impersonate voucher contract and give it some funds - const impersonatedBosonVoucher = await getImpersonatedSigner(bosonVoucher.address); + const impersonatedBosonVoucher = await getImpersonatedSigner(await bosonVoucher.getAddress()); await provider.send("hardhat_setBalance", [ - impersonatedBosonVoucher.address, + await impersonatedBosonVoucher.getAddress(), parseEther("10").toHexString(), ]); // Simulate a second commit with the same token id await expect( - exchangeHandler.connect(impersonatedBosonVoucher).commitToPreMintedOffer(buyer.address, offerId, exchangeId) + exchangeHandler.connect(impersonatedBosonVoucher).commitToPreMintedOffer(await buyer.getAddress(), offerId, exchangeId) ).to.revertedWith(RevertReasons.EXCHANGE_ALREADY_EXISTS); }); @@ -924,7 +924,7 @@ describe("IBosonExchangeHandler", function () { // Attempt to commit to the voided offer, expecting revert await expect( - bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId) + bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) ).to.revertedWith(RevertReasons.OFFER_HAS_BEEN_VOIDED); }); @@ -948,14 +948,14 @@ describe("IBosonExchangeHandler", function () { // Reserve a range and premint vouchers exchangeId = await exchangeHandler.getNextExchangeId(); - await offerHandler.connect(assistant).reserveRange(offerId, "1", assistant.address); + await offerHandler.connect(assistant).reserveRange(offerId, "1", await assistant.getAddress()); await bosonVoucher.connect(assistant).preMint(offerId, "1"); tokenId = deriveTokenId(offerId, exchangeId); // Attempt to commit to the not available offer, expecting revert await expect( - bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId) + bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) ).to.revertedWith(RevertReasons.OFFER_NOT_AVAILABLE); }); @@ -965,7 +965,7 @@ describe("IBosonExchangeHandler", function () { // Attempt to commit to the expired offer, expecting revert await expect( - bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId) + bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) ).to.revertedWith(RevertReasons.OFFER_HAS_EXPIRED); }); @@ -976,11 +976,11 @@ describe("IBosonExchangeHandler", function () { .connect(assistant) .createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId); // Commit to offer, so it's not availble anymore - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, ++offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), ++offerId, { value: price }); // Attempt to commit to the sold out offer, expecting revert await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.revertedWith(RevertReasons.OFFER_SOLD_OUT); }); }); @@ -994,7 +994,7 @@ describe("IBosonExchangeHandler", function () { offerIds = [offerId]; // Create Condition - condition = mockCondition({ tokenAddress: foreign20.address, threshold: "50", maxCommits: "3" }); + condition = mockCondition({ tokenAddress: await foreign20.getAddress(), threshold: "50", maxCommits: "3" }); expect(condition.isValid()).to.be.true; // Create Group @@ -1005,11 +1005,11 @@ describe("IBosonExchangeHandler", function () { it("should emit a BuyerCommitted event if user meets condition", async function () { // mint enough tokens for the buyer - await foreign20.connect(buyer).mint(buyer.address, condition.threshold); + await foreign20.connect(buyer).mint(await buyer.getAddress(), condition.threshold); // Commit to offer. // We're only concerned that the event is emitted, indicating the condition was met - await expect(exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price })).to.emit( + await expect(exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price })).to.emit( exchangeHandler, "BuyerCommitted" ); @@ -1017,13 +1017,13 @@ describe("IBosonExchangeHandler", function () { it("should allow buyer to commit up to the max times for the group", async function () { // mint enough tokens for the buyer - await foreign20.connect(buyer).mint(buyer.address, condition.threshold); + await foreign20.connect(buyer).mint(await buyer.getAddress(), condition.threshold); // Commit to offer the maximum number of times for (let i = 0; i < Number(condition.maxCommits); i++) { // We're only concerned that the event is emitted, indicating the commit was allowed await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.emit(exchangeHandler, "BuyerCommitted"); } }); @@ -1032,22 +1032,22 @@ describe("IBosonExchangeHandler", function () { it("buyer does not meet condition for commit", async function () { // Attempt to commit, expecting revert await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.revertedWith(RevertReasons.CANNOT_COMMIT); }); it("buyer has exhausted allowable commits", async function () { // mint a token for the buyer - await foreign20.connect(buyer).mint(buyer.address, condition.threshold); + await foreign20.connect(buyer).mint(await buyer.getAddress(), condition.threshold); // Commit to offer the maximum number of times for (let i = 0; i < Number(condition.maxCommits); i++) { - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); } // Attempt to commit again after maximum commits has been reached await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.revertedWith(RevertReasons.CANNOT_COMMIT); }); }); @@ -1061,7 +1061,7 @@ describe("IBosonExchangeHandler", function () { // Create Condition condition = mockCondition({ - tokenAddress: foreign721.address, + tokenAddress: await foreign721.getAddress(), threshold: "5", maxCommits: "3", tokenType: TokenType.NonFungibleToken, @@ -1080,7 +1080,7 @@ describe("IBosonExchangeHandler", function () { // Commit to offer. // We're only concerned that the event is emitted, indicating the condition was met - await expect(exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price })).to.emit( + await expect(exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price })).to.emit( exchangeHandler, "BuyerCommitted" ); @@ -1094,7 +1094,7 @@ describe("IBosonExchangeHandler", function () { for (let i = 0; i < Number(condition.maxCommits); i++) { // We're only concerned that the event is emitted, indicating the commit was allowed await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.emit(exchangeHandler, "BuyerCommitted"); } }); @@ -1103,7 +1103,7 @@ describe("IBosonExchangeHandler", function () { it("buyer does not meet condition for commit", async function () { // Attempt to commit, expecting revert await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.revertedWith(RevertReasons.CANNOT_COMMIT); }); @@ -1113,12 +1113,12 @@ describe("IBosonExchangeHandler", function () { // Commit to offer the maximum number of times for (let i = 0; i < Number(condition.maxCommits); i++) { - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); } // Attempt to commit again after maximum commits has been reached await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.revertedWith(RevertReasons.CANNOT_COMMIT); }); }); @@ -1132,7 +1132,7 @@ describe("IBosonExchangeHandler", function () { // Create Condition condition = mockCondition({ - tokenAddress: foreign1155.address, + tokenAddress: await foreign1155.getAddress(), threshold: "20", maxCommits: "3", tokenType: TokenType.MultiToken, @@ -1152,7 +1152,7 @@ describe("IBosonExchangeHandler", function () { // Commit to offer. // We're only concerned that the event is emitted, indicating the condition was met - await expect(exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price })).to.emit( + await expect(exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price })).to.emit( exchangeHandler, "BuyerCommitted" ); @@ -1166,7 +1166,7 @@ describe("IBosonExchangeHandler", function () { for (let i = 0; i < Number(condition.maxCommits); i++) { // We're only concerned that the event is emitted, indicating the commit was allowed await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.emit(exchangeHandler, "BuyerCommitted"); } }); @@ -1175,7 +1175,7 @@ describe("IBosonExchangeHandler", function () { it("buyer does not meet condition for commit", async function () { // Attempt to commit, expecting revert await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.revertedWith(RevertReasons.CANNOT_COMMIT); }); @@ -1185,12 +1185,12 @@ describe("IBosonExchangeHandler", function () { // Commit to offer the maximum number of times for (let i = 0; i < Number(condition.maxCommits); i++) { - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); } // Attempt to commit again after maximum commits has been reached await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.revertedWith(RevertReasons.CANNOT_COMMIT); }); }); @@ -1204,7 +1204,7 @@ describe("IBosonExchangeHandler", function () { // Create Condition condition = mockCondition({ - tokenAddress: foreign721.address, + tokenAddress: await foreign721.getAddress(), threshold: "0", maxCommits: "3", tokenType: TokenType.NonFungibleToken, @@ -1225,7 +1225,7 @@ describe("IBosonExchangeHandler", function () { // Commit to offer. // We're only concerned that the event is emitted, indicating the condition was met - await expect(exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price })).to.emit( + await expect(exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price })).to.emit( exchangeHandler, "BuyerCommitted" ); @@ -1239,7 +1239,7 @@ describe("IBosonExchangeHandler", function () { for (let i = 0; i < Number(condition.maxCommits); i++) { // We're only concerned that the event is emitted, indicating the commit was allowed await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.emit(exchangeHandler, "BuyerCommitted"); } }); @@ -1248,7 +1248,7 @@ describe("IBosonExchangeHandler", function () { it("token id does not exist", async function () { // Attempt to commit, expecting revert await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.revertedWith(RevertReasons.ERC721_NON_EXISTENT); }); @@ -1258,7 +1258,7 @@ describe("IBosonExchangeHandler", function () { // Attempt to commit, expecting revert await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.revertedWith(RevertReasons.CANNOT_COMMIT); }); @@ -1268,12 +1268,12 @@ describe("IBosonExchangeHandler", function () { // Commit to offer the maximum number of times for (let i = 0; i < Number(condition.maxCommits); i++) { - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); } // Attempt to commit again after maximum commits has been reached await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) ).to.revertedWith(RevertReasons.CANNOT_COMMIT); }); }); @@ -1298,7 +1298,7 @@ describe("IBosonExchangeHandler", function () { it("should emit a BuyerCommitted event", async function () { // Commit to offer. // We're only concerned that the event is emitted, indicating the condition was met - await expect(exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price })).to.emit( + await expect(exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price })).to.emit( exchangeHandler, "BuyerCommitted" ); @@ -1309,7 +1309,7 @@ describe("IBosonExchangeHandler", function () { context("👉 completeExchange()", async function () { beforeEach(async function () { // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); }); it("should emit an ExchangeCompleted event when buyer calls", async function () { @@ -1322,7 +1322,7 @@ describe("IBosonExchangeHandler", function () { // Complete the exchange, expecting event await expect(exchangeHandler.connect(buyer).completeExchange(exchange.id)) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offerId, buyerId, exchange.id, buyer.address); + .withArgs(offerId, buyerId, exchange.id, await buyer.getAddress()); }); it("should update state", async function () { @@ -1360,7 +1360,7 @@ describe("IBosonExchangeHandler", function () { // Complete exchange await expect(exchangeHandler.connect(assistant).completeExchange(exchange.id)) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offerId, buyerId, exchange.id, assistant.address); + .withArgs(offerId, buyerId, exchange.id, await assistant.getAddress()); }); it("should emit an ExchangeCompleted event if anyone calls after dispute period", async function () { @@ -1381,7 +1381,7 @@ describe("IBosonExchangeHandler", function () { // Complete exchange await expect(exchangeHandler.connect(rando).completeExchange(exchange.id)) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offerId, buyerId, exchange.id, rando.address); + .withArgs(offerId, buyerId, exchange.id, await rando.getAddress()); }); it("should emit an ExchangeCompleted event if another buyer calls after dispute period", async function () { @@ -1400,12 +1400,12 @@ describe("IBosonExchangeHandler", function () { await setNextBlockTimestamp(newTime); // Create a rando buyer account - await accountHandler.connect(rando).createBuyer(mockBuyer(rando.address)); + await accountHandler.connect(rando).createBuyer(mockBuyer(await rando.getAddress())); // Complete exchange await expect(exchangeHandler.connect(rando).completeExchange(exchange.id)) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offerId, buyerId, exchange.id, rando.address); + .withArgs(offerId, buyerId, exchange.id, await rando.getAddress()); }); context("💔 Revert Reasons", async function () { @@ -1473,7 +1473,7 @@ describe("IBosonExchangeHandler", function () { await exchangeHandler.connect(buyer).redeemVoucher(exchange.id); // Create a rando buyer account - await accountHandler.connect(rando).createBuyer(mockBuyer(rando.address)); + await accountHandler.connect(rando).createBuyer(mockBuyer(await rando.getAddress())); // Attempt to complete the exchange, expecting revert await expect(exchangeHandler.connect(rando).completeExchange(exchange.id)).to.revertedWith( @@ -1503,7 +1503,7 @@ describe("IBosonExchangeHandler", function () { for (exchangeId = 1; exchangeId <= 5; exchangeId++) { // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Redeem voucher await exchangeHandler.connect(buyer).redeemVoucher(exchangeId); @@ -1517,23 +1517,23 @@ describe("IBosonExchangeHandler", function () { const tx = await exchangeHandler.connect(buyer).completeExchangeBatch(exchangesToComplete); await expect(tx) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offerId, buyerId, exchangesToComplete[0], buyer.address); + .withArgs(offerId, buyerId, exchangesToComplete[0], await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offerId, buyerId, exchangesToComplete[1], buyer.address); + .withArgs(offerId, buyerId, exchangesToComplete[1], await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offerId, buyerId, exchangesToComplete[2], buyer.address); + .withArgs(offerId, buyerId, exchangesToComplete[2], await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offerId, buyerId, exchangesToComplete[3], buyer.address); + .withArgs(offerId, buyerId, exchangesToComplete[3], await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offerId, buyerId, exchangesToComplete[4], buyer.address); + .withArgs(offerId, buyerId, exchangesToComplete[4], await buyer.getAddress()); }); it("should update state", async function () { @@ -1562,23 +1562,23 @@ describe("IBosonExchangeHandler", function () { const tx = await exchangeHandler.connect(assistant).completeExchangeBatch(exchangesToComplete); await expect(tx) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offerId, buyerId, exchangesToComplete[0], assistant.address); + .withArgs(offerId, buyerId, exchangesToComplete[0], await assistant.getAddress()); await expect(tx) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offerId, buyerId, exchangesToComplete[1], assistant.address); + .withArgs(offerId, buyerId, exchangesToComplete[1], await assistant.getAddress()); await expect(tx) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offerId, buyerId, exchangesToComplete[2], assistant.address); + .withArgs(offerId, buyerId, exchangesToComplete[2], await assistant.getAddress()); await expect(tx) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offerId, buyerId, exchangesToComplete[3], assistant.address); + .withArgs(offerId, buyerId, exchangesToComplete[3], await assistant.getAddress()); await expect(tx) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offerId, buyerId, exchangesToComplete[4], assistant.address); + .withArgs(offerId, buyerId, exchangesToComplete[4], await assistant.getAddress()); }); it("should emit an ExchangeCompleted event if anyone calls after dispute period", async function () { @@ -1594,23 +1594,23 @@ describe("IBosonExchangeHandler", function () { const tx = await exchangeHandler.connect(rando).completeExchangeBatch(exchangesToComplete); await expect(tx) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offerId, buyerId, exchangesToComplete[0], rando.address); + .withArgs(offerId, buyerId, exchangesToComplete[0], await rando.getAddress()); await expect(tx) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offerId, buyerId, exchangesToComplete[1], rando.address); + .withArgs(offerId, buyerId, exchangesToComplete[1], await rando.getAddress()); await expect(tx) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offerId, buyerId, exchangesToComplete[2], rando.address); + .withArgs(offerId, buyerId, exchangesToComplete[2], await rando.getAddress()); await expect(tx) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offerId, buyerId, exchangesToComplete[3], rando.address); + .withArgs(offerId, buyerId, exchangesToComplete[3], await rando.getAddress()); await expect(tx) .to.emit(exchangeHandler, "ExchangeCompleted") - .withArgs(offerId, buyerId, exchangesToComplete[4], rando.address); + .withArgs(offerId, buyerId, exchangesToComplete[4], await rando.getAddress()); }); context("💔 Revert Reasons", async function () { @@ -1649,7 +1649,7 @@ describe("IBosonExchangeHandler", function () { it("exchange is not in redeemed state", async function () { // Create exchange with id 6 - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); exchangeId = "6"; // Cancel the voucher for any 1 exchange @@ -1666,7 +1666,7 @@ describe("IBosonExchangeHandler", function () { it("caller is not buyer and offer dispute period has not elapsed", async function () { // Create exchange with id 6 - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); exchangeId = "6"; @@ -1684,7 +1684,7 @@ describe("IBosonExchangeHandler", function () { it("caller is seller's assistant and offer dispute period has not elapsed", async function () { // Create exchange with id 6 - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); exchangeId = "6"; @@ -1702,14 +1702,14 @@ describe("IBosonExchangeHandler", function () { context("👉 revokeVoucher()", async function () { beforeEach(async function () { // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); }); it("should emit an VoucherRevoked event when seller's assistant calls", async function () { // Revoke the voucher, expecting event await expect(exchangeHandler.connect(assistant).revokeVoucher(exchange.id)) .to.emit(exchangeHandler, "VoucherRevoked") - .withArgs(offerId, exchange.id, assistant.address); + .withArgs(offerId, exchange.id, await assistant.getAddress()); }); it("should update state", async function () { @@ -1766,27 +1766,27 @@ describe("IBosonExchangeHandler", function () { context("👉 cancelVoucher()", async function () { beforeEach(async function () { // Commit to offer, retrieving the event - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); }); it("should emit an VoucherCanceled event when original buyer calls", async function () { // Cancel the voucher, expecting event await expect(exchangeHandler.connect(buyer).cancelVoucher(exchange.id)) .to.emit(exchangeHandler, "VoucherCanceled") - .withArgs(offerId, exchange.id, buyer.address); + .withArgs(offerId, exchange.id, await buyer.getAddress()); }); it("should emit an VoucherCanceled event when new owner (not a buyer) calls", async function () { // Transfer voucher to new owner tokenId = deriveTokenId(offerId, exchange.id); - bosonVoucherCloneAddress = calculateContractAddress(exchangeHandler.address, "1"); + bosonVoucherCloneAddress = calculateContractAddress(await exchangeHandler.getAddress(), "1"); bosonVoucherClone = await getContractAt("IBosonVoucher", bosonVoucherCloneAddress); - await bosonVoucherClone.connect(buyer).transferFrom(buyer.address, newOwner.address, tokenId); + await bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await newOwner.getAddress(), tokenId); // Cancel the voucher, expecting event await expect(exchangeHandler.connect(newOwner).cancelVoucher(exchange.id)) .to.emit(exchangeHandler, "VoucherCanceled") - .withArgs(offerId, exchange.id, newOwner.address); + .withArgs(offerId, exchange.id, await newOwner.getAddress()); }); it("should update state when buyer calls", async function () { @@ -1873,7 +1873,7 @@ describe("IBosonExchangeHandler", function () { context("👉 expireVoucher()", async function () { beforeEach(async function () { // Commit to offer, retrieving the event - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); }); it("should emit an VoucherExpired event when anyone calls and voucher has expired", async function () { @@ -1883,7 +1883,7 @@ describe("IBosonExchangeHandler", function () { // Expire the voucher, expecting event await expect(exchangeHandler.connect(rando).expireVoucher(exchange.id)) .to.emit(exchangeHandler, "VoucherExpired") - .withArgs(offerId, exchange.id, rando.address); + .withArgs(offerId, exchange.id, await rando.getAddress()); }); it("should update state when anyone calls and voucher has expired", async function () { @@ -1986,7 +1986,7 @@ describe("IBosonExchangeHandler", function () { context("👉 redeemVoucher()", async function () { beforeEach(async function () { // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); }); it("should emit a VoucherRedeemed event when buyer calls", async function () { @@ -1996,7 +1996,7 @@ describe("IBosonExchangeHandler", function () { // Redeem the voucher, expecting event await expect(exchangeHandler.connect(buyer).redeemVoucher(exchange.id)) .to.emit(exchangeHandler, "VoucherRedeemed") - .withArgs(offerId, exchange.id, buyer.address); + .withArgs(offerId, exchange.id, await buyer.getAddress()); }); it("should update state", async function () { @@ -2073,7 +2073,7 @@ describe("IBosonExchangeHandler", function () { context("👉 redeemVoucher() with bundle", async function () { beforeEach(async function () { // Mint some tokens to be bundled - await foreign20.connect(assistant).mint(assistant.address, "500"); + await foreign20.connect(assistant).mint(await assistant.getAddress(), "500"); // Mint first two and last two tokens of range await foreign721.connect(assistant).mint("0", "2"); await foreign721.connect(assistant).mint("8", "2"); @@ -2085,20 +2085,20 @@ describe("IBosonExchangeHandler", function () { await foreign1155.connect(assistant).setApprovalForAll(protocolDiamondAddress, true); // Create an ERC20 twin - twin20 = mockTwin(foreign20.address); + twin20 = mockTwin(await foreign20.getAddress()); twin20.amount = "3"; twin20.supplyAvailable = "30"; expect(twin20.isValid()).is.true; // Create an ERC721 twin - twin721 = mockTwin(foreign721.address, TokenType.NonFungibleToken); + twin721 = mockTwin(await foreign721.getAddress(), TokenType.NonFungibleToken); twin721.id = "2"; twin721.amount = "0"; twin721.supplyAvailable = "10"; expect(twin721.isValid()).is.true; // Create an ERC1155 twin - twin1155 = mockTwin(foreign1155.address, TokenType.MultiToken); + twin1155 = mockTwin(await foreign1155.getAddress(), TokenType.MultiToken); twin1155.id = "3"; twin1155.tokenId = "1"; twin1155.amount = "1"; @@ -2123,7 +2123,7 @@ describe("IBosonExchangeHandler", function () { await bundleHandler.connect(assistant).createBundle(bundle.toStruct()); // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Set time forward to the offer's voucherRedeemableFrom await setNextBlockTimestamp(Number(voucherRedeemableFrom)); @@ -2131,16 +2131,16 @@ describe("IBosonExchangeHandler", function () { it("should transfer the twin", async function () { // Check the buyer's balance of the ERC20 - balance = await foreign20.balanceOf(buyer.address); + balance = await foreign20.balanceOf(await buyer.getAddress()); expect(balance).to.equal(0); // Redeem the voucher await expect(exchangeHandler.connect(buyer).redeemVoucher(exchange.id)) .to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin20.id, twin20.tokenAddress, exchange.id, twin20.tokenId, twin20.amount, buyer.address); + .withArgs(twin20.id, twin20.tokenAddress, exchange.id, twin20.tokenId, twin20.amount, await buyer.getAddress()); // Check the buyer's balance of the ERC20 - balance = await foreign20.balanceOf(buyer.address); + balance = await foreign20.balanceOf(await buyer.getAddress()); expect(balance).to.equal(3); }); @@ -2175,7 +2175,7 @@ describe("IBosonExchangeHandler", function () { await bundleHandler.connect(assistant).createBundle(bundle.toStruct()); // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Set time forward to the offer's voucherRedeemableFrom voucherRedeemableFrom = offerDates.voucherRedeemableFrom; @@ -2209,7 +2209,7 @@ describe("IBosonExchangeHandler", function () { await bundleHandler.connect(assistant).createBundle(bundle.toStruct()); // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Set time forward to the offer's voucherRedeemableFrom voucherRedeemableFrom = offerDates.voucherRedeemableFrom; @@ -2218,10 +2218,10 @@ describe("IBosonExchangeHandler", function () { // Redeem the second voucher await expect(exchangeHandler.connect(buyer).redeemVoucher(++exchange.id)) .to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin20.id, twin20.tokenAddress, exchange.id, "0", twin20.amount, buyer.address); + .withArgs(twin20.id, twin20.tokenAddress, exchange.id, "0", twin20.amount, await buyer.getAddress()); // Check the buyer's balance - balance = await foreign20.balanceOf(buyer.address); + balance = await foreign20.balanceOf(await buyer.getAddress()); expect(balance).to.equal(3); const [, twin] = await twinHandler.getTwin(twin20.id); @@ -2237,11 +2237,11 @@ describe("IBosonExchangeHandler", function () { await expect(tx) .to.emit(exchangeHandler, "VoucherRevoked") - .withArgs(exchange.offerId, exchange.id, buyer.address); + .withArgs(exchange.offerId, exchange.id, await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "TwinTransferFailed") - .withArgs(twin20.id, twin20.tokenAddress, exchange.id, twin20.tokenId, twin20.amount, buyer.address); + .withArgs(twin20.id, twin20.tokenAddress, exchange.id, twin20.tokenId, twin20.amount, await buyer.getAddress()); // Get the exchange state [, response] = await exchangeHandler.connect(rando).getExchangeState(exchange.id); @@ -2253,11 +2253,11 @@ describe("IBosonExchangeHandler", function () { it("should revoke exchange when ERC20 contract transferFrom returns false", async function () { const [foreign20ReturnFalse] = await deployMockTokens(["Foreign20TransferFromReturnFalse"]); - await foreign20ReturnFalse.connect(assistant).mint(assistant.address, "500"); + await foreign20ReturnFalse.connect(assistant).mint(await assistant.getAddress(), "500"); await foreign20ReturnFalse.connect(assistant).approve(protocolDiamondAddress, "100"); // Create a new ERC20 twin - twin20 = mockTwin(foreign20ReturnFalse.address, TokenType.FungibleToken); + twin20 = mockTwin(await foreign20ReturnFalse.getAddress(), TokenType.FungibleToken); twin20.id = "4"; // Create a new twin @@ -2278,11 +2278,11 @@ describe("IBosonExchangeHandler", function () { await bundleHandler.connect(assistant).createBundle(new Bundle("1", seller.id, [++offerId], [twin20.id])); // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); await expect(exchangeHandler.connect(buyer).redeemVoucher(++exchange.id)) .to.emit(exchangeHandler, "TwinTransferFailed") - .withArgs(twin20.id, twin20.tokenAddress, exchange.id, "0", twin20.amount, buyer.address); + .withArgs(twin20.id, twin20.tokenAddress, exchange.id, "0", twin20.amount, await buyer.getAddress()); // Get the exchange state [, response] = await exchangeHandler.connect(rando).getExchangeState(exchange.id); @@ -2308,7 +2308,7 @@ describe("IBosonExchangeHandler", function () { await expect(tx) .to.emit(disputeHandler, "DisputeRaised") - .withArgs(exchangeId, ++exchange.buyerId, seller.id, testProtocolFunctions.address); + .withArgs(exchangeId, ++exchange.buyerId, seller.id, await testProtocolFunctions.getAddress()); await expect(tx) .to.emit(exchangeHandler, "TwinTransferFailed") @@ -2318,7 +2318,7 @@ describe("IBosonExchangeHandler", function () { exchangeId, twin20.tokenId, twin20.amount, - testProtocolFunctions.address + await testProtocolFunctions.getAddress() ); // Get the exchange state @@ -2338,7 +2338,7 @@ describe("IBosonExchangeHandler", function () { await bundleHandler.connect(assistant).createBundle(bundle.toStruct()); // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Set time forward to the offer's voucherRedeemableFrom await setNextBlockTimestamp(Number(voucherRedeemableFrom)); @@ -2349,34 +2349,34 @@ describe("IBosonExchangeHandler", function () { // Check the assistant owns the last ERC721 of twin range owner = await foreign721.ownerOf(tokenId); - expect(owner).to.equal(assistant.address); + expect(owner).to.equal(await assistant.getAddress()); [exists, response] = await exchangeHandler.connect(rando).getExchangeState(exchange.id); // Redeem the voucher await expect(exchangeHandler.connect(buyer).redeemVoucher(exchange.id)) .to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin721.id, twin721.tokenAddress, exchange.id, tokenId, "0", buyer.address); + .withArgs(twin721.id, twin721.tokenAddress, exchange.id, tokenId, "0", await buyer.getAddress()); // Check the buyer owns the last ERC721 of twin range owner = await foreign721.ownerOf(tokenId); - expect(owner).to.equal(buyer.address); + expect(owner).to.equal(await buyer.getAddress()); tokenId = "8"; // Check the assistant owns the last ERC721 of twin range owner = await foreign721.ownerOf(tokenId); - expect(owner).to.equal(assistant.address); + expect(owner).to.equal(await assistant.getAddress()); // Commit to offer for the second time - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Redeem the second voucher for the second time / id = 2 await expect(exchangeHandler.connect(buyer).redeemVoucher(++exchange.id)) .to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin721.id, twin721.tokenAddress, exchange.id, tokenId, "0", buyer.address); + .withArgs(twin721.id, twin721.tokenAddress, exchange.id, tokenId, "0", await buyer.getAddress()); // Check the buyer owns the last ERC721 of twin range owner = await foreign721.ownerOf(tokenId); - expect(owner).to.equal(buyer.address); + expect(owner).to.equal(await buyer.getAddress()); }); it("1 should be reduced from twin supplyAvailable", async function () { @@ -2412,7 +2412,7 @@ describe("IBosonExchangeHandler", function () { await bundleHandler.connect(assistant).createBundle(bundle.toStruct()); // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Set time forward to the offer's voucherRedeemableFrom voucherRedeemableFrom = offerDates.voucherRedeemableFrom; @@ -2422,11 +2422,11 @@ describe("IBosonExchangeHandler", function () { // Redeem the second voucher await expect(exchangeHandler.connect(buyer).redeemVoucher(++exchange.id)) .to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin721.id, twin721.tokenAddress, exchange.id, tokenId, twin721.amount, buyer.address); + .withArgs(twin721.id, twin721.tokenAddress, exchange.id, tokenId, twin721.amount, await buyer.getAddress()); // Check the buyer owns the first ERC721 in twin range owner = await foreign721.ownerOf(tokenId); - expect(owner).to.equal(buyer.address); + expect(owner).to.equal(await buyer.getAddress()); const [, twin] = await twinHandler.getTwin(twin721.id); expect(twin.supplyAvailable).to.equal(0); @@ -2455,7 +2455,7 @@ describe("IBosonExchangeHandler", function () { // Change twin supply to unlimited and token address to the new token twin721.supplyAvailable = constants.MaxUint256.toString(); - twin721.tokenAddress = other721.address; + twin721.tokenAddress = await other721.getAddress(); twin721.id = "4"; // Create a new twin with the new token address @@ -2466,7 +2466,7 @@ describe("IBosonExchangeHandler", function () { await bundleHandler.connect(assistant).createBundle(bundle.toStruct()); // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Set time forward to the offer's voucherRedeemableFrom voucherRedeemableFrom = offerDates.voucherRedeemableFrom; @@ -2491,35 +2491,35 @@ describe("IBosonExchangeHandler", function () { // Check the assistant owns the first ERC721 of twin range owner = await other721.ownerOf(expectedTokenId); - expect(owner).to.equal(assistant.address); + expect(owner).to.equal(await assistant.getAddress()); // Redeem the voucher await expect(exchangeHandler.connect(buyer).redeemVoucher(exchangeId)) .to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin721.id, twin721.tokenAddress, exchangeId, expectedTokenId, "0", buyer.address); + .withArgs(twin721.id, twin721.tokenAddress, exchangeId, expectedTokenId, "0", await buyer.getAddress()); // Check the buyer owns the first ERC721 of twin range owner = await other721.ownerOf(expectedTokenId); - expect(owner).to.equal(buyer.address); + expect(owner).to.equal(await buyer.getAddress()); ++expectedTokenId; // Check the assistant owns the second ERC721 of twin range owner = await other721.ownerOf(expectedTokenId); - expect(owner).to.equal(assistant.address); + expect(owner).to.equal(await assistant.getAddress()); // Commit to offer for the second time - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Redeem the voucher // tokenId transferred to the buyer is 1 await expect(exchangeHandler.connect(buyer).redeemVoucher(++exchangeId)) .to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin721.id, twin721.tokenAddress, exchangeId, expectedTokenId, "0", buyer.address); + .withArgs(twin721.id, twin721.tokenAddress, exchangeId, expectedTokenId, "0", await buyer.getAddress()); // Check the buyer owns the second ERC721 of twin range owner = await other721.ownerOf(expectedTokenId); - expect(owner).to.equal(buyer.address); + expect(owner).to.equal(await buyer.getAddress()); }); }); @@ -2532,11 +2532,11 @@ describe("IBosonExchangeHandler", function () { await expect(tx) .to.emit(exchangeHandler, "VoucherRevoked") - .withArgs(exchange.offerId, exchange.id, buyer.address); + .withArgs(exchange.offerId, exchange.id, await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "TwinTransferFailed") - .withArgs(twin721.id, twin721.tokenAddress, exchange.id, "9", "0", buyer.address); + .withArgs(twin721.id, twin721.tokenAddress, exchange.id, "9", "0", await buyer.getAddress()); // Get the exchange state [, response] = await exchangeHandler.connect(rando).getExchangeState(exchange.id); @@ -2558,11 +2558,11 @@ describe("IBosonExchangeHandler", function () { await expect(tx) .to.emit(disputeHandler, "DisputeRaised") - .withArgs(exchange.id, ++exchange.buyerId, seller.id, testProtocolFunctions.address); + .withArgs(exchange.id, ++exchange.buyerId, seller.id, await testProtocolFunctions.getAddress()); await expect(tx) .to.emit(exchangeHandler, "TwinTransferFailed") - .withArgs(twin721.id, twin721.tokenAddress, exchange.id, "9", "0", testProtocolFunctions.address); + .withArgs(twin721.id, twin721.tokenAddress, exchange.id, "9", "0", await testProtocolFunctions.getAddress()); // Get the exchange state [, response] = await exchangeHandler.connect(rando).getExchangeState(exchange.id); @@ -2581,7 +2581,7 @@ describe("IBosonExchangeHandler", function () { await bundleHandler.connect(assistant).createBundle(bundle.toStruct()); // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Set time forward to the offer's voucherRedeemableFrom await setNextBlockTimestamp(Number(voucherRedeemableFrom)); @@ -2591,16 +2591,16 @@ describe("IBosonExchangeHandler", function () { let tokenId = "1"; // Check the buyer's balance of the ERC1155 - balance = await foreign1155.balanceOf(buyer.address, tokenId); + balance = await foreign1155.balanceOf(await buyer.getAddress(), tokenId); expect(balance).to.equal(0); // Redeem the voucher await expect(exchangeHandler.connect(buyer).redeemVoucher(exchange.id)) .to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin1155.id, twin1155.tokenAddress, exchange.id, tokenId, twin1155.amount, buyer.address); + .withArgs(twin1155.id, twin1155.tokenAddress, exchange.id, tokenId, twin1155.amount, await buyer.getAddress()); // Check the buyer's balance of the ERC1155 - balance = await foreign1155.balanceOf(buyer.address, tokenId); + balance = await foreign1155.balanceOf(await buyer.getAddress(), tokenId); expect(balance).to.equal(1); }); @@ -2635,7 +2635,7 @@ describe("IBosonExchangeHandler", function () { await bundleHandler.connect(assistant).createBundle(bundle.toStruct()); // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Set time forward to the offer's voucherRedeemableFrom voucherRedeemableFrom = offerDates.voucherRedeemableFrom; @@ -2670,7 +2670,7 @@ describe("IBosonExchangeHandler", function () { await bundleHandler.connect(assistant).createBundle(bundle.toStruct()); // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Set time forward to the offer's voucherRedeemableFrom voucherRedeemableFrom = offerDates.voucherRedeemableFrom; @@ -2685,11 +2685,11 @@ describe("IBosonExchangeHandler", function () { exchange.id, twin1155.tokenId, twin1155.amount, - buyer.address + await buyer.getAddress() ); // Check the buyer's balance - balance = await foreign1155.balanceOf(buyer.address, twin1155.tokenId); + balance = await foreign1155.balanceOf(await buyer.getAddress(), twin1155.tokenId); expect(balance).to.equal(1); const [, twin] = await twinHandler.getTwin(twin1155.id); @@ -2704,7 +2704,7 @@ describe("IBosonExchangeHandler", function () { const tx = await exchangeHandler.connect(buyer).redeemVoucher(exchange.id); await expect(tx) .to.emit(exchangeHandler, "VoucherRevoked") - .withArgs(exchange.offerId, exchange.id, buyer.address); + .withArgs(exchange.offerId, exchange.id, await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "TwinTransferFailed") @@ -2714,7 +2714,7 @@ describe("IBosonExchangeHandler", function () { exchange.id, twin1155.tokenId, twin1155.amount, - buyer.address + await buyer.getAddress() ); // Get the exchange state @@ -2736,7 +2736,7 @@ describe("IBosonExchangeHandler", function () { const tx = await testProtocolFunctions.redeem(++exchange.id); await expect(tx) .to.emit(disputeHandler, "DisputeRaised") - .withArgs(exchange.id, ++exchange.buyerId, seller.id, testProtocolFunctions.address); + .withArgs(exchange.id, ++exchange.buyerId, seller.id, await testProtocolFunctions.getAddress()); await expect(tx) .to.emit(exchangeHandler, "TwinTransferFailed") @@ -2746,7 +2746,7 @@ describe("IBosonExchangeHandler", function () { exchange.id, twin1155.tokenId, twin1155.amount, - testProtocolFunctions.address + await testProtocolFunctions.getAddress() ); // Get the exchange state @@ -2766,7 +2766,7 @@ describe("IBosonExchangeHandler", function () { await bundleHandler.connect(assistant).createBundle(bundle.toStruct()); // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Set time forward to the offer's voucherRedeemableFrom await setNextBlockTimestamp(Number(voucherRedeemableFrom)); @@ -2777,15 +2777,15 @@ describe("IBosonExchangeHandler", function () { let tokenIdMultiToken = "1"; // Check the buyer's balance of the ERC20 - balance = await foreign20.balanceOf(buyer.address); + balance = await foreign20.balanceOf(await buyer.getAddress()); expect(balance).to.equal(0); // Check the assistant owns the ERC721 owner = await foreign721.ownerOf(tokenIdNonFungible); - expect(owner).to.equal(assistant.address); + expect(owner).to.equal(await assistant.getAddress()); // Check the buyer's balance of the ERC1155 - balance = await foreign1155.balanceOf(buyer.address, tokenIdMultiToken); + balance = await foreign1155.balanceOf(await buyer.getAddress(), tokenIdMultiToken); expect(balance).to.equal(0); let exchangeId = exchange.id; @@ -2801,27 +2801,27 @@ describe("IBosonExchangeHandler", function () { exchangeId, tokenIdMultiToken, twin1155.amount, - buyer.address + await buyer.getAddress() ); await expect(tx) .and.to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin20.id, twin20.tokenAddress, exchangeId, "0", twin20.amount, buyer.address); + .withArgs(twin20.id, twin20.tokenAddress, exchangeId, "0", twin20.amount, await buyer.getAddress()); await expect(tx) .and.to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin721.id, twin721.tokenAddress, exchangeId, tokenIdNonFungible, twin721.amount, buyer.address); + .withArgs(twin721.id, twin721.tokenAddress, exchangeId, tokenIdNonFungible, twin721.amount, await buyer.getAddress()); // Check the buyer's balance of the ERC20 - balance = await foreign20.balanceOf(buyer.address); + balance = await foreign20.balanceOf(await buyer.getAddress()); expect(balance).to.equal(3); // Check the buyer owns the ERC721 owner = await foreign721.ownerOf(tokenIdNonFungible); - expect(owner).to.equal(buyer.address); + expect(owner).to.equal(await buyer.getAddress()); // Check the buyer's balance of the ERC1155 - balance = await foreign1155.balanceOf(buyer.address, tokenIdMultiToken); + balance = await foreign1155.balanceOf(await buyer.getAddress(), tokenIdMultiToken); expect(balance).to.equal(1); }); @@ -2858,7 +2858,7 @@ describe("IBosonExchangeHandler", function () { await bundleHandler.connect(assistant).createBundle(bundle.toStruct()); // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Set time forward to the offer's voucherRedeemableFrom voucherRedeemableFrom = offerDates.voucherRedeemableFrom; @@ -2875,25 +2875,25 @@ describe("IBosonExchangeHandler", function () { exchange.id, twin1155.tokenId, twin1155.amount, - buyer.address + await buyer.getAddress() ); await expect(tx) .and.to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin721.id, twin721.tokenAddress, exchange.id, twin721.tokenId, twin721.amount, buyer.address); + .withArgs(twin721.id, twin721.tokenAddress, exchange.id, twin721.tokenId, twin721.amount, await buyer.getAddress()); await expect(tx) .and.to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin20.id, twin20.tokenAddress, exchange.id, "0", twin20.amount, buyer.address); + .withArgs(twin20.id, twin20.tokenAddress, exchange.id, "0", twin20.amount, await buyer.getAddress()); // Check the buyer's balance - balance = await foreign1155.balanceOf(buyer.address, twin1155.tokenId); + balance = await foreign1155.balanceOf(await buyer.getAddress(), twin1155.tokenId); expect(balance).to.equal(1); - balance = await foreign721.balanceOf(buyer.address); + balance = await foreign721.balanceOf(await buyer.getAddress()); expect(balance).to.equal(1); - balance = await foreign20.balanceOf(buyer.address); + balance = await foreign20.balanceOf(await buyer.getAddress()); expect(balance).to.equal(3); let [, twin] = await twinHandler.getTwin(twin1155.id); @@ -2930,7 +2930,7 @@ describe("IBosonExchangeHandler", function () { // Change twin supply to unlimited and token address to the new token twin721.supplyAvailable = constants.MaxUint256.toString(); - twin721.tokenAddress = other721.address; + twin721.tokenAddress = await other721.getAddress(); twin721.id = "4"; // Create a new ERC721 twin with the new token address await twinHandler.connect(assistant).createTwin(twin721.toStruct()); @@ -2950,7 +2950,7 @@ describe("IBosonExchangeHandler", function () { await bundleHandler.connect(assistant).createBundle(bundle.toStruct()); // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Set time forward to the offer's voucherRedeemableFrom voucherRedeemableFrom = offerDates.voucherRedeemableFrom; @@ -2965,11 +2965,11 @@ describe("IBosonExchangeHandler", function () { await expect(tx) .to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin721.id, twin721.tokenAddress, exchange.id, "0", twin721.amount, buyer.address); + .withArgs(twin721.id, twin721.tokenAddress, exchange.id, "0", twin721.amount, await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin20.id, twin20.tokenAddress, exchange.id, twin20.tokenId, twin20.amount, buyer.address); + .withArgs(twin20.id, twin20.tokenAddress, exchange.id, twin20.tokenId, twin20.amount, await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "TwinTransferred") @@ -2979,7 +2979,7 @@ describe("IBosonExchangeHandler", function () { exchange.id, twin1155.tokenId, twin1155.amount, - buyer.address + await buyer.getAddress() ); // Check the supplyAvailable of each twin @@ -3000,35 +3000,35 @@ describe("IBosonExchangeHandler", function () { // Check the assistant owns the first ERC721 of twin range owner = await other721.ownerOf(expectedTokenId); - expect(owner).to.equal(assistant.address); + expect(owner).to.equal(await assistant.getAddress()); // Redeem the voucher await expect(exchangeHandler.connect(buyer).redeemVoucher(exchangeId)) .to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin721.id, twin721.tokenAddress, exchangeId, expectedTokenId, "0", buyer.address); + .withArgs(twin721.id, twin721.tokenAddress, exchangeId, expectedTokenId, "0", await buyer.getAddress()); // Check the buyer owns the first ERC721 of twin range owner = await other721.ownerOf(expectedTokenId); - expect(owner).to.equal(buyer.address); + expect(owner).to.equal(await buyer.getAddress()); ++expectedTokenId; // Check the assistant owns the second ERC721 of twin range owner = await other721.ownerOf(expectedTokenId); - expect(owner).to.equal(assistant.address); + expect(owner).to.equal(await assistant.getAddress()); // Commit to offer for the second time - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Redeem the voucher // tokenId transferred to the buyer is 1 await expect(exchangeHandler.connect(buyer).redeemVoucher(++exchangeId)) .to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin721.id, twin721.tokenAddress, exchangeId, expectedTokenId, "0", buyer.address); + .withArgs(twin721.id, twin721.tokenAddress, exchangeId, expectedTokenId, "0", await buyer.getAddress()); // Check the buyer owns the second ERC721 of twin range owner = await other721.ownerOf(expectedTokenId); - expect(owner).to.equal(buyer.address); + expect(owner).to.equal(await buyer.getAddress()); }); }); @@ -3042,15 +3042,15 @@ describe("IBosonExchangeHandler", function () { await expect(tx) .to.emit(exchangeHandler, "VoucherRevoked") - .withArgs(exchange.offerId, exchangeId, buyer.address); + .withArgs(exchange.offerId, exchangeId, await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "TwinTransferFailed") - .withArgs(twin20.id, twin20.tokenAddress, exchangeId, "0", twin20.amount, buyer.address); + .withArgs(twin20.id, twin20.tokenAddress, exchangeId, "0", twin20.amount, await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin721.id, twin721.tokenAddress, exchangeId, "9", "0", buyer.address); + .withArgs(twin721.id, twin721.tokenAddress, exchangeId, "9", "0", await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "TwinTransferred") @@ -3060,7 +3060,7 @@ describe("IBosonExchangeHandler", function () { exchangeId, twin1155.tokenId, twin1155.amount, - buyer.address + await buyer.getAddress() ); // Get the exchange state @@ -3087,15 +3087,15 @@ describe("IBosonExchangeHandler", function () { const tx = await testProtocolFunctions.redeem(exchangeId); await expect(tx) .to.emit(disputeHandler, "DisputeRaised") - .withArgs(exchangeId, ++exchange.buyerId, seller.id, testProtocolFunctions.address); + .withArgs(exchangeId, ++exchange.buyerId, seller.id, await testProtocolFunctions.getAddress()); await expect(tx) .to.emit(exchangeHandler, "TwinTransferFailed") - .withArgs(twin20.id, twin20.tokenAddress, exchangeId, "0", twin20.amount, testProtocolFunctions.address); + .withArgs(twin20.id, twin20.tokenAddress, exchangeId, "0", twin20.amount, await testProtocolFunctions.getAddress()); await expect(tx) .to.emit(exchangeHandler, "TwinTransferFailed") - .withArgs(twin721.id, twin721.tokenAddress, exchangeId, "9", "0", testProtocolFunctions.address); + .withArgs(twin721.id, twin721.tokenAddress, exchangeId, "9", "0", await testProtocolFunctions.getAddress()); await expect(tx) .to.emit(exchangeHandler, "TwinTransferFailed") @@ -3105,7 +3105,7 @@ describe("IBosonExchangeHandler", function () { exchangeId, twin1155.tokenId, twin1155.amount, - testProtocolFunctions.address + await testProtocolFunctions.getAddress() ); // Get the exchange state @@ -3121,7 +3121,7 @@ describe("IBosonExchangeHandler", function () { context("👉 extendVoucher()", async function () { beforeEach(async function () { // Commit to offer - tx = await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; @@ -3141,7 +3141,7 @@ describe("IBosonExchangeHandler", function () { // Extend the voucher, expecting event await expect(exchangeHandler.connect(assistant).extendVoucher(exchange.id, validUntilDate)) .to.emit(exchangeHandler, "VoucherExtended") - .withArgs(offerId, exchange.id, validUntilDate, assistant.address); + .withArgs(offerId, exchange.id, validUntilDate, await assistant.getAddress()); }); it("should update state", async function () { @@ -3209,10 +3209,10 @@ describe("IBosonExchangeHandler", function () { context("👉 onVoucherTransferred()", async function () { beforeEach(async function () { // Commit to offer, retrieving the event - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Client used for tests - bosonVoucherCloneAddress = calculateContractAddress(exchangeHandler.address, "1"); + bosonVoucherCloneAddress = calculateContractAddress(await exchangeHandler.getAddress(), "1"); bosonVoucherClone = await getContractAt("IBosonVoucher", bosonVoucherCloneAddress); tokenId = deriveTokenId(offerId, exchange.id); @@ -3223,9 +3223,9 @@ describe("IBosonExchangeHandler", function () { nextAccountId = await accountHandler.connect(rando).getNextAccountId(); // Call onVoucherTransferred, expecting event - await expect(bosonVoucherClone.connect(buyer).transferFrom(buyer.address, newOwner.address, tokenId)) + await expect(bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await newOwner.getAddress(), tokenId)) .to.emit(exchangeHandler, "VoucherTransferred") - .withArgs(offerId, exchange.id, nextAccountId, bosonVoucherClone.address); + .withArgs(offerId, exchange.id, nextAccountId, await bosonVoucherClone.getAddress()); }); it("should update exchange when new buyer (with existing, active account) is passed", async function () { @@ -3233,10 +3233,10 @@ describe("IBosonExchangeHandler", function () { nextAccountId = await accountHandler.connect(rando).getNextAccountId(); // Create a buyer account for the new owner - await accountHandler.connect(newOwner).createBuyer(mockBuyer(newOwner.address)); + await accountHandler.connect(newOwner).createBuyer(mockBuyer(await newOwner.getAddress())); // Call onVoucherTransferred - await bosonVoucherClone.connect(buyer).transferFrom(buyer.address, newOwner.address, tokenId); + await bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await newOwner.getAddress(), tokenId); // Get the exchange [exists, response] = await exchangeHandler.connect(rando).getExchange(exchange.id); @@ -3254,7 +3254,7 @@ describe("IBosonExchangeHandler", function () { nextAccountId = await accountHandler.connect(rando).getNextAccountId(); // Call onVoucherTransferred - await bosonVoucherClone.connect(buyer).transferFrom(buyer.address, newOwner.address, tokenId); + await bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await newOwner.getAddress(), tokenId); // Get the exchange [exists, response] = await exchangeHandler.connect(rando).getExchange(exchange.id); @@ -3269,7 +3269,7 @@ describe("IBosonExchangeHandler", function () { it("should be triggered when a voucher is transferred", async function () { // Transfer voucher, expecting event - await expect(bosonVoucherClone.connect(buyer).transferFrom(buyer.address, newOwner.address, tokenId)).to.emit( + await expect(bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await newOwner.getAddress(), tokenId)).to.emit( exchangeHandler, "VoucherTransferred" ); @@ -3280,13 +3280,13 @@ describe("IBosonExchangeHandler", function () { nextExchangeId = await exchangeHandler.getNextExchangeId(); // Create a buyer account - await accountHandler.connect(newOwner).createBuyer(mockBuyer(newOwner.address)); + await accountHandler.connect(newOwner).createBuyer(mockBuyer(await newOwner.getAddress())); // Grant PROTOCOL role to EOA address for test - await accessController.grantRole(Role.PROTOCOL, rando.address); + await accessController.grantRole(Role.PROTOCOL, await rando.getAddress()); // Issue voucher, expecting no event - await expect(bosonVoucherClone.connect(rando).issueVoucher(nextExchangeId, buyer.address)).to.not.emit( + await expect(bosonVoucherClone.connect(rando).issueVoucher(nextExchangeId, await buyer.getAddress())).to.not.emit( exchangeHandler, "VoucherTransferred" ); @@ -3294,7 +3294,7 @@ describe("IBosonExchangeHandler", function () { it("should not be triggered when a voucher is burned", async function () { // Grant PROTOCOL role to EOA address for test - await accessController.grantRole(Role.PROTOCOL, rando.address); + await accessController.grantRole(Role.PROTOCOL, await rando.getAddress()); // Burn voucher, expecting no event await expect(bosonVoucherClone.connect(rando).burnVoucher(tokenId)).to.not.emit( @@ -3305,7 +3305,7 @@ describe("IBosonExchangeHandler", function () { it("Should not be triggered when from and to addresses are the same", async function () { // Transfer voucher, expecting event - await expect(bosonVoucherClone.connect(buyer).transferFrom(buyer.address, buyer.address, tokenId)).to.not.emit( + await expect(bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await buyer.getAddress(), tokenId)).to.not.emit( exchangeHandler, "VoucherTransferred" ); @@ -3313,7 +3313,7 @@ describe("IBosonExchangeHandler", function () { it("Should not be triggered when first transfer of preminted voucher happens", async function () { // Transfer voucher, expecting event - await expect(bosonVoucherClone.connect(buyer).transferFrom(buyer.address, buyer.address, tokenId)).to.not.emit( + await expect(bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await buyer.getAddress(), tokenId)).to.not.emit( exchangeHandler, "VoucherTransferred" ); @@ -3326,37 +3326,37 @@ describe("IBosonExchangeHandler", function () { // Attempt to create a buyer, expecting revert await expect( - bosonVoucherClone.connect(buyer).transferFrom(buyer.address, newOwner.address, tokenId) + bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await newOwner.getAddress(), tokenId) ).to.revertedWith(RevertReasons.REGION_PAUSED); }); it("Caller is not a clone address", async function () { // Attempt to call onVoucherTransferred, expecting revert await expect( - exchangeHandler.connect(rando).onVoucherTransferred(exchange.id, newOwner.address) + exchangeHandler.connect(rando).onVoucherTransferred(exchange.id, await newOwner.getAddress()) ).to.revertedWith(RevertReasons.ACCESS_DENIED); }); it("Caller is not a clone address associated with the seller", async function () { // Create a new seller to get new clone - seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); expect(seller.isValid()).is.true; await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); - expectedCloneAddress = calculateContractAddress(accountHandler.address, "2"); + expectedCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "2"); const bosonVoucherClone2 = await getContractAt("IBosonVoucher", expectedCloneAddress); // For the sake of test, mint token on bv2 with the id of token on bv1 // Temporarily grant PROTOCOL role to deployer account - await accessController.grantRole(Role.PROTOCOL, deployer.address); + await accessController.grantRole(Role.PROTOCOL, await deployer.getAddress()); - const newBuyer = mockBuyer(buyer.address); + const newBuyer = mockBuyer(await buyer.getAddress()); newBuyer.id = buyerId; await bosonVoucherClone2.issueVoucher(exchange.id, newBuyer.wallet); // Attempt to call onVoucherTransferred, expecting revert await expect( - bosonVoucherClone2.connect(buyer).transferFrom(buyer.address, newOwner.address, exchange.id) + bosonVoucherClone2.connect(buyer).transferFrom(await buyer.getAddress(), await newOwner.getAddress(), exchange.id) ).to.revertedWith(RevertReasons.ACCESS_DENIED); }); @@ -3366,7 +3366,7 @@ describe("IBosonExchangeHandler", function () { // Attempt to call onVoucherTransferred, expecting revert await expect( - exchangeHandler.connect(fauxClient).onVoucherTransferred(exchangeId, newOwner.address) + exchangeHandler.connect(fauxClient).onVoucherTransferred(exchangeId, await newOwner.getAddress()) ).to.revertedWith(RevertReasons.NO_SUCH_EXCHANGE); }); @@ -3376,7 +3376,7 @@ describe("IBosonExchangeHandler", function () { // Attempt to call onVoucherTransferred, expecting revert await expect( - exchangeHandler.connect(fauxClient).onVoucherTransferred(exchangeId, newOwner.address) + exchangeHandler.connect(fauxClient).onVoucherTransferred(exchangeId, await newOwner.getAddress()) ).to.revertedWith(RevertReasons.INVALID_STATE); }); @@ -3386,7 +3386,7 @@ describe("IBosonExchangeHandler", function () { // Attempt to call onVoucherTransferred, expecting revert await expect( - exchangeHandler.connect(fauxClient).onVoucherTransferred(exchangeId, newOwner.address) + exchangeHandler.connect(fauxClient).onVoucherTransferred(exchangeId, await newOwner.getAddress()) ).to.revertedWith(RevertReasons.VOUCHER_HAS_EXPIRED); }); }); @@ -3395,7 +3395,7 @@ describe("IBosonExchangeHandler", function () { context("👉 isExchangeFinalized()", async function () { beforeEach(async function () { // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); }); context("👍 undisputed exchange", async function () { @@ -3534,7 +3534,7 @@ describe("IBosonExchangeHandler", function () { customSignatureType, "Resolution", message, - disputeHandler.address + await disputeHandler.getAddress() ); // Resolve Dispute @@ -3602,7 +3602,7 @@ describe("IBosonExchangeHandler", function () { expect(nextExchangeId).to.equal(exchangeId); // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Get the next exchange id and ensure it was incremented by the creation of the offer nextExchangeId = await exchangeHandler.connect(rando).getNextExchangeId(); @@ -3623,7 +3623,7 @@ describe("IBosonExchangeHandler", function () { context("👉 getExchange()", async function () { beforeEach(async function () { // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); }); it("should return true for exists if exchange id is valid", async function () { @@ -3654,7 +3654,7 @@ describe("IBosonExchangeHandler", function () { context("👉 getExchangeState()", async function () { beforeEach(async function () { // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); }); it("should return true for exists if exchange id is valid", async function () { @@ -3685,7 +3685,7 @@ describe("IBosonExchangeHandler", function () { context("getReceipt", async function () { beforeEach(async () => { // Commit to offer - tx = await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Decrease offer quantityAvailable offer.quantityAvailable = "9"; @@ -3773,7 +3773,7 @@ describe("IBosonExchangeHandler", function () { offer.id = offerId = "2"; offer.price = offer.buyerCancelPenalty = offer.sellerDeposit = "0"; // set a dummy token address otherwise protocol token (zero address) and offer token will be the same and we will get the error AGENT_FEE_AMOUNT_TOO_HIGH - offer.exchangeToken = foreign20.address; + offer.exchangeToken = await foreign20.getAddress(); disputeResolverId = agentId = "0"; // Update voucherRedeemableFrom @@ -3790,7 +3790,7 @@ describe("IBosonExchangeHandler", function () { .createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId); // Commit to offer - tx = await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId); + tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId); // Decrease offer quantityAvailable offer.quantityAvailable = "0"; @@ -4002,7 +4002,7 @@ describe("IBosonExchangeHandler", function () { context("TwinReceipt tests", async function () { beforeEach(async function () { // Mint some tokens to be bundled - await foreign20.connect(assistant).mint(assistant.address, "500"); + await foreign20.connect(assistant).mint(await assistant.getAddress(), "500"); await foreign721.connect(assistant).mint("0", "10"); // Approve the protocol diamond to transfer seller's tokens @@ -4010,14 +4010,14 @@ describe("IBosonExchangeHandler", function () { await foreign721.connect(assistant).setApprovalForAll(protocolDiamondAddress, true); // Create an ERC20 twin - twin20 = mockTwin(foreign20.address); + twin20 = mockTwin(await foreign20.getAddress()); twin20.amount = "3"; expect(twin20.isValid()).is.true; await twinHandler.connect(assistant).createTwin(twin20.toStruct()); // Create an ERC721 twin - twin721 = mockTwin(foreign721.address, TokenType.NonFungibleToken); + twin721 = mockTwin(await foreign721.getAddress(), TokenType.NonFungibleToken); twin721.amount = "0"; twin721.supplyAvailable = "10"; twin721.id = "2"; @@ -4057,7 +4057,7 @@ describe("IBosonExchangeHandler", function () { await setNextBlockTimestamp(Number(voucherRedeemableFrom)); // Commit to offer - let tx = await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + let tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; @@ -4155,7 +4155,7 @@ describe("IBosonExchangeHandler", function () { await setNextBlockTimestamp(Number(voucherRedeemableFrom)); // Commit to offer - let tx = await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + let tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; @@ -4258,7 +4258,7 @@ describe("IBosonExchangeHandler", function () { offerIds = [offerId]; // Create condition - condition = mockCondition({ tokenAddress: foreign20.address }); + condition = mockCondition({ tokenAddress: await foreign20.getAddress() }); expect(condition.isValid()).to.be.true; // Create a new group @@ -4267,10 +4267,10 @@ describe("IBosonExchangeHandler", function () { await groupHandler.connect(assistant).createGroup(group, condition); // Mint enough tokens for the buyer - await foreign20.connect(buyer).mint(buyer.address, condition.threshold); + await foreign20.connect(buyer).mint(await buyer.getAddress(), condition.threshold); // Commit to offer - let tx = await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + let tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Decrease offer quantityAvailable offer.quantityAvailable = "9"; @@ -4349,7 +4349,7 @@ describe("IBosonExchangeHandler", function () { it("Receipt should contain agentId and agentAddress if agent for offer exists", async function () { // Create a valid agent - agent = mockAgent(rando.address); + agent = mockAgent(await rando.getAddress()); // Set new agentId agentId = agent.id = "4"; expect(agent.isValid()).is.true; @@ -4382,7 +4382,7 @@ describe("IBosonExchangeHandler", function () { .createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId); // Commit to offer - let tx = await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + let tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Decrease offer quantityAvailable offer.quantityAvailable = "0"; diff --git a/test/protocol/FundsHandlerTest.js b/test/protocol/FundsHandlerTest.js index 72d7c59f5..2f1beef27 100644 --- a/test/protocol/FundsHandlerTest.js +++ b/test/protocol/FundsHandlerTest.js @@ -168,7 +168,7 @@ describe("IBosonFundsHandler", function () { context("📋 Funds Handler Methods", async function () { beforeEach(async function () { // Create a valid seller, then set fields in tests directly - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); expect(seller.isValid()).is.true; // VoucherInitValues @@ -182,7 +182,7 @@ describe("IBosonFundsHandler", function () { await accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues); // top up assistants account - await mockToken.mint(assistant.address, "1000000"); + await mockToken.mint(await assistant.getAddress(), "1000000"); // approve protocol to transfer the tokens await mockToken.connect(assistant).approve(protocolDiamondAddress, "1000000"); @@ -203,9 +203,9 @@ describe("IBosonFundsHandler", function () { it("should emit a FundsDeposited event", async function () { // Deposit funds, testing for the event // Deposit token - await expect(fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, depositAmount)) + await expect(fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), depositAmount)) .to.emit(fundsHandler, "FundsDeposited") - .withArgs(seller.id, assistant.address, mockToken.address, depositAmount); + .withArgs(seller.id, await assistant.getAddress(), await mockToken.getAddress(), depositAmount); // Deposit native currency await expect( @@ -214,18 +214,18 @@ describe("IBosonFundsHandler", function () { .depositFunds(seller.id, ZeroAddress, depositAmount, { value: depositAmount }) ) .to.emit(fundsHandler, "FundsDeposited") - .withArgs(seller.id, rando.address, ZeroAddress, depositAmount); + .withArgs(seller.id, await rando.getAddress(), ZeroAddress, depositAmount); }); it("should update state", async function () { // Deposit token - await fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, depositAmount); + await fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), depositAmount); // Read on chain state let returnedAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); // Chain state should match the expected available funds - let expectedAvailableFunds = new FundsList([new Funds(mockToken.address, "Foreign20", depositAmount)]); + let expectedAvailableFunds = new FundsList([new Funds(await mockToken.getAddress(), "Foreign20", depositAmount)]); expect(returnedAvailableFunds).to.eql(expectedAvailableFunds); // Deposit native currency to the same seller id @@ -243,23 +243,23 @@ describe("IBosonFundsHandler", function () { it("should be possible to top up the account", async function () { // Deposit token - await fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, depositAmount); + await fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), depositAmount); // Read on chain state let returnedAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); // Chain state should match the expected available funds - let expectedAvailableFunds = new FundsList([new Funds(mockToken.address, "Foreign20", depositAmount)]); + let expectedAvailableFunds = new FundsList([new Funds(await mockToken.getAddress(), "Foreign20", depositAmount)]); expect(returnedAvailableFunds).to.eql(expectedAvailableFunds); // Deposit the same token again - await fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, 2 * depositAmount); + await fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), 2 * depositAmount); // Get new on chain state returnedAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); // Chain state should match the expected available funds - expectedAvailableFunds = new FundsList([new Funds(mockToken.address, "Foreign20", `${3 * depositAmount}`)]); + expectedAvailableFunds = new FundsList([new Funds(await mockToken.getAddress(), "Foreign20", `${3 * depositAmount}`)]); expect(returnedAvailableFunds).to.eql(expectedAvailableFunds); }); @@ -270,7 +270,7 @@ describe("IBosonFundsHandler", function () { // Attempt to deposit funds, expecting revert await expect( - fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, depositAmount) + fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), depositAmount) ).to.revertedWith(RevertReasons.REGION_PAUSED); }); @@ -278,7 +278,7 @@ describe("IBosonFundsHandler", function () { // Attempt to deposit the funds, expecting revert seller.id = "555"; await expect( - fundsHandler.connect(rando).depositFunds(seller.id, mockToken.address, depositAmount) + fundsHandler.connect(rando).depositFunds(seller.id, await mockToken.getAddress(), depositAmount) ).to.revertedWith(RevertReasons.NO_SUCH_SELLER); }); @@ -287,7 +287,7 @@ describe("IBosonFundsHandler", function () { await expect( fundsHandler .connect(rando) - .depositFunds(seller.id, mockToken.address, depositAmount, { value: depositAmount }) + .depositFunds(seller.id, await mockToken.getAddress(), depositAmount, { value: depositAmount }) ).to.revertedWith(RevertReasons.NATIVE_WRONG_ADDRESS); }); @@ -306,14 +306,14 @@ describe("IBosonFundsHandler", function () { // Attempt to deposit the funds, expecting revert await expect( - fundsHandler.connect(rando).depositFunds(seller.id, bosonToken.address, depositAmount) + fundsHandler.connect(rando).depositFunds(seller.id, await bosonToken.getAddress(), depositAmount) ).to.revertedWith(RevertReasons.SAFE_ERC20_LOW_LEVEL_CALL); }); it("Token address is not a contract", async function () { // Attempt to deposit the funds, expecting revert await expect( - fundsHandler.connect(rando).depositFunds(seller.id, admin.address, depositAmount) + fundsHandler.connect(rando).depositFunds(seller.id, await admin.getAddress(), depositAmount) ).to.revertedWithoutReason(); }); @@ -323,13 +323,13 @@ describe("IBosonFundsHandler", function () { await mockToken.connect(rando).approve(protocolDiamondAddress, depositAmount); // Attempt to deposit the funds, expecting revert await expect( - fundsHandler.connect(rando).depositFunds(seller.id, mockToken.address, depositAmount) + fundsHandler.connect(rando).depositFunds(seller.id, await mockToken.getAddress(), depositAmount) ).to.revertedWith(RevertReasons.ERC20_EXCEEDS_BALANCE); // not approved depositAmount = "10000000"; await expect( - fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, depositAmount) + fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), depositAmount) ).to.revertedWith(RevertReasons.ERC20_INSUFFICIENT_ALLOWANCE); }); @@ -338,23 +338,23 @@ describe("IBosonFundsHandler", function () { const [Foreign20WithFee] = await deployMockTokens(["Foreign20WithFee"]); // mint tokens and approve - await Foreign20WithFee.mint(assistant.address, depositAmount); + await Foreign20WithFee.mint(await assistant.getAddress(), depositAmount); await Foreign20WithFee.connect(assistant).approve(protocolDiamondAddress, depositAmount); // Attempt to deposit funds, expecting revert await expect( - fundsHandler.connect(assistant).depositFunds(seller.id, Foreign20WithFee.address, depositAmount) + fundsHandler.connect(assistant).depositFunds(seller.id, await Foreign20WithFee.getAddress(), depositAmount) ).to.revertedWith(RevertReasons.INSUFFICIENT_VALUE_RECEIVED); }); it("ERC20 transferFrom returns false", async function () { const [foreign20ReturnFalse] = await deployMockTokens(["Foreign20TransferFromReturnFalse"]); - await foreign20ReturnFalse.connect(assistant).mint(assistant.address, depositAmount); + await foreign20ReturnFalse.connect(assistant).mint(await assistant.getAddress(), depositAmount); await foreign20ReturnFalse.connect(assistant).approve(protocolDiamondAddress, depositAmount); await expect( - fundsHandler.connect(assistant).depositFunds(seller.id, foreign20ReturnFalse.address, depositAmount) + fundsHandler.connect(assistant).depositFunds(seller.id, await foreign20ReturnFalse.getAddress(), depositAmount) ).to.revertedWith(RevertReasons.SAFE_ERC20_NOT_SUCCEEDED); }); }); @@ -367,10 +367,10 @@ describe("IBosonFundsHandler", function () { // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -378,7 +378,7 @@ describe("IBosonFundsHandler", function () { //Create DisputeResolverFee array so offer creation will succeed disputeResolverFees = [ new DisputeResolverFee(ZeroAddress, "Native", "0"), - new DisputeResolverFee(mockToken.address, "mockToken", "0"), + new DisputeResolverFee(await mockToken.getAddress(), "mockToken", "0"), ]; // Make empty seller list, so every seller is allowed @@ -397,7 +397,7 @@ describe("IBosonFundsHandler", function () { offerToken = offer.clone(); offerToken.id = "2"; - offerToken.exchangeToken = mockToken.address; + offerToken.exchangeToken = await mockToken.getAddress(); // Check if domais are valid expect(offerNative.isValid()).is.true; @@ -424,7 +424,7 @@ describe("IBosonFundsHandler", function () { offerTokenProtocolFee = offerNativeProtocolFee = offerFees.protocolFee; // top up seller's and buyer's account - await Promise.all([mockToken.mint(assistant.address, sellerDeposit), mockToken.mint(buyer.address, price)]); + await Promise.all([mockToken.mint(await assistant.getAddress(), sellerDeposit), mockToken.mint(await buyer.getAddress(), price)]); // approve protocol to transfer the tokens await Promise.all([ @@ -434,15 +434,15 @@ describe("IBosonFundsHandler", function () { // deposit to seller's pool await Promise.all([ - fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, sellerDeposit), + fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), sellerDeposit), fundsHandler .connect(assistant) .depositFunds(seller.id, ZeroAddress, sellerDeposit, { value: sellerDeposit }), ]); // commit to both offers - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerToken.id); - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerNative.id, { value: offerNative.price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerNative.id, { value: offerNative.price }); buyerId = accountId.next().value; }); @@ -469,8 +469,8 @@ describe("IBosonFundsHandler", function () { it("should emit a FundsWithdrawn event", async function () { // Withdraw funds, testing for the event // Withdraw tokens - tokenListSeller = [mockToken.address, ZeroAddress]; - tokenListBuyer = [ZeroAddress, mockToken.address]; + tokenListSeller = [await mockToken.getAddress(), ZeroAddress]; + tokenListBuyer = [ZeroAddress, await mockToken.getAddress()]; // Withdraw amounts tokenAmountsSeller = [sellerPayoff, BigInt(sellerPayoff)/"2".toString()]; @@ -482,33 +482,33 @@ describe("IBosonFundsHandler", function () { .withdrawFunds(seller.id, tokenListSeller, tokenAmountsSeller); await expect(tx) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(seller.id, treasury.address, mockToken.address, sellerPayoff, assistant.address); + .withArgs(seller.id, await treasury.getAddress(), await mockToken.getAddress(), sellerPayoff, await assistant.getAddress()); await expect(tx) .to.emit(fundsHandler, "FundsWithdrawn") .withArgs( seller.id, - treasury.address, + await treasury.getAddress(), constants.Zero, BigInt(sellerPayoff)/"2", - assistant.address + await assistant.getAddress() ); // buyer withdrawal const tx2 = await fundsHandler.connect(buyer).withdrawFunds(buyerId, tokenListBuyer, tokenAmountsBuyer); await expect(tx2) - .to.emit(fundsHandler, "FundsWithdrawn", buyer.address) + .to.emit(fundsHandler, "FundsWithdrawn", await buyer.getAddress()) .withArgs( buyerId, - buyer.address, - mockToken.address, + await buyer.getAddress(), + await mockToken.getAddress(), BigInt(buyerPayoff)/"5", - buyer.address + await buyer.getAddress() ); await expect(tx2) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(buyerId, buyer.address, constants.Zero, buyerPayoff, buyer.address); + .withArgs(buyerId, await buyer.getAddress(), constants.Zero, buyerPayoff, await buyer.getAddress()); }); it("should update state", async function () { @@ -516,11 +516,11 @@ describe("IBosonFundsHandler", function () { // Read on chain state sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); - const treasuryBalanceBefore = await provider.getBalance(treasury.address); + const treasuryBalanceBefore = await provider.getBalance(await treasury.getAddress()); // Chain state should match the expected available funds before the withdrawal expectedSellerAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", sellerPayoff), + new Funds(await mockToken.getAddress(), "Foreign20", sellerPayoff), new Funds(ZeroAddress, "Native currency", sellerPayoff), ]); expect(sellersAvailableFunds).to.eql( @@ -538,7 +538,7 @@ describe("IBosonFundsHandler", function () { // Read on chain state sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); - const treasuryBalanceAfter = await provider.getBalance(treasury.address); + const treasuryBalanceAfter = await provider.getBalance(await treasury.getAddress()); // Chain state should match the expected available funds after the withdrawal // Native currency available funds are reduced for the withdrawal amount @@ -561,11 +561,11 @@ describe("IBosonFundsHandler", function () { // Read on chain state buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); - const buyerBalanceBefore = await mockToken.balanceOf(buyer.address); + const buyerBalanceBefore = await mockToken.balanceOf(await buyer.getAddress()); // Chain state should match the expected available funds before the withdrawal expectedBuyerAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", buyerPayoff), + new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff), new Funds(ZeroAddress, "Native currency", buyerPayoff), ]); expect(buyerAvailableFunds).to.eql( @@ -574,11 +574,11 @@ describe("IBosonFundsHandler", function () { ); // withdraw funds - await fundsHandler.connect(buyer).withdrawFunds(buyerId, [mockToken.address], [buyerPayoff]); + await fundsHandler.connect(buyer).withdrawFunds(buyerId, [await mockToken.getAddress()], [buyerPayoff]); // Read on chain state buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); - const buyerBalanceAfter = await mockToken.balanceOf(buyer.address); + const buyerBalanceAfter = await mockToken.balanceOf(await buyer.getAddress()); // Chain state should match the expected available funds after the withdrawal // Since all tokens are withdrawn, token should be removed from the list @@ -596,12 +596,12 @@ describe("IBosonFundsHandler", function () { it("should allow to withdraw all funds at once", async function () { // Read on chain state sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); - const treasuryNativeBalanceBefore = await provider.getBalance(treasury.address); - const treasuryTokenBalanceBefore = await mockToken.balanceOf(treasury.address); + const treasuryNativeBalanceBefore = await provider.getBalance(await treasury.getAddress()); + const treasuryTokenBalanceBefore = await mockToken.balanceOf(await treasury.getAddress()); // Chain state should match the expected available funds before the withdrawal expectedSellerAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", sellerPayoff), + new Funds(await mockToken.getAddress(), "Foreign20", sellerPayoff), new Funds(ZeroAddress, "Native currency", sellerPayoff), ]); expect(sellersAvailableFunds).to.eql( @@ -614,8 +614,8 @@ describe("IBosonFundsHandler", function () { // Read on chain state sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); - const treasuryNativeBalanceAfter = await provider.getBalance(treasury.address); - const treasuryTokenBalanceAfter = await mockToken.balanceOf(treasury.address); + const treasuryNativeBalanceAfter = await provider.getBalance(await treasury.getAddress()); + const treasuryTokenBalanceAfter = await mockToken.balanceOf(await treasury.getAddress()); // Chain state should match the expected available funds after the withdrawal // Funds available should be an empty list @@ -641,12 +641,12 @@ describe("IBosonFundsHandler", function () { // Read on chain state sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); - const treasuryNativeBalanceBefore = await provider.getBalance(treasury.address); - const treasuryTokenBalanceBefore = await mockToken.balanceOf(treasury.address); + const treasuryNativeBalanceBefore = await provider.getBalance(await treasury.getAddress()); + const treasuryTokenBalanceBefore = await mockToken.balanceOf(await treasury.getAddress()); // Chain state should match the expected available funds before the withdrawal expectedSellerAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", sellerPayoff), + new Funds(await mockToken.getAddress(), "Foreign20", sellerPayoff), new Funds(ZeroAddress, "Native currency", sellerPayoff), ]); expect(sellersAvailableFunds).to.eql( @@ -659,8 +659,8 @@ describe("IBosonFundsHandler", function () { // Read on chain state sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); - let treasuryNativeBalanceAfter = await provider.getBalance(treasury.address); - const treasuryTokenBalanceAfter = await mockToken.balanceOf(treasury.address); + let treasuryNativeBalanceAfter = await provider.getBalance(await treasury.getAddress()); + const treasuryTokenBalanceAfter = await mockToken.balanceOf(await treasury.getAddress()); // Chain state should match the expected available funds after the withdrawal // Funds available should still have the entries from above the threshold @@ -686,7 +686,7 @@ describe("IBosonFundsHandler", function () { // Read on chain state sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); - treasuryNativeBalanceAfter = await provider.getBalance(treasury.address); + treasuryNativeBalanceAfter = await provider.getBalance(await treasury.getAddress()); // Chain state should match the expected available funds after the withdrawal // Funds available should now be an empty list @@ -705,7 +705,7 @@ describe("IBosonFundsHandler", function () { it("It's possible to withdraw same toke twice if in total enough available funds", async function () { let reduction = parseUnits("0.1", "ether").toString(); // Withdraw token - tokenListSeller = [mockToken.address, mockToken.address]; + tokenListSeller = [await mockToken.getAddress(), await mockToken.getAddress()]; tokenAmountsSeller = [BigInt(sellerPayoff)-reduction.toString(), reduction]; // seller withdrawal @@ -716,22 +716,22 @@ describe("IBosonFundsHandler", function () { .to.emit(fundsHandler, "FundsWithdrawn") .withArgs( seller.id, - treasury.address, - mockToken.address, + await treasury.getAddress(), + await mockToken.getAddress(), BigInt(sellerPayoff)-reduction.toString(), - assistant.address + await assistant.getAddress() ); await expect(tx) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(seller.id, treasury.address, mockToken.address, reduction, assistant.address); + .withArgs(seller.id, await treasury.getAddress(), await mockToken.getAddress(), reduction, await assistant.getAddress()); }); context("Agent Withdraws funds", async function () { beforeEach(async function () { // Create a valid agent, agentId = "4"; - agent = mockAgent(other.address); + agent = mockAgent(await other.getAddress()); agent.id = agentId; expect(agent.isValid()).is.true; @@ -743,7 +743,7 @@ describe("IBosonFundsHandler", function () { agentOffer = offer.clone(); agentOffer.id = "3"; exchangeId = "3"; - agentOffer.exchangeToken = mockToken.address; + agentOffer.exchangeToken = await mockToken.getAddress(); // Create offer with agent await offerHandler @@ -756,18 +756,18 @@ describe("IBosonFundsHandler", function () { voucherRedeemableFrom = offerDates.voucherRedeemableFrom; // top up seller's and buyer's account - await mockToken.mint(assistant.address, sellerDeposit); - await mockToken.mint(buyer.address, price); + await mockToken.mint(await assistant.getAddress(), sellerDeposit); + await mockToken.mint(await buyer.getAddress(), price); // approve protocol to transfer the tokens await mockToken.connect(assistant).approve(protocolDiamondAddress, sellerDeposit); await mockToken.connect(buyer).approve(protocolDiamondAddress, price); // deposit to seller's pool - await fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, sellerDeposit); + await fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), sellerDeposit); // commit to agent offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, agentOffer.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), agentOffer.id); // Set time forward to the offer's voucherRedeemableFrom await setNextBlockTimestamp(Number(voucherRedeemableFrom)); @@ -785,9 +785,9 @@ describe("IBosonFundsHandler", function () { // Check the balance BEFORE withdrawFunds() const feeCollectorNativeBalanceBefore = await mockToken.balanceOf(agent.wallet); - await expect(fundsHandler.connect(other).withdrawFunds(agentId, [mockToken.address], [agentPayoff])) + await expect(fundsHandler.connect(other).withdrawFunds(agentId, [await mockToken.getAddress()], [agentPayoff])) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(agentId, agent.wallet, mockToken.address, agentPayoff, agent.wallet); + .withArgs(agentId, agent.wallet, await mockToken.getAddress(), agentPayoff, agent.wallet); // Check the balance AFTER withdrawFunds() const feeCollectorNativeBalanceAfter = await mockToken.balanceOf(agent.wallet); @@ -816,9 +816,9 @@ describe("IBosonFundsHandler", function () { // Check the balance BEFORE withdrawFunds() const feeCollectorNativeBalanceBefore = await mockToken.balanceOf(agent.wallet); - await expect(fundsHandler.connect(other).withdrawFunds(agentId, [mockToken.address], [agentPayoff])) + await expect(fundsHandler.connect(other).withdrawFunds(agentId, [await mockToken.getAddress()], [agentPayoff])) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(agentId, agent.wallet, mockToken.address, agentPayoff, agent.wallet); + .withArgs(agentId, agent.wallet, await mockToken.getAddress(), agentPayoff, agent.wallet); // Check the balance AFTER withdrawFunds() const feeCollectorNativeBalanceAfter = await mockToken.balanceOf(agent.wallet); @@ -839,7 +839,7 @@ describe("IBosonFundsHandler", function () { context("💔 Revert Reasons", async function () { it("The funds region of protocol is paused", async function () { // Withdraw tokens - tokenListBuyer = [ZeroAddress, mockToken.address]; + tokenListBuyer = [ZeroAddress, await mockToken.getAddress()]; // Withdraw amounts tokenAmountsBuyer = [buyerPayoff, BigInt(buyerPayoff)/"5".toString()]; @@ -872,7 +872,7 @@ describe("IBosonFundsHandler", function () { it("Token list address does not match token amount address", async function () { // Withdraw token - tokenList = [mockToken.address, ZeroAddress]; + tokenList = [await mockToken.getAddress(), ZeroAddress]; tokenAmounts = [sellerPayoff]; // Attempt to withdraw the funds, expecting revert @@ -893,7 +893,7 @@ describe("IBosonFundsHandler", function () { it("Caller tries to withdraw more than they have in the available funds", async function () { // Withdraw token - tokenList = [mockToken.address]; + tokenList = [await mockToken.getAddress()]; tokenAmounts = [BigInt(sellerPayoff)*"2"]; // Attempt to withdraw the funds, expecting revert @@ -904,7 +904,7 @@ describe("IBosonFundsHandler", function () { it("Caller tries to withdraw the same token twice", async function () { // Withdraw token - tokenList = [mockToken.address, mockToken.address]; + tokenList = [await mockToken.getAddress(), await mockToken.getAddress()]; tokenAmounts = [sellerPayoff, sellerPayoff]; // Attempt to withdraw the funds, expecting revert @@ -915,7 +915,7 @@ describe("IBosonFundsHandler", function () { it("Nothing to withdraw", async function () { // Withdraw token - tokenList = [mockToken.address]; + tokenList = [await mockToken.getAddress()]; tokenAmounts = ["0"]; await expect( @@ -938,7 +938,7 @@ describe("IBosonFundsHandler", function () { // commit to offer on behalf of some contract tx = await exchangeHandler .connect(buyer) - .commitToOffer(fallbackErrorContract.address, offerNative.id, { value: price }); + .commitToOffer(await fallbackErrorContract.getAddress(), offerNative.id, { value: price }); txReceipt = await tx.wait(); event = getEvent(txReceipt, exchangeHandler, "BuyerCommitted"); exchangeId = event.exchangeId; @@ -950,7 +950,7 @@ describe("IBosonFundsHandler", function () { // we call a fallbackContract which calls fundsHandler.withdraw, which should revert await expect( fallbackErrorContract.withdrawFunds( - fundsHandler.address, + await fundsHandler.getAddress(), fallbackContractBuyerId, [ZeroAddress], [offerNative.price] @@ -965,7 +965,7 @@ describe("IBosonFundsHandler", function () { // commit to offer on behalf of some contract tx = await exchangeHandler .connect(buyer) - .commitToOffer(fallbackErrorContract.address, offerNative.id, { value: price }); + .commitToOffer(await fallbackErrorContract.getAddress(), offerNative.id, { value: price }); txReceipt = await tx.wait(); event = getEvent(txReceipt, exchangeHandler, "BuyerCommitted"); exchangeId = event.exchangeId; @@ -977,7 +977,7 @@ describe("IBosonFundsHandler", function () { // we call a fallbackContract which calls fundsHandler.withdraw, which should revert await expect( fallbackErrorContract.withdrawFunds( - fundsHandler.address, + await fundsHandler.getAddress(), fallbackContractBuyerId, [ZeroAddress], [offerNative.price] @@ -1006,13 +1006,13 @@ describe("IBosonFundsHandler", function () { it("Transfer of funds failed - ERC20 transfer returns false", async function () { const [foreign20ReturnFalse] = await deployMockTokens(["Foreign20TransferReturnFalse"]); - await foreign20ReturnFalse.connect(assistant).mint(assistant.address, sellerDeposit); + await foreign20ReturnFalse.connect(assistant).mint(await assistant.getAddress(), sellerDeposit); await foreign20ReturnFalse.connect(assistant).approve(protocolDiamondAddress, sellerDeposit); - await fundsHandler.connect(assistant).depositFunds(seller.id, foreign20ReturnFalse.address, sellerDeposit); + await fundsHandler.connect(assistant).depositFunds(seller.id, await foreign20ReturnFalse.getAddress(), sellerDeposit); await expect( - fundsHandler.connect(assistant).withdrawFunds(seller.id, [foreign20ReturnFalse.address], [sellerDeposit]) + fundsHandler.connect(assistant).withdrawFunds(seller.id, [await foreign20ReturnFalse.getAddress()], [sellerDeposit]) ).to.revertedWith(RevertReasons.SAFE_ERC20_NOT_SUCCEEDED); }); }); @@ -1041,7 +1041,7 @@ describe("IBosonFundsHandler", function () { protocolPayoff = offerTokenProtocolFee; // grant fee collecor role - await accessController.grantRole(Role.FEE_COLLECTOR, feeCollector.address); + await accessController.grantRole(Role.FEE_COLLECTOR, await feeCollector.getAddress()); // set the protocol id protocolId = "0"; @@ -1049,35 +1049,35 @@ describe("IBosonFundsHandler", function () { it("should emit a FundsWithdrawn event", async function () { // Withdraw funds, testing for the event - tokenList = [mockToken.address, ZeroAddress]; + tokenList = [await mockToken.getAddress(), ZeroAddress]; tokenAmounts = [protocolPayoff, protocolPayoff]; // protocol fee withdrawal const tx = await fundsHandler.connect(feeCollector).withdrawProtocolFees(tokenList, tokenAmounts); await expect(tx) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(protocolId, protocolTreasury.address, mockToken.address, protocolPayoff, feeCollector.address); + .withArgs(protocolId, await protocolTreasury.getAddress(), await mockToken.getAddress(), protocolPayoff, await feeCollector.getAddress()); await expect(tx) .to.emit(fundsHandler, "FundsWithdrawn") .withArgs( protocolId, - protocolTreasury.address, + await protocolTreasury.getAddress(), constants.Zero, protocolPayoff, - feeCollector.address + await feeCollector.getAddress() ); }); it("should update state", async function () { // Read on chain state protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); - const protocolTreasuryNativeBalanceBefore = await provider.getBalance(protocolTreasury.address); - const protocolTreasuryTokenBalanceBefore = await mockToken.balanceOf(protocolTreasury.address); + const protocolTreasuryNativeBalanceBefore = await provider.getBalance(await protocolTreasury.getAddress()); + const protocolTreasuryTokenBalanceBefore = await mockToken.balanceOf(await protocolTreasury.getAddress()); // Chain state should match the expected available funds before the withdrawal expectedProtocolAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", protocolPayoff), + new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff), new Funds(ZeroAddress, "Native currency", protocolPayoff), ]); expect(protocolAvailableFunds).to.eql( @@ -1093,7 +1093,7 @@ describe("IBosonFundsHandler", function () { tx = await fundsHandler .connect(feeCollector) .withdrawProtocolFees( - [mockToken.address, ZeroAddress], + [await mockToken.getAddress(), ZeroAddress], [protocolPayoff, partialFeeWithdrawAmount] ); @@ -1103,8 +1103,8 @@ describe("IBosonFundsHandler", function () { // Read on chain state protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); - const protocolTreasuryNativeBalanceAfter = await provider.getBalance(protocolTreasury.address); - const protocolTreasuryTokenBalanceAfter = await mockToken.balanceOf(protocolTreasury.address); + const protocolTreasuryNativeBalanceAfter = await provider.getBalance(await protocolTreasury.getAddress()); + const protocolTreasuryTokenBalanceAfter = await mockToken.balanceOf(await protocolTreasury.getAddress()); // Chain state should match the expected available funds after the withdrawal // Native currency available funds are reduced for the withdrawal amount @@ -1136,12 +1136,12 @@ describe("IBosonFundsHandler", function () { it("should allow to withdraw all funds at once", async function () { // Read on chain state protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); - const protocolTreasuryNativeBalanceBefore = await provider.getBalance(protocolTreasury.address); - const protocolTreasuryTokenBalanceBefore = await mockToken.balanceOf(protocolTreasury.address); + const protocolTreasuryNativeBalanceBefore = await provider.getBalance(await protocolTreasury.getAddress()); + const protocolTreasuryTokenBalanceBefore = await mockToken.balanceOf(await protocolTreasury.getAddress()); // Chain state should match the expected available funds before the withdrawal expectedProtocolAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", protocolPayoff), + new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff), new Funds(ZeroAddress, "Native currency", protocolPayoff), ]); expect(protocolAvailableFunds).to.eql( @@ -1158,8 +1158,8 @@ describe("IBosonFundsHandler", function () { // Read on chain state protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); - const protocolTreasuryNativeBalanceAfter = await provider.getBalance(protocolTreasury.address); - const protocolTreasuryTokenBalanceAfter = await mockToken.balanceOf(protocolTreasury.address); + const protocolTreasuryNativeBalanceAfter = await provider.getBalance(await protocolTreasury.getAddress()); + const protocolTreasuryTokenBalanceAfter = await mockToken.balanceOf(await protocolTreasury.getAddress()); // Chain state should match the expected available funds after the withdrawal // Funds available should be an empty list @@ -1186,12 +1186,12 @@ describe("IBosonFundsHandler", function () { // Read on chain state protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); - let protocolTreasuryNativeBalanceBefore = await provider.getBalance(protocolTreasury.address); - const protocolTreasuryTokenBalanceBefore = await mockToken.balanceOf(protocolTreasury.address); + let protocolTreasuryNativeBalanceBefore = await provider.getBalance(await protocolTreasury.getAddress()); + const protocolTreasuryTokenBalanceBefore = await mockToken.balanceOf(await protocolTreasury.getAddress()); // Chain state should match the expected available funds before the withdrawal expectedProtocolAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", protocolPayoff), + new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff), new Funds(ZeroAddress, "Native currency", protocolPayoff), ]); expect(protocolAvailableFunds).to.eql( @@ -1208,8 +1208,8 @@ describe("IBosonFundsHandler", function () { // Read on chain state protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); - let protocolTreasuryNativeBalanceAfter = await provider.getBalance(protocolTreasury.address); - const protocolTreasuryTokenBalanceAfter = await mockToken.balanceOf(protocolTreasury.address); + let protocolTreasuryNativeBalanceAfter = await provider.getBalance(await protocolTreasury.getAddress()); + const protocolTreasuryTokenBalanceAfter = await mockToken.balanceOf(await protocolTreasury.getAddress()); // Chain state should match the expected available funds after the withdrawal // Funds available should still have the entries from above the threshold @@ -1239,7 +1239,7 @@ describe("IBosonFundsHandler", function () { // Read on chain state protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); - protocolTreasuryNativeBalanceAfter = await provider.getBalance(protocolTreasury.address); + protocolTreasuryNativeBalanceAfter = await provider.getBalance(await protocolTreasury.getAddress()); // Chain state should match the expected available funds after the withdrawal // Funds available should now be an empty list @@ -1258,7 +1258,7 @@ describe("IBosonFundsHandler", function () { it("It's possible to withdraw same token twice if in total enough available funds", async function () { let reduction = parseUnits("0.01", "ether").toString(); // Withdraw token - tokenList = [mockToken.address, mockToken.address]; + tokenList = [await mockToken.getAddress(), await mockToken.getAddress()]; tokenAmounts = [BigInt(protocolPayoff)-reduction.toString(), reduction]; // protocol fee withdrawal @@ -1267,21 +1267,21 @@ describe("IBosonFundsHandler", function () { .to.emit(fundsHandler, "FundsWithdrawn") .withArgs( protocolId, - protocolTreasury.address, - mockToken.address, + await protocolTreasury.getAddress(), + await mockToken.getAddress(), BigInt(protocolPayoff)-reduction.toString(), - feeCollector.address + await feeCollector.getAddress() ); await expect(tx) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(protocolId, protocolTreasury.address, mockToken.address, reduction, feeCollector.address); + .withArgs(protocolId, await protocolTreasury.getAddress(), await mockToken.getAddress(), reduction, await feeCollector.getAddress()); }); context("💔 Revert Reasons", async function () { it("The funds region of protocol is paused", async function () { // Withdraw funds, testing for the event - tokenList = [mockToken.address, ZeroAddress]; + tokenList = [await mockToken.getAddress(), ZeroAddress]; tokenAmounts = [protocolPayoff, protocolPayoff]; // Pause the funds region of the protocol @@ -1302,7 +1302,7 @@ describe("IBosonFundsHandler", function () { it("Token list address does not match token amount address", async function () { // Withdraw token - tokenList = [mockToken.address, ZeroAddress]; + tokenList = [await mockToken.getAddress(), ZeroAddress]; tokenAmounts = [sellerPayoff]; // Attempt to withdraw the funds, expecting revert @@ -1323,7 +1323,7 @@ describe("IBosonFundsHandler", function () { it("Caller tries to withdraw more than they have in the available funds", async function () { // Withdraw token - tokenList = [mockToken.address]; + tokenList = [await mockToken.getAddress()]; tokenAmounts = [BigInt(offerTokenProtocolFee)*"2"]; // Attempt to withdraw the funds, expecting revert @@ -1334,7 +1334,7 @@ describe("IBosonFundsHandler", function () { it("Caller tries to withdraw the same token twice", async function () { // Withdraw token - tokenList = [mockToken.address, mockToken.address]; + tokenList = [await mockToken.getAddress(), await mockToken.getAddress()]; tokenAmounts = [offerTokenProtocolFee, offerTokenProtocolFee]; // Attempt to withdraw the funds, expecting revert @@ -1345,7 +1345,7 @@ describe("IBosonFundsHandler", function () { it("Nothing to withdraw", async function () { // Withdraw token - tokenList = [mockToken.address]; + tokenList = [await mockToken.getAddress()]; tokenAmounts = ["0"]; await expect( @@ -1366,10 +1366,10 @@ describe("IBosonFundsHandler", function () { const [fallbackErrorContract] = await deployMockTokens(["FallbackError"]); // temporarily grant ADMIN role to deployer account - await accessController.grantRole(Role.ADMIN, deployer.address); + await accessController.grantRole(Role.ADMIN, await deployer.getAddress()); // set treasury to this contract - await configHandler.connect(deployer).setTreasuryAddress(fallbackErrorContract.address); + await configHandler.connect(deployer).setTreasuryAddress(await fallbackErrorContract.getAddress()); // attempt to withdraw the funds, expecting revert await expect( @@ -1384,10 +1384,10 @@ describe("IBosonFundsHandler", function () { const [fallbackErrorContract] = await deployMockTokens(["WithoutFallbackError"]); // temporarily grant ADMIN role to deployer account - await accessController.grantRole(Role.ADMIN, deployer.address); + await accessController.grantRole(Role.ADMIN, await deployer.getAddress()); // set treasury to this contract - await configHandler.connect(deployer).setTreasuryAddress(fallbackErrorContract.address); + await configHandler.connect(deployer).setTreasuryAddress(await fallbackErrorContract.getAddress()); // attempt to withdraw the funds, expecting revert await expect( @@ -1423,19 +1423,19 @@ describe("IBosonFundsHandler", function () { // Deploy the mock token with no name const [mockToken] = await deployMockTokens(["Foreign20NoName"]); // top up assistants account - await mockToken.mint(assistant.address, "1000000"); + await mockToken.mint(await assistant.getAddress(), "1000000"); // approve protocol to transfer the tokens await mockToken.connect(assistant).approve(protocolDiamondAddress, "1000000"); // Deposit token - await fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, depositAmount); + await fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), depositAmount); // Read on chain state let returnedAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); // Chain state should match the expected available funds let expectedAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Token name unspecified", depositAmount), + new Funds(await mockToken.getAddress(), "Token name unspecified", depositAmount), ]); expect(returnedAvailableFunds).to.eql(expectedAvailableFunds); }); @@ -1447,7 +1447,7 @@ describe("IBosonFundsHandler", function () { context("📋 FundsLib Methods", async function () { beforeEach(async function () { // Create a valid seller - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); expect(seller.isValid()).is.true; // VoucherInitValues @@ -1462,10 +1462,10 @@ describe("IBosonFundsHandler", function () { // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -1474,7 +1474,7 @@ describe("IBosonFundsHandler", function () { DRFee = parseUnits("0", "ether").toString(); disputeResolverFees = [ new DisputeResolverFee(ZeroAddress, "Native", "0"), - new DisputeResolverFee(mockToken.address, "mockToken", DRFee), + new DisputeResolverFee(await mockToken.getAddress(), "mockToken", DRFee), ]; // Make empty seller list, so every seller is allowed @@ -1493,7 +1493,7 @@ describe("IBosonFundsHandler", function () { offerToken = offerNative.clone(); offerToken.id = "2"; - offerToken.exchangeToken = mockToken.address; + offerToken.exchangeToken = await mockToken.getAddress(); offerDates = mo.offerDates; expect(offerDates.isValid()).is.true; @@ -1520,15 +1520,15 @@ describe("IBosonFundsHandler", function () { resolutionPeriod = offerDurations.resolutionPeriod; // top up seller's and buyer's account - await mockToken.mint(assistant.address, `${2 * sellerDeposit}`); - await mockToken.mint(buyer.address, `${2 * price}`); + await mockToken.mint(await assistant.getAddress(), `${2 * sellerDeposit}`); + await mockToken.mint(await buyer.getAddress(), `${2 * price}`); // approve protocol to transfer the tokens await mockToken.connect(assistant).approve(protocolDiamondAddress, `${2 * sellerDeposit}`); await mockToken.connect(buyer).approve(protocolDiamondAddress, `${2 * price}`); // deposit to seller's pool - await fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, `${2 * sellerDeposit}`); + await fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), `${2 * sellerDeposit}`); await fundsHandler .connect(assistant) .depositFunds(seller.id, ZeroAddress, `${2 * sellerDeposit}`, { @@ -1539,7 +1539,7 @@ describe("IBosonFundsHandler", function () { // Create a valid agent, agentId = "3"; agentFeePercentage = "500"; //5% - agent = mockAgent(other.address); + agent = mockAgent(await other.getAddress()); expect(agent.isValid()).is.true; @@ -1563,24 +1563,24 @@ describe("IBosonFundsHandler", function () { let buyerId = "4"; // 1: seller, 2: disputeResolver, 3: agent, 4: buyer // Commit to an offer with erc20 token, test for FundsEncumbered event - const tx = await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerToken.id); + const tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id); await expect(tx) .to.emit(exchangeHandler, "FundsEncumbered") - .withArgs(buyerId, mockToken.address, price, buyer.address); + .withArgs(buyerId, await mockToken.getAddress(), price, await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "FundsEncumbered") - .withArgs(seller.id, mockToken.address, sellerDeposit, buyer.address); + .withArgs(seller.id, await mockToken.getAddress(), sellerDeposit, await buyer.getAddress()); // Commit to an offer with native currency, test for FundsEncumbered event - const tx2 = await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerNative.id, { value: price }); + const tx2 = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerNative.id, { value: price }); await expect(tx2) .to.emit(exchangeHandler, "FundsEncumbered") - .withArgs(buyerId, ZeroAddress, price, buyer.address); + .withArgs(buyerId, ZeroAddress, price, await buyer.getAddress()); await expect(tx2) .to.emit(exchangeHandler, "FundsEncumbered") - .withArgs(seller.id, ZeroAddress, sellerDeposit, buyer.address); + .withArgs(seller.id, ZeroAddress, sellerDeposit, await buyer.getAddress()); }); it("should update state", async function () { @@ -1592,7 +1592,7 @@ describe("IBosonFundsHandler", function () { const sellersAvailableFundsBefore = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); // Commit to an offer with erc20 token - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerToken.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id); // Check that token balance increased const contractTokenBalanceAfter = await mockToken.balanceOf(protocolDiamondAddress); @@ -1613,7 +1613,7 @@ describe("IBosonFundsHandler", function () { ).to.eql(sellerDeposit, "Token seller available funds mismatch"); // Commit to an offer with native currency - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerNative.id, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerNative.id, { value: price }); // check that native currency balance increased const contractNativeBalanceAfter = await provider.getBalance(protocolDiamondAddress); @@ -1640,7 +1640,7 @@ describe("IBosonFundsHandler", function () { let sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); expect(sellersAvailableFunds.funds.length).to.eql(2, "Funds length mismatch"); expect(sellersAvailableFunds.funds[0].tokenAddress).to.eql( - mockToken.address, + await mockToken.getAddress(), "Token contract address mismatch" ); expect(sellersAvailableFunds.funds[1].tokenAddress).to.eql( @@ -1649,8 +1649,8 @@ describe("IBosonFundsHandler", function () { ); // Commit to offer with token twice to empty the seller's pool - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerToken.id); - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerToken.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id); // Token address should be removed and have only native currency in the list sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -1661,8 +1661,8 @@ describe("IBosonFundsHandler", function () { ); // Commit to offer with token twice to empty the seller's pool - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerNative.id, { value: price }); - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerNative.id, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerNative.id, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerNative.id, { value: price }); // Seller available funds must be empty sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -1680,23 +1680,23 @@ describe("IBosonFundsHandler", function () { await accountHandler .connect(adminDR) .addFeesToDisputeResolver(disputeResolver.id, [ - new DisputeResolverFee(otherToken.address, "Other Token", "0"), + new DisputeResolverFee(await otherToken.getAddress(), "Other Token", "0"), ]); // top up seller's and buyer's account - await otherToken.mint(assistant.address, sellerDeposit); + await otherToken.mint(await assistant.getAddress(), sellerDeposit); // approve protocol to transfer the tokens await otherToken.connect(assistant).approve(protocolDiamondAddress, sellerDeposit); // deposit to seller's pool - await fundsHandler.connect(assistant).depositFunds(seller.id, otherToken.address, sellerDeposit); + await fundsHandler.connect(assistant).depositFunds(seller.id, await otherToken.getAddress(), sellerDeposit); // seller's available funds let sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); expect(sellersAvailableFunds.funds.length).to.eql(3, "Funds length mismatch"); expect(sellersAvailableFunds.funds[0].tokenAddress).to.eql( - mockToken.address, + await mockToken.getAddress(), "Token contract address mismatch" ); expect(sellersAvailableFunds.funds[1].tokenAddress).to.eql( @@ -1704,23 +1704,23 @@ describe("IBosonFundsHandler", function () { "Native currency address mismatch" ); expect(sellersAvailableFunds.funds[2].tokenAddress).to.eql( - otherToken.address, + await otherToken.getAddress(), "Boson token address mismatch" ); // Commit to offer with token twice to empty the seller's pool - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerNative.id, { value: price }); - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerNative.id, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerNative.id, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerNative.id, { value: price }); // Native currency address should be removed and have only mock token and other token in the list sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); expect(sellersAvailableFunds.funds.length).to.eql(2, "Funds length mismatch"); expect(sellersAvailableFunds.funds[0].tokenAddress).to.eql( - mockToken.address, + await mockToken.getAddress(), "Token contract address mismatch" ); expect(sellersAvailableFunds.funds[1].tokenAddress).to.eql( - otherToken.address, + await otherToken.getAddress(), "Other token address mismatch" ); }); @@ -1729,15 +1729,15 @@ describe("IBosonFundsHandler", function () { it("when someone else deposits on buyer's behalf, callers funds are transferred", async function () { // buyer will commit to an offer on rando's behalf // get token balance before the commit - const buyerTokenBalanceBefore = await mockToken.balanceOf(buyer.address); - const randoTokenBalanceBefore = await mockToken.balanceOf(rando.address); + const buyerTokenBalanceBefore = await mockToken.balanceOf(await buyer.getAddress()); + const randoTokenBalanceBefore = await mockToken.balanceOf(await rando.getAddress()); // commit to an offer with token on rando's behalf - await exchangeHandler.connect(buyer).commitToOffer(rando.address, offerToken.id); + await exchangeHandler.connect(buyer).commitToOffer(await rando.getAddress(), offerToken.id); // get token balance after the commit - const buyerTokenBalanceAfter = await mockToken.balanceOf(buyer.address); - const randoTokenBalanceAfter = await mockToken.balanceOf(rando.address); + const buyerTokenBalanceAfter = await mockToken.balanceOf(await buyer.getAddress()); + const randoTokenBalanceAfter = await mockToken.balanceOf(await rando.getAddress()); // buyer's balance should decrease, rando's should remain expect(buyerTokenBalanceBefore-buyerTokenBalanceAfter.toString()).to.eql( @@ -1754,17 +1754,17 @@ describe("IBosonFundsHandler", function () { expect(exchange.buyerId.toString()).to.eql(randoBuyerId, "Wrong buyer id"); // get native currency balance before the commit - const buyerNativeBalanceBefore = await provider.getBalance(buyer.address); - const randoNativeBalanceBefore = await provider.getBalance(rando.address); + const buyerNativeBalanceBefore = await provider.getBalance(await buyer.getAddress()); + const randoNativeBalanceBefore = await provider.getBalance(await rando.getAddress()); // commit to an offer with native currency on rando's behalf - tx = await exchangeHandler.connect(buyer).commitToOffer(rando.address, offerNative.id, { value: price }); + tx = await exchangeHandler.connect(buyer).commitToOffer(await rando.getAddress(), offerNative.id, { value: price }); txReceipt = await tx.wait(); txCost = tx.gasPrice*txReceipt.gasUsed; // get token balance after the commit - const buyerNativeBalanceAfter = await provider.getBalance(buyer.address); - const randoNativeBalanceAfter = await provider.getBalance(rando.address); + const buyerNativeBalanceAfter = await provider.getBalance(await buyer.getAddress()); + const randoNativeBalanceAfter = await provider.getBalance(await rando.getAddress()); // buyer's balance should decrease, rando's should remain expect(buyerNativeBalanceBefore-buyerNativeBalanceAfter.sub(txCost).toString()).to.eql( @@ -1781,42 +1781,42 @@ describe("IBosonFundsHandler", function () { // make sure that randoBuyerId actually belongs to rando address let [, buyerStruct] = await accountHandler.getBuyer(randoBuyerId); - expect(buyerStruct.wallet).to.eql(rando.address, "Wrong buyer address"); + expect(buyerStruct.wallet).to.eql(await rando.getAddress(), "Wrong buyer address"); }); it("if offer is preminted, only sellers funds are encumbered", async function () { // deposit to seller's pool to cover for the price const buyerId = mockBuyer().id; - await mockToken.mint(assistant.address, `${2 * price}`); + await mockToken.mint(await assistant.getAddress(), `${2 * price}`); await mockToken.connect(assistant).approve(protocolDiamondAddress, `${2 * price}`); - await fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, `${2 * price}`); + await fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), `${2 * price}`); await fundsHandler.connect(assistant).depositFunds(seller.id, ZeroAddress, `${2 * price}`, { value: `${2 * price}`, }); // get token balance before the commit - const buyerTokenBalanceBefore = await mockToken.balanceOf(buyer.address); + const buyerTokenBalanceBefore = await mockToken.balanceOf(await buyer.getAddress()); const sellersAvailableFundsBefore = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); // reserve a range and premint vouchers await offerHandler .connect(assistant) - .reserveRange(offerToken.id, offerToken.quantityAvailable, assistant.address); - const voucherCloneAddress = calculateContractAddress(accountHandler.address, "1"); + .reserveRange(offerToken.id, offerToken.quantityAvailable, await assistant.getAddress()); + const voucherCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "1"); const bosonVoucher = await getContractAt("BosonVoucher", voucherCloneAddress); await bosonVoucher.connect(assistant).preMint(offerToken.id, offerToken.quantityAvailable); // commit to an offer via preminted voucher let exchangeId = "1"; let tokenId = deriveTokenId(offerToken.id, exchangeId); - tx = await bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId); + tx = await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); // it should emit FundsEncumbered event with amount equal to sellerDeposit + price let encumberedFunds = BigInt(sellerDeposit)+price; await expect(tx) .to.emit(exchangeHandler, "FundsEncumbered") - .withArgs(seller.id, mockToken.address, encumberedFunds, bosonVoucher.address); + .withArgs(seller.id, await mockToken.getAddress(), encumberedFunds, await bosonVoucher.getAddress()); // Check that seller's pool balance was reduced let sellersAvailableFundsAfter = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -1828,7 +1828,7 @@ describe("IBosonFundsHandler", function () { ).to.eql(encumberedFunds.toString(), "Token seller available funds mismatch"); // buyer's token balance should stay the same - const buyerTokenBalanceAfter = await mockToken.balanceOf(buyer.address); + const buyerTokenBalanceAfter = await mockToken.balanceOf(await buyer.getAddress()); expect(buyerTokenBalanceBefore.toString()).to.eql( buyerTokenBalanceAfter.toString(), "Buyer's token balance should remain the same" @@ -1840,27 +1840,27 @@ describe("IBosonFundsHandler", function () { expect(exchange.buyerId.toString()).to.eql(buyerId, "Wrong buyer id"); // get native currency balance before the commit - const buyerNativeBalanceBefore = await provider.getBalance(buyer.address); + const buyerNativeBalanceBefore = await provider.getBalance(await buyer.getAddress()); // reserve a range and premint vouchers exchangeId = await exchangeHandler.getNextExchangeId(); tokenId = deriveTokenId(offerNative.id, exchangeId); await offerHandler .connect(assistant) - .reserveRange(offerNative.id, offerNative.quantityAvailable, assistant.address); + .reserveRange(offerNative.id, offerNative.quantityAvailable, await assistant.getAddress()); await bosonVoucher.connect(assistant).preMint(offerNative.id, offerNative.quantityAvailable); // commit to an offer via preminted voucher - tx = await bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId); + tx = await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); // it should emit FundsEncumbered event with amount equal to sellerDeposit + price encumberedFunds = BigInt(sellerDeposit)+price; await expect(tx) .to.emit(exchangeHandler, "FundsEncumbered") - .withArgs(seller.id, ZeroAddress, encumberedFunds, bosonVoucher.address); + .withArgs(seller.id, ZeroAddress, encumberedFunds, await bosonVoucher.getAddress()); // buyer's balance should remain the same - const buyerNativeBalanceAfter = await provider.getBalance(buyer.address); + const buyerNativeBalanceAfter = await provider.getBalance(await buyer.getAddress()); expect(buyerNativeBalanceBefore.toString()).to.eql( buyerNativeBalanceAfter.toString(), "Buyer's native balance should remain the same" @@ -1886,14 +1886,14 @@ describe("IBosonFundsHandler", function () { await expect( exchangeHandler .connect(buyer) - .commitToOffer(buyer.address, offerNative.id, { value: BigInt(price)-"1".toString() }) + .commitToOffer(await buyer.getAddress(), offerNative.id, { value: BigInt(price)-"1".toString() }) ).to.revertedWith(RevertReasons.INSUFFICIENT_VALUE_RECEIVED); }); it("Native currency sent together with ERC20 token transfer", async function () { // Attempt to commit to an offer, expecting revert await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerToken.id, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id, { value: price }) ).to.revertedWith(RevertReasons.NATIVE_NOT_ALLOWED); }); @@ -1902,7 +1902,7 @@ describe("IBosonFundsHandler", function () { [bosonToken] = await deployMockTokens(["BosonToken"]); // create an offer with a bad token contrat - offerToken.exchangeToken = bosonToken.address; + offerToken.exchangeToken = await bosonToken.getAddress(); offerToken.id = "3"; // add to DR fees @@ -1916,14 +1916,14 @@ describe("IBosonFundsHandler", function () { .createOffer(offerToken, offerDates, offerDurations, disputeResolverId, agentId); // Attempt to commit to an offer, expecting revert - await expect(exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerToken.id)).to.revertedWith( + await expect(exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id)).to.revertedWith( RevertReasons.SAFE_ERC20_LOW_LEVEL_CALL ); }); it("Token address is not a contract", async function () { // create an offer with a bad token contrat - offerToken.exchangeToken = admin.address; + offerToken.exchangeToken = await admin.getAddress(); offerToken.id = "3"; // add to DR fees @@ -1939,7 +1939,7 @@ describe("IBosonFundsHandler", function () { // Attempt to commit to an offer, expecting revert await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerToken.id) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id) ).to.revertedWithoutReason(); }); @@ -1948,7 +1948,7 @@ describe("IBosonFundsHandler", function () { // approve more than account actually have await mockToken.connect(rando).approve(protocolDiamondAddress, price); // Attempt to commit to an offer, expecting revert - await expect(exchangeHandler.connect(rando).commitToOffer(rando.address, offerToken.id)).to.revertedWith( + await expect(exchangeHandler.connect(rando).commitToOffer(await rando.getAddress(), offerToken.id)).to.revertedWith( RevertReasons.ERC20_EXCEEDS_BALANCE ); @@ -1957,7 +1957,7 @@ describe("IBosonFundsHandler", function () { .connect(rando) .approve(protocolDiamondAddress, BigInt(price)-"1".toString()); // Attempt to commit to an offer, expecting revert - await expect(exchangeHandler.connect(rando).commitToOffer(rando.address, offerToken.id)).to.revertedWith( + await expect(exchangeHandler.connect(rando).commitToOffer(await rando.getAddress(), offerToken.id)).to.revertedWith( RevertReasons.ERC20_INSUFFICIENT_ALLOWANCE ); }); @@ -1971,7 +1971,7 @@ describe("IBosonFundsHandler", function () { .createOffer(offerToken, offerDates, offerDurations, disputeResolverId, agentId); // Attempt to commit to an offer, expecting revert - await expect(exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerToken.id)).to.revertedWith( + await expect(exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id)).to.revertedWith( RevertReasons.INSUFFICIENT_AVAILABLE_FUNDS ); @@ -1984,7 +1984,7 @@ describe("IBosonFundsHandler", function () { // Attempt to commit to an offer, expecting revert await expect( - exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerNative.id, { value: price }) + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerNative.id, { value: price }) ).to.revertedWith(RevertReasons.INSUFFICIENT_AVAILABLE_FUNDS); }); @@ -1992,8 +1992,8 @@ describe("IBosonFundsHandler", function () { // reserve a range and premint vouchers for offer in tokens await offerHandler .connect(assistant) - .reserveRange(offerToken.id, offerToken.quantityAvailable, assistant.address); - const voucherCloneAddress = calculateContractAddress(accountHandler.address, "1"); + .reserveRange(offerToken.id, offerToken.quantityAvailable, await assistant.getAddress()); + const voucherCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "1"); const bosonVoucher = await getContractAt("BosonVoucher", voucherCloneAddress); await bosonVoucher.connect(assistant).preMint(offerToken.id, offerToken.quantityAvailable); @@ -2003,7 +2003,7 @@ describe("IBosonFundsHandler", function () { // Attempt to commit to an offer via preminted voucher, expecting revert let tokenId = deriveTokenId(offerToken.id, "1"); await expect( - bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId) + bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) ).to.revertedWith(RevertReasons.INSUFFICIENT_AVAILABLE_FUNDS); // reserve a range and premint vouchers for offer in native currency @@ -2011,12 +2011,12 @@ describe("IBosonFundsHandler", function () { tokenId = deriveTokenId(offerNative.id, exchangeId); await offerHandler .connect(assistant) - .reserveRange(offerNative.id, offerNative.quantityAvailable, assistant.address); + .reserveRange(offerNative.id, offerNative.quantityAvailable, await assistant.getAddress()); await bosonVoucher.connect(assistant).preMint(offerNative.id, offerNative.quantityAvailable); // Attempt to commit to an offer, expecting revert await expect( - bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId) + bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) ).to.revertedWith(RevertReasons.INSUFFICIENT_AVAILABLE_FUNDS); }); @@ -2029,12 +2029,12 @@ describe("IBosonFundsHandler", function () { await accountHandler .connect(adminDR) .addFeesToDisputeResolver(disputeResolverId, [ - new DisputeResolverFee(Foreign20WithFee.address, "Foreign20WithFee", DRFee), + new DisputeResolverFee(await Foreign20WithFee.getAddress(), "Foreign20WithFee", DRFee), ]); // Create an offer with ERC20 with fees // Prepare an absolute zero offer - offerToken.exchangeToken = Foreign20WithFee.address; + offerToken.exchangeToken = await Foreign20WithFee.getAddress(); offerToken.sellerDeposit = "0"; offerToken.id++; @@ -2044,11 +2044,11 @@ describe("IBosonFundsHandler", function () { .createOffer(offerToken, offerDates, offerDurations, disputeResolverId, agentId); // mint tokens and approve - await Foreign20WithFee.mint(buyer.address, offerToken.price); + await Foreign20WithFee.mint(await buyer.getAddress(), offerToken.price); await Foreign20WithFee.connect(buyer).approve(protocolDiamondAddress, offerToken.price); // Attempt to commit to offer, expecting revert - await expect(exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerToken.id)).to.revertedWith( + await expect(exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id)).to.revertedWith( RevertReasons.INSUFFICIENT_VALUE_RECEIVED ); }); @@ -2063,7 +2063,7 @@ describe("IBosonFundsHandler", function () { exchangeId = "1"; // commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerToken.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id); }); context("Final state COMPLETED", async function () { @@ -2094,16 +2094,16 @@ describe("IBosonFundsHandler", function () { await expect(tx) .to.emit(exchangeHandler, "FundsReleased") - .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, buyer.address); + .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "ProtocolFeeCollected") - .withArgs(exchangeId, offerToken.exchangeToken, protocolPayoff, buyer.address); + .withArgs(exchangeId, offerToken.exchangeToken, protocolPayoff, await buyer.getAddress()); }); it("should update state", async function () { // commit again, so seller has nothing in available funds - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerToken.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id); // Read on chain state sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -2131,8 +2131,8 @@ describe("IBosonFundsHandler", function () { // seller: sellerDeposit + price - protocolFee - agentFee // protocol: protocolFee // agent: 0 - expectedSellerAvailableFunds.funds.push(new Funds(mockToken.address, "Foreign20", sellerPayoff)); - expectedProtocolAvailableFunds.funds.push(new Funds(mockToken.address, "Foreign20", offerTokenProtocolFee)); + expectedSellerAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", sellerPayoff)); + expectedProtocolAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", offerTokenProtocolFee)); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -2151,12 +2151,12 @@ describe("IBosonFundsHandler", function () { protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); agentAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(agentId)); expectedSellerAvailableFunds.funds[1] = new Funds( - mockToken.address, + await mockToken.getAddress(), "Foreign20", BigInt(sellerPayoff)*2.toString() ); expectedProtocolAvailableFunds.funds[0] = new Funds( - mockToken.address, + await mockToken.getAddress(), "Foreign20", BigInt(protocolPayoff)*2.toString() ); @@ -2174,7 +2174,7 @@ describe("IBosonFundsHandler", function () { .createOffer(agentOffer, offerDates, offerDurations, disputeResolverId, agent.id); // Commit to Offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, agentOffer.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), agentOffer.id); // succesfully redeem exchange exchangeId = "2"; @@ -2206,15 +2206,15 @@ describe("IBosonFundsHandler", function () { // Complete the exchange, expecting event await expect(tx) .to.emit(exchangeHandler, "FundsReleased") - .withArgs(exchangeId, seller.id, agentOffer.exchangeToken, sellerPayoff, buyer.address); + .withArgs(exchangeId, seller.id, agentOffer.exchangeToken, sellerPayoff, await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "ProtocolFeeCollected") - .withArgs(exchangeId, agentOffer.exchangeToken, protocolPayoff, buyer.address); + .withArgs(exchangeId, agentOffer.exchangeToken, protocolPayoff, await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "FundsReleased") - .withArgs(exchangeId, agentId, agentOffer.exchangeToken, agentPayoff, buyer.address); + .withArgs(exchangeId, agentId, agentOffer.exchangeToken, agentPayoff, await buyer.getAddress()); }); it("should update state", async function () { @@ -2244,9 +2244,9 @@ describe("IBosonFundsHandler", function () { // seller: sellerDeposit + price - protocolFee - agentFee // protocol: protocolFee // agent: agentFee - expectedSellerAvailableFunds.funds.push(new Funds(mockToken.address, "Foreign20", sellerPayoff)); - expectedProtocolAvailableFunds.funds.push(new Funds(mockToken.address, "Foreign20", agentOfferProtocolFee)); - expectedAgentAvailableFunds.funds.push(new Funds(mockToken.address, "Foreign20", agentPayoff)); + expectedSellerAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", sellerPayoff)); + expectedProtocolAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", agentOfferProtocolFee)); + expectedAgentAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", agentPayoff)); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -2276,7 +2276,7 @@ describe("IBosonFundsHandler", function () { // Revoke the voucher, expecting event await expect(exchangeHandler.connect(assistant).revokeVoucher(exchangeId)) .to.emit(exchangeHandler, "FundsReleased") - .withArgs(exchangeId, buyerId, offerToken.exchangeToken, buyerPayoff, assistant.address); + .withArgs(exchangeId, buyerId, offerToken.exchangeToken, buyerPayoff, await assistant.getAddress()); }); it("should update state", async function () { @@ -2288,7 +2288,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", sellerDeposit), + new Funds(await mockToken.getAddress(), "Foreign20", sellerDeposit), new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); @@ -2307,7 +2307,7 @@ describe("IBosonFundsHandler", function () { // seller: 0 // protocol: 0 // agent: 0 - expectedBuyerAvailableFunds.funds.push(new Funds(mockToken.address, "Foreign20", buyerPayoff)); + expectedBuyerAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff)); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -2319,7 +2319,7 @@ describe("IBosonFundsHandler", function () { // Test that if buyer has some funds available, and gets more, the funds are only updated // Commit again - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerToken.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id); // Revoke another voucher await exchangeHandler.connect(assistant).revokeVoucher(++exchangeId); @@ -2330,7 +2330,7 @@ describe("IBosonFundsHandler", function () { // protocol: 0 // agent: 0 expectedBuyerAvailableFunds.funds[0] = new Funds( - mockToken.address, + await mockToken.getAddress(), "Foreign20", BigInt(buyerPayoff)*2.toString() ); @@ -2355,18 +2355,18 @@ describe("IBosonFundsHandler", function () { .createOffer(agentOffer, offerDates, offerDurations, disputeResolverId, agent.id); // top up seller's and buyer's account - await mockToken.mint(assistant.address, `${2 * sellerDeposit}`); - await mockToken.mint(buyer.address, `${2 * price}`); + await mockToken.mint(await assistant.getAddress(), `${2 * sellerDeposit}`); + await mockToken.mint(await buyer.getAddress(), `${2 * price}`); // approve protocol to transfer the tokens await mockToken.connect(assistant).approve(protocolDiamondAddress, `${2 * sellerDeposit}`); await mockToken.connect(buyer).approve(protocolDiamondAddress, `${2 * price}`); // deposit to seller's pool - await fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, `${2 * sellerDeposit}`); + await fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), `${2 * sellerDeposit}`); // Commit to Offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, agentOffer.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), agentOffer.id); // expected payoffs // buyer: sellerDeposit + price @@ -2393,7 +2393,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", `${2 * sellerDeposit}`), + new Funds(await mockToken.getAddress(), "Foreign20", `${2 * sellerDeposit}`), new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); @@ -2412,7 +2412,7 @@ describe("IBosonFundsHandler", function () { // seller: 0 // protocol: 0 // agent: 0 - expectedBuyerAvailableFunds.funds.push(new Funds(mockToken.address, "Foreign20", buyerPayoff)); + expectedBuyerAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff)); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -2424,7 +2424,7 @@ describe("IBosonFundsHandler", function () { // Test that if buyer has some funds available, and gets more, the funds are only updated // Commit again - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, agentOffer.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), agentOffer.id); // Revoke another voucher await exchangeHandler.connect(assistant).revokeVoucher(++exchangeId); @@ -2435,12 +2435,12 @@ describe("IBosonFundsHandler", function () { // protocol: 0 // agent: 0 expectedBuyerAvailableFunds.funds[0] = new Funds( - mockToken.address, + await mockToken.getAddress(), "Foreign20", BigInt(buyerPayoff)*2.toString() ); expectedSellerAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", `${sellerDeposit}`), + new Funds(await mockToken.getAddress(), "Foreign20", `${sellerDeposit}`), new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -2473,11 +2473,11 @@ describe("IBosonFundsHandler", function () { const tx = await exchangeHandler.connect(buyer).cancelVoucher(exchangeId); await expect(tx) .to.emit(exchangeHandler, "FundsReleased") - .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, buyer.address); + .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "FundsReleased") - .withArgs(exchangeId, buyerId, offerToken.exchangeToken, buyerPayoff, buyer.address); + .withArgs(exchangeId, buyerId, offerToken.exchangeToken, buyerPayoff, await buyer.getAddress()); await expect(tx).to.not.emit(exchangeHandler, "ProtocolFeeCollected"); }); @@ -2491,7 +2491,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", sellerDeposit), + new Funds(await mockToken.getAddress(), "Foreign20", sellerDeposit), new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); @@ -2511,11 +2511,11 @@ describe("IBosonFundsHandler", function () { // protocol: 0 // agent: 0 expectedSellerAvailableFunds.funds[0] = new Funds( - mockToken.address, + await mockToken.getAddress(), "Foreign20", BigInt(sellerDeposit)+sellerPayoff.toString() ); - expectedBuyerAvailableFunds.funds.push(new Funds(mockToken.address, "Foreign20", buyerPayoff)); + expectedBuyerAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff)); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -2534,18 +2534,18 @@ describe("IBosonFundsHandler", function () { .createOffer(agentOffer, offerDates, offerDurations, disputeResolverId, agent.id); // top up seller's and buyer's account - await mockToken.mint(assistant.address, `${2 * sellerDeposit}`); - await mockToken.mint(buyer.address, `${2 * price}`); + await mockToken.mint(await assistant.getAddress(), `${2 * sellerDeposit}`); + await mockToken.mint(await buyer.getAddress(), `${2 * price}`); // approve protocol to transfer the tokens await mockToken.connect(assistant).approve(protocolDiamondAddress, `${2 * sellerDeposit}`); await mockToken.connect(buyer).approve(protocolDiamondAddress, `${2 * price}`); // deposit to seller's pool - await fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, `${sellerDeposit}`); + await fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), `${sellerDeposit}`); // Commit to Offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, agentOffer.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), agentOffer.id); // expected payoffs // buyer: price - buyerCancelPenalty @@ -2574,7 +2574,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", sellerDeposit), + new Funds(await mockToken.getAddress(), "Foreign20", sellerDeposit), new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); @@ -2594,11 +2594,11 @@ describe("IBosonFundsHandler", function () { // protocol: 0 // agent: 0 expectedSellerAvailableFunds.funds[0] = new Funds( - mockToken.address, + await mockToken.getAddress(), "Foreign20", BigInt(sellerDeposit)+sellerPayoff.toString() ); - expectedBuyerAvailableFunds.funds.push(new Funds(mockToken.address, "Foreign20", buyerPayoff)); + expectedBuyerAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff)); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -2651,11 +2651,11 @@ describe("IBosonFundsHandler", function () { await expect(tx) .to.emit(disputeHandler, "ProtocolFeeCollected") - .withArgs(exchangeId, offerToken.exchangeToken, protocolPayoff, buyer.address); + .withArgs(exchangeId, offerToken.exchangeToken, protocolPayoff, await buyer.getAddress()); await expect(tx) .to.emit(disputeHandler, "FundsReleased") - .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, buyer.address); + .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, await buyer.getAddress()); //check that FundsReleased event was NOT emitted with buyer Id const txReceipt = await tx.wait(); @@ -2664,7 +2664,7 @@ describe("IBosonFundsHandler", function () { buyerId, offerToken.exchangeToken, buyerPayoff, - buyer.address, + await buyer.getAddress(), ]); expect(match).to.be.false; }); @@ -2678,7 +2678,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", sellerDeposit), + new Funds(await mockToken.getAddress(), "Foreign20", sellerDeposit), new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); @@ -2698,11 +2698,11 @@ describe("IBosonFundsHandler", function () { // protocol: protocolFee // agent: 0 expectedSellerAvailableFunds.funds[0] = new Funds( - mockToken.address, + await mockToken.getAddress(), "Foreign20", BigInt(sellerDeposit)+sellerPayoff.toString() ); - expectedProtocolAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", protocolPayoff); + expectedProtocolAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -2738,7 +2738,7 @@ describe("IBosonFundsHandler", function () { await offerHandler .connect(assistant) .createOffer(agentOffer, offerDates, offerDurations, disputeResolverId, agent.id); - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, agentOffer.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), agentOffer.id); // succesfully redeem exchange await exchangeHandler.connect(buyer).redeemVoucher(exchangeId); @@ -2753,15 +2753,15 @@ describe("IBosonFundsHandler", function () { await expect(tx) .to.emit(disputeHandler, "ProtocolFeeCollected") - .withArgs(exchangeId, offerToken.exchangeToken, protocolPayoff, buyer.address); + .withArgs(exchangeId, offerToken.exchangeToken, protocolPayoff, await buyer.getAddress()); await expect(tx) .to.emit(disputeHandler, "FundsReleased") - .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, buyer.address); + .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "FundsReleased") - .withArgs(exchangeId, agentId, agentOffer.exchangeToken, agentPayoff, buyer.address); + .withArgs(exchangeId, agentId, agentOffer.exchangeToken, agentPayoff, await buyer.getAddress()); }); it("should update state", async function () { @@ -2792,10 +2792,10 @@ describe("IBosonFundsHandler", function () { // protocol: protocolFee // agent: agentFee expectedSellerAvailableFunds.funds.push( - new Funds(mockToken.address, "Foreign20", BigInt(sellerPayoff).toString()) + new Funds(await mockToken.getAddress(), "Foreign20", BigInt(sellerPayoff).toString()) ); - expectedProtocolAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", protocolPayoff); - expectedAgentAvailableFunds.funds.push(new Funds(mockToken.address, "Foreign20", agentPayoff)); + expectedProtocolAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff); + expectedAgentAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", agentPayoff)); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -2831,11 +2831,11 @@ describe("IBosonFundsHandler", function () { const tx = await disputeHandler.connect(rando).expireDispute(exchangeId); await expect(tx) .to.emit(disputeHandler, "ProtocolFeeCollected") - .withArgs(exchangeId, offerToken.exchangeToken, protocolPayoff, rando.address); + .withArgs(exchangeId, offerToken.exchangeToken, protocolPayoff, await rando.getAddress()); await expect(tx) .to.emit(disputeHandler, "FundsReleased") - .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, rando.address); + .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, await rando.getAddress()); //check that FundsReleased event was NOT emitted with buyer Id const txReceipt = await tx.wait(); @@ -2844,7 +2844,7 @@ describe("IBosonFundsHandler", function () { buyerId, offerToken.exchangeToken, buyerPayoff, - rando.address, + await rando.getAddress(), ]); expect(match).to.be.false; }); @@ -2858,7 +2858,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", sellerDeposit), + new Funds(await mockToken.getAddress(), "Foreign20", sellerDeposit), new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); @@ -2878,11 +2878,11 @@ describe("IBosonFundsHandler", function () { // protocol: protocolFee // agent: 0 expectedSellerAvailableFunds.funds[0] = new Funds( - mockToken.address, + await mockToken.getAddress(), "Foreign20", BigInt(sellerDeposit)+sellerPayoff.toString() ); - expectedProtocolAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", protocolPayoff); + expectedProtocolAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -2901,7 +2901,7 @@ describe("IBosonFundsHandler", function () { .createOffer(agentOffer, offerDates, offerDurations, disputeResolverId, agent.id); // Commit to Offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, agentOffer.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), agentOffer.id); // expected payoffs // buyer: 0 @@ -2946,15 +2946,15 @@ describe("IBosonFundsHandler", function () { // Complete the exchange, expecting event await expect(tx) .to.emit(exchangeHandler, "FundsReleased") - .withArgs(exchangeId, agentId, agentOffer.exchangeToken, agentPayoff, rando.address); + .withArgs(exchangeId, agentId, agentOffer.exchangeToken, agentPayoff, await rando.getAddress()); await expect(tx) .to.emit(exchangeHandler, "FundsReleased") - .withArgs(exchangeId, seller.id, agentOffer.exchangeToken, sellerPayoff, rando.address); + .withArgs(exchangeId, seller.id, agentOffer.exchangeToken, sellerPayoff, await rando.getAddress()); await expect(tx) .to.emit(exchangeHandler, "ProtocolFeeCollected") - .withArgs(exchangeId, agentOffer.exchangeToken, protocolPayoff, rando.address); + .withArgs(exchangeId, agentOffer.exchangeToken, protocolPayoff, await rando.getAddress()); }); it("should update state", async function () { @@ -2986,11 +2986,11 @@ describe("IBosonFundsHandler", function () { // agent: agent fee expectedSellerAvailableFunds = new FundsList([ new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), - new Funds(mockToken.address, "Foreign20", sellerPayoff), + new Funds(await mockToken.getAddress(), "Foreign20", sellerPayoff), ]); - expectedProtocolAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", protocolPayoff); - expectedAgentAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", agentPayoff); + expectedProtocolAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff); + expectedAgentAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", agentPayoff); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -3045,7 +3045,7 @@ describe("IBosonFundsHandler", function () { customSignatureType, "Resolution", message, - disputeHandler.address + await disputeHandler.getAddress() )); }); @@ -3056,11 +3056,11 @@ describe("IBosonFundsHandler", function () { .resolveDispute(exchangeId, buyerPercentBasisPoints, r, s, v); await expect(tx) .to.emit(disputeHandler, "FundsReleased") - .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, assistant.address); + .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, await assistant.getAddress()); await expect(tx) .to.emit(disputeHandler, "FundsReleased") - .withArgs(exchangeId, buyerId, offerToken.exchangeToken, buyerPayoff, assistant.address); + .withArgs(exchangeId, buyerId, offerToken.exchangeToken, buyerPayoff, await assistant.getAddress()); await expect(tx).to.not.emit(disputeHandler, "ProtocolFeeCollected"); }); @@ -3074,7 +3074,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", sellerDeposit), + new Funds(await mockToken.getAddress(), "Foreign20", sellerDeposit), new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); @@ -3094,11 +3094,11 @@ describe("IBosonFundsHandler", function () { // protocol: 0 // agent: 0 expectedSellerAvailableFunds.funds[0] = new Funds( - mockToken.address, + await mockToken.getAddress(), "Foreign20", BigInt(sellerDeposit)+sellerPayoff.toString() ); - expectedBuyerAvailableFunds = new FundsList([new Funds(mockToken.address, "Foreign20", buyerPayoff)]); + expectedBuyerAvailableFunds = new FundsList([new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff)]); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -3118,7 +3118,7 @@ describe("IBosonFundsHandler", function () { .createOffer(agentOffer, offerDates, offerDurations, disputeResolverId, agent.id); // Commit to Offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, agentOffer.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), agentOffer.id); exchangeId = "2"; @@ -3168,7 +3168,7 @@ describe("IBosonFundsHandler", function () { customSignatureType, "Resolution", message, - disputeHandler.address + await disputeHandler.getAddress() )); }); @@ -3200,9 +3200,9 @@ describe("IBosonFundsHandler", function () { // protocol: 0 // agent: 0 expectedSellerAvailableFunds.funds.push( - new Funds(mockToken.address, "Foreign20", BigInt(sellerPayoff).toString()) + new Funds(await mockToken.getAddress(), "Foreign20", BigInt(sellerPayoff).toString()) ); - expectedBuyerAvailableFunds = new FundsList([new Funds(mockToken.address, "Foreign20", buyerPayoff)]); + expectedBuyerAvailableFunds = new FundsList([new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff)]); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -3242,11 +3242,11 @@ describe("IBosonFundsHandler", function () { await expect(tx) .to.emit(disputeHandler, "ProtocolFeeCollected") - .withArgs(exchangeId, offerToken.exchangeToken, protocolPayoff, buyer.address); + .withArgs(exchangeId, offerToken.exchangeToken, protocolPayoff, await buyer.getAddress()); await expect(tx) .to.emit(disputeHandler, "FundsReleased") - .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, buyer.address); + .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, await buyer.getAddress()); //check that FundsReleased event was NOT emitted with buyer Id const txReceipt = await tx.wait(); @@ -3255,7 +3255,7 @@ describe("IBosonFundsHandler", function () { buyerId, offerToken.exchangeToken, buyerPayoff, - buyer.address, + await buyer.getAddress(), ]); expect(match).to.be.false; }); @@ -3269,7 +3269,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", sellerDeposit), + new Funds(await mockToken.getAddress(), "Foreign20", sellerDeposit), new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); @@ -3289,11 +3289,11 @@ describe("IBosonFundsHandler", function () { // protocol: protocolFee // agent: 0 expectedSellerAvailableFunds.funds[0] = new Funds( - mockToken.address, + await mockToken.getAddress(), "Foreign20", BigInt(sellerDeposit)+sellerPayoff.toString() ); - expectedProtocolAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", protocolPayoff); + expectedProtocolAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -3333,8 +3333,8 @@ describe("IBosonFundsHandler", function () { // approve protocol to transfer the tokens await mockToken.connect(buyer).approve(protocolDiamondAddress, agentOffer.price); - await mockToken.mint(buyer.address, agentOffer.price); - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, agentOffer.id); + await mockToken.mint(await buyer.getAddress(), agentOffer.price); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), agentOffer.id); // succesfully redeem exchange await exchangeHandler.connect(buyer).redeemVoucher(exchangeId); @@ -3343,7 +3343,7 @@ describe("IBosonFundsHandler", function () { await disputeHandler.connect(buyer).raiseDispute(exchangeId); // escalate the dispute - await mockToken.mint(buyer.address, buyerEscalationDeposit); + await mockToken.mint(await buyer.getAddress(), buyerEscalationDeposit); await mockToken.connect(buyer).approve(protocolDiamondAddress, buyerEscalationDeposit); await disputeHandler.connect(buyer).escalateDispute(exchangeId); }); @@ -3376,10 +3376,10 @@ describe("IBosonFundsHandler", function () { // protocol: protocolFee // agent: agentFee expectedSellerAvailableFunds.funds.push( - new Funds(mockToken.address, "Foreign20", BigInt(sellerPayoff).toString()) + new Funds(await mockToken.getAddress(), "Foreign20", BigInt(sellerPayoff).toString()) ); - expectedProtocolAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", protocolPayoff); - expectedAgentAvailableFunds.funds.push(new Funds(mockToken.address, "Foreign20", agentPayoff)); + expectedProtocolAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff); + expectedAgentAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", agentPayoff)); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -3436,7 +3436,7 @@ describe("IBosonFundsHandler", function () { customSignatureType, "Resolution", message, - disputeHandler.address + await disputeHandler.getAddress() )); // Escalate the dispute @@ -3450,11 +3450,11 @@ describe("IBosonFundsHandler", function () { .resolveDispute(exchangeId, buyerPercentBasisPoints, r, s, v); await expect(tx) .to.emit(disputeHandler, "FundsReleased") - .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, assistant.address); + .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, await assistant.getAddress()); await expect(tx) .to.emit(disputeHandler, "FundsReleased") - .withArgs(exchangeId, buyerId, offerToken.exchangeToken, buyerPayoff, assistant.address); + .withArgs(exchangeId, buyerId, offerToken.exchangeToken, buyerPayoff, await assistant.getAddress()); await expect(tx).to.not.emit(disputeHandler, "ProtocolFeeCollected"); }); @@ -3468,7 +3468,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", sellerDeposit), + new Funds(await mockToken.getAddress(), "Foreign20", sellerDeposit), new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); @@ -3487,9 +3487,9 @@ describe("IBosonFundsHandler", function () { // seller: (price + sellerDeposit + buyerEscalationDeposit)*(1-buyerPercentage); note that seller has sellerDeposit in availableFunds from before // protocol: 0 // agent: 0 - expectedBuyerAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", buyerPayoff); + expectedBuyerAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff); expectedSellerAvailableFunds.funds[0] = new Funds( - mockToken.address, + await mockToken.getAddress(), "Foreign20", BigInt(sellerDeposit)+sellerPayoff.toString() ); @@ -3512,10 +3512,10 @@ describe("IBosonFundsHandler", function () { // approve protocol to transfer the tokens await mockToken.connect(buyer).approve(protocolDiamondAddress, agentOffer.price); - await mockToken.mint(buyer.address, agentOffer.price); + await mockToken.mint(await buyer.getAddress(), agentOffer.price); // Commit to Offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, agentOffer.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), agentOffer.id); exchangeId = "2"; @@ -3567,11 +3567,11 @@ describe("IBosonFundsHandler", function () { customSignatureType, "Resolution", message, - disputeHandler.address + await disputeHandler.getAddress() )); // escalate the dispute - await mockToken.mint(buyer.address, buyerEscalationDeposit); + await mockToken.mint(await buyer.getAddress(), buyerEscalationDeposit); await mockToken.connect(buyer).approve(protocolDiamondAddress, buyerEscalationDeposit); await disputeHandler.connect(buyer).escalateDispute(exchangeId); }); @@ -3604,9 +3604,9 @@ describe("IBosonFundsHandler", function () { // protocol: 0 // agent: 0 expectedSellerAvailableFunds.funds.push( - new Funds(mockToken.address, "Foreign20", BigInt(sellerPayoff).toString()) + new Funds(await mockToken.getAddress(), "Foreign20", BigInt(sellerPayoff).toString()) ); - expectedBuyerAvailableFunds = new FundsList([new Funds(mockToken.address, "Foreign20", buyerPayoff)]); + expectedBuyerAvailableFunds = new FundsList([new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff)]); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -3652,11 +3652,11 @@ describe("IBosonFundsHandler", function () { const tx = await disputeHandler.connect(assistantDR).decideDispute(exchangeId, buyerPercentBasisPoints); await expect(tx) .to.emit(disputeHandler, "FundsReleased") - .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, assistantDR.address); + .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, await assistantDR.getAddress()); await expect(tx) .to.emit(disputeHandler, "FundsReleased") - .withArgs(exchangeId, buyerId, offerToken.exchangeToken, buyerPayoff, assistantDR.address); + .withArgs(exchangeId, buyerId, offerToken.exchangeToken, buyerPayoff, await assistantDR.getAddress()); await expect(tx).to.not.emit(disputeHandler, "ProtocolFeeCollected"); }); @@ -3670,7 +3670,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", sellerDeposit), + new Funds(await mockToken.getAddress(), "Foreign20", sellerDeposit), new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); @@ -3689,9 +3689,9 @@ describe("IBosonFundsHandler", function () { // seller: (price + sellerDeposit + buyerEscalationDeposit)*(1-buyerPercentage); note that seller has sellerDeposit in availableFunds from before // protocol: 0 // agent: 0 - expectedBuyerAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", buyerPayoff); + expectedBuyerAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff); expectedSellerAvailableFunds.funds[0] = new Funds( - mockToken.address, + await mockToken.getAddress(), "Foreign20", BigInt(sellerDeposit)+sellerPayoff.toString() ); @@ -3714,10 +3714,10 @@ describe("IBosonFundsHandler", function () { // approve protocol to transfer the tokens await mockToken.connect(buyer).approve(protocolDiamondAddress, agentOffer.price); - await mockToken.mint(buyer.address, agentOffer.price); + await mockToken.mint(await buyer.getAddress(), agentOffer.price); // Commit to Offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, agentOffer.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), agentOffer.id); exchangeId = "2"; @@ -3755,7 +3755,7 @@ describe("IBosonFundsHandler", function () { protocolPayoff = 0; // escalate the dispute - await mockToken.mint(buyer.address, buyerEscalationDeposit); + await mockToken.mint(await buyer.getAddress(), buyerEscalationDeposit); await mockToken.connect(buyer).approve(protocolDiamondAddress, buyerEscalationDeposit); await disputeHandler.connect(buyer).escalateDispute(exchangeId); }); @@ -3788,9 +3788,9 @@ describe("IBosonFundsHandler", function () { // protocol: 0 // agent: 0 expectedSellerAvailableFunds.funds.push( - new Funds(mockToken.address, "Foreign20", BigInt(sellerPayoff).toString()) + new Funds(await mockToken.getAddress(), "Foreign20", BigInt(sellerPayoff).toString()) ); - expectedBuyerAvailableFunds = new FundsList([new Funds(mockToken.address, "Foreign20", buyerPayoff)]); + expectedBuyerAvailableFunds = new FundsList([new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff)]); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -3833,10 +3833,10 @@ describe("IBosonFundsHandler", function () { const tx = await disputeHandler.connect(rando).expireEscalatedDispute(exchangeId); await expect(tx) .to.emit(disputeHandler, "FundsReleased") - .withArgs(exchangeId, buyerId, offerToken.exchangeToken, buyerPayoff, rando.address); + .withArgs(exchangeId, buyerId, offerToken.exchangeToken, buyerPayoff, await rando.getAddress()); await expect(tx) .to.emit(disputeHandler, "FundsReleased") - .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, rando.address); + .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, await rando.getAddress()); await expect(tx).to.not.emit(disputeHandler, "ProtocolFeeCollected"); }); @@ -3850,7 +3850,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", sellerDeposit), + new Funds(await mockToken.getAddress(), "Foreign20", sellerDeposit), new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); @@ -3869,9 +3869,9 @@ describe("IBosonFundsHandler", function () { // seller: sellerDeposit; note that seller has sellerDeposit in availableFunds from before // protocol: 0 // agent: 0 - expectedBuyerAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", buyerPayoff); + expectedBuyerAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff); expectedSellerAvailableFunds.funds[0] = new Funds( - mockToken.address, + await mockToken.getAddress(), "Foreign20", BigInt(sellerDeposit)+sellerPayoff.toString() ); @@ -3894,10 +3894,10 @@ describe("IBosonFundsHandler", function () { // approve protocol to transfer the tokens await mockToken.connect(buyer).approve(protocolDiamondAddress, agentOffer.price); - await mockToken.mint(buyer.address, agentOffer.price); + await mockToken.mint(await buyer.getAddress(), agentOffer.price); // Commit to Offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, agentOffer.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), agentOffer.id); exchangeId = "2"; @@ -3918,7 +3918,7 @@ describe("IBosonFundsHandler", function () { protocolPayoff = 0; // Escalate the dispute - await mockToken.mint(buyer.address, buyerEscalationDeposit); + await mockToken.mint(await buyer.getAddress(), buyerEscalationDeposit); await mockToken.connect(buyer).approve(protocolDiamondAddress, buyerEscalationDeposit); tx = await disputeHandler.connect(buyer).escalateDispute(exchangeId); @@ -3957,9 +3957,9 @@ describe("IBosonFundsHandler", function () { // seller: sellerDeposit; // protocol: 0 // agent: 0 - expectedBuyerAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", buyerPayoff); + expectedBuyerAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff); expectedSellerAvailableFunds.funds.push( - new Funds(mockToken.address, "Foreign20", BigInt(sellerPayoff).toString()) + new Funds(await mockToken.getAddress(), "Foreign20", BigInt(sellerPayoff).toString()) ); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -3998,11 +3998,11 @@ describe("IBosonFundsHandler", function () { await expect(tx) .to.emit(disputeHandler, "FundsReleased") - .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, assistantDR.address); + .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, await assistantDR.getAddress()); await expect(tx) .to.emit(disputeHandler, "FundsReleased") - .withArgs(exchangeId, buyerId, offerToken.exchangeToken, buyerPayoff, assistantDR.address); + .withArgs(exchangeId, buyerId, offerToken.exchangeToken, buyerPayoff, await assistantDR.getAddress()); await expect(tx).to.not.emit(disputeHandler, "ProtocolFeeCollected"); @@ -4013,7 +4013,7 @@ describe("IBosonFundsHandler", function () { seller.id, offerToken.exchangeToken, sellerPayoff, - rando.address, + await rando.getAddress(), ]); expect(match).to.be.false; }); @@ -4027,7 +4027,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", sellerDeposit), + new Funds(await mockToken.getAddress(), "Foreign20", sellerDeposit), new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), ]); expectedBuyerAvailableFunds = new FundsList([]); @@ -4046,9 +4046,9 @@ describe("IBosonFundsHandler", function () { // seller: sellerDeposit; note that seller has sellerDeposit in availableFunds from before // protocol: 0 // agent: 0 - expectedBuyerAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", buyerPayoff); + expectedBuyerAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff); expectedSellerAvailableFunds.funds[0] = new Funds( - mockToken.address, + await mockToken.getAddress(), "Foreign20", BigInt(sellerDeposit)+sellerPayoff.toString() ); @@ -4071,10 +4071,10 @@ describe("IBosonFundsHandler", function () { // approve protocol to transfer the tokens await mockToken.connect(buyer).approve(protocolDiamondAddress, agentOffer.price); - await mockToken.mint(buyer.address, agentOffer.price); + await mockToken.mint(await buyer.getAddress(), agentOffer.price); // Commit to Offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, agentOffer.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), agentOffer.id); exchangeId = "2"; @@ -4095,7 +4095,7 @@ describe("IBosonFundsHandler", function () { protocolPayoff = 0; // Escalate the dispute - await mockToken.mint(buyer.address, buyerEscalationDeposit); + await mockToken.mint(await buyer.getAddress(), buyerEscalationDeposit); await mockToken.connect(buyer).approve(protocolDiamondAddress, buyerEscalationDeposit); await disputeHandler.connect(buyer).escalateDispute(exchangeId); }); @@ -4127,9 +4127,9 @@ describe("IBosonFundsHandler", function () { // seller: sellerDeposit; // protocol: 0 // agent: 0 - expectedBuyerAvailableFunds.funds[0] = new Funds(mockToken.address, "Foreign20", buyerPayoff); + expectedBuyerAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff); expectedSellerAvailableFunds.funds.push( - new Funds(mockToken.address, "Foreign20", BigInt(sellerPayoff).toString()) + new Funds(await mockToken.getAddress(), "Foreign20", BigInt(sellerPayoff).toString()) ); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -4176,11 +4176,11 @@ describe("IBosonFundsHandler", function () { const tx = await exchangeHandler.connect(buyer).completeExchange(exchangeId); await expect(tx) .to.emit(exchangeHandler, "FundsReleased") - .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, buyer.address); + .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "ProtocolFeeCollected") - .withArgs(exchangeId, offerToken.exchangeToken, offerTokenProtocolFee, buyer.address); + .withArgs(exchangeId, offerToken.exchangeToken, offerTokenProtocolFee, await buyer.getAddress()); }); it("Protocol fee for new exchanges should be the same as at the offer creation", async function () { @@ -4191,7 +4191,7 @@ describe("IBosonFundsHandler", function () { // similar as teste before, excpet the commit to offer is done after the procol fee change // commit to offer and get the correct exchangeId - tx = await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerToken.id); + tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id); txReceipt = await tx.wait(); event = getEvent(txReceipt, exchangeHandler, "BuyerCommitted"); exchangeId = event.exchangeId.toString(); @@ -4206,11 +4206,11 @@ describe("IBosonFundsHandler", function () { tx = await exchangeHandler.connect(buyer).completeExchange(exchangeId); await expect(tx) .to.emit(exchangeHandler, "FundsReleased") - .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, buyer.address); + .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "ProtocolFeeCollected") - .withArgs(exchangeId, offerToken.exchangeToken, offerTokenProtocolFee, buyer.address); + .withArgs(exchangeId, offerToken.exchangeToken, offerTokenProtocolFee, await buyer.getAddress()); }); context("Offer has an agent", async function () { @@ -4244,7 +4244,7 @@ describe("IBosonFundsHandler", function () { .createOffer(agentOffer, offerDates, offerDurations, disputeResolverId, agent.id); // Commit to Agent Offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, agentOffer.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), agentOffer.id); // set the new procol fee protocolFeePercentage = "300"; // 3% @@ -4263,33 +4263,33 @@ describe("IBosonFundsHandler", function () { await expect(tx) .to.emit(exchangeHandler, "FundsReleased") - .withArgs(exchangeId, seller.id, agentOffer.exchangeToken, sellerPayoff, buyer.address); + .withArgs(exchangeId, seller.id, agentOffer.exchangeToken, sellerPayoff, await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "ProtocolFeeCollected") - .withArgs(exchangeId, agentOffer.exchangeToken, protocolPayoff, buyer.address); + .withArgs(exchangeId, agentOffer.exchangeToken, protocolPayoff, await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "FundsReleased") - .withArgs(exchangeId, agentId, agentOffer.exchangeToken, agentPayoff, buyer.address); + .withArgs(exchangeId, agentId, agentOffer.exchangeToken, agentPayoff, await buyer.getAddress()); }); it("Protocol fee for new exchanges should be the same as at the agent offer creation", async function () { // similar as tests before, excpet the commit to offer is done after the protocol fee change // top up seller's and buyer's account - await mockToken.mint(assistant.address, sellerDeposit); - await mockToken.mint(buyer.address, price); + await mockToken.mint(await assistant.getAddress(), sellerDeposit); + await mockToken.mint(await buyer.getAddress(), price); // approve protocol to transfer the tokens await mockToken.connect(assistant).approve(protocolDiamondAddress, sellerDeposit); await mockToken.connect(buyer).approve(protocolDiamondAddress, price); // deposit to seller's pool - await fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, sellerDeposit); + await fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), sellerDeposit); // commit to offer and get the correct exchangeId - tx = await exchangeHandler.connect(buyer).commitToOffer(buyer.address, agentOffer.id); + tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), agentOffer.id); txReceipt = await tx.wait(); event = getEvent(txReceipt, exchangeHandler, "BuyerCommitted"); exchangeId = event.exchangeId.toString(); @@ -4306,15 +4306,15 @@ describe("IBosonFundsHandler", function () { // Complete the exchange, expecting event await expect(tx) .to.emit(exchangeHandler, "FundsReleased") - .withArgs(exchangeId, seller.id, agentOffer.exchangeToken, sellerPayoff, buyer.address); + .withArgs(exchangeId, seller.id, agentOffer.exchangeToken, sellerPayoff, await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "ProtocolFeeCollected") - .withArgs(exchangeId, agentOffer.exchangeToken, protocolPayoff, buyer.address); + .withArgs(exchangeId, agentOffer.exchangeToken, protocolPayoff, await buyer.getAddress()); await expect(tx) .to.emit(exchangeHandler, "FundsReleased") - .withArgs(exchangeId, agentId, agentOffer.exchangeToken, agentPayoff, buyer.address); + .withArgs(exchangeId, agentId, agentOffer.exchangeToken, agentPayoff, await buyer.getAddress()); }); }); }); diff --git a/test/protocol/GroupHandlerTest.js b/test/protocol/GroupHandlerTest.js index 33573f837..f0987a105 100644 --- a/test/protocol/GroupHandlerTest.js +++ b/test/protocol/GroupHandlerTest.js @@ -103,7 +103,7 @@ describe("IBosonGroupHandler", function () { agentId = "0"; // agent id is optional while creating an offer // Create a valid seller, then set fields in tests directly - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); expect(seller.isValid()).is.true; // VoucherInitValues @@ -118,10 +118,10 @@ describe("IBosonGroupHandler", function () { // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -205,7 +205,7 @@ describe("IBosonGroupHandler", function () { assert.equal(event.groupId.toString(), group.id, "Group Id is incorrect"); assert.equal(event.sellerId.toString(), group.sellerId, "Seller Id is incorrect"); - assert.equal(event.executedBy.toString(), assistant.address, "Executed by is incorrect"); + assert.equal(event.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); assert.equal(groupInstance.toString(), group.toString(), "Group struct is incorrect"); }); @@ -240,7 +240,7 @@ describe("IBosonGroupHandler", function () { assert.equal(event.groupId.toString(), groupId, "Group Id is incorrect"); assert.equal(event.sellerId.toString(), group.sellerId, "Seller Id is incorrect"); - assert.equal(event.executedBy.toString(), assistant.address, "Executed by is incorrect"); + assert.equal(event.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); assert.equal(groupInstance.toStruct().toString(), groupStruct.toString(), "Group struct is incorrect"); // wrong group id should not exist @@ -280,7 +280,7 @@ describe("IBosonGroupHandler", function () { assert.equal(event.groupId.toString(), groupId, "Group Id is incorrect"); assert.equal(event.sellerId.toString(), seller.id, "Seller Id is incorrect"); - assert.equal(event.executedBy.toString(), assistant.address, "Executed by is incorrect"); + assert.equal(event.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); assert.equal(groupInstance.toStruct().toString(), groupStruct.toString(), "Group struct is incorrect"); }); @@ -304,7 +304,7 @@ describe("IBosonGroupHandler", function () { it("Caller is not the seller of all offers", async function () { // create another seller and an offer - seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); await offerHandler.connect(rando).createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId); // creates an offer with id 6 @@ -375,7 +375,7 @@ describe("IBosonGroupHandler", function () { }); it("Token address is not zero", async function () { - condition.tokenAddress = rando.address; + condition.tokenAddress = await rando.getAddress(); // Attempt to create the group, expecting revert await expect(groupHandler.connect(assistant).createGroup(group, condition)).to.revertedWith( @@ -415,7 +415,7 @@ describe("IBosonGroupHandler", function () { beforeEach(async function () { condition = mockCondition({ method: EvaluationMethod.Threshold, - tokenAddress: rando.address, + tokenAddress: await rando.getAddress(), maxCommits: "10", threshold: "200", }); @@ -453,7 +453,7 @@ describe("IBosonGroupHandler", function () { beforeEach(async function () { condition = mockCondition({ method: EvaluationMethod.SpecificToken, - tokenAddress: rando.address, + tokenAddress: await rando.getAddress(), threshold: "0", maxCommits: "5", }); @@ -514,7 +514,7 @@ describe("IBosonGroupHandler", function () { assert.equal(event.groupId.toString(), group.id, "Group Id is incorrect"); assert.equal(event.sellerId.toString(), group.sellerId, "Seller Id is incorrect"); - assert.equal(event.executedBy.toString(), assistant.address, "Executed by is incorrect"); + assert.equal(event.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); assert.equal(groupInstance.toString(), group.toString(), "Group struct is incorrect"); }); @@ -572,7 +572,7 @@ describe("IBosonGroupHandler", function () { it("Caller is not the seller of all offers", async function () { // create another seller and an offer - seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); await offerHandler.connect(rando).createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId); // creates an offer with id 6 @@ -682,7 +682,7 @@ describe("IBosonGroupHandler", function () { expect(groupInstance.isValid()).to.be.true; assert.equal(event.groupId.toString(), group.id, "Group Id is incorrect"); - assert.equal(event.executedBy.toString(), assistant.address, "Executed by is incorrect"); + assert.equal(event.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); assert.equal(groupInstance.toString(), group.toString(), "Group struct is incorrect"); }); @@ -856,7 +856,7 @@ describe("IBosonGroupHandler", function () { assert.equal(event.groupId.toString(), group.id, "Group Id is incorrect"); assert.equal(event.sellerId.toString(), group.sellerId, "Seller Id is incorrect"); - assert.equal(event.executedBy.toString(), assistant.address, "Executed by is incorrect"); + assert.equal(event.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); assert.equal(groupInstance.toString(), group.toString(), "Group struct is incorrect"); }); diff --git a/test/protocol/MetaTransactionsHandlerTest.js b/test/protocol/MetaTransactionsHandlerTest.js index 7720da9bf..e7d2cd941 100644 --- a/test/protocol/MetaTransactionsHandlerTest.js +++ b/test/protocol/MetaTransactionsHandlerTest.js @@ -184,7 +184,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Define the facet cut const facetCuts = [ { - facetAddress: mockMetaTransactionsHandlerFacet.address, + facetAddress: await mockMetaTransactionsHandlerFacet.getAddress(), action: FacetCutAction.Add, functionSelectors: getSelectors(mockMetaTransactionsHandlerFacet), }, @@ -233,20 +233,20 @@ describe("IBosonMetaTransactionsHandler", function () { it("should return false if nonce is not used", async function () { // Check if nonce is used before - result = await metaTransactionsHandler.connect(assistant).isUsedNonce(rando.address, nonce); + result = await metaTransactionsHandler.connect(assistant).isUsedNonce(await rando.getAddress(), nonce); // Verify the expectation assert.equal(result, expectedResult, "Nonce is used"); }); it("should be true after executing a meta transaction with nonce", async function () { - result = await metaTransactionsHandler.connect(assistant).isUsedNonce(assistant.address, nonce); + result = await metaTransactionsHandler.connect(assistant).isUsedNonce(await assistant.getAddress(), nonce); // Verify the expectation assert.equal(result, expectedResult, "Nonce is used"); // Create a valid seller for meta transaction - seller = mockSeller(assistant.address, assistant.address, ZeroAddress, assistant.address); + seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), ZeroAddress, await assistant.getAddress()); expect(seller.isValid()).is.true; // VoucherInitValues @@ -280,8 +280,8 @@ describe("IBosonMetaTransactionsHandler", function () { // Prepare the message let message = {}; message.nonce = parseInt(nonce); - message.from = assistant.address; - message.contractAddress = accountHandler.address; + message.from = await assistant.getAddress(); + message.contractAddress = await accountHandler.getAddress(); message.functionName = "createSeller((uint256,address,address,address,address,bool,string),(uint256,uint8),(string,uint256))"; message.functionSignature = functionSignature; @@ -292,12 +292,12 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Send as meta transaction await metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -308,13 +308,13 @@ describe("IBosonMetaTransactionsHandler", function () { // We expect that the nonce is used now. Hence expecting to return true. expectedResult = true; - result = await metaTransactionsHandler.connect(assistant).isUsedNonce(assistant.address, nonce); + result = await metaTransactionsHandler.connect(assistant).isUsedNonce(await assistant.getAddress(), nonce); assert.equal(result, expectedResult, "Nonce is not used"); //Verify that another nonce value is unused. expectedResult = false; nonce = nonce + 1; - result = await metaTransactionsHandler.connect(rando).isUsedNonce(assistant.address, nonce); + result = await metaTransactionsHandler.connect(rando).isUsedNonce(await assistant.getAddress(), nonce); assert.equal(result, expectedResult, "Nonce is used"); }); }); @@ -333,19 +333,19 @@ describe("IBosonMetaTransactionsHandler", function () { functionHashList = functionList.map((func) => keccak256(toUtf8Bytes(func))); // Grant UPGRADER role to admin account - await accessController.grantRole(Role.ADMIN, admin.address); + await accessController.grantRole(Role.ADMIN, await admin.getAddress()); }); it("should emit a FunctionsAllowlisted event", async function () { // Enable functions await expect(metaTransactionsHandler.connect(admin).setAllowlistedFunctions(functionHashList, true)) .to.emit(metaTransactionsHandler, "FunctionsAllowlisted") - .withArgs(functionHashList, true, admin.address); + .withArgs(functionHashList, true, await admin.getAddress()); // Disable functions await expect(metaTransactionsHandler.connect(admin).setAllowlistedFunctions(functionHashList, false)) .to.emit(metaTransactionsHandler, "FunctionsAllowlisted") - .withArgs(functionHashList, false, admin.address); + .withArgs(functionHashList, false, await admin.getAddress()); }); it("should update state", async function () { @@ -395,7 +395,7 @@ describe("IBosonMetaTransactionsHandler", function () { functionHashList = functionList.map((func) => keccak256(toUtf8Bytes(func))); // Grant UPGRADER role to admin account - await accessController.grantRole(Role.ADMIN, admin.address); + await accessController.grantRole(Role.ADMIN, await admin.getAddress()); }); it("after initialization all state modifying functions should be allowlisted", async function () { @@ -448,7 +448,7 @@ describe("IBosonMetaTransactionsHandler", function () { functionHashList = functionList.map((func) => keccak256(toUtf8Bytes(func))); // Grant UPGRADER role to admin account - await accessController.grantRole(Role.ADMIN, admin.address); + await accessController.grantRole(Role.ADMIN, await admin.getAddress()); }); it("after initialization all state modifying functions should be allowlisted", async function () { @@ -511,7 +511,7 @@ describe("IBosonMetaTransactionsHandler", function () { context("👉 AccountHandlerFacet 👉 createSeller()", async function () { beforeEach(async function () { // Create a valid seller for meta transaction - seller = mockSeller(assistant.address, assistant.address, ZeroAddress, assistant.address); + seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), ZeroAddress, await assistant.getAddress()); expect(seller.isValid()).is.true; // VoucherInitValues @@ -525,8 +525,8 @@ describe("IBosonMetaTransactionsHandler", function () { // Prepare the message message = {}; message.nonce = parseInt(nonce); - message.from = assistant.address; - message.contractAddress = accountHandler.address; + message.from = await assistant.getAddress(); + message.contractAddress = await accountHandler.getAddress(); message.functionName = "createSeller((uint256,address,address,address,address,bool,string),(uint256,uint8),(string,uint256))"; }); @@ -547,21 +547,21 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // send a meta transaction, check for event await expect( metaTransactionsHandler .connect(deployer) - .executeMetaTransaction(assistant.address, message.functionName, functionSignature, nonce, r, s, v) + .executeMetaTransaction(await assistant.getAddress(), message.functionName, functionSignature, nonce, r, s, v) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") - .withArgs(assistant.address, deployer.address, message.functionName, nonce); + .withArgs(await assistant.getAddress(), await deployer.getAddress(), message.functionName, nonce); // Verify that nonce is used. Expect true. let expectedResult = true; - result = await metaTransactionsHandler.connect(assistant).isUsedNonce(assistant.address, nonce); + result = await metaTransactionsHandler.connect(assistant).isUsedNonce(await assistant.getAddress(), nonce); assert.equal(result, expectedResult, "Nonce is unused"); }); @@ -586,21 +586,21 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // send a meta transaction, does not revert await expect( metaTransactionsHandler .connect(deployer) - .executeMetaTransaction(assistant.address, message.functionName, functionSignature, nonce, r, s, v) + .executeMetaTransaction(await assistant.getAddress(), message.functionName, functionSignature, nonce, r, s, v) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") - .withArgs(assistant.address, deployer.address, message.functionName, nonce); + .withArgs(await assistant.getAddress(), await deployer.getAddress(), message.functionName, nonce); // Verify that nonce is used. Expect true. let expectedResult = true; - result = await metaTransactionsHandler.connect(assistant).isUsedNonce(assistant.address, nonce); + result = await metaTransactionsHandler.connect(assistant).isUsedNonce(await assistant.getAddress(), nonce); assert.equal(result, expectedResult, "Nonce is unused"); }); @@ -623,13 +623,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // send a meta transaction, expecting revert await expect( metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -658,30 +658,30 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() )); // send a meta transaction, check for event await expect( metaTransactionsHandler .connect(deployer) - .executeMetaTransaction(assistant.address, message.functionName, functionSignature, nonce, r, s, v) + .executeMetaTransaction(await assistant.getAddress(), message.functionName, functionSignature, nonce, r, s, v) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") - .withArgs(assistant.address, deployer.address, message.functionName, nonce); + .withArgs(await assistant.getAddress(), await deployer.getAddress(), message.functionName, nonce); // Verify that nonce is used. Expect true. let expectedResult = true; - result = await metaTransactionsHandler.connect(assistant).isUsedNonce(assistant.address, nonce); + result = await metaTransactionsHandler.connect(assistant).isUsedNonce(await assistant.getAddress(), nonce); assert.equal(result, expectedResult, "Nonce is unused"); // send a meta transaction again, check for event - seller.assistant = assistantDR.address; - seller.admin = adminDR.address; - seller.clerk = clerkDR.address; - seller.treasury = treasuryDR.address; + seller.assistant = await assistantDR.getAddress(); + seller.admin = await adminDR.getAddress(); + seller.clerk = await clerkDR.getAddress(); + seller.treasury = await treasuryDR.getAddress(); - message.from = adminDR.address; + message.from = await adminDR.getAddress(); // Prepare the function signature for the facet function. functionSignature = accountHandler.interface.encodeFunctionData("createSeller", [ @@ -698,20 +698,20 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() )); await expect( metaTransactionsHandler .connect(rando) - .executeMetaTransaction(adminDR.address, message.functionName, functionSignature, nonce, r, s, v) + .executeMetaTransaction(await adminDR.getAddress(), message.functionName, functionSignature, nonce, r, s, v) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") - .withArgs(adminDR.address, rando.address, message.functionName, nonce); + .withArgs(await adminDR.getAddress(), await rando.getAddress(), message.functionName, nonce); // Verify that nonce is used. Expect true. expectedResult = true; - result = await metaTransactionsHandler.connect(assistantDR).isUsedNonce(assistantDR.address, nonce); + result = await metaTransactionsHandler.connect(assistantDR).isUsedNonce(await assistantDR.getAddress(), nonce); assert.equal(result, expectedResult, "Nonce is unused"); }); @@ -734,7 +734,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Pause the metatx region of the protocol @@ -744,7 +744,7 @@ describe("IBosonMetaTransactionsHandler", function () { await expect( metaTransactionsHandler .connect(deployer) - .executeMetaTransaction(assistant.address, message.functionName, functionSignature, nonce, r, s, v) + .executeMetaTransaction(await assistant.getAddress(), message.functionName, functionSignature, nonce, r, s, v) ).to.revertedWith(RevertReasons.REGION_PAUSED); }); @@ -771,13 +771,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -808,13 +808,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -845,13 +845,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -888,13 +888,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -921,12 +921,12 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute the meta transaction. await metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -938,7 +938,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction again with the same nonce, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -958,7 +958,7 @@ describe("IBosonMetaTransactionsHandler", function () { ]); // Prepare the message - message.from = rando.address; + message.from = await rando.getAddress(); message.functionSignature = functionSignature; // Collect the signature components @@ -967,13 +967,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -1001,13 +1001,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -1020,7 +1020,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -1033,7 +1033,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -1046,7 +1046,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -1062,7 +1062,7 @@ describe("IBosonMetaTransactionsHandler", function () { context("👉TwinHandler 👉 removeTwin()", async function () { beforeEach(async function () { // Create a valid seller for meta transaction - seller = mockSeller(assistant.address, assistant.address, ZeroAddress, assistant.address); + seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), ZeroAddress, await assistant.getAddress()); expect(seller.isValid()).is.true; // VoucherInitValues @@ -1076,13 +1076,13 @@ describe("IBosonMetaTransactionsHandler", function () { await accountHandler.connect(assistant).createSeller(seller, emptyAuthToken, voucherInitValues); // Create a valid twin, then set fields in tests directly - twin = mockTwin(bosonToken.address); + twin = mockTwin(await bosonToken.getAddress()); twin.id = "1"; twin.sellerId = "1"; expect(twin.isValid()).is.true; // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // Create a twin await twinHandler.connect(assistant).createTwin(twin); @@ -1090,8 +1090,8 @@ describe("IBosonMetaTransactionsHandler", function () { // Prepare the message message = {}; message.nonce = parseInt(nonce); - message.from = assistant.address; - message.contractAddress = twinHandler.address; + message.from = await assistant.getAddress(); + message.contractAddress = await twinHandler.getAddress(); }); it("removeTwin() can remove a twin", async function () { @@ -1112,12 +1112,12 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Remove the twin. Send as meta transaction. await metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -1137,14 +1137,14 @@ describe("IBosonMetaTransactionsHandler", function () { // Prepare the message message = {}; message.nonce = parseInt(nonce); - message.from = assistant.address; - message.contractAddress = metaTransactionsHandler.address; + message.from = await assistant.getAddress(); + message.contractAddress = await metaTransactionsHandler.getAddress(); }); it("Should fail when try to call executeMetaTransaction method itself", async function () { // Function signature for executeMetaTransaction function. functionSignature = metaTransactionsHandler.interface.encodeFunctionData("executeMetaTransaction", [ - assistant.address, + await assistant.getAddress(), "executeMetaTransaction", constants.HashZero, // hash of zero nonce, @@ -1154,7 +1154,7 @@ describe("IBosonMetaTransactionsHandler", function () { ]); // Prepare the message - message.contractAddress = metaTransactionsHandler.address; + message.contractAddress = await metaTransactionsHandler.getAddress(); message.functionName = "executeMetaTransaction(address,string,bytes,uint256,bytes32,bytes32,uint8)"; message.functionSignature = functionSignature; @@ -1164,13 +1164,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // send a meta transaction, expecting revert await expect( metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -1183,7 +1183,7 @@ describe("IBosonMetaTransactionsHandler", function () { it("Returns default revert reason if called function reverts without a reason", async function () { // Create a valid seller for meta transaction - seller = mockSeller(assistant.address, assistant.address, ZeroAddress, assistant.address); + seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), ZeroAddress, await assistant.getAddress()); voucherInitValues = mockVoucherInitValues(); emptyAuthToken = mockAuthToken(); await accountHandler.connect(assistant).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -1191,7 +1191,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Depositing funds, where token address is not a contract address reverts without a reason. functionSignature = fundsHandler.interface.encodeFunctionData("depositFunds", [ seller.id, - rando.address, + await rando.getAddress(), "10", ]); @@ -1205,13 +1205,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // send a meta transaction, expecting revert await expect( metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -1225,7 +1225,7 @@ describe("IBosonMetaTransactionsHandler", function () { context("Reentrancy guard", async function () { beforeEach(async function () { // Create a valid seller for meta transaction - seller = mockSeller(assistant.address, assistant.address, ZeroAddress, assistant.address); + seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), ZeroAddress, await assistant.getAddress()); expect(seller.isValid()).is.true; // VoucherInitValues @@ -1250,10 +1250,10 @@ describe("IBosonMetaTransactionsHandler", function () { // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -1261,7 +1261,7 @@ describe("IBosonMetaTransactionsHandler", function () { buyerId = accountId.next().value; //Create DisputeResolverFee array so offer creation will succeed - disputeResolverFees = [new DisputeResolverFee(maliciousToken.address, "maliciousToken", "0")]; + disputeResolverFees = [new DisputeResolverFee(await maliciousToken.getAddress(), "maliciousToken", "0")]; // Make empty seller list, so every seller is allowed sellerAllowList = []; @@ -1274,7 +1274,7 @@ describe("IBosonMetaTransactionsHandler", function () { const { offer, ...mo } = await mockOffer(); ({ offerDates, offerDurations } = mo); offerToken = offer; - offerToken.exchangeToken = maliciousToken.address; + offerToken.exchangeToken = await maliciousToken.getAddress(); price = offer.price; sellerDeposit = offer.sellerDeposit; @@ -1290,18 +1290,18 @@ describe("IBosonMetaTransactionsHandler", function () { .createOffer(offerToken, offerDates, offerDurations, disputeResolver.id, agentId); // top up seller's and buyer's account - await maliciousToken.mint(assistant.address, sellerDeposit); - await maliciousToken.mint(buyer.address, price); + await maliciousToken.mint(await assistant.getAddress(), sellerDeposit); + await maliciousToken.mint(await buyer.getAddress(), price); // Approve protocol to transfer the tokens await maliciousToken.connect(assistant).approve(protocolDiamondAddress, sellerDeposit); await maliciousToken.connect(buyer).approve(protocolDiamondAddress, price); // Deposit to seller's pool - await fundsHandler.connect(assistant).depositFunds(seller.id, maliciousToken.address, sellerDeposit); + await fundsHandler.connect(assistant).depositFunds(seller.id, await maliciousToken.getAddress(), sellerDeposit); // Commit to the offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerToken.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id); // Cancel the voucher, so both seller and buyer have something to withdraw await exchangeHandler.connect(buyer).cancelVoucher(exchangeId); // canceling the voucher in tokens @@ -1311,7 +1311,7 @@ describe("IBosonMetaTransactionsHandler", function () { buyerPayoff = BigInt(offerToken.price)-offerToken.buyerCancelPenalty.toString(); // Prepare validFundDetails - tokenListBuyer = [maliciousToken.address]; + tokenListBuyer = [await maliciousToken.getAddress()]; tokenAmountsBuyer = [buyerPayoff]; validFundDetails = { entityId: buyerId, @@ -1322,10 +1322,10 @@ describe("IBosonMetaTransactionsHandler", function () { // Prepare the message message = {}; message.nonce = parseInt(nonce); - message.contractAddress = fundsHandler.address; + message.contractAddress = await fundsHandler.getAddress(); message.functionName = "withdrawFunds(uint256,address[],uint256[])"; message.fundDetails = validFundDetails; - message.from = buyer.address; + message.from = await buyer.getAddress(); // Set the fund Type fundType = [ @@ -1361,7 +1361,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxFund", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); let [, buyerStruct] = await accountHandler.getBuyer(buyerId); @@ -1370,7 +1370,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute the meta transaction. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -1391,7 +1391,7 @@ describe("IBosonMetaTransactionsHandler", function () { await maliciousToken.setProtocolAddress(protocolDiamondAddress); // Mint and approve protocol to transfer the tokens - await maliciousToken.mint(rando.address, "1"); + await maliciousToken.mint(await rando.getAddress(), "1"); await maliciousToken.connect(rando).approve(protocolDiamondAddress, "1"); // Just make a random metaTx signature to some view function that will delete "currentSender" @@ -1400,8 +1400,8 @@ describe("IBosonMetaTransactionsHandler", function () { // Prepare the message message.nonce = "0"; - message.from = rando.address; - message.contractAddress = accountHandler.address; + message.from = await rando.getAddress(); + message.contractAddress = await accountHandler.getAddress(); message.functionName = "getNextExchangeId()"; message.functionSignature = functionSignature; @@ -1411,22 +1411,22 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); - await maliciousToken.setMetaTxBytes(rando.address, functionSignature, r, s, v); + await maliciousToken.setMetaTxBytes(await rando.getAddress(), functionSignature, r, s, v); // Prepare the function signature for the facet function. functionSignature = fundsHandler.interface.encodeFunctionData("depositFunds", [ seller.id, - maliciousToken.address, + await maliciousToken.getAddress(), "1", ]); // Prepare the message message.nonce = nonce; - message.from = rando.address; - message.contractAddress = accountHandler.address; + message.from = await rando.getAddress(); + message.contractAddress = await accountHandler.getAddress(); message.functionName = "depositFunds(uint256,address,uint256)"; message.functionSignature = functionSignature; @@ -1436,14 +1436,14 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() )); // send a meta transaction, expect revert await expect( metaTransactionsHandler .connect(deployer) - .executeMetaTransaction(rando.address, message.functionName, functionSignature, nonce, r, s, v) + .executeMetaTransaction(await rando.getAddress(), message.functionName, functionSignature, nonce, r, s, v) ).to.revertedWith(RevertReasons.REENTRANCY_GUARD); }); }); @@ -1454,7 +1454,7 @@ describe("IBosonMetaTransactionsHandler", function () { offerId = "1"; // Create a valid seller - seller = mockSeller(assistant.address, assistant.address, ZeroAddress, assistant.address); + seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), ZeroAddress, await assistant.getAddress()); expect(seller.isValid()).is.true; // VoucherInitValues @@ -1468,10 +1468,10 @@ describe("IBosonMetaTransactionsHandler", function () { // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -1479,7 +1479,7 @@ describe("IBosonMetaTransactionsHandler", function () { //Create DisputeResolverFee array so offer creation will succeed disputeResolverFees = [ new DisputeResolverFee(ZeroAddress, "Native", "0"), - new DisputeResolverFee(mockToken.address, "BosonToken", "0"), + new DisputeResolverFee(await mockToken.getAddress(), "BosonToken", "0"), ]; // Make empty seller list, so every seller is allowed @@ -1513,8 +1513,8 @@ describe("IBosonMetaTransactionsHandler", function () { // Prepare the message message = {}; message.nonce = parseInt(nonce); - message.contractAddress = exchangeHandler.address; - message.from = buyer.address; + message.contractAddress = await exchangeHandler.getAddress(); + message.from = await buyer.getAddress(); message.functionName = "commitToOffer(address,uint256)"; // Deposit native currency to the same seller id @@ -1530,7 +1530,7 @@ describe("IBosonMetaTransactionsHandler", function () { context("👉 ExchangeHandlerFacet 👉 commitToOffer()", async function () { beforeEach(async function () { - offer.exchangeToken = mockToken.address; + offer.exchangeToken = await mockToken.getAddress(); // Check if domains are valid expect(offer.isValid()).is.true; @@ -1538,15 +1538,15 @@ describe("IBosonMetaTransactionsHandler", function () { expect(offerDurations.isValid()).is.true; // top up seller's and buyer's account - await mockToken.mint(assistant.address, sellerDeposit); - await mockToken.mint(buyer.address, price); + await mockToken.mint(await assistant.getAddress(), sellerDeposit); + await mockToken.mint(await buyer.getAddress(), price); // approve protocol to transfer the tokens await mockToken.connect(assistant).approve(protocolDiamondAddress, sellerDeposit); await mockToken.connect(buyer).approve(protocolDiamondAddress, price); // deposit to seller's pool - await fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, sellerDeposit); + await fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), sellerDeposit); // Create the offer await offerHandler @@ -1576,7 +1576,7 @@ describe("IBosonMetaTransactionsHandler", function () { // prepare validOfferDetails validOfferDetails = { - buyer: buyer.address, + buyer: await buyer.getAddress(), offerId: offer.id, }; @@ -1596,7 +1596,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxCommitToOffer", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Prepare the function signature @@ -1606,13 +1606,13 @@ describe("IBosonMetaTransactionsHandler", function () { ); // Expect that buyer has token balance matching the offer price. - const buyerBalanceBefore = await mockToken.balanceOf(buyer.address); + const buyerBalanceBefore = await mockToken.balanceOf(await buyer.getAddress()); assert.equal(buyerBalanceBefore, price, "Buyer initial token balance mismatch"); // send a meta transaction, check for event await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -1622,15 +1622,15 @@ describe("IBosonMetaTransactionsHandler", function () { ) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") - .withArgs(buyer.address, deployer.address, message.functionName, nonce); + .withArgs(await buyer.getAddress(), await deployer.getAddress(), message.functionName, nonce); // Expect that buyer (meta tx signer) has paid the tokens to commit to an offer. - const buyerBalanceAfter = await mockToken.balanceOf(buyer.address); + const buyerBalanceAfter = await mockToken.balanceOf(await buyer.getAddress()); assert.equal(buyerBalanceAfter, "0", "Buyer final token balance mismatch"); // Verify that nonce is used. Expect true. let expectedResult = true; - result = await metaTransactionsHandler.connect(buyer).isUsedNonce(buyer.address, nonce); + result = await metaTransactionsHandler.connect(buyer).isUsedNonce(await buyer.getAddress(), nonce); assert.equal(result, expectedResult, "Nonce is unused"); }); @@ -1650,7 +1650,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxCommitToOffer", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Prepare the function signature @@ -1662,7 +1662,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -1689,12 +1689,12 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxCommitToOffer", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute the meta transaction. await metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -1706,7 +1706,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction again with the same nonce, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -1719,7 +1719,7 @@ describe("IBosonMetaTransactionsHandler", function () { it("Should fail when Signer and Signature do not match", async function () { // Prepare the message - message.from = rando.address; + message.from = await rando.getAddress(); // Collect the signature components let { r, s, v } = await prepareDataSignatureParameters( @@ -1727,13 +1727,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxCommitToOffer", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -1773,7 +1773,7 @@ describe("IBosonMetaTransactionsHandler", function () { message.exchangeDetails = validExchangeDetails; // Commit to offer - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); }); context("👉 ExchangeHandlerFacet 👉 cancelVoucher()", async function () { @@ -1789,7 +1789,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Prepare the function signature @@ -1800,7 +1800,7 @@ describe("IBosonMetaTransactionsHandler", function () { // send a meta transaction, check for event await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -1810,11 +1810,11 @@ describe("IBosonMetaTransactionsHandler", function () { ) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") - .withArgs(buyer.address, deployer.address, message.functionName, nonce); + .withArgs(await buyer.getAddress(), await deployer.getAddress(), message.functionName, nonce); // Verify that nonce is used. Expect true. let expectedResult = true; - result = await metaTransactionsHandler.connect(buyer).isUsedNonce(buyer.address, nonce); + result = await metaTransactionsHandler.connect(buyer).isUsedNonce(await buyer.getAddress(), nonce); assert.equal(result, expectedResult, "Nonce is unused"); }); @@ -1833,7 +1833,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Prepare the function signature @@ -1844,7 +1844,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -1870,12 +1870,12 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute the meta transaction. await metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -1887,7 +1887,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction again with the same nonce, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -1900,7 +1900,7 @@ describe("IBosonMetaTransactionsHandler", function () { it("Should fail when Signer and Signature do not match", async function () { // Prepare the message - message.from = rando.address; + message.from = await rando.getAddress(); // Collect the signature components let { r, s, v } = await prepareDataSignatureParameters( @@ -1908,13 +1908,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -1943,7 +1943,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Prepare the function signature @@ -1954,7 +1954,7 @@ describe("IBosonMetaTransactionsHandler", function () { // send a meta transaction, check for event await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -1964,11 +1964,11 @@ describe("IBosonMetaTransactionsHandler", function () { ) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") - .withArgs(buyer.address, deployer.address, message.functionName, nonce); + .withArgs(await buyer.getAddress(), await deployer.getAddress(), message.functionName, nonce); // Verify that nonce is used. Expect true. let expectedResult = true; - result = await metaTransactionsHandler.connect(buyer).isUsedNonce(buyer.address, nonce); + result = await metaTransactionsHandler.connect(buyer).isUsedNonce(await buyer.getAddress(), nonce); assert.equal(result, expectedResult, "Nonce is unused"); }); @@ -1987,7 +1987,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Prepare the function signature @@ -1998,7 +1998,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2024,12 +2024,12 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute the meta transaction. await metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2041,7 +2041,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction again with the same nonce, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2054,7 +2054,7 @@ describe("IBosonMetaTransactionsHandler", function () { it("Should fail when Signer and Signature do not match", async function () { // Prepare the message - message.from = rando.address; + message.from = await rando.getAddress(); // Collect the signature components let { r, s, v } = await prepareDataSignatureParameters( @@ -2062,13 +2062,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2100,7 +2100,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Prepare the function signature @@ -2111,7 +2111,7 @@ describe("IBosonMetaTransactionsHandler", function () { // send a meta transaction, check for event await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2121,7 +2121,7 @@ describe("IBosonMetaTransactionsHandler", function () { ) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") - .withArgs(buyer.address, deployer.address, message.functionName, nonce); + .withArgs(await buyer.getAddress(), await deployer.getAddress(), message.functionName, nonce); // Get the exchange state let response; @@ -2131,7 +2131,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Verify that nonce is used. Expect true. let expectedResult = true; - result = await metaTransactionsHandler.connect(buyer).isUsedNonce(buyer.address, nonce); + result = await metaTransactionsHandler.connect(buyer).isUsedNonce(await buyer.getAddress(), nonce); assert.equal(result, expectedResult, "Nonce is unused"); }); @@ -2150,7 +2150,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Prepare the function signature @@ -2161,7 +2161,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2187,12 +2187,12 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute the meta transaction. await metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2204,7 +2204,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction again with the same nonce, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2217,7 +2217,7 @@ describe("IBosonMetaTransactionsHandler", function () { it("Should fail when Signer and Signature do not match", async function () { // Prepare the message - message.from = rando.address; + message.from = await rando.getAddress(); // Collect the signature components let { r, s, v } = await prepareDataSignatureParameters( @@ -2225,13 +2225,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2265,7 +2265,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Prepare the function signature @@ -2276,7 +2276,7 @@ describe("IBosonMetaTransactionsHandler", function () { // send a meta transaction, check for event await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2286,7 +2286,7 @@ describe("IBosonMetaTransactionsHandler", function () { ) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") - .withArgs(buyer.address, deployer.address, message.functionName, nonce); + .withArgs(await buyer.getAddress(), await deployer.getAddress(), message.functionName, nonce); // Get the dispute state let response; @@ -2296,7 +2296,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Verify that nonce is used. Expect true. let expectedResult = true; - result = await metaTransactionsHandler.connect(buyer).isUsedNonce(buyer.address, nonce); + result = await metaTransactionsHandler.connect(buyer).isUsedNonce(await buyer.getAddress(), nonce); assert.equal(result, expectedResult, "Nonce is unused"); }); @@ -2315,7 +2315,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Prepare the function signature @@ -2326,7 +2326,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2352,12 +2352,12 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute the meta transaction. await metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2369,7 +2369,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction again with the same nonce, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2382,7 +2382,7 @@ describe("IBosonMetaTransactionsHandler", function () { it("Should fail when Signer and Signature do not match", async function () { // Prepare the message - message.from = rando.address; + message.from = await rando.getAddress(); // Collect the signature components let { r, s, v } = await prepareDataSignatureParameters( @@ -2390,13 +2390,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2436,7 +2436,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Prepare the message message.functionName = "raiseDispute(uint256)"; message.exchangeDetails = validExchangeDetails; - message.from = buyer.address; + message.from = await buyer.getAddress(); // Set time forward to the offer's voucherRedeemableFrom await setNextBlockTimestamp(Number(voucherRedeemableFrom)); @@ -2452,7 +2452,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Prepare the function signature @@ -2463,7 +2463,7 @@ describe("IBosonMetaTransactionsHandler", function () { // send a meta transaction, check for event await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2473,7 +2473,7 @@ describe("IBosonMetaTransactionsHandler", function () { ) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") - .withArgs(buyer.address, deployer.address, message.functionName, nonce); + .withArgs(await buyer.getAddress(), await deployer.getAddress(), message.functionName, nonce); // Get the exchange state let response; @@ -2483,7 +2483,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Verify that nonce is used. Expect true. let expectedResult = true; - result = await metaTransactionsHandler.connect(buyer).isUsedNonce(buyer.address, nonce); + result = await metaTransactionsHandler.connect(buyer).isUsedNonce(await buyer.getAddress(), nonce); assert.equal(result, expectedResult, "Nonce is unused"); }); @@ -2502,7 +2502,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Prepare the function signature @@ -2513,7 +2513,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2539,12 +2539,12 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute the meta transaction. await metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2556,7 +2556,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction again with the same nonce, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2569,7 +2569,7 @@ describe("IBosonMetaTransactionsHandler", function () { it("Should fail when Signer and Signature do not match", async function () { // Prepare the message - message.from = rando.address; + message.from = await rando.getAddress(); // Collect the signature components let { r, s, v } = await prepareDataSignatureParameters( @@ -2577,13 +2577,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2617,7 +2617,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Prepare the function signature @@ -2628,7 +2628,7 @@ describe("IBosonMetaTransactionsHandler", function () { // send a meta transaction, check for event await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2638,7 +2638,7 @@ describe("IBosonMetaTransactionsHandler", function () { ) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") - .withArgs(buyer.address, deployer.address, message.functionName, nonce); + .withArgs(await buyer.getAddress(), await deployer.getAddress(), message.functionName, nonce); // Get the dispute state let response; @@ -2648,7 +2648,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Verify that nonce is used. Expect true. let expectedResult = true; - result = await metaTransactionsHandler.connect(buyer).isUsedNonce(buyer.address, nonce); + result = await metaTransactionsHandler.connect(buyer).isUsedNonce(await buyer.getAddress(), nonce); assert.equal(result, expectedResult, "Nonce is unused"); }); @@ -2667,7 +2667,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Prepare the function signature @@ -2678,7 +2678,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2704,12 +2704,12 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute the meta transaction. await metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2721,7 +2721,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction again with the same nonce, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2734,7 +2734,7 @@ describe("IBosonMetaTransactionsHandler", function () { it("Should fail when Signer and Signature do not match", async function () { // Prepare the message - message.from = rando.address; + message.from = await rando.getAddress(); // Collect the signature components let { r, s, v } = await prepareDataSignatureParameters( @@ -2742,13 +2742,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxExchange", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2794,7 +2794,7 @@ describe("IBosonMetaTransactionsHandler", function () { customSignatureType2, "Resolution", message2, - disputeHandler.address + await disputeHandler.getAddress() ); // prepare validDisputeResolutionDetails @@ -2832,7 +2832,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Prepare the message message.functionName = "resolveDispute(uint256,uint256,bytes32,bytes32,uint8)"; message.disputeResolutionDetails = validDisputeResolutionDetails; - message.from = buyer.address; + message.from = await buyer.getAddress(); }); it("Should emit MetaTransactionExecuted event and update state", async () => { @@ -2842,7 +2842,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxDisputeResolution", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Prepare the function signature @@ -2857,7 +2857,7 @@ describe("IBosonMetaTransactionsHandler", function () { // send a meta transaction, check for event await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2867,7 +2867,7 @@ describe("IBosonMetaTransactionsHandler", function () { ) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") - .withArgs(buyer.address, deployer.address, message.functionName, nonce); + .withArgs(await buyer.getAddress(), await deployer.getAddress(), message.functionName, nonce); // Get the dispute state let response; @@ -2877,7 +2877,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Verify that nonce is used. Expect true. let expectedResult = true; - result = await metaTransactionsHandler.connect(buyer).isUsedNonce(buyer.address, nonce); + result = await metaTransactionsHandler.connect(buyer).isUsedNonce(await buyer.getAddress(), nonce); assert.equal(result, expectedResult, "Nonce is unused"); }); @@ -2903,7 +2903,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxDisputeResolution", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Prepare the function signature @@ -2918,7 +2918,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2948,12 +2948,12 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxDisputeResolution", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute the meta transaction. await metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2965,7 +2965,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction again with the same nonce, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -2978,7 +2978,7 @@ describe("IBosonMetaTransactionsHandler", function () { it("Should fail when Signer and Signature do not match", async function () { // Prepare the message - message.from = rando.address; + message.from = await rando.getAddress(); // Collect the signature components let { r, s, v } = await prepareDataSignatureParameters( @@ -2986,13 +2986,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxDisputeResolution", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -3013,7 +3013,7 @@ describe("IBosonMetaTransactionsHandler", function () { offerId = "1"; // Create a valid seller - seller = mockSeller(assistant.address, assistant.address, ZeroAddress, assistant.address); + seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), ZeroAddress, await assistant.getAddress()); expect(seller.isValid()).is.true; // VoucherInitValues @@ -3028,16 +3028,16 @@ describe("IBosonMetaTransactionsHandler", function () { // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; //Create DisputeResolverFee array so offer creation will succeed - disputeResolverFees = [new DisputeResolverFee(mockToken.address, "mockToken", "0")]; + disputeResolverFees = [new DisputeResolverFee(await mockToken.getAddress(), "mockToken", "0")]; // Make empty seller list, so every seller is allowed sellerAllowList = []; @@ -3049,7 +3049,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Valid offer domains ({ offer, offerDates, offerDurations } = await mockOffer()); - offer.exchangeToken = mockToken.address; + offer.exchangeToken = await mockToken.getAddress(); // Check if domains are valid expect(offer.isValid()).is.true; @@ -3062,15 +3062,15 @@ describe("IBosonMetaTransactionsHandler", function () { voucherRedeemableFrom = offerDates.voucherRedeemableFrom; // top up seller's and buyer's account - await mockToken.mint(assistant.address, sellerDeposit); - await mockToken.mint(buyer.address, price); + await mockToken.mint(await assistant.getAddress(), sellerDeposit); + await mockToken.mint(await buyer.getAddress(), price); // approve protocol to transfer the tokens await mockToken.connect(assistant).approve(protocolDiamondAddress, sellerDeposit); await mockToken.connect(buyer).approve(protocolDiamondAddress, price); // deposit to seller's pool - await fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, sellerDeposit); + await fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), sellerDeposit); // Prepare the function signature for the facet function. functionSignature = offerHandler.interface.encodeFunctionData("createOffer", [ @@ -3097,8 +3097,8 @@ describe("IBosonMetaTransactionsHandler", function () { // Prepare the message message = {}; message.nonce = parseInt(nonce); - message.from = assistant.address; - message.contractAddress = offerHandler.address; + message.from = await assistant.getAddress(); + message.contractAddress = await offerHandler.getAddress(); message.functionName = "createOffer((uint256,uint256,uint256,uint256,uint256,uint256,address,string,string,bool),(uint256,uint256,uint256,uint256),(uint256,uint256,uint256),uint256,uint256)"; message.functionSignature = functionSignature; @@ -3116,13 +3116,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // send a meta transaction, check for event await expect( metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -3132,11 +3132,11 @@ describe("IBosonMetaTransactionsHandler", function () { ) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") - .withArgs(assistant.address, deployer.address, message.functionName, nonce); + .withArgs(await assistant.getAddress(), await deployer.getAddress(), message.functionName, nonce); // Verify that nonce is used. Expect true. let expectedResult = true; - result = await metaTransactionsHandler.connect(assistant).isUsedNonce(assistant.address, nonce); + result = await metaTransactionsHandler.connect(assistant).isUsedNonce(await assistant.getAddress(), nonce); assert.equal(result, expectedResult, "Nonce is unused"); }); @@ -3163,13 +3163,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -3188,12 +3188,12 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute the meta transaction. await metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -3205,7 +3205,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction again with the same nonce, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -3218,7 +3218,7 @@ describe("IBosonMetaTransactionsHandler", function () { it("Should fail when Signer and Signature do not match", async function () { // Prepare the message - message.from = rando.address; + message.from = await rando.getAddress(); // Collect the signature components let { r, s, v } = await prepareDataSignatureParameters( @@ -3226,13 +3226,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - assistant.address, + await assistant.getAddress(), message.functionName, functionSignature, nonce, @@ -3251,7 +3251,7 @@ describe("IBosonMetaTransactionsHandler", function () { exchangeId = "1"; // Create a valid seller - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); expect(seller.isValid()).is.true; // VoucherInitValues @@ -3265,10 +3265,10 @@ describe("IBosonMetaTransactionsHandler", function () { // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -3276,7 +3276,7 @@ describe("IBosonMetaTransactionsHandler", function () { //Create DisputeResolverFee array so offer creation will succeed disputeResolverFees = [ new DisputeResolverFee(ZeroAddress, "Native", "0"), - new DisputeResolverFee(mockToken.address, "mockToken", "0"), + new DisputeResolverFee(await mockToken.getAddress(), "mockToken", "0"), ]; buyerId = accountId.next().value; @@ -3294,7 +3294,7 @@ describe("IBosonMetaTransactionsHandler", function () { offerNative = offer; offerToken = offerNative.clone(); offerToken.id = "2"; - offerToken.exchangeToken = mockToken.address; + offerToken.exchangeToken = await mockToken.getAddress(); price = offer.price; sellerDeposit = offer.sellerDeposit; @@ -3315,24 +3315,24 @@ describe("IBosonMetaTransactionsHandler", function () { ]); // top up seller's and buyer's account - await mockToken.mint(assistant.address, sellerDeposit); - await mockToken.mint(buyer.address, price); + await mockToken.mint(await assistant.getAddress(), sellerDeposit); + await mockToken.mint(await buyer.getAddress(), price); // approve protocol to transfer the tokens await mockToken.connect(assistant).approve(protocolDiamondAddress, sellerDeposit); await mockToken.connect(buyer).approve(protocolDiamondAddress, price); // deposit to seller's pool - await fundsHandler.connect(assistant).depositFunds(seller.id, mockToken.address, sellerDeposit); + await fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), sellerDeposit); await fundsHandler.connect(assistant).depositFunds(seller.id, ZeroAddress, sellerDeposit, { value: sellerDeposit, }); // commit to both offers - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerToken.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id); await exchangeHandler .connect(buyer) - .commitToOffer(buyer.address, offerNative.id, { value: offerNative.price }); + .commitToOffer(await buyer.getAddress(), offerNative.id, { value: offerNative.price }); // cancel the voucher, so both seller and buyer have something to withdraw await exchangeHandler.connect(buyer).cancelVoucher(exchangeId); // canceling the voucher in tokens @@ -3343,7 +3343,7 @@ describe("IBosonMetaTransactionsHandler", function () { buyerPayoff = BigInt(offerToken.price)-offerToken.buyerCancelPenalty.toString(); // prepare validFundDetails - tokenListBuyer = [mockToken.address, ZeroAddress]; + tokenListBuyer = [await mockToken.getAddress(), ZeroAddress]; tokenAmountsBuyer = [buyerPayoff, BigInt(buyerPayoff)/"2".toString()]; validFundDetails = { entityId: buyerId, @@ -3354,10 +3354,10 @@ describe("IBosonMetaTransactionsHandler", function () { // Prepare the message message = {}; message.nonce = parseInt(nonce); - message.contractAddress = fundsHandler.address; + message.contractAddress = await fundsHandler.getAddress(); message.functionName = "withdrawFunds(uint256,address[],uint256[])"; message.fundDetails = validFundDetails; - message.from = buyer.address; + message.from = await buyer.getAddress(); // Set the fund Type fundType = [ @@ -3390,11 +3390,11 @@ describe("IBosonMetaTransactionsHandler", function () { beforeEach(async function () { // Read on chain state buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); - buyerBalanceBefore = await mockToken.balanceOf(buyer.address); + buyerBalanceBefore = await mockToken.balanceOf(await buyer.getAddress()); // Chain state should match the expected available funds before the withdrawal expectedBuyerAvailableFunds = new FundsList([ - new Funds(mockToken.address, "Foreign20", buyerPayoff), + new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff), new Funds(ZeroAddress, "Native currency", buyerPayoff), ]); expect(buyerAvailableFunds).to.eql( @@ -3410,7 +3410,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxFund", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Prepare the function signature @@ -3423,7 +3423,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Withdraw funds. Send a meta transaction, check for event. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -3433,11 +3433,11 @@ describe("IBosonMetaTransactionsHandler", function () { ) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") - .withArgs(buyer.address, deployer.address, message.functionName, nonce); + .withArgs(await buyer.getAddress(), await deployer.getAddress(), message.functionName, nonce); // Read on chain state buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); - buyerBalanceAfter = await mockToken.balanceOf(buyer.address); + buyerBalanceAfter = await mockToken.balanceOf(await buyer.getAddress()); // Chain state should match the expected available funds after the withdrawal // Since all tokens are withdrawn, token should be removed from the list @@ -3458,7 +3458,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Verify that nonce is used. Expect true. let expectedResult = true; - result = await metaTransactionsHandler.connect(buyer).isUsedNonce(buyer.address, nonce); + result = await metaTransactionsHandler.connect(buyer).isUsedNonce(await buyer.getAddress(), nonce); assert.equal(result, expectedResult, "Nonce is unused"); }); @@ -3478,7 +3478,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxFund", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Prepare the function signature @@ -3491,7 +3491,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Withdraw funds. Send a meta transaction, check for event. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -3501,11 +3501,11 @@ describe("IBosonMetaTransactionsHandler", function () { ) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") - .withArgs(buyer.address, deployer.address, message.functionName, nonce); + .withArgs(await buyer.getAddress(), await deployer.getAddress(), message.functionName, nonce); // Read on chain state buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); - buyerBalanceAfter = await mockToken.balanceOf(buyer.address); + buyerBalanceAfter = await mockToken.balanceOf(await buyer.getAddress()); // Chain state should match the expected available funds after the withdrawal // Since all tokens are withdrawn, funds list should be empty. @@ -3520,7 +3520,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Verify that nonce is used. Expect true. let expectedResult = true; - result = await metaTransactionsHandler.connect(buyer).isUsedNonce(buyer.address, nonce); + result = await metaTransactionsHandler.connect(buyer).isUsedNonce(await buyer.getAddress(), nonce); assert.equal(result, expectedResult, "Nonce is unused"); }); @@ -3528,7 +3528,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Set token address to boson token validFundDetails = { entityId: buyerId, - tokenList: [bosonToken.address], + tokenList: [await bosonToken.getAddress()], tokenAmounts: [buyerPayoff], }; @@ -3541,7 +3541,7 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxFund", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Prepare the function signature @@ -3554,7 +3554,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -3583,12 +3583,12 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxFund", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute the meta transaction. await metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -3600,7 +3600,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Execute meta transaction again with the same nonce, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, @@ -3613,7 +3613,7 @@ describe("IBosonMetaTransactionsHandler", function () { it("Should fail when Signer and Signature do not match", async function () { // Prepare the message - message.from = rando.address; + message.from = await rando.getAddress(); // Collect the signature components let { r, s, v } = await prepareDataSignatureParameters( @@ -3621,13 +3621,13 @@ describe("IBosonMetaTransactionsHandler", function () { customTransactionType, "MetaTxFund", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler.executeMetaTransaction( - buyer.address, + await buyer.getAddress(), message.functionName, functionSignature, nonce, diff --git a/test/protocol/OfferHandlerTest.js b/test/protocol/OfferHandlerTest.js index bf50559b9..72163ff34 100644 --- a/test/protocol/OfferHandlerTest.js +++ b/test/protocol/OfferHandlerTest.js @@ -125,7 +125,7 @@ describe("IBosonOfferHandler", function () { , { percentage: protocolFeePercentage, flatBoson: protocolFeeFlatBoson, buyerEscalationDepositPercentage }, ], - } = await setupTestEnvironment(contracts, { bosonTokenAddress: bosonToken.address })); + } = await setupTestEnvironment(contracts, { bosonTokenAddress: await bosonToken.getAddress() })); // make all account the same assistant = admin; @@ -163,7 +163,7 @@ describe("IBosonOfferHandler", function () { id = nextAccountId = "1"; // argument sent to contract for createSeller will be ignored // Create a valid seller, then set fields in tests directly - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); expect(seller.isValid()).is.true; // VoucherInitValues @@ -177,10 +177,10 @@ describe("IBosonOfferHandler", function () { // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -190,7 +190,7 @@ describe("IBosonOfferHandler", function () { DRFeeToken = "0"; disputeResolverFees = [ new DisputeResolverFee(ZeroAddress, "Native", DRFeeNative), - new DisputeResolverFee(bosonToken.address, "Boson", DRFeeToken), + new DisputeResolverFee(await bosonToken.getAddress(), "Boson", DRFeeToken), ]; // Make empty seller list, so every seller is allowed @@ -258,7 +258,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -317,7 +317,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // wrong offer id should not exist @@ -347,7 +347,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -375,13 +375,13 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); it("If exchange token is $BOSON, fee should be flat boson fee", async function () { // Prepare an offer with $BOSON as exchange token - offer.exchangeToken = bosonToken.address; + offer.exchangeToken = await bosonToken.getAddress(); disputeResolutionTerms = new DisputeResolutionTerms( disputeResolver.id, disputeResolver.escalationResponsePeriod, @@ -405,7 +405,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTerms.toStruct(), offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -430,7 +430,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -452,7 +452,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -471,11 +471,11 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // create another offer, now with bosonToken as exchange token - offer.exchangeToken = bosonToken.address; + offer.exchangeToken = await bosonToken.getAddress(); offer.id = "2"; disputeResolutionTermsStruct = new DisputeResolutionTerms( disputeResolver.id, @@ -500,13 +500,13 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); it("Should allow creation of an offer if DR has a sellerAllowList and seller is on it", async function () { // Create new seller so sellerAllowList can have an entry - seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -704,10 +704,10 @@ describe("IBosonOfferHandler", function () { it.skip("Dispute resolver is not active", async function () { // create another dispute resolver, but don't activate it disputeResolver = mockDisputeResolver( - rando.address, - rando.address, + await rando.getAddress(), + await rando.getAddress(), ZeroAddress, - rando.address, + await rando.getAddress(), false ); await accountHandler @@ -743,10 +743,10 @@ describe("IBosonOfferHandler", function () { it.skip("For absolute zero offer, specified dispute resolver is not active", async function () { // create another dispute resolver, but don't activate it disputeResolver = mockDisputeResolver( - rando.address, - rando.address, + await rando.getAddress(), + await rando.getAddress(), ZeroAddress, - rando.address, + await rando.getAddress(), false ); await accountHandler @@ -772,7 +772,7 @@ describe("IBosonOfferHandler", function () { it("Seller is not on dispute resolver's seller allow list", async function () { // Create new seller so sellerAllowList can have an entry - seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -787,7 +787,7 @@ describe("IBosonOfferHandler", function () { it("Dispute resolver does not accept fees in the exchange token", async function () { // Set some address that is not part of dispute resolver fees - offer.exchangeToken = rando.address; + offer.exchangeToken = await rando.getAddress(); // Attempt to Create an offer, expecting revert await expect( @@ -799,7 +799,7 @@ describe("IBosonOfferHandler", function () { context("When offer has non zero agent id", async function () { beforeEach(async function () { // Create a valid agent, then set fields in tests directly - agent = mockAgent(other.address); + agent = mockAgent(await other.getAddress()); agent.id = "3"; agentId = agent.id; expect(agent.isValid()).is.true; @@ -827,7 +827,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Check that mapping between agent and offer is correct @@ -863,7 +863,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); //Check offer agent fee for New offer. @@ -922,7 +922,7 @@ describe("IBosonOfferHandler", function () { it("Sum of agent fee amount and protocol fee amount should be <= than the offer fee limit", async function () { // Create a valid agent, then set fields in tests directly - agent = mockAgent(assistant.address); + agent = mockAgent(await assistant.getAddress()); agent.id = "4"; agent.feePercentage = "3000"; //30% expect(agent.isValid()).is.true; @@ -962,7 +962,7 @@ describe("IBosonOfferHandler", function () { // Void the offer, testing for the event await expect(offerHandler.connect(assistant).voidOffer(id)) .to.emit(offerHandler, "OfferVoided") - .withArgs(id, offerStruct.sellerId, assistant.address); + .withArgs(id, offerStruct.sellerId, await assistant.getAddress()); }); it("should update state", async function () { @@ -1016,7 +1016,7 @@ describe("IBosonOfferHandler", function () { // caller is an assistant of another seller // Create a valid seller, then set fields in tests directly - seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); // AuthToken emptyAuthToken = mockAuthToken(); @@ -1059,7 +1059,7 @@ describe("IBosonOfferHandler", function () { // Extend the valid until date, testing for the event await expect(offerHandler.connect(assistant).extendOffer(offer.id, offerDates.validUntil)) .to.emit(offerHandler, "OfferExtended") - .withArgs(id, offer.sellerId, offerDates.validUntil, assistant.address); + .withArgs(id, offer.sellerId, offerDates.validUntil, await assistant.getAddress()); }); it("should update state", async function () { @@ -1116,7 +1116,7 @@ describe("IBosonOfferHandler", function () { // caller is an assistant of another seller // Create a valid seller, then set fields in tests directly - seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); // AuthToken emptyAuthToken = mockAuthToken(); @@ -1190,7 +1190,7 @@ describe("IBosonOfferHandler", function () { // Extend the valid until date, testing for the event await expect(offerHandler.connect(assistant).extendOffer(offer.id, offerDates.validUntil)) .to.emit(offerHandler, "OfferExtended") - .withArgs(id, offer.sellerId, offerDates.validUntil, assistant.address); + .withArgs(id, offer.sellerId, offerDates.validUntil, await assistant.getAddress()); }); it("should update state", async function () { @@ -1238,23 +1238,23 @@ describe("IBosonOfferHandler", function () { id = nextOfferId++; // expected address of the first clone - const voucherCloneAddress = calculateContractAddress(accountHandler.address, "1"); + const voucherCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "1"); bosonVoucher = await getContractAt("BosonVoucher", voucherCloneAddress); length = 100; firstTokenId = 1; lastTokenId = firstTokenId + length - 1; const tokenIdStart = deriveTokenId(offer.id, firstTokenId); - range = new Range(tokenIdStart.toString(), length.toString(), "0", "0", assistant.address); + range = new Range(tokenIdStart.toString(), length.toString(), "0", "0", await assistant.getAddress()); }); it("should emit an RangeReserved event", async function () { // Reserve a range, testing for the event - const tx = await offerHandler.connect(assistant).reserveRange(id, length, assistant.address); + const tx = await offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress()); await expect(tx) .to.emit(offerHandler, "RangeReserved") - .withArgs(id, offer.sellerId, firstTokenId, lastTokenId, assistant.address, assistant.address); + .withArgs(id, offer.sellerId, firstTokenId, lastTokenId, await assistant.getAddress(), await assistant.getAddress()); await expect(tx).to.emit(bosonVoucher, "RangeReserved").withArgs(id, range.toStruct()); }); @@ -1266,7 +1266,7 @@ describe("IBosonOfferHandler", function () { const nextExchangeIdBefore = await exchangeHandler.getNextExchangeId(); // Reserve a range - await offerHandler.connect(assistant).reserveRange(id, length, assistant.address); + await offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress()); // Quantity available should be updated [, offerStruct] = await offerHandler.connect(rando).getOffer(id); @@ -1294,13 +1294,13 @@ describe("IBosonOfferHandler", function () { .depositFunds(seller.id, ZeroAddress, sellerPool, { value: sellerPool }); // Commit to the offer twice - await exchangeHandler.connect(rando).commitToOffer(rando.address, id, { value: price }); - await exchangeHandler.connect(rando).commitToOffer(rando.address, id, { value: price }); + await exchangeHandler.connect(rando).commitToOffer(await rando.getAddress(), id, { value: price }); + await exchangeHandler.connect(rando).commitToOffer(await rando.getAddress(), id, { value: price }); // Reserve a range, testing for the event - await expect(offerHandler.connect(assistant).reserveRange(id, length, assistant.address)) + await expect(offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress())) .to.emit(offerHandler, "RangeReserved") - .withArgs(id, offer.sellerId, firstTokenId + 2, lastTokenId + 2, assistant.address, assistant.address); + .withArgs(id, offer.sellerId, firstTokenId + 2, lastTokenId + 2, await assistant.getAddress(), await assistant.getAddress()); }); it("It's possible to reserve a range with maximum allowed length", async function () { @@ -1312,7 +1312,7 @@ describe("IBosonOfferHandler", function () { // Set maximum allowed length length = BigInt(2)**64-1; - await expect(offerHandler.connect(assistant).reserveRange(nextOfferId, length, assistant.address)).to.emit( + await expect(offerHandler.connect(assistant).reserveRange(nextOfferId, length, await assistant.getAddress())).to.emit( offerHandler, "RangeReserved" ); @@ -1330,7 +1330,7 @@ describe("IBosonOfferHandler", function () { const quantityAvailableBefore = offerStruct.quantityAvailable; // Reserve a range - await offerHandler.connect(assistant).reserveRange(nextOfferId, length, assistant.address); + await offerHandler.connect(assistant).reserveRange(nextOfferId, length, await assistant.getAddress()); // Quantity available should not change [, offerStruct] = await offerHandler.connect(rando).getOffer(nextOfferId); @@ -1344,16 +1344,16 @@ describe("IBosonOfferHandler", function () { context("Owner range is contract", async function () { beforeEach(async function () { - range.owner = bosonVoucher.address; + range.owner = await bosonVoucher.getAddress(); }); it("should emit an RangeReserved event", async function () { // Reserve a range, testing for the event - const tx = await offerHandler.connect(assistant).reserveRange(id, length, bosonVoucher.address); + const tx = await offerHandler.connect(assistant).reserveRange(id, length, await bosonVoucher.getAddress()); await expect(tx) .to.emit(offerHandler, "RangeReserved") - .withArgs(id, offer.sellerId, firstTokenId, lastTokenId, bosonVoucher.address, assistant.address); + .withArgs(id, offer.sellerId, firstTokenId, lastTokenId, await bosonVoucher.getAddress(), await assistant.getAddress()); await expect(tx).to.emit(bosonVoucher, "RangeReserved").withArgs(id, range.toStruct()); }); @@ -1365,7 +1365,7 @@ describe("IBosonOfferHandler", function () { const nextExchangeIdBefore = await exchangeHandler.getNextExchangeId(); // Reserve a range - await offerHandler.connect(assistant).reserveRange(id, length, bosonVoucher.address); + await offerHandler.connect(assistant).reserveRange(id, length, await bosonVoucher.getAddress()); // Quantity available should be updated [, offerStruct] = await offerHandler.connect(rando).getOffer(id); @@ -1392,7 +1392,7 @@ describe("IBosonOfferHandler", function () { await pauseHandler.connect(pauser).pause([PausableRegion.Offers]); // Attempt to reserve a range, expecting revert - await expect(offerHandler.connect(assistant).reserveRange(id, length, assistant.address)).to.revertedWith( + await expect(offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( RevertReasons.REGION_PAUSED ); }); @@ -1402,7 +1402,7 @@ describe("IBosonOfferHandler", function () { await pauseHandler.connect(pauser).pause([PausableRegion.Exchanges]); // Attempt to reserve a range, expecting revert - await expect(offerHandler.connect(assistant).reserveRange(id, length, assistant.address)).to.revertedWith( + await expect(offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( RevertReasons.REGION_PAUSED ); }); @@ -1412,7 +1412,7 @@ describe("IBosonOfferHandler", function () { id = "444"; // Attempt to reserve a range, expecting revert - await expect(offerHandler.connect(assistant).reserveRange(id, length, assistant.address)).to.revertedWith( + await expect(offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( RevertReasons.NO_SUCH_OFFER ); @@ -1420,7 +1420,7 @@ describe("IBosonOfferHandler", function () { id = "0"; // Attempt to reserve a range, expecting revert - await expect(offerHandler.connect(assistant).reserveRange(id, length, assistant.address)).to.revertedWith( + await expect(offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( RevertReasons.NO_SUCH_OFFER ); }); @@ -1430,7 +1430,7 @@ describe("IBosonOfferHandler", function () { await offerHandler.connect(assistant).voidOffer(id); // Attempt to reserve a range, expecting revert - await expect(offerHandler.connect(assistant).reserveRange(id, length, assistant.address)).to.revertedWith( + await expect(offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( RevertReasons.OFFER_HAS_BEEN_VOIDED ); }); @@ -1438,13 +1438,13 @@ describe("IBosonOfferHandler", function () { it("Caller is not seller", async function () { // caller is not the assistant of any seller // Attempt to reserve a range, expecting revert - await expect(offerHandler.connect(rando).reserveRange(id, length, assistant.address)).to.revertedWith( + await expect(offerHandler.connect(rando).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( RevertReasons.NOT_ASSISTANT ); // caller is an assistant of another seller // Create a valid seller, then set fields in tests directly - seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); // AuthToken emptyAuthToken = mockAuthToken(); @@ -1452,7 +1452,7 @@ describe("IBosonOfferHandler", function () { await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); // Attempt to reserve a range, expecting revert - await expect(offerHandler.connect(rando).reserveRange(id, length, assistant.address)).to.revertedWith( + await expect(offerHandler.connect(rando).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( RevertReasons.NOT_ASSISTANT ); }); @@ -1462,7 +1462,7 @@ describe("IBosonOfferHandler", function () { length = 0; // Attempt to reserve a range, expecting revert - await expect(offerHandler.connect(assistant).reserveRange(id, length, assistant.address)).to.revertedWith( + await expect(offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( RevertReasons.INVALID_RANGE_LENGTH ); }); @@ -1472,7 +1472,7 @@ describe("IBosonOfferHandler", function () { length = Number(offer.quantityAvailable) + 1; // Attempt to reserve a range, expecting revert - await expect(offerHandler.connect(assistant).reserveRange(id, length, assistant.address)).to.revertedWith( + await expect(offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( RevertReasons.INVALID_RANGE_LENGTH ); }); @@ -1489,23 +1489,23 @@ describe("IBosonOfferHandler", function () { // Attempt to reserve a range, expecting revert await expect( - offerHandler.connect(assistant).reserveRange(nextOfferId, length, assistant.address) + offerHandler.connect(assistant).reserveRange(nextOfferId, length, await assistant.getAddress()) ).to.revertedWith(RevertReasons.INVALID_RANGE_LENGTH); }); it("Call to BosonVoucher.reserveRange() reverts", async function () { // Reserve a range - await offerHandler.connect(assistant).reserveRange(id, length, assistant.address); + await offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress()); // Attempt to reserve the same range again, expecting revert - await expect(offerHandler.connect(assistant).reserveRange(id, length, assistant.address)).to.revertedWith( + await expect(offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( RevertReasons.OFFER_RANGE_ALREADY_RESERVED ); }); it("_to address isn't contract address or contract owner address", async function () { // Try to reserve range for rando address, it should fail - await expect(offerHandler.connect(assistant).reserveRange(id, length, rando.address)).to.be.revertedWith( + await expect(offerHandler.connect(assistant).reserveRange(id, length, await rando.getAddress())).to.be.revertedWith( RevertReasons.INVALID_TO_ADDRESS ); }); @@ -1677,7 +1677,7 @@ describe("IBosonOfferHandler", function () { id = sellerId = nextAccountId = "1"; // argument sent to contract for createSeller will be ignored // Create a valid seller, then set fields in tests directly - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); expect(seller.isValid()).is.true; // VoucherInitValues @@ -1691,10 +1691,10 @@ describe("IBosonOfferHandler", function () { // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -1707,7 +1707,7 @@ describe("IBosonOfferHandler", function () { DRFeeToken = "0"; disputeResolverFees = [ new DisputeResolverFee(ZeroAddress, "Native", DRFeeNative), - new DisputeResolverFee(bosonToken.address, "Boson", DRFeeToken), + new DisputeResolverFee(await bosonToken.getAddress(), "Boson", DRFeeToken), ]; // Register the dispute resolver @@ -1791,7 +1791,7 @@ describe("IBosonOfferHandler", function () { // change some offers to test different cases // offer with boson as an exchange token and unlimited supply - offers[2].exchangeToken = bosonToken.address; + offers[2].exchangeToken = await bosonToken.getAddress(); offerFeesList[2].protocolFee = protocolFeeFlatBoson; offerFeesStructs[2] = offerFeesList[2].toStruct(); offers[2].quantityAvailable = constants.MaxUint256.toString(); @@ -1841,7 +1841,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[0], offerFeesStructs[0], agentIds[0], - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -1855,7 +1855,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[1], offerFeesStructs[1], agentIds[1], - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -1869,7 +1869,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[2], offerFeesStructs[2], agentIds[2], - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -1883,7 +1883,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[3], offerFeesStructs[3], agentIds[3], - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -1897,7 +1897,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[4], offerFeesStructs[4], agentIds[4], - assistant.address + await assistant.getAddress() ); }); @@ -1961,7 +1961,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[0], offerFeesStructs[0], agentIds[0], - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -1975,7 +1975,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[1], offerFeesStructs[1], agentIds[1], - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -1989,7 +1989,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[2], offerFeesStructs[2], agentIds[2], - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -2003,7 +2003,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[3], offerFeesStructs[3], agentIds[3], - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -2017,7 +2017,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[4], offerFeesStructs[4], agentIds[4], - assistant.address + await assistant.getAddress() ); for (let i = 0; i < 5; i++) { @@ -2055,7 +2055,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[0], offerFeesStructs[0], agentIds[0], - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -2069,7 +2069,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[1], offerFeesStructs[1], agentIds[1], - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -2083,7 +2083,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[2], offerFeesStructs[2], agentIds[2], - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -2097,7 +2097,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[3], offerFeesStructs[3], agentIds[3], - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -2111,13 +2111,13 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[4], offerFeesStructs[4], agentIds[4], - assistant.address + await assistant.getAddress() ); }); it("Should allow creation of an offer if DR has a sellerAllowList and seller is on it", async function () { // Create new seller so sellerAllowList can have an entry - seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -2354,10 +2354,10 @@ describe("IBosonOfferHandler", function () { it.skip("For some offer, dispute resolver is not active", async function () { // create another dispute resolver, but don't activate it disputeResolver = mockDisputeResolver( - rando.address, - rando.address, + await rando.getAddress(), + await rando.getAddress(), ZeroAddress, - rando.address, + await rando.getAddress(), false ); await accountHandler @@ -2402,10 +2402,10 @@ describe("IBosonOfferHandler", function () { it.skip("For some absolute zero offer, specified dispute resolver is not active", async function () { // create another dispute resolver, but don't activate it disputeResolver = mockDisputeResolver( - rando.address, - rando.address, + await rando.getAddress(), + await rando.getAddress(), ZeroAddress, - rando.address, + await rando.getAddress(), false ); await accountHandler @@ -2436,7 +2436,7 @@ describe("IBosonOfferHandler", function () { it("For some offer seller is not on dispute resolver's seller allow list", async function () { // Create new seller so sellerAllowList can have an entry - seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -2453,7 +2453,7 @@ describe("IBosonOfferHandler", function () { it("For some offer, dispute resolver does not accept fees in the exchange token", async function () { // Set some address that is not part of dispute resolver fees - offers[3].exchangeToken = rando.address; + offers[3].exchangeToken = await rando.getAddress(); // Attempt to Create offers, expecting revert await expect( @@ -2538,7 +2538,7 @@ describe("IBosonOfferHandler", function () { offerFeesStructs = []; // Create an agent: Required constructor params - agent = mockAgent(other.address); + agent = mockAgent(await other.getAddress()); agent.id = agentId; expect(agent.isValid()).is.true; // Create a valid agent @@ -2550,7 +2550,7 @@ describe("IBosonOfferHandler", function () { // Set updated offerFees let protocolFee; - if (offers[i].exchangeToken == bosonToken.address) { + if (offers[i].exchangeToken == await bosonToken.getAddress()) { protocolFee = protocolFeeFlatBoson; } else { protocolFee = applyPercentage(offers[i].price, protocolFeePercentage); @@ -2580,7 +2580,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[0], offerFeesStructs[0], nonZeroAgentIds[0], - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -2594,7 +2594,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[1], offerFeesStructs[1], nonZeroAgentIds[1], - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -2608,7 +2608,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[2], offerFeesStructs[2], nonZeroAgentIds[2], - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -2622,7 +2622,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[3], offerFeesStructs[3], nonZeroAgentIds[3], - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -2636,7 +2636,7 @@ describe("IBosonOfferHandler", function () { disputeResolutionTermsStructs[4], offerFeesStructs[4], nonZeroAgentIds[4], - assistant.address + await assistant.getAddress() ); }); @@ -2672,7 +2672,7 @@ describe("IBosonOfferHandler", function () { let id = "4"; // argument sent to contract for createAgent will be ignored // Create a valid agent, then set fields in tests directly - agent = mockAgent(assistant.address); + agent = mockAgent(await assistant.getAddress()); agent.id = id; agent.feePercentage = "3000"; // 30% expect(agent.isValid()).is.true; @@ -2717,15 +2717,15 @@ describe("IBosonOfferHandler", function () { const tx = await offerHandler.connect(assistant).voidOfferBatch(offersToVoid); await expect(tx) .to.emit(offerHandler, "OfferVoided") - .withArgs(offersToVoid[0], offerStruct.sellerId, assistant.address); + .withArgs(offersToVoid[0], offerStruct.sellerId, await assistant.getAddress()); await expect(tx) .to.emit(offerHandler, "OfferVoided") - .withArgs(offersToVoid[1], offerStruct.sellerId, assistant.address); + .withArgs(offersToVoid[1], offerStruct.sellerId, await assistant.getAddress()); await expect(tx) .to.emit(offerHandler, "OfferVoided") - .withArgs(offersToVoid[2], offerStruct.sellerId, assistant.address); + .withArgs(offersToVoid[2], offerStruct.sellerId, await assistant.getAddress()); }); it("should update state", async function () { @@ -2790,7 +2790,7 @@ describe("IBosonOfferHandler", function () { ); // caller is an assistant of another seller - seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); // AuthToken emptyAuthToken = mockAuthToken(); @@ -2856,15 +2856,15 @@ describe("IBosonOfferHandler", function () { const tx = await offerHandler.connect(assistant).extendOfferBatch(offersToExtend, newValidUntilDate); await expect(tx) .to.emit(offerHandler, "OfferExtended") - .withArgs(offersToExtend[0], offer.sellerId, newValidUntilDate, assistant.address); + .withArgs(offersToExtend[0], offer.sellerId, newValidUntilDate, await assistant.getAddress()); await expect(tx) .to.emit(offerHandler, "OfferExtended") - .withArgs(offersToExtend[1], offer.sellerId, newValidUntilDate, assistant.address); + .withArgs(offersToExtend[1], offer.sellerId, newValidUntilDate, await assistant.getAddress()); await expect(tx) .to.emit(offerHandler, "OfferExtended") - .withArgs(offersToExtend[2], offer.sellerId, newValidUntilDate, assistant.address); + .withArgs(offersToExtend[2], offer.sellerId, newValidUntilDate, await assistant.getAddress()); }); it("should update state", async function () { @@ -2921,7 +2921,7 @@ describe("IBosonOfferHandler", function () { ); // caller is an assistant of another seller - seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); // AuthToken emptyAuthToken = mockAuthToken(); diff --git a/test/protocol/OrchestrationHandlerTest.js b/test/protocol/OrchestrationHandlerTest.js index 03d6cff1c..37d64864b 100644 --- a/test/protocol/OrchestrationHandlerTest.js +++ b/test/protocol/OrchestrationHandlerTest.js @@ -160,7 +160,7 @@ describe("IBosonOrchestrationHandler", function () { { percentage: protocolFeePercentage, flatBoson: protocolFeeFlatBoson, buyerEscalationDepositPercentage }, ], diamondAddress: protocolDiamondAddress, - } = await setupTestEnvironment(contracts, { bosonTokenAddress: bosonToken.address })); + } = await setupTestEnvironment(contracts, { bosonTokenAddress: await bosonToken.getAddress() })); // make all account the same assistant = admin; @@ -196,10 +196,10 @@ describe("IBosonOrchestrationHandler", function () { beforeEach(async function () { // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -210,7 +210,7 @@ describe("IBosonOrchestrationHandler", function () { DRFeeToken = "0"; disputeResolverFees = [ new DisputeResolverFee(ZeroAddress, "Native", DRFeeNative), - new DisputeResolverFee(bosonToken.address, "Boson", DRFeeToken), + new DisputeResolverFee(await bosonToken.getAddress(), "Boson", DRFeeToken), ]; // Make empty seller list, so every seller is allowed @@ -222,7 +222,7 @@ describe("IBosonOrchestrationHandler", function () { .createDisputeResolver(disputeResolver, disputeResolverFees, sellerAllowList); // Create a valid seller, then set fields in tests directly - seller = mockSeller(assistant.address, assistant.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), await clerk.getAddress(), await treasury.getAddress()); expect(seller.isValid()).is.true; // How that seller looks as a returned struct @@ -244,7 +244,7 @@ describe("IBosonOrchestrationHandler", function () { // deploy mock auth token and mint one to assistant const [mockAuthERC721Contract] = await deployMockTokens(["Foreign721"]); - await configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.Lens, mockAuthERC721Contract.address); + await configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.Lens, await mockAuthERC721Contract.getAddress()); await mockAuthERC721Contract.connect(assistant).mint(authToken.tokenId, 1); // The first offer id @@ -296,11 +296,11 @@ describe("IBosonOrchestrationHandler", function () { await accountHandler .connect(adminDR) .addFeesToDisputeResolver(disputeResolverId, [ - new DisputeResolverFee(mockToken.address, "MockToken", DRFeeToken), + new DisputeResolverFee(await mockToken.getAddress(), "MockToken", DRFeeToken), ]); // create an offer with a mock token contract - offer.exchangeToken = mockToken.address; + offer.exchangeToken = await mockToken.getAddress(); offer.sellerDeposit = offer.price = offer.buyerCancelPenalty = "0"; offer.id++; @@ -311,11 +311,11 @@ describe("IBosonOrchestrationHandler", function () { // mint tokens to buyer and approve the protocol buyerEscalationDepositToken = applyPercentage(DRFeeToken, buyerEscalationDepositPercentage); - await mockToken.mint(buyer.address, buyerEscalationDepositToken); + await mockToken.mint(await buyer.getAddress(), buyerEscalationDepositToken); await mockToken.connect(buyer).approve(protocolDiamondAddress, buyerEscalationDepositToken); // Commit to offer and put exchange all the way to dispute - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offer.id); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offer.id); await exchangeHandler.connect(buyer).redeemVoucher(++exchangeId); return mockToken; @@ -358,7 +358,7 @@ describe("IBosonOrchestrationHandler", function () { exchangeId = "1"; // Commit to offer, creating a new exchange - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, nextOfferId, { value: price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), nextOfferId, { value: price }); // Set time forward to the offer's voucherRedeemableFrom await setNextBlockTimestamp(Number(voucherRedeemableFrom)); @@ -375,7 +375,7 @@ describe("IBosonOrchestrationHandler", function () { .raiseAndEscalateDispute(exchangeId, { value: buyerEscalationDepositNative }) ) .to.emit(disputeHandler, "DisputeRaised") - .withArgs(exchangeId, buyerId, seller.id, buyer.address); + .withArgs(exchangeId, buyerId, seller.id, await buyer.getAddress()); }); it("should emit a DisputeEscalated event", async function () { @@ -386,7 +386,7 @@ describe("IBosonOrchestrationHandler", function () { .raiseAndEscalateDispute(exchangeId, { value: buyerEscalationDepositNative }) ) .to.emit(disputeHandler, "DisputeEscalated") - .withArgs(exchangeId, disputeResolverId, buyer.address); + .withArgs(exchangeId, disputeResolverId, await buyer.getAddress()); }); it("should update state", async function () { @@ -446,7 +446,7 @@ describe("IBosonOrchestrationHandler", function () { // Escalate the dispute, testing for the event await expect(orchestrationHandler.connect(buyer).raiseAndEscalateDispute(exchangeId)) .to.emit(disputeHandler, "DisputeEscalated") - .withArgs(exchangeId, disputeResolverId, buyer.address); + .withArgs(exchangeId, disputeResolverId, await buyer.getAddress()); // Protocol balance should increase for buyer escalation deposit const escrowBalanceAfter = await mockToken.balanceOf(protocolDiamondAddress); @@ -587,11 +587,11 @@ describe("IBosonOrchestrationHandler", function () { agentId ); - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); await expect(tx) .to.emit(orchestrationHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, assistant.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await assistant.getAddress()); await expect(tx) .to.emit(orchestrationHandler, "OfferCreated") .withArgs( @@ -603,7 +603,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Voucher clone contract @@ -618,7 +618,7 @@ describe("IBosonOrchestrationHandler", function () { await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ZeroAddress, assistant.address); + .withArgs(ZeroAddress, await assistant.getAddress()); }); it("should emit a SellerCreated and OfferCreated events with auth token", async function () { @@ -639,11 +639,11 @@ describe("IBosonOrchestrationHandler", function () { agentId ); - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); await expect(tx) .to.emit(orchestrationHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, authTokenStruct, assistant.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, authTokenStruct, await assistant.getAddress()); await expect(tx) .to.emit(orchestrationHandler, "OfferCreated") @@ -656,7 +656,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Voucher clone contract @@ -671,7 +671,7 @@ describe("IBosonOrchestrationHandler", function () { await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ZeroAddress, assistant.address); + .withArgs(ZeroAddress, await assistant.getAddress()); }); it("should update state", async function () { @@ -735,10 +735,10 @@ describe("IBosonOrchestrationHandler", function () { } // Voucher clone contract - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); - expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); + expect(await bosonVoucher.owner()).to.equal(await assistant.getAddress(), "Wrong voucher clone owner"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); @@ -767,7 +767,7 @@ describe("IBosonOrchestrationHandler", function () { agentId ); - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); @@ -815,7 +815,7 @@ describe("IBosonOrchestrationHandler", function () { agentId ); - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); @@ -866,9 +866,9 @@ describe("IBosonOrchestrationHandler", function () { .withArgs( sellerId, sellerStruct, - calculateContractAddress(orchestrationHandler.address, "1"), + calculateContractAddress(await orchestrationHandler.getAddress(), "1"), emptyAuthTokenStruct, - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -882,7 +882,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // wrong seller id should not exist @@ -931,7 +931,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -964,13 +964,13 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); it("If exchange token is $BOSON, fee should be flat boson fee", async function () { // Prepare an offer with $BOSON as exchange token - offer.exchangeToken = bosonToken.address; + offer.exchangeToken = await bosonToken.getAddress(); disputeResolutionTermsStruct = new DisputeResolutionTerms( disputeResolver.id, disputeResolver.escalationResponsePeriod, @@ -1005,7 +1005,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -1041,7 +1041,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -1074,7 +1074,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -1104,13 +1104,13 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // create another offer, now with bosonToken as exchange token - seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); contractURI = `https://ipfs.io/ipfs/QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ`; - offer.exchangeToken = bosonToken.address; + offer.exchangeToken = await bosonToken.getAddress(); offer.id = "2"; offer.sellerId = seller.id; disputeResolutionTermsStruct = new DisputeResolutionTerms( @@ -1147,7 +1147,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - rando.address + await rando.getAddress() ); }); @@ -1160,7 +1160,7 @@ describe("IBosonOrchestrationHandler", function () { firstTokenId = 1; lastTokenId = firstTokenId + reservedRangeLength - 1; const tokenIdStart = deriveTokenId(offer.id, firstTokenId); - range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", assistant.address); + range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", await assistant.getAddress()); }); it("should emit a SellerCreated, OfferCreated and RangeReserved events with auth token", async function () { @@ -1177,17 +1177,17 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), authToken, voucherInitValues, agentId ); - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); await expect(tx) .to.emit(orchestrationHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, authTokenStruct, assistant.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, authTokenStruct, await assistant.getAddress()); await expect(tx) .to.emit(orchestrationHandler, "OfferCreated") @@ -1200,12 +1200,12 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); await expect(tx) .to.emit(orchestrationHandler, "RangeReserved") - .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, assistant.address, assistant.address); + .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, await assistant.getAddress(), await assistant.getAddress()); // Voucher clone contract bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); @@ -1221,7 +1221,7 @@ describe("IBosonOrchestrationHandler", function () { await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ZeroAddress, assistant.address); + .withArgs(ZeroAddress, await assistant.getAddress()); }); it("should update state", async function () { @@ -1238,7 +1238,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), authToken, voucherInitValues, agentId @@ -1290,10 +1290,10 @@ describe("IBosonOrchestrationHandler", function () { } // Voucher clone contract - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); - expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); + expect(await bosonVoucher.owner()).to.equal(await assistant.getAddress(), "Wrong voucher clone owner"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); @@ -1386,7 +1386,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), emptyAuthToken, voucherInitValues, agentId @@ -1437,7 +1437,7 @@ describe("IBosonOrchestrationHandler", function () { }); it("Caller is not the supplied admin", async function () { - seller.assistant = rando.address; + seller.assistant = await rando.getAddress(); // Attempt to create a seller and an offer, expecting revert await expect( @@ -1458,7 +1458,7 @@ describe("IBosonOrchestrationHandler", function () { it("Caller does not own supplied auth token", async function () { seller.admin = ZeroAddress; - seller.assistant = rando.address; + seller.assistant = await rando.getAddress(); // Attempt to create a seller and an offer, expecting revert await expect( @@ -1478,7 +1478,7 @@ describe("IBosonOrchestrationHandler", function () { }); it("Caller is not the supplied assistant", async function () { - seller.admin = rando.address; + seller.admin = await rando.getAddress(); // Attempt to create a seller and an offer, expecting revert await expect( @@ -1498,9 +1498,9 @@ describe("IBosonOrchestrationHandler", function () { }); it("Clerk is not a zero address", async function () { - seller.admin = rando.address; - seller.assistant = rando.address; - seller.clerk = rando.address; + seller.admin = await rando.getAddress(); + seller.assistant = await rando.getAddress(); + seller.clerk = await rando.getAddress(); // Attempt to create a seller and an offer, expecting revert await expect( @@ -1870,10 +1870,10 @@ describe("IBosonOrchestrationHandler", function () { it.skip("Dispute resolver is not active", async function () { // create another dispute resolver, but don't activate it disputeResolver = mockDisputeResolver( - rando.address, - rando.address, + await rando.getAddress(), + await rando.getAddress(), ZeroAddress, - rando.address, + await rando.getAddress(), false ); disputeResolver.id = "2"; // mock id is 3 because seller was mocked first but here we are creating dispute resolver first @@ -1925,10 +1925,10 @@ describe("IBosonOrchestrationHandler", function () { it.skip("For absolute zero offer, specified dispute resolver is not active", async function () { // create another dispute resolver, but don't activate it disputeResolver = mockDisputeResolver( - rando.address, - rando.address, + await rando.getAddress(), + await rando.getAddress(), ZeroAddress, - rando.address, + await rando.getAddress(), false ); disputeResolver.id = "2"; // mock id is 3 because seller was mocked first but here we are creating dispute resolver first @@ -1960,7 +1960,7 @@ describe("IBosonOrchestrationHandler", function () { it("Seller is not on dispute resolver's seller allow list", async function () { // Create new seller so sellerAllowList can have an entry - const newSeller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + const newSeller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); await accountHandler.connect(rando).createSeller(newSeller, emptyAuthToken, voucherInitValues); @@ -1986,7 +1986,7 @@ describe("IBosonOrchestrationHandler", function () { it("Dispute resolver does not accept fees in the exchange token", async function () { // Set some address that is not part of dispute resolver fees - offer.exchangeToken = rando.address; + offer.exchangeToken = await rando.getAddress(); // Attempt to create a seller and an offer, expecting revert await expect( @@ -2020,7 +2020,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), emptyAuthToken, voucherInitValues, agentId @@ -2043,7 +2043,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), emptyAuthToken, voucherInitValues, agentId @@ -2066,7 +2066,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), emptyAuthToken, voucherInitValues, agentId @@ -2086,7 +2086,7 @@ describe("IBosonOrchestrationHandler", function () { agentId = "2"; // argument sent to contract for createAgent will be ignored // Create a valid agent, then set fields in tests directly - agent = mockAgent(other1.address); + agent = mockAgent(await other1.getAddress()); agent.id = agentId; expect(agent.isValid()).is.true; @@ -2118,9 +2118,9 @@ describe("IBosonOrchestrationHandler", function () { .withArgs( seller.id, sellerStruct, - calculateContractAddress(orchestrationHandler.address, "1"), + calculateContractAddress(await orchestrationHandler.getAddress(), "1"), emptyAuthTokenStruct, - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -2134,7 +2134,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -2168,7 +2168,7 @@ describe("IBosonOrchestrationHandler", function () { let id = "3"; // argument sent to contract for createAgent will be ignored // Create a valid agent, then set fields in tests directly - agent = mockAgent(assistant.address); + agent = mockAgent(await assistant.getAddress()); agent.id = id; agent.feePercentage = "3000"; // 30% expect(agent.isValid()).is.true; @@ -2210,7 +2210,7 @@ describe("IBosonOrchestrationHandler", function () { seller.id = "2"; // "1" is dispute resolver offerIds = ["1"]; - condition = mockCondition({ tokenAddress: other2.address, tokenType: TokenType.MultiToken, tokenId: "5150" }); + condition = mockCondition({ tokenAddress: await other2.getAddress(), tokenType: TokenType.MultiToken, tokenId: "5150" }); expect(condition.isValid()).to.be.true; group = new Group(nextGroupId, seller.id, offerIds); @@ -2242,7 +2242,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -2256,7 +2256,7 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(eventGroupCreated.groupId.toString(), group.id, "Group Id is incorrect"); assert.equal(eventGroupCreated.sellerId.toString(), group.sellerId, "Seller Id is incorrect"); - assert.equal(eventGroupCreated.executedBy.toString(), assistant.address, "Executed by is incorrect"); + assert.equal(eventGroupCreated.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); assert.equal(groupInstance.toString(), group.toString(), "Group struct is incorrect"); }); @@ -2331,7 +2331,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -2369,7 +2369,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -2388,7 +2388,7 @@ describe("IBosonOrchestrationHandler", function () { it("If exchange token is $BOSON, fee should be flat boson fee", async function () { // Prepare an offer with $BOSON as exchange token - offer.exchangeToken = bosonToken.address; + offer.exchangeToken = await bosonToken.getAddress(); disputeResolutionTermsStruct = new DisputeResolutionTerms( disputeResolver.id, disputeResolver.escalationResponsePeriod, @@ -2414,7 +2414,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -2441,7 +2441,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -2465,7 +2465,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -2486,11 +2486,11 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // create another offer, now with bosonToken as exchange token - offer.exchangeToken = bosonToken.address; + offer.exchangeToken = await bosonToken.getAddress(); offer.id = "2"; disputeResolutionTermsStruct = new DisputeResolutionTerms( disputeResolver.id, @@ -2517,7 +2517,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -2540,7 +2540,7 @@ describe("IBosonOrchestrationHandler", function () { agentId = "3"; // argument sent to contract for createAgent will be ignored // Create a valid agent, then set fields in tests directly - agent = mockAgent(other1.address); + agent = mockAgent(await other1.getAddress()); agent.id = agentId; expect(agent.isValid()).is.true; @@ -2570,7 +2570,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -2584,7 +2584,7 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(eventGroupCreated.groupId.toString(), group.id, "Group Id is incorrect"); assert.equal(eventGroupCreated.sellerId.toString(), group.sellerId, "Seller Id is incorrect"); - assert.equal(eventGroupCreated.executedBy.toString(), assistant.address, "Executed by is incorrect"); + assert.equal(eventGroupCreated.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); assert.equal(groupInstance.toString(), group.toString(), "Group struct is incorrect"); }); }); @@ -2599,11 +2599,11 @@ describe("IBosonOrchestrationHandler", function () { lastTokenId = firstTokenId + reservedRangeLength - 1; // Voucher clone contract - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); const tokenIdStart = deriveTokenId(offer.id, firstTokenId); - range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", bosonVoucher.address); + range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", await bosonVoucher.getAddress()); }); it("should emit an OfferCreated, a GroupCreated and a RangeReserved events", async function () { @@ -2617,7 +2617,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - bosonVoucher.address, + await bosonVoucher.getAddress(), condition, agentId ); @@ -2634,13 +2634,13 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // RangeReserved event (on protocol contract) await expect(tx) .to.emit(orchestrationHandler, "RangeReserved") - .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, bosonVoucher.address, assistant.address); + .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, await bosonVoucher.getAddress(), await assistant.getAddress()); // Events with structs that contain arrays must be tested differently const txReceipt = await tx.wait(); @@ -2653,7 +2653,7 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(eventGroupCreated.groupId.toString(), group.id, "Group Id is incorrect"); assert.equal(eventGroupCreated.sellerId.toString(), group.sellerId, "Seller Id is incorrect"); - assert.equal(eventGroupCreated.executedBy.toString(), assistant.address, "Executed by is incorrect"); + assert.equal(eventGroupCreated.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); assert.equal(groupInstance.toString(), group.toString(), "Group struct is incorrect"); // RangeReserved event (on voucher contract) @@ -2670,7 +2670,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - bosonVoucher.address, + await bosonVoucher.getAddress(), condition, agentId ); @@ -2779,7 +2779,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - bosonVoucher.address, + await bosonVoucher.getAddress(), condition, agentId ) @@ -2889,7 +2889,7 @@ describe("IBosonOrchestrationHandler", function () { condition = mockCondition({ tokenType: TokenType.MultiToken, - tokenAddress: other2.address, + tokenAddress: await other2.getAddress(), tokenId: "5150", maxCommits: "3", }); @@ -2933,7 +2933,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -3021,7 +3021,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -3059,7 +3059,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -3078,7 +3078,7 @@ describe("IBosonOrchestrationHandler", function () { it("If exchange token is $BOSON, fee should be flat boson fee", async function () { // Prepare an offer with $BOSON as exchange token - offer.exchangeToken = bosonToken.address; + offer.exchangeToken = await bosonToken.getAddress(); disputeResolutionTermsStruct = new DisputeResolutionTerms( disputeResolver.id, disputeResolver.escalationResponsePeriod, @@ -3104,7 +3104,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -3131,7 +3131,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -3155,7 +3155,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -3176,11 +3176,11 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // create another offer, now with bosonToken as exchange token - offer.exchangeToken = bosonToken.address; + offer.exchangeToken = await bosonToken.getAddress(); offer.id++; disputeResolutionTermsStruct = new DisputeResolutionTerms( disputeResolver.id, @@ -3207,7 +3207,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -3230,7 +3230,7 @@ describe("IBosonOrchestrationHandler", function () { agentId = "3"; // argument sent to contract for createAgent will be ignored // Create a valid agent, then set fields in tests directly - agent = mockAgent(other1.address); + agent = mockAgent(await other1.getAddress()); agent.id = agentId; expect(agent.isValid()).is.true; @@ -3260,7 +3260,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -3287,10 +3287,10 @@ describe("IBosonOrchestrationHandler", function () { firstTokenId = 1; lastTokenId = firstTokenId + reservedRangeLength - 1; const tokenIdStart = deriveTokenId(offer.id, firstTokenId); - range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", assistant.address); + range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", await assistant.getAddress()); // Voucher clone contract - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); }); @@ -3304,7 +3304,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), nextGroupId, agentId ); @@ -3321,13 +3321,13 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // RangeReserved event (on protocol contract) await expect(tx) .to.emit(orchestrationHandler, "RangeReserved") - .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, assistant.address, assistant.address); + .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, await assistant.getAddress(), await assistant.getAddress()); // Events with structs that contain arrays must be tested differently const txReceipt = await tx.wait(); @@ -3356,7 +3356,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), nextGroupId, agentId ); @@ -3456,7 +3456,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), nextGroupId, agentId ) @@ -3529,7 +3529,7 @@ describe("IBosonOrchestrationHandler", function () { nextTwinId = "1"; // Create a valid twin. - twin = mockTwin(bosonToken.address); + twin = mockTwin(await bosonToken.getAddress()); twin.sellerId = seller.id; // How that twin looks as a returned struct twinStruct = twin.toStruct(); @@ -3538,7 +3538,7 @@ describe("IBosonOrchestrationHandler", function () { await accountHandler.connect(assistant).createSeller(seller, emptyAuthToken, voucherInitValues); // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler }); it("should emit an OfferCreated, a TwinCreated and a BundleCreated events", async function () { @@ -3559,7 +3559,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -3661,7 +3661,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -3714,7 +3714,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -3747,7 +3747,7 @@ describe("IBosonOrchestrationHandler", function () { it("If exchange token is $BOSON, fee should be flat boson fee", async function () { // Prepare an offer with $BOSON as exchange token - offer.exchangeToken = bosonToken.address; + offer.exchangeToken = await bosonToken.getAddress(); disputeResolutionTermsStruct = new DisputeResolutionTerms( disputeResolver.id, disputeResolver.escalationResponsePeriod, @@ -3773,7 +3773,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -3800,7 +3800,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -3826,7 +3826,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -3847,11 +3847,11 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // create another offer, now with bosonToken as exchange token - offer.exchangeToken = bosonToken.address; + offer.exchangeToken = await bosonToken.getAddress(); offer.id = "2"; disputeResolutionTermsStruct = new DisputeResolutionTerms( disputeResolver.id, @@ -3878,7 +3878,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -3901,7 +3901,7 @@ describe("IBosonOrchestrationHandler", function () { agentId = "3"; // argument sent to contract for createAgent will be ignored // Create a valid agent, then set fields in tests directly - agent = mockAgent(other1.address); + agent = mockAgent(await other1.getAddress()); agent.id = agentId; expect(agent.isValid()).is.true; @@ -3931,7 +3931,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -3969,11 +3969,11 @@ describe("IBosonOrchestrationHandler", function () { lastTokenId = firstTokenId + reservedRangeLength - 1; // Voucher clone contract - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); const tokenIdStart = deriveTokenId(offer.id, firstTokenId); - range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", bosonVoucher.address); + range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", await bosonVoucher.getAddress()); }); it("should emit an OfferCreated, a TwinCreated, a BundleCreated and a RangeReserved events", async function () { @@ -3986,7 +3986,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - bosonVoucher.address, + await bosonVoucher.getAddress(), twin, agentId ); @@ -4003,13 +4003,13 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // RangeReserved event (on protocol contract) await expect(tx) .to.emit(orchestrationHandler, "RangeReserved") - .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, bosonVoucher.address, assistant.address); + .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, await bosonVoucher.getAddress(), await assistant.getAddress()); // Events with structs that contain arrays must be tested differently const txReceipt = await tx.wait(); @@ -4048,7 +4048,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - bosonVoucher.address, + await bosonVoucher.getAddress(), twin, agentId ); @@ -4175,7 +4175,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - bosonVoucher.address, + await bosonVoucher.getAddress(), twin, agentId ) @@ -4184,10 +4184,10 @@ describe("IBosonOrchestrationHandler", function () { it("should revert if protocol is not approved to transfer the ERC20 token", async function () { // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 0); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 0); // approving the twin handler //ERC20 token address - twin.tokenAddress = bosonToken.address; + twin.tokenAddress = await bosonToken.getAddress(); await expect( orchestrationHandler @@ -4198,7 +4198,7 @@ describe("IBosonOrchestrationHandler", function () { it("should revert if protocol is not approved to transfer the ERC721 token", async function () { //ERC721 token address - twin.tokenAddress = foreign721.address; + twin.tokenAddress = await foreign721.getAddress(); await expect( orchestrationHandler @@ -4209,7 +4209,7 @@ describe("IBosonOrchestrationHandler", function () { it("should revert if protocol is not approved to transfer the ERC1155 token", async function () { //ERC1155 token address - twin.tokenAddress = foreign1155.address; + twin.tokenAddress = await foreign1155.getAddress(); await expect( orchestrationHandler @@ -4230,7 +4230,7 @@ describe("IBosonOrchestrationHandler", function () { }); it("Token address is a contract address that does not support the isApprovedForAll", async function () { - twin.tokenAddress = twinHandler.address; + twin.tokenAddress = await twinHandler.getAddress(); await expect( orchestrationHandler @@ -4240,7 +4240,7 @@ describe("IBosonOrchestrationHandler", function () { }); it("Token address is a contract that reverts from a fallback method", async function () { - twin.tokenAddress = fallbackError.address; + twin.tokenAddress = await fallbackError.getAddress(); await expect( orchestrationHandler @@ -4261,7 +4261,7 @@ describe("IBosonOrchestrationHandler", function () { // Required constructor params for Group offerIds = ["1"]; - condition = mockCondition({ tokenType: TokenType.MultiToken, tokenAddress: other2.address, tokenId: "5150" }); + condition = mockCondition({ tokenType: TokenType.MultiToken, tokenAddress: await other2.getAddress(), tokenId: "5150" }); expect(condition.isValid()).to.be.true; group = new Group(nextGroupId, seller.id, offerIds); @@ -4288,7 +4288,7 @@ describe("IBosonOrchestrationHandler", function () { nextTwinId = "1"; // Create a valid twin. - twin = mockTwin(bosonToken.address); + twin = mockTwin(await bosonToken.getAddress()); twin.sellerId = seller.id; // How that twin looks as a returned struct @@ -4298,7 +4298,7 @@ describe("IBosonOrchestrationHandler", function () { await accountHandler.connect(assistant).createSeller(seller, emptyAuthToken, voucherInitValues); // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler }); it("should emit an OfferCreated, a GroupCreated, a TwinCreated and a BundleCreated events", async function () { @@ -4327,7 +4327,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -4474,7 +4474,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -4545,7 +4545,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -4588,7 +4588,7 @@ describe("IBosonOrchestrationHandler", function () { it("If exchange token is $BOSON, fee should be flat boson fee", async function () { // Prepare an offer with $BOSON as exchange token - offer.exchangeToken = bosonToken.address; + offer.exchangeToken = await bosonToken.getAddress(); disputeResolutionTermsStruct = new DisputeResolutionTerms( disputeResolver.id, disputeResolver.escalationResponsePeriod, @@ -4622,7 +4622,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -4657,7 +4657,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -4691,7 +4691,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -4720,11 +4720,11 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // create another offer, now with bosonToken as exchange token - offer.exchangeToken = bosonToken.address; + offer.exchangeToken = await bosonToken.getAddress(); offer.id = "2"; disputeResolutionTermsStruct = new DisputeResolutionTerms( disputeResolver.id, @@ -4759,7 +4759,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); }); @@ -4790,7 +4790,7 @@ describe("IBosonOrchestrationHandler", function () { agentId = "3"; // argument sent to contract for createAgent will be ignored // Create a valid agent, then set fields in tests directly - agent = mockAgent(other1.address); + agent = mockAgent(await other1.getAddress()); agent.id = agentId; agent.feePercentage = "3000"; // 30% expect(agent.isValid()).is.true; @@ -4829,7 +4829,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -4876,10 +4876,10 @@ describe("IBosonOrchestrationHandler", function () { firstTokenId = 1; lastTokenId = firstTokenId + reservedRangeLength - 1; const tokenIdStart = deriveTokenId(offer.id, firstTokenId); - range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", assistant.address); + range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", await assistant.getAddress()); // Voucher clone contract - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); }); @@ -4893,7 +4893,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), condition, twin, agentId @@ -4911,13 +4911,13 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // RangeReserved event (on protocol contract) await expect(tx) .to.emit(orchestrationHandler, "RangeReserved") - .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, assistant.address, assistant.address); + .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, await assistant.getAddress(), await assistant.getAddress()); // Events with structs that contain arrays must be tested differently const txReceipt = await tx.wait(); @@ -4966,7 +4966,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), condition, twin, agentId @@ -5165,7 +5165,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), condition, twin, agentId @@ -5185,7 +5185,7 @@ describe("IBosonOrchestrationHandler", function () { // Required constructor params for Group offerIds = ["1"]; - condition = mockCondition({ tokenType: TokenType.MultiToken, tokenAddress: other2.address, tokenId: "5150" }); + condition = mockCondition({ tokenType: TokenType.MultiToken, tokenAddress: await other2.getAddress(), tokenId: "5150" }); expect(condition.isValid()).to.be.true; group = new Group(nextGroupId, seller.id, offerIds); @@ -5212,12 +5212,12 @@ describe("IBosonOrchestrationHandler", function () { agentId ); - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); // SellerCreated and OfferCreated events await expect(tx) .to.emit(orchestrationHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, assistant.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await assistant.getAddress()); await expect(tx) .to.emit(orchestrationHandler, "OfferCreated") @@ -5230,7 +5230,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -5258,7 +5258,7 @@ describe("IBosonOrchestrationHandler", function () { await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ZeroAddress, assistant.address); + .withArgs(ZeroAddress, await assistant.getAddress()); }); it("should update state", async function () { @@ -5339,10 +5339,10 @@ describe("IBosonOrchestrationHandler", function () { } // Voucher clone contract - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); - expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); + expect(await bosonVoucher.owner()).to.equal(await assistant.getAddress(), "Wrong voucher clone owner"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); @@ -5371,7 +5371,7 @@ describe("IBosonOrchestrationHandler", function () { ); // Voucher clone contract - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); @@ -5419,7 +5419,7 @@ describe("IBosonOrchestrationHandler", function () { ); // Voucher clone contract - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); @@ -5472,9 +5472,9 @@ describe("IBosonOrchestrationHandler", function () { .withArgs( sellerId, sellerStruct, - calculateContractAddress(orchestrationHandler.address, "1"), + calculateContractAddress(await orchestrationHandler.getAddress(), "1"), emptyAuthTokenStruct, - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -5488,7 +5488,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -5517,7 +5517,7 @@ describe("IBosonOrchestrationHandler", function () { agentId = "2"; // argument sent to contract for createAgent will be ignored // Create a valid agent, then set fields in tests directly - agent = mockAgent(other1.address); + agent = mockAgent(await other1.getAddress()); agent.id = agentId; expect(agent.isValid()).is.true; @@ -5551,9 +5551,9 @@ describe("IBosonOrchestrationHandler", function () { .withArgs( seller.id, sellerStruct, - calculateContractAddress(orchestrationHandler.address, "1"), + calculateContractAddress(await orchestrationHandler.getAddress(), "1"), emptyAuthTokenStruct, - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -5567,7 +5567,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -5594,7 +5594,7 @@ describe("IBosonOrchestrationHandler", function () { firstTokenId = 1; lastTokenId = firstTokenId + reservedRangeLength - 1; const tokenIdStart = deriveTokenId(offer.id, firstTokenId); - range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", assistant.address); + range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", await assistant.getAddress()); }); it("should emit a SellerCreated, an OfferCreated, a GroupCreated and a RangeReserved event", async function () { @@ -5608,19 +5608,19 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), condition, emptyAuthToken, voucherInitValues, agentId ); - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); // SellerCreated and OfferCreated RangeReserved events await expect(tx) .to.emit(orchestrationHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, assistant.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await assistant.getAddress()); await expect(tx) .to.emit(orchestrationHandler, "OfferCreated") @@ -5633,12 +5633,12 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); await expect(tx) .to.emit(orchestrationHandler, "RangeReserved") - .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, assistant.address, assistant.address); + .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, await assistant.getAddress(), await assistant.getAddress()); // Events with structs that contain arrays must be tested differently const txReceipt = await tx.wait(); @@ -5667,7 +5667,7 @@ describe("IBosonOrchestrationHandler", function () { await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ZeroAddress, assistant.address); + .withArgs(ZeroAddress, await assistant.getAddress()); }); it("should update state", async function () { @@ -5681,7 +5681,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), condition, emptyAuthToken, voucherInitValues, @@ -5753,10 +5753,10 @@ describe("IBosonOrchestrationHandler", function () { } // Voucher clone contract - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); - expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); + expect(await bosonVoucher.owner()).to.equal(await assistant.getAddress(), "Wrong voucher clone owner"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); @@ -5874,7 +5874,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), condition, emptyAuthToken, voucherInitValues, @@ -5906,7 +5906,7 @@ describe("IBosonOrchestrationHandler", function () { nextTwinId = "1"; // Create a valid twin. - twin = mockTwin(bosonToken.address); + twin = mockTwin(await bosonToken.getAddress()); twin.sellerId = seller.id; // How that twin looks as a returned struct @@ -5915,7 +5915,7 @@ describe("IBosonOrchestrationHandler", function () { it("should emit a SellerCreated, an OfferCreated, a TwinCreated and a BundleCreated event", async function () { // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler // Create a seller, an offer with condition and a twin with bundle, testing for the events const tx = await orchestrationHandler @@ -5932,12 +5932,12 @@ describe("IBosonOrchestrationHandler", function () { agentId ); - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); // SellerCreated and OfferCreated events await expect(tx) .to.emit(orchestrationHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, assistant.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await assistant.getAddress()); await expect(tx) .to.emit(orchestrationHandler, "OfferCreated") @@ -5950,7 +5950,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -5964,7 +5964,7 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(eventTwinCreated.twinId.toString(), twin.id, "Twin Id is incorrect"); assert.equal(eventTwinCreated.sellerId.toString(), twin.sellerId, "Seller Id is incorrect"); - assert.equal(eventTwinCreated.executedBy.toString(), assistant.address, "Executed by is incorrect"); + assert.equal(eventTwinCreated.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); assert.equal(twinInstance.toString(), twin.toString(), "Twin struct is incorrect"); // BundleCreated event @@ -5975,7 +5975,7 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(eventBundleCreated.bundleId.toString(), bundle.id, "Bundle Id is incorrect"); assert.equal(eventBundleCreated.sellerId.toString(), bundle.sellerId, "Seller Id is incorrect"); - assert.equal(eventBundleCreated.executedBy.toString(), assistant.address, "Executed by is incorrect"); + assert.equal(eventBundleCreated.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); assert.equal(bundleInstance.toString(), bundle.toString(), "Bundle struct is incorrect"); // Voucher clone contract @@ -5990,12 +5990,12 @@ describe("IBosonOrchestrationHandler", function () { await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ZeroAddress, assistant.address); + .withArgs(ZeroAddress, await assistant.getAddress()); }); it("should update state", async function () { // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler // Create a seller, an offer with condition and a twin with bundle, testing for the events await orchestrationHandler @@ -6077,10 +6077,10 @@ describe("IBosonOrchestrationHandler", function () { } // Voucher clone contract - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); - expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); + expect(await bosonVoucher.owner()).to.equal(await assistant.getAddress(), "Wrong voucher clone owner"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); @@ -6094,7 +6094,7 @@ describe("IBosonOrchestrationHandler", function () { expect(voucherInitValues.isValid()).is.true; // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler // Create a seller, an offer with condition and a twin with bundle, testing for the events await orchestrationHandler @@ -6112,7 +6112,7 @@ describe("IBosonOrchestrationHandler", function () { ); // Voucher clone contract - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); @@ -6145,7 +6145,7 @@ describe("IBosonOrchestrationHandler", function () { expect(voucherInitValues.isValid()).is.true; // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler // Create a seller, an offer with condition and a twin with bundle, testing for the events await orchestrationHandler @@ -6163,7 +6163,7 @@ describe("IBosonOrchestrationHandler", function () { ); // Voucher clone contract - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); @@ -6192,7 +6192,7 @@ describe("IBosonOrchestrationHandler", function () { it("should ignore any provided ids and assign the next available", async function () { // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler const sellerId = seller.id; seller.id = "333"; @@ -6220,9 +6220,9 @@ describe("IBosonOrchestrationHandler", function () { .withArgs( sellerId, sellerStruct, - calculateContractAddress(orchestrationHandler.address, "1"), + calculateContractAddress(await orchestrationHandler.getAddress(), "1"), emptyAuthTokenStruct, - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -6236,7 +6236,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -6280,7 +6280,7 @@ describe("IBosonOrchestrationHandler", function () { agentId = "2"; // argument sent to contract for createAgent will be ignored // Create a valid agent, then set fields in tests directly - agent = mockAgent(other1.address); + agent = mockAgent(await other1.getAddress()); agent.id = agentId; expect(agent.isValid()).is.true; @@ -6294,7 +6294,7 @@ describe("IBosonOrchestrationHandler", function () { it("should emit a SellerCreated, an OfferCreated, a TwinCreated and a BundleCreated event", async function () { // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler // Create a seller, an offer with condition and a twin with bundle, testing for the events const tx = await orchestrationHandler @@ -6317,9 +6317,9 @@ describe("IBosonOrchestrationHandler", function () { .withArgs( seller.id, sellerStruct, - calculateContractAddress(orchestrationHandler.address, "1"), + calculateContractAddress(await orchestrationHandler.getAddress(), "1"), emptyAuthTokenStruct, - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -6333,7 +6333,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -6347,7 +6347,7 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(eventTwinCreated.twinId.toString(), twin.id, "Twin Id is incorrect"); assert.equal(eventTwinCreated.sellerId.toString(), twin.sellerId, "Seller Id is incorrect"); - assert.equal(eventTwinCreated.executedBy.toString(), assistant.address, "Executed by is incorrect"); + assert.equal(eventTwinCreated.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); assert.equal(twinInstance.toString(), twin.toString(), "Twin struct is incorrect"); // BundleCreated event @@ -6358,7 +6358,7 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(eventBundleCreated.bundleId.toString(), bundle.id, "Bundle Id is incorrect"); assert.equal(eventBundleCreated.sellerId.toString(), bundle.sellerId, "Seller Id is incorrect"); - assert.equal(eventBundleCreated.executedBy.toString(), assistant.address, "Executed by is incorrect"); + assert.equal(eventBundleCreated.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); assert.equal(bundleInstance.toString(), bundle.toString(), "Bundle struct is incorrect"); }); }); @@ -6372,12 +6372,12 @@ describe("IBosonOrchestrationHandler", function () { firstTokenId = 1; lastTokenId = firstTokenId + reservedRangeLength - 1; const tokenIdStart = deriveTokenId(offer.id, firstTokenId); - range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", assistant.address); + range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", await assistant.getAddress()); }); it("should emit a SellerCreated, an OfferCreated, a TwinCreated, a BundleCreated and RangeReserved event", async function () { // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler // Create a seller, a preminted offer with condition and a twin with bundle, testing for the events const tx = await orchestrationHandler @@ -6389,19 +6389,19 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), twin, emptyAuthToken, voucherInitValues, agentId ); - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); // SellerCreated, OfferCreated and RangeReserved events await expect(tx) .to.emit(orchestrationHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, assistant.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await assistant.getAddress()); await expect(tx) .to.emit(orchestrationHandler, "OfferCreated") @@ -6414,12 +6414,12 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); await expect(tx) .to.emit(orchestrationHandler, "RangeReserved") - .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, assistant.address, assistant.address); + .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, await assistant.getAddress(), await assistant.getAddress()); // Events with structs that contain arrays must be tested differently const txReceipt = await tx.wait(); @@ -6432,7 +6432,7 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(eventTwinCreated.twinId.toString(), twin.id, "Twin Id is incorrect"); assert.equal(eventTwinCreated.sellerId.toString(), twin.sellerId, "Seller Id is incorrect"); - assert.equal(eventTwinCreated.executedBy.toString(), assistant.address, "Executed by is incorrect"); + assert.equal(eventTwinCreated.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); assert.equal(twinInstance.toString(), twin.toString(), "Twin struct is incorrect"); // BundleCreated event @@ -6443,7 +6443,7 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(eventBundleCreated.bundleId.toString(), bundle.id, "Bundle Id is incorrect"); assert.equal(eventBundleCreated.sellerId.toString(), bundle.sellerId, "Seller Id is incorrect"); - assert.equal(eventBundleCreated.executedBy.toString(), assistant.address, "Executed by is incorrect"); + assert.equal(eventBundleCreated.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); assert.equal(bundleInstance.toString(), bundle.toString(), "Bundle struct is incorrect"); // Voucher clone contract @@ -6460,12 +6460,12 @@ describe("IBosonOrchestrationHandler", function () { await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ZeroAddress, assistant.address); + .withArgs(ZeroAddress, await assistant.getAddress()); }); it("should update state", async function () { // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler // Create a seller, a preminted offer with condition and a twin with bundle, testing for the events await orchestrationHandler @@ -6477,7 +6477,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), twin, emptyAuthToken, voucherInitValues, @@ -6552,10 +6552,10 @@ describe("IBosonOrchestrationHandler", function () { } // Voucher clone contract - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); - expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); + expect(await bosonVoucher.owner()).to.equal(await assistant.getAddress(), "Wrong voucher clone owner"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); @@ -6684,7 +6684,7 @@ describe("IBosonOrchestrationHandler", function () { await pauseHandler.connect(pauser).pause([PausableRegion.Exchanges]); // Approve twin transfer - await bosonToken.connect(assistant).approve(twinHandler.address, 1); + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // Attempt to create a twin expecting revert const reservedRangeLength = offer.quantityAvailable; @@ -6698,7 +6698,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), twin, emptyAuthToken, voucherInitValues, @@ -6717,7 +6717,7 @@ describe("IBosonOrchestrationHandler", function () { offerIds = ["1"]; - condition = mockCondition({ tokenType: TokenType.MultiToken, tokenAddress: other2.address, tokenId: "5150" }); + condition = mockCondition({ tokenType: TokenType.MultiToken, tokenAddress: await other2.getAddress(), tokenId: "5150" }); expect(condition.isValid()).to.be.true; group = new Group(nextGroupId, seller.id, offerIds); @@ -6745,7 +6745,7 @@ describe("IBosonOrchestrationHandler", function () { nextTwinId = "1"; // Create a valid twin. - twin = mockTwin(bosonToken.address); + twin = mockTwin(await bosonToken.getAddress()); twin.sellerId = seller.id; // How that twin looks as a returned struct @@ -6754,7 +6754,7 @@ describe("IBosonOrchestrationHandler", function () { it("should emit a SellerCreated, an OfferCreated, a GroupCreated, a TwinCreated and a BundleCreated event", async function () { // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler // Create a seller, an offer with condition, twin and bundle const tx = await orchestrationHandler @@ -6772,12 +6772,12 @@ describe("IBosonOrchestrationHandler", function () { agentId ); - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); // SellerCreated and OfferCreated events await expect(tx) .to.emit(orchestrationHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, assistant.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await assistant.getAddress()); await expect(tx) .to.emit(orchestrationHandler, "OfferCreated") @@ -6790,7 +6790,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -6838,12 +6838,12 @@ describe("IBosonOrchestrationHandler", function () { await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ZeroAddress, assistant.address); + .withArgs(ZeroAddress, await assistant.getAddress()); }); it("should update state", async function () { // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler // Create a seller, an offer with condition, twin and bundle await orchestrationHandler @@ -6945,10 +6945,10 @@ describe("IBosonOrchestrationHandler", function () { } // Voucher clone contract - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); - expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); + expect(await bosonVoucher.owner()).to.equal(await assistant.getAddress(), "Wrong voucher clone owner"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); @@ -6962,7 +6962,7 @@ describe("IBosonOrchestrationHandler", function () { expect(voucherInitValues.isValid()).is.true; // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler // Create a seller, an offer with condition, twin and bundle await orchestrationHandler @@ -6981,7 +6981,7 @@ describe("IBosonOrchestrationHandler", function () { ); // Voucher clone contract - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); @@ -7014,7 +7014,7 @@ describe("IBosonOrchestrationHandler", function () { expect(voucherInitValues.isValid()).is.true; // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler // Create a seller, an offer with condition, twin and bundle await orchestrationHandler @@ -7033,7 +7033,7 @@ describe("IBosonOrchestrationHandler", function () { ); // Voucher clone contract - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); expect(await bosonVoucher.name()).to.equal(VOUCHER_NAME + " " + seller.id, "Wrong voucher client name"); @@ -7062,7 +7062,7 @@ describe("IBosonOrchestrationHandler", function () { it("should ignore any provided ids and assign the next available", async function () { // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler const sellerId = seller.id; seller.id = "333"; @@ -7091,9 +7091,9 @@ describe("IBosonOrchestrationHandler", function () { .withArgs( sellerId, sellerStruct, - calculateContractAddress(orchestrationHandler.address, "1"), + calculateContractAddress(await orchestrationHandler.getAddress(), "1"), emptyAuthTokenStruct, - assistant.address + await assistant.getAddress() ); await expect(tx) @@ -7107,7 +7107,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -7162,7 +7162,7 @@ describe("IBosonOrchestrationHandler", function () { agentId = "2"; // argument sent to contract for createAgent will be ignored // Create a valid agent, then set fields in tests directly - agent = mockAgent(other1.address); + agent = mockAgent(await other1.getAddress()); agent.id = agentId; expect(agent.isValid()).is.true; @@ -7176,9 +7176,9 @@ describe("IBosonOrchestrationHandler", function () { it("should emit a SellerCreated, an OfferCreated, a GroupCreated, a TwinCreated and a BundleCreated event", async function () { // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); // Create a seller, an offer with condition, twin and bundle const tx = await orchestrationHandler @@ -7199,7 +7199,7 @@ describe("IBosonOrchestrationHandler", function () { // SellerCreated and OfferCreated events await expect(tx) .to.emit(orchestrationHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, assistant.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await assistant.getAddress()); await expect(tx) .to.emit(orchestrationHandler, "OfferCreated") @@ -7212,7 +7212,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); // Events with structs that contain arrays must be tested differently @@ -7260,7 +7260,7 @@ describe("IBosonOrchestrationHandler", function () { await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ZeroAddress, assistant.address); + .withArgs(ZeroAddress, await assistant.getAddress()); }); }); @@ -7273,12 +7273,12 @@ describe("IBosonOrchestrationHandler", function () { firstTokenId = 1; lastTokenId = firstTokenId + reservedRangeLength - 1; const tokenIdStart = deriveTokenId(offer.id, firstTokenId); - range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", assistant.address); + range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", await assistant.getAddress()); }); it("should emit a SellerCreated, an OfferCreated, a GroupCreated, a TwinCreated, a BundleCreated and a RangeReserved event", async function () { // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler // Create a seller, a preminted offer with condition, twin and bundle const tx = await orchestrationHandler @@ -7290,7 +7290,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), condition, twin, emptyAuthToken, @@ -7298,12 +7298,12 @@ describe("IBosonOrchestrationHandler", function () { agentId ); - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); // SellerCreated, OfferCreated and RangeReserved events await expect(tx) .to.emit(orchestrationHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, assistant.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await assistant.getAddress()); await expect(tx) .to.emit(orchestrationHandler, "OfferCreated") @@ -7316,12 +7316,12 @@ describe("IBosonOrchestrationHandler", function () { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address + await assistant.getAddress() ); await expect(tx) .to.emit(orchestrationHandler, "RangeReserved") - .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, assistant.address, assistant.address); + .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, await assistant.getAddress(), await assistant.getAddress()); // Events with structs that contain arrays must be tested differently const txReceipt = await tx.wait(); @@ -7370,12 +7370,12 @@ describe("IBosonOrchestrationHandler", function () { await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ZeroAddress, assistant.address); + .withArgs(ZeroAddress, await assistant.getAddress()); }); it("should update state", async function () { // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler // Create a seller, a preminted offer with condition, twin and bundle await orchestrationHandler @@ -7387,7 +7387,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - assistant.address, + await assistant.getAddress(), condition, twin, emptyAuthToken, @@ -7482,10 +7482,10 @@ describe("IBosonOrchestrationHandler", function () { } // Voucher clone contract - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); - expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); + expect(await bosonVoucher.owner()).to.equal(await assistant.getAddress(), "Wrong voucher clone owner"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); @@ -7642,7 +7642,7 @@ describe("IBosonOrchestrationHandler", function () { await pauseHandler.connect(pauser).pause([PausableRegion.Exchanges]); // Approve twin transfer - await bosonToken.connect(assistant).approve(twinHandler.address, 1); + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // Attempt to create a group, expecting revert const reservedRangeLength = offer.quantityAvailable; @@ -7656,7 +7656,7 @@ describe("IBosonOrchestrationHandler", function () { offerDurations, disputeResolver.id, reservedRangeLength, - bosonVoucher.address, + await bosonVoucher.getAddress(), condition, twin, emptyAuthToken, diff --git a/test/protocol/PauseHandlerTest.js b/test/protocol/PauseHandlerTest.js index 3218d8803..9bf47df35 100644 --- a/test/protocol/PauseHandlerTest.js +++ b/test/protocol/PauseHandlerTest.js @@ -67,7 +67,7 @@ describe("IBosonPauseHandler", function () { // Pause the protocol, testing for the event await expect(pauseHandler.connect(pauser).pause(regions)) .to.emit(pauseHandler, "ProtocolPaused") - .withArgs(regions, pauser.address); + .withArgs(regions, await pauser.getAddress()); }); context("💔 Revert Reasons", async function () { @@ -109,7 +109,7 @@ describe("IBosonPauseHandler", function () { // Unpause the protocol, testing for the event await expect(pauseHandler.connect(pauser).unpause()) .to.emit(pauseHandler, "ProtocolUnpaused") - .withArgs(pauser.address); + .withArgs(await pauser.getAddress()); }); it("should be possible to pause again after an unpause", async function () { @@ -123,7 +123,7 @@ describe("IBosonPauseHandler", function () { regions = [PausableRegion.Funds]; await expect(pauseHandler.connect(pauser).pause(regions)) .to.emit(pauseHandler, "ProtocolPaused") - .withArgs(regions, pauser.address); + .withArgs(regions, await pauser.getAddress()); }); context("💔 Revert Reasons", async function () { diff --git a/test/protocol/ProtocolDiamondTest.js b/test/protocol/ProtocolDiamondTest.js index d5ada610c..0c84fad60 100644 --- a/test/protocol/ProtocolDiamondTest.js +++ b/test/protocol/ProtocolDiamondTest.js @@ -65,23 +65,23 @@ describe("ProtocolDiamond", async function () { ); // Cast Diamond to DiamondLoupeFacet - loupeFacetViaDiamond = await getContractAt("DiamondLoupeFacet", protocolDiamond.address); + loupeFacetViaDiamond = await getContractAt("DiamondLoupeFacet", await protocolDiamond.getAddress()); // Cast Diamond to DiamondCutFacet - cutFacetViaDiamond = await getContractAt("DiamondCutFacet", protocolDiamond.address); + cutFacetViaDiamond = await getContractAt("DiamondCutFacet", await protocolDiamond.getAddress()); // Cast Diamond to ERC165Facet - erc165ViaDiamond = await getContractAt("ERC165Facet", protocolDiamond.address); + erc165ViaDiamond = await getContractAt("ERC165Facet", await protocolDiamond.getAddress()); // Get the facet addresses addresses = Object.assign([], await loupeFacetViaDiamond.facetAddresses()); // Deployer grants ADMIN role to admin address and renounces admin - await accessController.connect(deployer).grantRole(Role.ADMIN, admin.address); - await accessController.connect(deployer).renounceRole(Role.ADMIN, deployer.address); + await accessController.connect(deployer).grantRole(Role.ADMIN, await admin.getAddress()); + await accessController.connect(deployer).renounceRole(Role.ADMIN, await deployer.getAddress()); // Grant UPGRADER role to upgrader account - await accessController.connect(admin).grantRole(Role.UPGRADER, upgrader.address); + await accessController.connect(admin).grantRole(Role.UPGRADER, await upgrader.getAddress()); }); // Interface support (ERC-156 provided by ProtocolDiamond, others by deployed facets) @@ -156,7 +156,7 @@ describe("ProtocolDiamond", async function () { // Define the facet cut facetCuts = [ { - facetAddress: testFacet256.address, + facetAddress: await testFacet256.getAddress(), action: FacetCutAction.Add, functionSelectors: selectors, }, @@ -180,13 +180,13 @@ describe("ProtocolDiamond", async function () { it("facet addresses should be correct and in order", async () => { // DiamondLoupeFacet was first cut - assert.equal(addresses[0], diamondLoupe.address); + assert.equal(addresses[0], await diamondLoupe.getAddress()); // DiamondCutFacet was second cut - assert.equal(addresses[1], diamondCut.address); + assert.equal(addresses[1], await diamondCut.getAddress()); // ERC165Facet was last cut - assert.equal(addresses[2], erc165.address); + assert.equal(addresses[2], await erc165.getAddress()); }); it("Should return correct addresses even when selectorCount is greater than 8", async () => { @@ -201,7 +201,7 @@ describe("ProtocolDiamond", async function () { // Define the facet cut facetCuts = [ { - facetAddress: test1Facet.address, + facetAddress: await test1Facet.getAddress(), action: FacetCutAction.Add, functionSelectors: selectors, }, @@ -214,10 +214,10 @@ describe("ProtocolDiamond", async function () { const addresses = await loupeFacetViaDiamond.facetAddresses(); - assert.equal(addresses[0], diamondLoupe.address); - assert.equal(addresses[1], diamondCut.address); - assert.equal(addresses[2], erc165.address); - assert.equal(addresses[3], test1Facet.address); + assert.equal(addresses[0], await diamondLoupe.getAddress()); + assert.equal(addresses[1], await diamondCut.getAddress()); + assert.equal(addresses[2], await erc165.getAddress()); + assert.equal(addresses[3], await test1Facet.getAddress()); assert.equal(addresses.length, 4); }); @@ -227,14 +227,14 @@ describe("ProtocolDiamond", async function () { it("should return the correct function selectors for the DiamondCutFacet", async () => { // Test cutFacetViaDiamond selectors selectors = getSelectors(cutFacetViaDiamond); - result = await loupeFacetViaDiamond.facetFunctionSelectors(diamondCut.address); + result = await loupeFacetViaDiamond.facetFunctionSelectors(await diamondCut.getAddress()); assert.sameMembers(result, selectors); }); it("should return the correct function selectors for the DiamondLoupeFacet", async () => { // Test DiamondLoupeFacet selectors selectors = getSelectors(loupeFacetViaDiamond); - result = await loupeFacetViaDiamond.facetFunctionSelectors(diamondLoupe.address); + result = await loupeFacetViaDiamond.facetFunctionSelectors(await diamondLoupe.getAddress()); assert.sameMembers(result, selectors); }); }); @@ -280,13 +280,13 @@ describe("ProtocolDiamond", async function () { // the ABI of these facets, once their functions have been added. // Cast Diamond to Test1Facet - test1ViaDiamond = await getContractAt("Test1Facet", protocolDiamond.address); + test1ViaDiamond = await getContractAt("Test1Facet", await protocolDiamond.getAddress()); // Cast Diamond to Test2Facet - test2ViaDiamond = await getContractAt("Test2Facet", protocolDiamond.address); + test2ViaDiamond = await getContractAt("Test2Facet", await protocolDiamond.getAddress()); // Cast Diamond to Test3Facet - test3ViaDiamond = await getContractAt("Test3Facet", protocolDiamond.address); + test3ViaDiamond = await getContractAt("Test3Facet", await protocolDiamond.getAddress()); }); context("👉 diamondCut() - Privileged Access", async function () { @@ -297,7 +297,7 @@ describe("ProtocolDiamond", async function () { // Define the facet cut facetCuts = [ { - facetAddress: test1Facet.address, + facetAddress: await test1Facet.getAddress(), action: FacetCutAction.Add, functionSelectors: selectors, }, @@ -329,7 +329,7 @@ describe("ProtocolDiamond", async function () { // Define the facet cut facetCuts = [ { - facetAddress: test1Facet.address, + facetAddress: await test1Facet.getAddress(), action: FacetCutAction.Add, functionSelectors: selectors, }, @@ -347,7 +347,7 @@ describe("ProtocolDiamond", async function () { assert.equal(receipt.status, 1, `Diamond upgrade failed: ${tx.hash}`); // Make sure function selectors for the facet are correct - result = await loupeFacetViaDiamond.facetFunctionSelectors(test1Facet.address); + result = await loupeFacetViaDiamond.facetFunctionSelectors(await test1Facet.getAddress()); assert.sameMembers(result, selectors); }); @@ -358,7 +358,7 @@ describe("ProtocolDiamond", async function () { // Define the facet cut facetCuts = [ { - facetAddress: test2Facet.address, + facetAddress: await test2Facet.getAddress(), action: FacetCutAction.Add, functionSelectors: selectors, }, @@ -376,7 +376,7 @@ describe("ProtocolDiamond", async function () { assert.equal(receipt.status, 1, `Diamond upgrade failed: ${tx.hash}`); // Make sure function selectors for the facet are correct - result = await loupeFacetViaDiamond.facetFunctionSelectors(test2Facet.address); + result = await loupeFacetViaDiamond.facetFunctionSelectors(await test2Facet.getAddress()); assert.sameMembers(result, selectors); }); @@ -390,12 +390,12 @@ describe("ProtocolDiamond", async function () { // Define facet cuts facetCuts = [ { - facetAddress: test1Facet.address, + facetAddress: await test1Facet.getAddress(), action: FacetCutAction.Add, functionSelectors: selectors[0], }, { - facetAddress: test2Facet.address, + facetAddress: await test2Facet.getAddress(), action: FacetCutAction.Add, functionSelectors: selectors[1], }, @@ -411,8 +411,8 @@ describe("ProtocolDiamond", async function () { // Ensure the currently installed test selectors are what we added result = [ - await loupeFacetViaDiamond.facetFunctionSelectors(test1Facet.address), - await loupeFacetViaDiamond.facetFunctionSelectors(test2Facet.address), + await loupeFacetViaDiamond.facetFunctionSelectors(await test1Facet.getAddress()), + await loupeFacetViaDiamond.facetFunctionSelectors(await test2Facet.getAddress()), ]; assert.sameMembers(result.flat(), selectors.flat()); }); @@ -440,7 +440,7 @@ describe("ProtocolDiamond", async function () { // Define the facet cut facetCuts = [ { - facetAddress: test2Facet.address, + facetAddress: await test2Facet.getAddress(), action: FacetCutAction.Add, functionSelectors: selectors, }, @@ -463,12 +463,12 @@ describe("ProtocolDiamond", async function () { // Define the facet cuts facetCuts = [ { - facetAddress: test1Facet.address, + facetAddress: await test1Facet.getAddress(), action: FacetCutAction.Add, functionSelectors: getSelectors(test1Facet), }, { - facetAddress: test2Facet.address, + facetAddress: await test2Facet.getAddress(), action: FacetCutAction.Add, functionSelectors: getSelectors(test2Facet), }, @@ -512,7 +512,7 @@ describe("ProtocolDiamond", async function () { assert.equal(receipt.status, 1, `Diamond upgrade failed: ${tx.hash}`); // Verify that the function selectors were removed - result = await loupeFacetViaDiamond.facetFunctionSelectors(test1Facet.address); + result = await loupeFacetViaDiamond.facetFunctionSelectors(await test1Facet.getAddress()); assert.sameMembers(result, getSelectors(test1Facet).get(discard)); }); @@ -542,7 +542,7 @@ describe("ProtocolDiamond", async function () { assert.equal(receipt.status, 1, `Diamond upgrade failed: ${tx.hash}`); // Verify that the function selectors were removed - result = await loupeFacetViaDiamond.facetFunctionSelectors(test2Facet.address); + result = await loupeFacetViaDiamond.facetFunctionSelectors(await test2Facet.getAddress()); assert.sameMembers(result, getSelectors(test2Facet).get(discard)); }); @@ -593,7 +593,7 @@ describe("ProtocolDiamond", async function () { assert.equal(facets.length, 1); // loupe // Check that the remaining facet address is correct - assert.equal(facets[0].facetAddress, diamondLoupe.address, "Incorrect facet address"); + assert.equal(facets[0].facetAddress, await diamondLoupe.getAddress(), "Incorrect facet address"); }); it("at least one selector should be removed", async function () { @@ -620,7 +620,7 @@ describe("ProtocolDiamond", async function () { // Define the facet cuts facetCuts = [ { - facetAddress: test1Facet.address, + facetAddress: await test1Facet.getAddress(), action: FacetCutAction.Remove, functionSelectors: selectors, }, @@ -653,7 +653,7 @@ describe("ProtocolDiamond", async function () { // to test that immutable function cannot be replaced facetCuts = [ { - facetAddress: protocolDiamond.address, + facetAddress: await protocolDiamond.getAddress(), action: FacetCutAction.Add, functionSelectors: getSelectors(test3Facet), }, @@ -685,12 +685,12 @@ describe("ProtocolDiamond", async function () { // Define the facet cuts facetCuts = [ { - facetAddress: test1Facet.address, + facetAddress: await test1Facet.getAddress(), action: FacetCutAction.Add, functionSelectors: getSelectors(test1Facet), }, { - facetAddress: test2Facet.address, + facetAddress: await test2Facet.getAddress(), action: FacetCutAction.Add, functionSelectors: getSelectors(test2Facet), }, @@ -720,7 +720,7 @@ describe("ProtocolDiamond", async function () { // Define the facet cut facetCuts = [ { - facetAddress: test2FacetUpgrade.address, + facetAddress: await test2FacetUpgrade.getAddress(), action: FacetCutAction.Replace, functionSelectors: getSelectors(test2FacetUpgrade), }, @@ -763,7 +763,7 @@ describe("ProtocolDiamond", async function () { // to test that immutable function cannot be replaced facetCuts = [ { - facetAddress: protocolDiamond.address, + facetAddress: await protocolDiamond.getAddress(), action: FacetCutAction.Add, functionSelectors: getSelectors(test3Facet), }, @@ -777,7 +777,7 @@ describe("ProtocolDiamond", async function () { // Define the facet cut facetCuts = [ { - facetAddress: test3Facet.address, + facetAddress: await test3Facet.getAddress(), action: FacetCutAction.Replace, functionSelectors: getSelectors(test3Facet), }, @@ -793,7 +793,7 @@ describe("ProtocolDiamond", async function () { // Define the facet cuts facetCuts = [ { - facetAddress: test1Facet.address, + facetAddress: await test1Facet.getAddress(), action: FacetCutAction.Replace, functionSelectors: getSelectors(test1Facet), }, @@ -809,7 +809,7 @@ describe("ProtocolDiamond", async function () { // Define the facet cut facetCuts = [ { - facetAddress: test3Facet.address, + facetAddress: await test3Facet.getAddress(), action: FacetCutAction.Replace, functionSelectors: getSelectors(test3Facet), }, @@ -826,7 +826,7 @@ describe("ProtocolDiamond", async function () { // Define the facet cuts facetCuts = [ { - facetAddress: test1Facet.address, + facetAddress: await test1Facet.getAddress(), action: 3, functionSelectors: getSelectors(test1Facet), }, @@ -852,7 +852,7 @@ describe("ProtocolDiamond", async function () { // the ABI of these facets, once their functions have been added. // Cast Diamond to Test3Facet - test3ViaDiamond = await getContractAt("Test3Facet", protocolDiamond.address); + test3ViaDiamond = await getContractAt("Test3Facet", await protocolDiamond.getAddress()); }); context("👉 Normal operation", async function () { @@ -860,7 +860,7 @@ describe("ProtocolDiamond", async function () { // Encode the initialization call initFunction = "initialize(address _testAddress)"; initInterface = new Interface([`function ${initFunction}`]); - initCallData = initInterface.encodeFunctionData("initialize", [rando.address]); + initCallData = initInterface.encodeFunctionData("initialize", [await rando.getAddress()]); // Get the Test3Facet function selectors from the abi, removing the initializer selectors = getSelectors(test3Facet).remove([initFunction]); @@ -868,7 +868,7 @@ describe("ProtocolDiamond", async function () { // Create facet cut payload facetCuts = [ { - facetAddress: test3Facet.address, + facetAddress: await test3Facet.getAddress(), action: FacetCutAction.Add, functionSelectors: selectors, }, @@ -877,7 +877,7 @@ describe("ProtocolDiamond", async function () { // Execute the Diamond cut tx = await cutFacetViaDiamond .connect(upgrader) - .diamondCut(facetCuts, test3Facet.address, initCallData, { gasLimit }); + .diamondCut(facetCuts, await test3Facet.getAddress(), initCallData, { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); @@ -888,7 +888,7 @@ describe("ProtocolDiamond", async function () { it("Should call an initializer function if supplied", async () => { // Make sure function selectors for the facet are correct - result = await loupeFacetViaDiamond.facetFunctionSelectors(test3Facet.address); + result = await loupeFacetViaDiamond.facetFunctionSelectors(await test3Facet.getAddress()); assert.sameMembers(result, selectors); }); @@ -901,7 +901,7 @@ describe("ProtocolDiamond", async function () { it("Should store initializer argument in diamond storage slot when method runs", async () => { // Make sure argument passed to initializer got stored when method ran result = await test3ViaDiamond.getTestAddress(); - assert.equal(result, rando.address, "Initializer argument not stored"); + assert.equal(result, await rando.getAddress(), "Initializer argument not stored"); }); it("Should call an initializer function on diamond itself", async () => { @@ -912,7 +912,7 @@ describe("ProtocolDiamond", async function () { // Arguments for Diamond constructor const diamondArgs = [ - accessController.address, + await accessController.getAddress(), [getFacetAddCut(diamondLoupe), getFacetAddCut(diamondCut), getFacetAddCut(erc165)], interfaces, ]; @@ -923,12 +923,12 @@ describe("ProtocolDiamond", async function () { await protocolDiamond.deployTransaction.wait(); // Cast new Diamond to DiamondCutFacet - cutFacetViaDiamond = await getContractAt("DiamondCutFacet", protocolDiamond.address); + cutFacetViaDiamond = await getContractAt("DiamondCutFacet", await protocolDiamond.getAddress()); // Create facet cut payload facetCuts = [ { - facetAddress: protocolDiamond.address, + facetAddress: await protocolDiamond.getAddress(), action: FacetCutAction.Add, functionSelectors: selectors, }, @@ -937,7 +937,7 @@ describe("ProtocolDiamond", async function () { // Execute the Diamond cut await cutFacetViaDiamond .connect(upgrader) - .diamondCut(facetCuts, protocolDiamond.address, initCallData, { gasLimit }); + .diamondCut(facetCuts, await protocolDiamond.getAddress(), initCallData, { gasLimit }); // Make sure initializer state got stored when modifier ran result = await protocolDiamond.isInitialized(); @@ -950,7 +950,7 @@ describe("ProtocolDiamond", async function () { // Encode the initialization call initFunction = "initialize(address _testAddress)"; initInterface = new Interface([`function ${initFunction}`]); - initCallData = initInterface.encodeFunctionData("initialize", [accessController.address]); + initCallData = initInterface.encodeFunctionData("initialize", [await accessController.getAddress()]); // Get the Test3Facet function selectors from the abi, removing the initializer selectors = getSelectors(test3Facet).remove([initFunction]); @@ -958,7 +958,7 @@ describe("ProtocolDiamond", async function () { // Create facet cut payload facetCuts = [ { - facetAddress: test3Facet.address, + facetAddress: await test3Facet.getAddress(), action: FacetCutAction.Add, functionSelectors: selectors, }, @@ -966,7 +966,7 @@ describe("ProtocolDiamond", async function () { // If contract address is supplied Test3Facet's initializer will revert with the specific reason await expect( - cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, test3Facet.address, initCallData, { gasLimit }) + cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, await test3Facet.getAddress(), initCallData, { gasLimit }) ).to.revertedWith(RevertReasons.CONTRACT_NOT_ALLOWED); }); @@ -974,7 +974,7 @@ describe("ProtocolDiamond", async function () { // Encode the initialization call initFunction = "initialize(address _testAddress)"; initInterface = new Interface([`function ${initFunction}`]); - initCallData = initInterface.encodeFunctionData("initialize", [upgrader.address]); + initCallData = initInterface.encodeFunctionData("initialize", [await upgrader.getAddress()]); // Get the Test3Facet function selectors from the abi, removing the initializer selectors = getSelectors(test3Facet).remove([initFunction]); @@ -982,7 +982,7 @@ describe("ProtocolDiamond", async function () { // Create facet cut payload facetCuts = [ { - facetAddress: test3Facet.address, + facetAddress: await test3Facet.getAddress(), action: FacetCutAction.Add, functionSelectors: selectors, }, @@ -991,7 +991,7 @@ describe("ProtocolDiamond", async function () { // If the caller's address is supplied Test3Facet's initializer will revert with no reason // and so the diamondCut function will supply it's own reason await expect( - cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, test3Facet.address, initCallData, { gasLimit }) + cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, await test3Facet.getAddress(), initCallData, { gasLimit }) ).to.revertedWith(RevertReasons.INIT_REVERTED); }); @@ -999,7 +999,7 @@ describe("ProtocolDiamond", async function () { // Encode the initialization call initFunction = "initialize(address _testAddress)"; initInterface = new Interface([`function ${initFunction}`]); - initCallData = initInterface.encodeFunctionData("initialize", [accessController.address]); + initCallData = initInterface.encodeFunctionData("initialize", [await accessController.getAddress()]); // Get the Test3Facet function selectors from the abi, removing the initializer selectors = getSelectors(test3Facet).remove([initFunction]); @@ -1007,7 +1007,7 @@ describe("ProtocolDiamond", async function () { // Create facet cut payload facetCuts = [ { - facetAddress: test3Facet.address, + facetAddress: await test3Facet.getAddress(), action: FacetCutAction.Add, functionSelectors: selectors, }, @@ -1029,7 +1029,7 @@ describe("ProtocolDiamond", async function () { // Create facet cut payload facetCuts = [ { - facetAddress: test3Facet.address, + facetAddress: await test3Facet.getAddress(), action: FacetCutAction.Add, functionSelectors: selectors, }, @@ -1037,7 +1037,7 @@ describe("ProtocolDiamond", async function () { // If _calldata is empty, but contract address is not supplied, diamondCut will revert with it's own reason await expect( - cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, test3Facet.address, "0x", { gasLimit }) + cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, await test3Facet.getAddress(), "0x", { gasLimit }) ).to.revertedWith(RevertReasons.INIT_EMPTY_CALLDATA_NON_ZERO_ADDRESS); }); @@ -1045,7 +1045,7 @@ describe("ProtocolDiamond", async function () { // Encode the initialization call initFunction = "initialize(address _testAddress)"; initInterface = new Interface([`function ${initFunction}`]); - initCallData = initInterface.encodeFunctionData("initialize", [accessController.address]); + initCallData = initInterface.encodeFunctionData("initialize", [await accessController.getAddress()]); // Get the Test3Facet function selectors from the abi, removing the initializer selectors = getSelectors(test3Facet).remove([initFunction]); @@ -1053,7 +1053,7 @@ describe("ProtocolDiamond", async function () { // Create facet cut payload facetCuts = [ { - facetAddress: test3Facet.address, + facetAddress: await test3Facet.getAddress(), action: FacetCutAction.Add, functionSelectors: selectors, }, @@ -1061,7 +1061,7 @@ describe("ProtocolDiamond", async function () { // If contract address has no code, diamondCut will revert with it's own reason await expect( - cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, deployer.address, initCallData, { gasLimit }) + cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, await deployer.getAddress(), initCallData, { gasLimit }) ).to.revertedWith(RevertReasons.INIT_ADDRESS_WITH_NO_CODE); }); @@ -1098,20 +1098,20 @@ describe("ProtocolDiamond", async function () { await test2Facet.deployed(); // Cast Diamond to Test1Facet - test1ViaDiamond = await getContractAt("Test1Facet", protocolDiamond.address); + test1ViaDiamond = await getContractAt("Test1Facet", await protocolDiamond.getAddress()); // Cast Diamond to Test2Facet - test2ViaDiamond = await getContractAt("Test2Facet", protocolDiamond.address); + test2ViaDiamond = await getContractAt("Test2Facet", await protocolDiamond.getAddress()); // Define the facet cuts facetCuts = [ { - facetAddress: test1Facet.address, + facetAddress: await test1Facet.getAddress(), action: FacetCutAction.Add, functionSelectors: getSelectors(test1Facet), }, { - facetAddress: test2Facet.address, + facetAddress: await test2Facet.getAddress(), action: FacetCutAction.Add, functionSelectors: getSelectors(test2Facet), }, diff --git a/test/protocol/ProtocolInitializationHandlerTest.js b/test/protocol/ProtocolInitializationHandlerTest.js index 77d09d1fe..57e38c1da 100644 --- a/test/protocol/ProtocolInitializationHandlerTest.js +++ b/test/protocol/ProtocolInitializationHandlerTest.js @@ -36,21 +36,21 @@ describe("ProtocolInitializationHandler", async function () { [protocolDiamond, , , , accessController] = await deployProtocolDiamond(maxPriorityFeePerGas); // Temporarily grant UPGRADER role to deployer account - await accessController.grantRole(Role.UPGRADER, deployer.address); + await accessController.grantRole(Role.UPGRADER, await deployer.getAddress()); // Temporarily grant UPGRADER role to deployer 1ccount - await accessController.grantRole(Role.UPGRADER, deployer.address); + await accessController.grantRole(Role.UPGRADER, await deployer.getAddress()); // Cast Diamond to IERC165 - erc165 = await getContractAt("ERC165Facet", protocolDiamond.address); + erc165 = await getContractAt("ERC165Facet", await protocolDiamond.getAddress()); // Cast Diamond to DiamondCutFacet - diamondCutFacet = await getContractAt("DiamondCutFacet", protocolDiamond.address); + diamondCutFacet = await getContractAt("DiamondCutFacet", await protocolDiamond.getAddress()); // Cast Diamond to ProtocolInitializationHandlerFacet protocolInitializationFacet = await getContractAt( "ProtocolInitializationHandlerFacet", - protocolDiamond.address + await protocolDiamond.getAddress() ); version = "2.2.0"; @@ -64,7 +64,7 @@ describe("ProtocolInitializationHandler", async function () { context("📋 Initializer", async function () { it("Should initialize version 2.2.0 and emit ProtocolInitialized", async function () { const { cutTransaction } = await deployAndCutFacets( - protocolDiamond.address, + await protocolDiamond.getAddress(), { ProtocolInitializationHandlerFacet: [] }, maxPriorityFeePerGas ); @@ -91,7 +91,7 @@ describe("ProtocolInitializationHandler", async function () { const callData = protocolInitializationFacetDeployed.interface.encodeFunctionData("initialize", [ version, - [rando.address], + [await rando.getAddress()], [], true, initializationData, @@ -103,7 +103,7 @@ describe("ProtocolInitializationHandler", async function () { const cutArgs = [ [facetCut], - protocolInitializationFacetDeployed.address, + await protocolInitializationFacetDeployed.getAddress(), callData, await getFees(maxPriorityFeePerGas), ]; @@ -128,7 +128,7 @@ describe("ProtocolInitializationHandler", async function () { const cutArgs = [ [facetCut], - protocolInitializationFacetDeployed.address, + await protocolInitializationFacetDeployed.getAddress(), callData, await getFees(maxPriorityFeePerGas), ]; @@ -155,7 +155,7 @@ describe("ProtocolInitializationHandler", async function () { await diamondCutFacet.diamondCut( [facetCut], - protocolInitializationFacetDeployed.address, + await protocolInitializationFacetDeployed.getAddress(), callData, await getFees(maxPriorityFeePerGas) ); @@ -165,18 +165,18 @@ describe("ProtocolInitializationHandler", async function () { const testFacet = await FacetTestFactory.deploy(await getFees(maxPriorityFeePerGas)); await testFacet.deployTransaction.wait(); - const calldataTestFacet = testFacet.interface.encodeFunctionData("initialize", [rando.address]); + const calldataTestFacet = testFacet.interface.encodeFunctionData("initialize", [await rando.getAddress()]); facetCut = getFacetAddCut(testFacet, [calldataTestFacet.slice(0, 10)]); const calldataProtocolInitialization = protocolInitializationFacetDeployed.interface.encodeFunctionData( "initialize", - [version, [testFacet.address], [calldataTestFacet], true, initializationData, [], []] + [version, [await testFacet.getAddress()], [calldataTestFacet], true, initializationData, [], []] ); const cutTransaction = diamondCutFacet.diamondCut( [facetCut], - protocolInitializationFacetDeployed.address, + await protocolInitializationFacetDeployed.getAddress(), calldataProtocolInitialization, await getFees(maxPriorityFeePerGas) ); @@ -190,13 +190,13 @@ describe("ProtocolInitializationHandler", async function () { // Add protocolInitializationFacet to diamond await deployAndCutFacets( - protocolDiamond.address, + await protocolDiamond.getAddress(), { ProtocolInitializationHandlerFacet: [] }, maxPriorityFeePerGas ); // Get actual deployed protocolInitializationFacet - const diamondLoupe = await getContractAt("DiamondLoupeFacet", protocolDiamond.address); + const diamondLoupe = await getContractAt("DiamondLoupeFacet", await protocolDiamond.getAddress()); const signature = protocolInitializationFacet.interface.getSighash("getVersion()"); const existingFacetAddress = await diamondLoupe.facetAddress(signature); const protocolInitializationFacet2 = await getContractAt( @@ -213,7 +213,7 @@ describe("ProtocolInitializationHandler", async function () { await expect( protocolInitializationFacet2.initialize( formatBytes32String("haha"), - [selfDestructor.address], + [await selfDestructor.getAddress()], [selfDestructorInitData], false, "0x", @@ -234,7 +234,7 @@ describe("ProtocolInitializationHandler", async function () { const interfaceId = InterfaceIds[interfaceImplementers["ProtocolInitializationHandlerFacet"]]; const { deployedFacets } = await deployAndCutFacets( - protocolDiamond.address, + await protocolDiamond.getAddress(), { ProtocolInitializationHandlerFacet: [version, [], [], true] }, maxPriorityFeePerGas, version, @@ -274,7 +274,7 @@ describe("ProtocolInitializationHandler", async function () { await diamondCutFacet.diamondCut( [], - deployedProtocolInitializationHandlerFacet.contract.address, + deployedProtocolInitializationHandlerFacet.await contract.getAddress(), calldataProtocolInitialization, await getFees(maxPriorityFeePerGas) ); @@ -300,13 +300,13 @@ describe("ProtocolInitializationHandler", async function () { const testFacet = await FacetTestFactory.deploy(await getFees(maxPriorityFeePerGas)); await testFacet.deployTransaction.wait(); - const calldataTestFacet = testFacet.interface.encodeFunctionData("initialize", [rando.address]); + const calldataTestFacet = testFacet.interface.encodeFunctionData("initialize", [await rando.getAddress()]); version = formatBytes32String("2.3.0"); const calldataProtocolInitialization = deployedProtocolInitializationHandlerFacet.contract.interface.encodeFunctionData("initialize", [ version, - [testFacet.address], + [await testFacet.getAddress()], [calldataTestFacet], true, "0x", @@ -318,14 +318,14 @@ describe("ProtocolInitializationHandler", async function () { await diamondCutFacet.diamondCut( facetCuts, - deployedProtocolInitializationHandlerFacet.contract.address, + deployedProtocolInitializationHandlerFacet.await contract.getAddress(), calldataProtocolInitialization, await getFees(maxPriorityFeePerGas) ); - const testFacetContract = await getContractAt("Test3Facet", protocolDiamond.address); + const testFacetContract = await getContractAt("Test3Facet", await protocolDiamond.getAddress()); - expect(await testFacetContract.getTestAddress()).to.equal(rando.address); + expect(await testFacetContract.getTestAddress()).to.equal(await rando.getAddress()); }); context("💔 Revert Reasons", async function () { @@ -340,12 +340,12 @@ describe("ProtocolInitializationHandler", async function () { }); it("Delegate call to initialize fails", async function () { - const calldataTestFacet = testFacet.interface.encodeFunctionData("initialize", [testFacet.address]); + const calldataTestFacet = testFacet.interface.encodeFunctionData("initialize", [await testFacet.getAddress()]); const calldataProtocolInitialization = deployedProtocolInitializationHandlerFacet.contract.interface.encodeFunctionData("initialize", [ version, - [testFacet.address], + [await testFacet.getAddress()], [calldataTestFacet], true, initializationData, @@ -358,7 +358,7 @@ describe("ProtocolInitializationHandler", async function () { await expect( diamondCutFacet.diamondCut( facetCuts, - deployedProtocolInitializationHandlerFacet.contract.address, + deployedProtocolInitializationHandlerFacet.await contract.getAddress(), calldataProtocolInitialization, await getFees(maxPriorityFeePerGas) ) @@ -368,12 +368,12 @@ describe("ProtocolInitializationHandler", async function () { it("Default reason if not supplied by implementation", async () => { // If the caller's address is supplied Test3Facet's initializer will revert with no reason // and so the diamondCut function will supply it's own reason - const calldataTestFacet = testFacet.interface.encodeFunctionData("initialize", [deployer.address]); + const calldataTestFacet = testFacet.interface.encodeFunctionData("initialize", [await deployer.getAddress()]); const calldataProtocolInitialization = deployedProtocolInitializationHandlerFacet.contract.interface.encodeFunctionData("initialize", [ version, - [testFacet.address], + [await testFacet.getAddress()], [calldataTestFacet], true, initializationData, @@ -386,7 +386,7 @@ describe("ProtocolInitializationHandler", async function () { await expect( diamondCutFacet.diamondCut( facetCuts, - deployedProtocolInitializationHandlerFacet.contract.address, + deployedProtocolInitializationHandlerFacet.await contract.getAddress(), calldataProtocolInitialization, await getFees(maxPriorityFeePerGas) ) @@ -428,7 +428,7 @@ describe("ProtocolInitializationHandler", async function () { // Make initial deployment (simulate v2.1.0) await deployAndCutFacets( - protocolDiamond.address, + await protocolDiamond.getAddress(), facetsToDeploy, maxPriorityFeePerGas, version, @@ -449,7 +449,7 @@ describe("ProtocolInitializationHandler", async function () { // Prepare cut data facetCut = getFacetAddCut(configHandler); // Attach correct address to configHandler - configHandler = configHandler.attach(protocolDiamond.address); + configHandler = configHandler.attach(await protocolDiamond.getAddress()); // Prepare calldata calldataProtocolInitialization = deployedProtocolInitializationHandlerFacet.interface.encodeFunctionData( "initialize", @@ -462,20 +462,20 @@ describe("ProtocolInitializationHandler", async function () { await expect( diamondCutFacet.diamondCut( [facetCut], - deployedProtocolInitializationHandlerFacet.address, + await deployedProtocolInitializationHandlerFacet.getAddress(), calldataProtocolInitialization, await getFees(maxPriorityFeePerGas) ) ) .to.emit(configHandler, "MaxPremintedVouchersChanged") - .withArgs(maxPremintedVouchers, deployer.address); + .withArgs(maxPremintedVouchers, await deployer.getAddress()); }); it("Should update state", async function () { // Make the cut, check the event await diamondCutFacet.diamondCut( [facetCut], - deployedProtocolInitializationHandlerFacet.address, + await deployedProtocolInitializationHandlerFacet.getAddress(), calldataProtocolInitialization, await getFees(maxPriorityFeePerGas) ); @@ -499,7 +499,7 @@ describe("ProtocolInitializationHandler", async function () { await expect( diamondCutFacet.diamondCut( [facetCut], - deployedProtocolInitializationHandlerFacet.address, + await deployedProtocolInitializationHandlerFacet.getAddress(), calldataProtocolInitialization, await getFees(maxPriorityFeePerGas) ) @@ -513,7 +513,7 @@ describe("ProtocolInitializationHandler", async function () { const { deployedFacets: [{ contract: deployedProtocolInitializationHandlerFacet }], } = await deployAndCutFacets( - protocolDiamond.address, + await protocolDiamond.getAddress(), { ProtocolInitializationHandlerFacet: [version, [], [], true] }, maxPriorityFeePerGas, version, @@ -528,7 +528,7 @@ describe("ProtocolInitializationHandler", async function () { await expect( diamondCutFacet.diamondCut( [facetCut], - deployedProtocolInitializationHandlerFacet.address, + await deployedProtocolInitializationHandlerFacet.getAddress(), calldataProtocolInitialization, await getFees(maxPriorityFeePerGas) ) @@ -547,7 +547,7 @@ describe("ProtocolInitializationHandler", async function () { const facetsToDeploy = await getV2_2_0DeployConfig(); // Make initial deployment (simulate v2.2.0) - await deployAndCutFacets(protocolDiamond.address, facetsToDeploy, maxPriorityFeePerGas, version); + await deployAndCutFacets(await protocolDiamond.getAddress(), facetsToDeploy, maxPriorityFeePerGas, version); version = "2.2.1"; @@ -572,7 +572,7 @@ describe("ProtocolInitializationHandler", async function () { // Make the cut, check the event const tx = await diamondCutFacet.diamondCut( [facetCut], - deployedProtocolInitializationHandlerFacet.address, + await deployedProtocolInitializationHandlerFacet.getAddress(), calldataProtocolInitialization, await getFees(maxPriorityFeePerGas) ); @@ -598,7 +598,7 @@ describe("ProtocolInitializationHandler", async function () { await diamondCutFacet.diamondCut( [facetCut], - deployedProtocolInitializationHandlerFacet.address, + await deployedProtocolInitializationHandlerFacet.getAddress(), calldataProtocolInitializationWrong, await getFees(maxPriorityFeePerGas) ); @@ -616,7 +616,7 @@ describe("ProtocolInitializationHandler", async function () { await expect( diamondCutFacet.diamondCut( [facetCut], - deployedProtocolInitializationHandlerFacet.address, + await deployedProtocolInitializationHandlerFacet.getAddress(), calldataProtocolInitialization, await getFees(maxPriorityFeePerGas) ) diff --git a/test/protocol/SellerHandlerTest.js b/test/protocol/SellerHandlerTest.js index 768aaaf86..8cf521cbb 100644 --- a/test/protocol/SellerHandlerTest.js +++ b/test/protocol/SellerHandlerTest.js @@ -76,16 +76,16 @@ describe("SellerHandler", function () { [mockAuthERC721Contract, mockAuthERC721Contract2] = await deployMockTokens(["Foreign721", "Foreign721"]); await expect( - configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.Lens, mockAuthERC721Contract.address) + configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.Lens, await mockAuthERC721Contract.getAddress()) ) .to.emit(configHandler, "AuthTokenContractChanged") - .withArgs(AuthTokenType.Lens, mockAuthERC721Contract.address, deployer.address); + .withArgs(AuthTokenType.Lens, await mockAuthERC721Contract.getAddress(), await deployer.getAddress()); await expect( - configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.ENS, mockAuthERC721Contract2.address) + configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.ENS, await mockAuthERC721Contract2.getAddress()) ) .to.emit(configHandler, "AuthTokenContractChanged") - .withArgs(AuthTokenType.ENS, mockAuthERC721Contract2.address, deployer.address); + .withArgs(AuthTokenType.ENS, await mockAuthERC721Contract2.getAddress(), await deployer.getAddress()); await mockAuthERC721Contract.connect(authTokenOwner).mint(8400, 1); @@ -104,10 +104,10 @@ describe("SellerHandler", function () { // Create a valid seller, then set fields in tests directly seller = mockSeller( - assistant.address, - admin.address, - clerk.address, - treasury.address, + await assistant.getAddress(), + await admin.getAddress(), + await clerk.getAddress(), + await treasury.getAddress(), true, "https://ipfs.io/ipfs/originalUri" ); @@ -122,7 +122,7 @@ describe("SellerHandler", function () { expect(voucherInitValues.isValid()).is.true; // expected address of the first clone - expectedCloneAddress = calculateContractAddress(accountHandler.address, "1"); + expectedCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "1"); // AuthTokens emptyAuthToken = mockAuthToken(); @@ -146,7 +146,7 @@ describe("SellerHandler", function () { await expect(tx) .to.emit(accountHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, admin.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await admin.getAddress()); // Voucher clone contract bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); @@ -165,7 +165,7 @@ describe("SellerHandler", function () { await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ZeroAddress, assistant.address); + .withArgs(ZeroAddress, await assistant.getAddress()); }); it("should emit a SellerCreated event when auth token is not empty", async function () { @@ -176,7 +176,7 @@ describe("SellerHandler", function () { await expect(tx) .to.emit(accountHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, authTokenStruct, authTokenOwner.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, authTokenStruct, await authTokenOwner.getAddress()); // Voucher clone contract bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); @@ -195,7 +195,7 @@ describe("SellerHandler", function () { await expect(tx) .to.emit(bosonVoucher, "OwnershipTransferred") - .withArgs(ZeroAddress, assistant.address); + .withArgs(ZeroAddress, await assistant.getAddress()); }); it("should update state when authToken is empty", async function () { @@ -222,7 +222,7 @@ describe("SellerHandler", function () { // Voucher clone contract bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); - expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); + expect(await bosonVoucher.owner()).to.equal(await assistant.getAddress(), "Wrong voucher clone owner"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); @@ -324,7 +324,7 @@ describe("SellerHandler", function () { // Voucher clone contract bosonVoucher = await getContractAt("OwnableUpgradeable", expectedCloneAddress); - expect(await bosonVoucher.owner()).to.equal(assistant.address, "Wrong voucher clone owner"); + expect(await bosonVoucher.owner()).to.equal(await assistant.getAddress(), "Wrong voucher clone owner"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); expect(await bosonVoucher.contractURI()).to.equal(contractURI, "Wrong contract URI"); @@ -339,7 +339,7 @@ describe("SellerHandler", function () { // Create a seller, testing for the event await expect(accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues)) .to.emit(accountHandler, "SellerCreated") - .withArgs(sellerId, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, admin.address); + .withArgs(sellerId, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await admin.getAddress()); // wrong seller id should not exist [exists] = await accountHandler.connect(rando).getSeller(seller.id); @@ -351,10 +351,10 @@ describe("SellerHandler", function () { }); it("should be possible to use the same address for assistant, admin and treasury", async function () { - seller.assistant = other1.address; - seller.admin = other1.address; + seller.assistant = await other1.getAddress(); + seller.admin = await other1.getAddress(); seller.clerk = ZeroAddress; - seller.treasury = other1.address; + seller.treasury = await other1.getAddress(); //Create struct again with new addresses sellerStruct = seller.toStruct(); @@ -362,45 +362,45 @@ describe("SellerHandler", function () { // Create a seller, testing for the event await expect(accountHandler.connect(other1).createSeller(seller, emptyAuthToken, voucherInitValues)) .to.emit(accountHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, other1.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await other1.getAddress()); }); it("should be possible to use non-unique treasury address", async function () { // Create a seller, testing for the event await expect(accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues)) .to.emit(accountHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, admin.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await admin.getAddress()); seller.id = accountId.next().value; - seller.assistant = other1.address; - seller.admin = other1.address; + seller.assistant = await other1.getAddress(); + seller.admin = await other1.getAddress(); //Create struct again with new addresses sellerStruct = seller.toStruct(); // expected address of the first clone - expectedCloneAddress = calculateContractAddress(accountHandler.address, "2"); + expectedCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "2"); // Create a seller, testing for the event await expect(accountHandler.connect(other1).createSeller(seller, emptyAuthToken, voucherInitValues)) .to.emit(accountHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, other1.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await other1.getAddress()); }); it("every seller should get a different clone address", async function () { // Create a seller, testing for the event await expect(accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues)) .to.emit(accountHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, admin.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await admin.getAddress()); // second seller - expectedCloneAddress = calculateContractAddress(accountHandler.address, "2"); - seller = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); + expectedCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "2"); + seller = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); // Create a seller, testing for the event await expect(accountHandler.connect(other1).createSeller(seller, emptyAuthToken, voucherInitValues)) .to.emit(accountHandler, "SellerCreated") - .withArgs(seller.id, seller.toStruct(), expectedCloneAddress, emptyAuthTokenStruct, other1.address); + .withArgs(seller.id, seller.toStruct(), expectedCloneAddress, emptyAuthTokenStruct, await other1.getAddress()); }); it("should be possible to create a seller with same auth token id but different type", async function () { @@ -413,9 +413,9 @@ describe("SellerHandler", function () { // Create a seller, testing for the event await expect(accountHandler.connect(authTokenOwner).createSeller(seller, authToken, voucherInitValues)) .to.emit(accountHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, authTokenStruct, authTokenOwner.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, authTokenStruct, await authTokenOwner.getAddress()); - seller.assistant = other1.address; + seller.assistant = await other1.getAddress(); // Update assistant address so we can create a seller with the same auth token id but different type const tx = await accountHandler.connect(authTokenOwner).updateSeller(seller, authToken); @@ -435,7 +435,7 @@ describe("SellerHandler", function () { await expect(tx) .to.emit(accountHandler, "SellerUpdatePending") - .withArgs(seller.id, pendingSellerUpdateStruct, pendingAuthTokenStruct, authTokenOwner.address); + .withArgs(seller.id, pendingSellerUpdateStruct, pendingAuthTokenStruct, await authTokenOwner.getAddress()); sellerStruct = seller.toStruct(); @@ -455,11 +455,11 @@ describe("SellerHandler", function () { pendingSellerUpdateStruct, authTokenStruct, pendingAuthTokenStruct, - other1.address + await other1.getAddress() ); seller.id = accountId.next().value; - seller.assistant = authTokenOwner.address; + seller.assistant = await authTokenOwner.getAddress(); //Create struct again with new addresses sellerStruct = seller.toStruct(); @@ -472,12 +472,12 @@ describe("SellerHandler", function () { await mockAuthERC721Contract2.connect(authTokenOwner).mint(8400, 1); // expected address of the first clone - expectedCloneAddress = calculateContractAddress(accountHandler.address, "2"); + expectedCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "2"); // Create a seller, testing for the event await expect(accountHandler.connect(authTokenOwner).createSeller(seller, authToken, voucherInitValues)) .to.emit(accountHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, authTokenStruct, authTokenOwner.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, authTokenStruct, await authTokenOwner.getAddress()); }); it("should be possible to create a seller with same auth token type but different id", async function () { @@ -490,9 +490,9 @@ describe("SellerHandler", function () { // Create a seller, testing for the event await expect(accountHandler.connect(authTokenOwner).createSeller(seller, authToken, voucherInitValues)) .to.emit(accountHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, authTokenStruct, authTokenOwner.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, authTokenStruct, await authTokenOwner.getAddress()); - seller.assistant = other1.address; + seller.assistant = await other1.getAddress(); pendingSellerUpdate = seller.clone(); pendingSellerUpdate.id = "0"; @@ -512,7 +512,7 @@ describe("SellerHandler", function () { await expect(tx) .to.emit(accountHandler, "SellerUpdatePending") - .withArgs(seller.id, pendingSellerUpdateStruct, pendingAuthTokenStruct, authTokenOwner.address); + .withArgs(seller.id, pendingSellerUpdateStruct, pendingAuthTokenStruct, await authTokenOwner.getAddress()); // Nothing pending left pendingSellerUpdate.assistant = ZeroAddress; @@ -530,12 +530,12 @@ describe("SellerHandler", function () { pendingSellerUpdateStruct, authTokenStruct, pendingAuthTokenStruct, - other1.address + await other1.getAddress() ); const newAuthTokenOwner = rando; seller.id = accountId.next().value; - seller.assistant = newAuthTokenOwner.address; + seller.assistant = await newAuthTokenOwner.getAddress(); //Create struct again with new addresses sellerStruct = seller.toStruct(); @@ -548,12 +548,12 @@ describe("SellerHandler", function () { await mockAuthERC721Contract.connect(rando).mint(authToken.tokenId, 1); // expected address of the first clone - expectedCloneAddress = calculateContractAddress(accountHandler.address, "2"); + expectedCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "2"); // Create a seller, testing for the event await expect(accountHandler.connect(rando).createSeller(seller, authToken, voucherInitValues)) .to.emit(accountHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, authTokenStruct, newAuthTokenOwner.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, authTokenStruct, await newAuthTokenOwner.getAddress()); }); context("💔 Revert Reasons", async function () { @@ -581,21 +581,21 @@ describe("SellerHandler", function () { await accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues); // Update seller assistant - seller.assistant = other1.address; + seller.assistant = await other1.getAddress(); await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); // Approve the update await accountHandler.connect(other1).optInToSellerUpdate(seller.id, [SellerUpdateFields.Assistant]); - seller.admin = other1.address; + seller.admin = await other1.getAddress(); // Attempt to Create a seller with non-unique assistant, expecting revert await expect( accountHandler.connect(other1).createSeller(seller, emptyAuthToken, voucherInitValues) ).to.revertedWith(RevertReasons.SELLER_ADDRESS_MUST_BE_UNIQUE); - seller.admin = admin.address; - seller.assistant = assistant.address; + seller.admin = await admin.getAddress(); + seller.assistant = await assistant.getAddress(); // Attempt to Create a seller with non-unique admin, expecting revert await expect( @@ -608,13 +608,13 @@ describe("SellerHandler", function () { await accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues); // Update seller assistant - seller.assistant = other1.address; + seller.assistant = await other1.getAddress(); await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); // Approve the update await accountHandler.connect(other1).optInToSellerUpdate(seller.id, [SellerUpdateFields.Assistant]); - seller.admin = other1.address; + seller.admin = await other1.getAddress(); // Attempt to Create a seller with non-unique assistant, expecting revert await expect( @@ -622,8 +622,8 @@ describe("SellerHandler", function () { ).to.revertedWith(RevertReasons.SELLER_ADDRESS_MUST_BE_UNIQUE); // Update seller admin - seller.admin = other3.address; - seller.assistant = assistant.address; + seller.admin = await other3.getAddress(); + seller.assistant = await assistant.getAddress(); await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); @@ -631,7 +631,7 @@ describe("SellerHandler", function () { await accountHandler.connect(other3).optInToSellerUpdate(seller.id, [SellerUpdateFields.Admin]); await accountHandler.connect(assistant).optInToSellerUpdate(seller.id, [SellerUpdateFields.Assistant]); - seller.assistant = other3.address; + seller.assistant = await other3.getAddress(); // Attempt to Create a seller with non-unique admin, expecting revert await expect( @@ -641,20 +641,20 @@ describe("SellerHandler", function () { it("addresses are not unique to this seller Id when address used for same role and the seller is created with auth token", async function () { // Create a seller - seller.admin = rando.address; - seller.assistant = rando.address; + seller.admin = await rando.getAddress(); + seller.assistant = await rando.getAddress(); seller2 = mockSeller( - authTokenOwner.address, + await authTokenOwner.getAddress(), ZeroAddress, ZeroAddress, - authTokenOwner.address + await authTokenOwner.getAddress() ); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); // Update the seller, so assistant matches authTokenOwner - seller.assistant = authTokenOwner.address; + seller.assistant = await authTokenOwner.getAddress(); await accountHandler.connect(rando).updateSeller(seller, emptyAuthToken); // Approve the update @@ -685,7 +685,7 @@ describe("SellerHandler", function () { it("authToken is not unique to this seller", async function () { // Set admin == zero address because seller will be created with auth token seller.admin = ZeroAddress; - seller.assistant = authTokenOwner.address; + seller.assistant = await authTokenOwner.getAddress(); // Create a seller await accountHandler.connect(authTokenOwner).createSeller(seller, authToken, voucherInitValues); @@ -709,7 +709,7 @@ describe("SellerHandler", function () { }); it("Caller is not the supplied admin", async function () { - seller.assistant = rando.address; + seller.assistant = await rando.getAddress(); // Attempt to Create a seller with admin not the same to caller address await expect( @@ -720,7 +720,7 @@ describe("SellerHandler", function () { it("Caller does not own supplied auth token", async function () { // Set admin == zero address because seller will be created with auth token seller.admin = ZeroAddress; - seller.assistant = rando.address; + seller.assistant = await rando.getAddress(); // Attempt to Create a seller without owning the auth token await expect( @@ -729,7 +729,7 @@ describe("SellerHandler", function () { }); it("Caller is not the supplied assistant", async function () { - seller.admin = rando.address; + seller.admin = await rando.getAddress(); // Attempt to Create a seller with assistant not the same to caller address await expect( @@ -738,9 +738,9 @@ describe("SellerHandler", function () { }); it("Clerk is not a zero address", async function () { - seller.admin = rando.address; - seller.assistant = rando.address; - seller.clerk = rando.address; + seller.admin = await rando.getAddress(); + seller.assistant = await rando.getAddress(); + seller.clerk = await rando.getAddress(); // Attempt to Create a seller with clerk not the same to caller address await expect( @@ -794,7 +794,7 @@ describe("SellerHandler", function () { await accountHandler.connect(authTokenOwner).createSeller(seller, authToken, voucherInitValues); // Create a another seller - seller2 = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); + seller2 = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); expect(seller2.isValid()).is.true; await accountHandler.connect(other1).createSeller(seller2, emptyAuthToken, voucherInitValues); @@ -871,7 +871,7 @@ describe("SellerHandler", function () { await accountHandler.connect(authTokenOwner).createSeller(seller, authToken, voucherInitValues); // Create a another seller - seller2 = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); + seller2 = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); expect(seller2.isValid()).is.true; contractURI = `https://ipfs.io/ipfs/QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ`; @@ -887,7 +887,7 @@ describe("SellerHandler", function () { it("should return the correct seller when searching on assistant address", async function () { [exists, sellerStruct, authTokenStruct] = await accountHandler .connect(rando) - .getSellerByAddress(assistant.address); + .getSellerByAddress(await assistant.getAddress()); expect(exists).is.true; @@ -909,7 +909,7 @@ describe("SellerHandler", function () { it("should return the correct seller when searching on admin address", async function () { [exists, sellerStruct, emptyAuthTokenStruct] = await accountHandler .connect(rando) - .getSellerByAddress(other1.address); + .getSellerByAddress(await other1.getAddress()); expect(exists).is.true; @@ -931,7 +931,7 @@ describe("SellerHandler", function () { it("should return exists false and default values when searching on treasury address", async function () { [exists, sellerStruct, emptyAuthTokenStruct] = await accountHandler .connect(rando) - .getSellerByAddress(treasury.address); + .getSellerByAddress(await treasury.getAddress()); expect(exists).is.false; @@ -957,7 +957,7 @@ describe("SellerHandler", function () { it("should return exists false and default values when searching on unassociated address", async function () { [exists, sellerStruct, emptyAuthTokenStruct] = await accountHandler .connect(rando) - .getSellerByAddress(deployer.address); + .getSellerByAddress(await deployer.getAddress()); expect(exists).is.false; @@ -1052,7 +1052,7 @@ describe("SellerHandler", function () { await accountHandler.connect(authTokenOwner).createSeller(seller, authToken, voucherInitValues); // Create seller 2 - seller2 = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); + seller2 = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); expect(seller2.isValid()).is.true; contractURI = `https://ipfs.io/ipfs/QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ`; @@ -1061,10 +1061,10 @@ describe("SellerHandler", function () { // Create seller 3 seller3 = mockSeller( - other5.address, + await other5.getAddress(), ZeroAddress, ZeroAddress, - treasury.address + await treasury.getAddress() ); expect(seller3.isValid()).is.true; @@ -1126,10 +1126,10 @@ describe("SellerHandler", function () { // Create seller 4 seller4 = mockSeller( - rando.address, + await rando.getAddress(), ZeroAddress, ZeroAddress, - treasury.address + await treasury.getAddress() ); expect(seller4.isValid()).is.true; @@ -1182,10 +1182,10 @@ describe("SellerHandler", function () { // Create seller 4 seller4 = mockSeller( - rando.address, + await rando.getAddress(), ZeroAddress, ZeroAddress, - treasury.address + await treasury.getAddress() ); expect(seller4.isValid()).is.true; @@ -1275,13 +1275,13 @@ describe("SellerHandler", function () { }); it("should emit a SellerUpdateApplied and OwnershipTransferred event with correct values if values change", async function () { - seller.treasury = other4.address; + seller.treasury = await other4.getAddress(); seller.metadataUri = "https://ipfs.io/ipfs/updatedUri"; // Treasury and metadataURI are only values that can be update without address owner authorization sellerStruct = seller.toStruct(); seller.admin = ZeroAddress; - seller.assistant = other1.address; + seller.assistant = await other1.getAddress(); expect(seller.isValid()).is.true; pendingSellerUpdate = seller.clone(); @@ -1307,26 +1307,26 @@ describe("SellerHandler", function () { pendingSellerUpdateStruct, emptyAuthTokenStruct, pendingAuthTokenStruct, - admin.address + await admin.getAddress() ); // Testing for the SellerUpdatePending event await expect(tx) .to.emit(accountHandler, "SellerUpdatePending") - .withArgs(seller.id, pendingSellerUpdateStruct, pendingAuthTokenStruct, admin.address); + .withArgs(seller.id, pendingSellerUpdateStruct, pendingAuthTokenStruct, await admin.getAddress()); // Update seller assistant tx = await accountHandler.connect(other1).optInToSellerUpdate(seller.id, [SellerUpdateFields.Assistant]); // Voucher clone contract - const bosonVoucherCloneAddress = calculateContractAddress(exchangeHandler.address, "1"); + const bosonVoucherCloneAddress = calculateContractAddress(await exchangeHandler.getAddress(), "1"); bosonVoucher = await getContractAt("OwnableUpgradeable", bosonVoucherCloneAddress); - await expect(tx).to.emit(bosonVoucher, "OwnershipTransferred").withArgs(assistant.address, other1.address); + await expect(tx).to.emit(bosonVoucher, "OwnershipTransferred").withArgs(await assistant.getAddress(), await other1.getAddress()); pendingSellerUpdate.assistant = ZeroAddress; pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); - seller.admin = admin.address; + seller.admin = await admin.getAddress(); sellerStruct = seller.toStruct(); // Check assistant update @@ -1338,7 +1338,7 @@ describe("SellerHandler", function () { pendingSellerUpdateStruct, emptyAuthTokenStruct, pendingAuthTokenStruct, - other1.address + await other1.getAddress() ); // Update seller auth token @@ -1360,19 +1360,19 @@ describe("SellerHandler", function () { pendingSellerUpdateStruct, authTokenStruct, pendingAuthTokenStruct, - authTokenOwner.address + await authTokenOwner.getAddress() ); }); it("should only emit SellerUpdatePending event if no update has been immediately applied", async function () { - seller.assistant = other1.address; + seller.assistant = await other1.getAddress(); const tx = await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); // SellerUpdateApplied should not be emit because no value has immediately updated await expect(tx).to.not.emit(accountHandler, "SellerUpdateApplied"); // Voucher clone contract - const bosonVoucherCloneAddress = calculateContractAddress(exchangeHandler.address, "1"); + const bosonVoucherCloneAddress = calculateContractAddress(await exchangeHandler.getAddress(), "1"); bosonVoucher = await getContractAt("OwnableUpgradeable", bosonVoucherCloneAddress); // Since assistant stayed the same yet, clone contract ownership should not be transferred immediately @@ -1383,9 +1383,9 @@ describe("SellerHandler", function () { }); it("should update state of all fields except Id and active flag", async function () { - seller.assistant = other1.address; + seller.assistant = await other1.getAddress(); seller.admin = ZeroAddress; - seller.treasury = other4.address; + seller.treasury = await other4.getAddress(); seller.active = false; //Update should not change id or active flag @@ -1420,10 +1420,10 @@ describe("SellerHandler", function () { } //Check that old addresses are no longer mapped. We don't map the treasury address. - [exists] = await accountHandler.connect(rando).getSellerByAddress(assistant.address); + [exists] = await accountHandler.connect(rando).getSellerByAddress(await assistant.getAddress()); expect(exists).to.be.false; - [exists] = await accountHandler.connect(rando).getSellerByAddress(admin.address); + [exists] = await accountHandler.connect(rando).getSellerByAddress(await admin.getAddress()); expect(exists).to.be.false; //Check that new addresses are mapped. We don't map the treasury address. @@ -1435,7 +1435,7 @@ describe("SellerHandler", function () { expect(exists).to.be.false; // Voucher clone contract - const bosonVoucherCloneAddress = calculateContractAddress(exchangeHandler.address, "1"); + const bosonVoucherCloneAddress = calculateContractAddress(await exchangeHandler.getAddress(), "1"); bosonVoucher = await getContractAt("OwnableUpgradeable", bosonVoucherCloneAddress); expect(await bosonVoucher.owner()).to.equal(seller.assistant, "Wrong voucher clone owner"); @@ -1443,23 +1443,23 @@ describe("SellerHandler", function () { it("should update state from auth token to empty auth token", async function () { seller2 = mockSeller( - other1.address, + await other1.getAddress(), ZeroAddress, ZeroAddress, - other1.address + await other1.getAddress() ); expect(seller2.isValid()).is.true; // msg.sender must be equal to seller's assistant - await mockAuthERC721Contract.connect(authTokenOwner).transferFrom(authTokenOwner.address, other1.address, 8400); + await mockAuthERC721Contract.connect(authTokenOwner).transferFrom(await authTokenOwner.getAddress(), await other1.getAddress(), 8400); const newAuthTokenOwner = other1; // Create a seller with auth token await accountHandler.connect(newAuthTokenOwner).createSeller(seller2, authToken, voucherInitValues); - seller2.assistant = other5.address; - seller2.admin = other6.address; - seller2.treasury = other7.address; + seller2.assistant = await other5.getAddress(); + seller2.admin = await other6.getAddress(); + seller2.treasury = await other7.getAddress(); seller2.active = false; //Update should not change id or active flag @@ -1494,13 +1494,13 @@ describe("SellerHandler", function () { } //Check that old addresses are no longer mapped. We don't map the treasury address. - [exists] = await accountHandler.connect(rando).getSellerByAddress(other1.address); + [exists] = await accountHandler.connect(rando).getSellerByAddress(await other1.getAddress()); expect(exists).to.be.false; [exists] = await accountHandler.connect(rando).getSellerByAddress(ZeroAddress); expect(exists).to.be.false; - [exists] = await accountHandler.connect(rando).getSellerByAddress(other3.address); + [exists] = await accountHandler.connect(rando).getSellerByAddress(await other3.getAddress()); expect(exists).to.be.false; //Check that new addresses are mapped. We don't map the treasury address. @@ -1511,7 +1511,7 @@ describe("SellerHandler", function () { expect(exists).to.be.true; // Voucher clone contract - const bosonVoucherCloneAddress = calculateContractAddress(exchangeHandler.address, "1"); + const bosonVoucherCloneAddress = calculateContractAddress(await exchangeHandler.getAddress(), "1"); bosonVoucher = await getContractAt("OwnableUpgradeable", bosonVoucherCloneAddress); expect(await bosonVoucher.owner()).to.equal(seller.assistant, "Wrong voucher clone owner"); @@ -1519,23 +1519,23 @@ describe("SellerHandler", function () { it("should update state from auth token to new auth token", async function () { seller2 = mockSeller( - other1.address, + await other1.getAddress(), ZeroAddress, ZeroAddress, - other1.address + await other1.getAddress() ); expect(seller2.isValid()).is.true; // msg.sender must be equal to seller's assistant - await mockAuthERC721Contract.connect(authTokenOwner).transferFrom(authTokenOwner.address, other1.address, 8400); + await mockAuthERC721Contract.connect(authTokenOwner).transferFrom(await authTokenOwner.getAddress(), await other1.getAddress(), 8400); const newAuthTokenOwner = other1; // Create a seller with auth token await accountHandler.connect(newAuthTokenOwner).createSeller(seller2, authToken, voucherInitValues); - seller2.assistant = other5.address; + seller2.assistant = await other5.getAddress(); seller2.admin = ZeroAddress; - seller2.treasury = other7.address; + seller2.treasury = await other7.getAddress(); seller2.active = false; await mockAuthERC721Contract2.connect(newAuthTokenOwner).mint(0, 1); @@ -1572,13 +1572,13 @@ describe("SellerHandler", function () { } //Check that old addresses are no longer mapped. We don't map the treasury address. - [exists] = await accountHandler.connect(rando).getSellerByAddress(other1.address); + [exists] = await accountHandler.connect(rando).getSellerByAddress(await other1.getAddress()); expect(exists).to.be.false; [exists] = await accountHandler.connect(rando).getSellerByAddress(ZeroAddress); expect(exists).to.be.false; - [exists] = await accountHandler.connect(rando).getSellerByAddress(other3.address); + [exists] = await accountHandler.connect(rando).getSellerByAddress(await other3.getAddress()); expect(exists).to.be.false; //Check that new addresses are mapped. We don't map the treasury address. @@ -1589,14 +1589,14 @@ describe("SellerHandler", function () { expect(exists).to.be.false; // Voucher clone contract - const bosonVoucherCloneAddress = calculateContractAddress(exchangeHandler.address, "1"); + const bosonVoucherCloneAddress = calculateContractAddress(await exchangeHandler.getAddress(), "1"); bosonVoucher = await getContractAt("OwnableUpgradeable", bosonVoucherCloneAddress); expect(await bosonVoucher.owner()).to.equal(seller.assistant, "Wrong voucher clone owner"); }); it("should update only one address", async function () { - seller.assistant = other1.address; + seller.assistant = await other1.getAddress(); sellerStruct = seller.toStruct(); @@ -1627,10 +1627,10 @@ describe("SellerHandler", function () { it("should update the correct seller", async function () { // Configure another seller seller2 = mockSeller( - other1.address, + await other1.getAddress(), ZeroAddress, ZeroAddress, - other1.address + await other1.getAddress() ); expect(seller2.isValid()).is.true; @@ -1647,9 +1647,9 @@ describe("SellerHandler", function () { await accountHandler.connect(authTokenOwner).createSeller(seller2, authToken2, voucherInitValues); //Update seller2 - seller2.assistant = rando.address; + seller2.assistant = await rando.getAddress(); seller2.admin = ZeroAddress; - seller2.treasury = rando.address; + seller2.treasury = await rando.getAddress(); seller2.active = false; //Update should not change id or active flag @@ -1706,9 +1706,9 @@ describe("SellerHandler", function () { }); it("should be able to only update with new admin address", async function () { - seller.admin = other2.address; + seller.admin = await other2.getAddress(); sellerStruct = seller.toStruct(); - pendingSellerUpdate.admin = other2.address; + pendingSellerUpdate.admin = await other2.getAddress(); pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); // Update seller @@ -1717,7 +1717,7 @@ describe("SellerHandler", function () { // Testing for the SellerUpdatePending event await expect(tx) .to.emit(accountHandler, "SellerUpdatePending") - .withArgs(seller.id, pendingSellerUpdateStruct, emptyAuthTokenStruct, admin.address); + .withArgs(seller.id, pendingSellerUpdateStruct, emptyAuthTokenStruct, await admin.getAddress()); pendingSellerUpdate.admin = ZeroAddress; pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); @@ -1731,12 +1731,12 @@ describe("SellerHandler", function () { pendingSellerUpdateStruct, emptyAuthTokenStruct, emptyAuthTokenStruct, - other2.address + await other2.getAddress() ); - seller.admin = other3.address; + seller.admin = await other3.getAddress(); sellerStruct = seller.toStruct(); - pendingSellerUpdate.admin = other3.address; + pendingSellerUpdate.admin = await other3.getAddress(); pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); // Update seller @@ -1745,7 +1745,7 @@ describe("SellerHandler", function () { // Testing for the SellerUpdatePending event await expect(tx) .to.emit(accountHandler, "SellerUpdatePending") - .withArgs(seller.id, pendingSellerUpdateStruct, emptyAuthTokenStruct, other2.address); + .withArgs(seller.id, pendingSellerUpdateStruct, emptyAuthTokenStruct, await other2.getAddress()); pendingSellerUpdate.admin = ZeroAddress; pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); @@ -1759,7 +1759,7 @@ describe("SellerHandler", function () { pendingSellerUpdateStruct, emptyAuthTokenStruct, emptyAuthTokenStruct, - other3.address + await other3.getAddress() ); // Attempt to update the seller with original admin address, expecting revert @@ -1775,7 +1775,7 @@ describe("SellerHandler", function () { // Update seller, testing for the event await expect(accountHandler.connect(admin).updateSeller(seller, authToken)) .to.emit(accountHandler, "SellerUpdatePending") - .withArgs(seller.id, pendingSellerUpdateStruct, authTokenStruct, admin.address); + .withArgs(seller.id, pendingSellerUpdateStruct, authTokenStruct, await admin.getAddress()); // Approve update await expect( @@ -1788,15 +1788,15 @@ describe("SellerHandler", function () { pendingSellerUpdateStruct, authTokenStruct, emptyAuthTokenStruct, - authTokenOwner.address + await authTokenOwner.getAddress() ); - seller.assistant = other3.address; - pendingSellerUpdate.assistant = other3.address; + seller.assistant = await other3.getAddress(); + pendingSellerUpdate.assistant = await other3.getAddress(); pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); // Transfer ownership of auth token because owner must be different from old admin - await mockAuthERC721Contract.connect(authTokenOwner).transferFrom(authTokenOwner.address, other1.address, 8400); + await mockAuthERC721Contract.connect(authTokenOwner).transferFrom(await authTokenOwner.getAddress(), await other1.getAddress(), 8400); const newAuthTokenOwner = other1; // Update seller @@ -1805,7 +1805,7 @@ describe("SellerHandler", function () { // Testing for the SellerUpdatePending event await expect(tx) .to.emit(accountHandler, "SellerUpdatePending") - .withArgs(seller.id, pendingSellerUpdateStruct, emptyAuthTokenStruct, newAuthTokenOwner.address); + .withArgs(seller.id, pendingSellerUpdateStruct, emptyAuthTokenStruct, await newAuthTokenOwner.getAddress()); sellerStruct = seller.toStruct(); pendingSellerUpdate.assistant = ZeroAddress; @@ -1820,7 +1820,7 @@ describe("SellerHandler", function () { pendingSellerUpdateStruct, authTokenStruct, emptyAuthTokenStruct, - other3.address + await other3.getAddress() ); // Attempt to update the seller with original admin address, expecting revertStruct @@ -1832,10 +1832,10 @@ describe("SellerHandler", function () { it("should be possible to use non-unique treasury address", async function () { seller2 = seller.clone(); seller2.id = accountId.next().value; - seller2.treasury = other2.address; + seller2.treasury = await other2.getAddress(); - seller.assistant = other1.address; - seller.admin = other1.address; + seller.assistant = await other1.getAddress(); + seller.admin = await other1.getAddress(); pendingSellerUpdate = seller.clone(); pendingSellerUpdate.active = false; @@ -1850,7 +1850,7 @@ describe("SellerHandler", function () { // Testing for the SellerUpdatePending event await expect(tx) .to.emit(accountHandler, "SellerUpdatePending") - .withArgs(seller.id, pendingSellerUpdateStruct, emptyAuthTokenStruct, admin.address); + .withArgs(seller.id, pendingSellerUpdateStruct, emptyAuthTokenStruct, await admin.getAddress()); //Create struct again with new addresses sellerStruct = seller.toStruct(); @@ -1863,28 +1863,28 @@ describe("SellerHandler", function () { // Make sure seller treasury didn't change [, sellerStruct, authTokenStruct] = await accountHandler.connect(rando).getSeller(seller.id); let returnedSeller = Seller.fromStruct(sellerStruct); - expect(returnedSeller.treasury).to.equal(treasury.address); + expect(returnedSeller.treasury).to.equal(await treasury.getAddress()); // Create seller 2 await accountHandler.connect(admin).createSeller(seller2, emptyAuthToken, voucherInitValues); // Update seller 2 treasury - seller2.treasury = treasury.address; + seller2.treasury = await treasury.getAddress(); await accountHandler.connect(admin).updateSeller(seller2, emptyAuthToken); // Check seller 2 treasury [, sellerStruct, authTokenStruct] = await accountHandler.connect(rando).getSeller(seller2.id); let returnedSeller2 = Seller.fromStruct(sellerStruct); - expect(returnedSeller2.treasury).to.equal(treasury.address); + expect(returnedSeller2.treasury).to.equal(await treasury.getAddress()); }); it("should be possible to use the same address for assistant, admin and treasury", async function () { // Only treasury doesn't need owner approval and will be updated immediately - seller.treasury = other1.address; + seller.treasury = await other1.getAddress(); sellerStruct = seller.toStruct(); - seller.assistant = other1.address; - seller.admin = other1.address; + seller.assistant = await other1.getAddress(); + seller.admin = await other1.getAddress(); // Update seller const tx = await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); @@ -1906,13 +1906,13 @@ describe("SellerHandler", function () { pendingSellerUpdateStruct, emptyAuthTokenStruct, emptyAuthTokenStruct, - admin.address + await admin.getAddress() ); // Testing for the SellerUpdatePending event await expect(tx) .to.emit(accountHandler, "SellerUpdatePending") - .withArgs(seller.id, pendingSellerUpdateStruct, emptyAuthTokenStruct, admin.address); + .withArgs(seller.id, pendingSellerUpdateStruct, emptyAuthTokenStruct, await admin.getAddress()); sellerStruct = seller.toStruct(); // Nothing pending left @@ -1934,7 +1934,7 @@ describe("SellerHandler", function () { pendingSellerUpdateStruct, emptyAuthTokenStruct, emptyAuthTokenStruct, - other1.address + await other1.getAddress() ); }); @@ -1994,7 +1994,7 @@ describe("SellerHandler", function () { }); it("Clerk is not a zero address", async function () { - seller.clerk = rando.address; + seller.clerk = await rando.getAddress(); // Attempt to update a seller, expecting revert await expect(accountHandler.connect(authTokenOwner).updateSeller(seller, emptyAuthToken)).to.revertedWith( @@ -2013,28 +2013,28 @@ describe("SellerHandler", function () { it("addresses are not unique to this seller Id when addresses used for same role", async function () { seller.id = accountId.next().value; - seller.assistant = other1.address; - seller.admin = other1.address; - seller.treasury = other1.address; + seller.assistant = await other1.getAddress(); + seller.admin = await other1.getAddress(); + seller.treasury = await other1.getAddress(); seller.active = true; sellerStruct = seller.toStruct(); - expectedCloneAddress = calculateContractAddress(accountHandler.address, "2"); + expectedCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "2"); //Create second seller await expect(accountHandler.connect(other1).createSeller(seller, emptyAuthToken, voucherInitValues)) .to.emit(accountHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, other1.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await other1.getAddress()); //Set assistant address value to be same as first seller created in Seller Methods beforeEach - seller.assistant = assistant.address; //already being used by seller 1 + seller.assistant = await assistant.getAddress(); //already being used by seller 1 // Attempt to update seller 2 with non-unique assistant, expecting revert await expect(accountHandler.connect(other1).updateSeller(seller, emptyAuthToken)).to.revertedWith( RevertReasons.SELLER_ADDRESS_MUST_BE_UNIQUE ); - seller.admin = admin.address; //already being used by seller 1 - seller.assistant = other1.address; + seller.admin = await admin.getAddress(); //already being used by seller 1 + seller.assistant = await other1.getAddress(); // Attempt to update a seller with non-unique admin, expecting revert await expect(accountHandler.connect(other1).updateSeller(seller, emptyAuthToken)).to.revertedWith( @@ -2044,20 +2044,20 @@ describe("SellerHandler", function () { it("addresses are not unique to this seller Id when address used for different role", async function () { seller.id = accountId.next().value; - seller.assistant = other1.address; - seller.admin = other1.address; - seller.treasury = other1.address; + seller.assistant = await other1.getAddress(); + seller.admin = await other1.getAddress(); + seller.treasury = await other1.getAddress(); seller.active = true; sellerStruct = seller.toStruct(); - expectedCloneAddress = calculateContractAddress(accountHandler.address, "2"); + expectedCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "2"); //Create second seller await expect(accountHandler.connect(other1).createSeller(seller, emptyAuthToken, voucherInitValues)) .to.emit(accountHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, other1.address); + .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await other1.getAddress()); //Set seller 2's admin address to seller 1's assistant address - seller.admin = assistant.address; + seller.admin = await assistant.getAddress(); // Attempt to update seller 2 with non-unique assistant, expecting revert await expect(accountHandler.connect(other1).updateSeller(seller, emptyAuthToken)).to.revertedWith( @@ -2065,8 +2065,8 @@ describe("SellerHandler", function () { ); //Set seller 2's assistant address to seller 1's admin address - seller.admin = other1.address; - seller.assistant = admin.address; + seller.admin = await other1.getAddress(); + seller.assistant = await admin.getAddress(); // Attempt to update a seller with non-unique admin, expecting revert await expect(accountHandler.connect(other1).updateSeller(seller, emptyAuthToken)).to.revertedWith( @@ -2100,7 +2100,7 @@ describe("SellerHandler", function () { await accountHandler.connect(authTokenOwner).optInToSellerUpdate(seller.id, [SellerUpdateFields.AuthToken]); //Set seller 2's auth token to empty - seller2 = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); + seller2 = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); expect(seller2.isValid()).is.true; // Create a seller with auth token @@ -2130,10 +2130,10 @@ describe("SellerHandler", function () { const authTokenOwner = other1; //Create seller 2 with auth token seller2 = mockSeller( - other1.address, + await other1.getAddress(), ZeroAddress, ZeroAddress, - other1.address + await other1.getAddress() ); expect(seller2.isValid()).is.true; @@ -2147,7 +2147,7 @@ describe("SellerHandler", function () { await accountHandler.connect(authTokenOwner).createSeller(seller2, authToken2, voucherInitValues); //Transfer the token to a different address - await mockAuthERC721Contract2.connect(authTokenOwner).transferFrom(authTokenOwner.address, other7.address, 0); + await mockAuthERC721Contract2.connect(authTokenOwner).transferFrom(await authTokenOwner.getAddress(), await other7.getAddress(), 0); // Attempt to update seller2 for token that seller doesn't own await expect(accountHandler.connect(authTokenOwner).updateSeller(seller2, authToken2)).to.revertedWith( @@ -2160,10 +2160,10 @@ describe("SellerHandler", function () { //Create seller 2 with auth token seller2 = mockSeller( - other1.address, + await other1.getAddress(), ZeroAddress, ZeroAddress, - other1.address + await other1.getAddress() ); expect(seller2.isValid()).is.true; @@ -2201,7 +2201,7 @@ describe("SellerHandler", function () { }); it("New assistant should opt-in to update seller", async function () { - seller.assistant = other1.address; + seller.assistant = await other1.getAddress(); sellerStruct = seller.toStruct(); await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); @@ -2214,12 +2214,12 @@ describe("SellerHandler", function () { pendingSellerUpdateStruct, emptyAuthTokenStruct, emptyAuthTokenStruct, - other1.address + await other1.getAddress() ); }); it("New admin should opt-in to update seller", async function () { - seller.admin = other1.address; + seller.admin = await other1.getAddress(); sellerStruct = seller.toStruct(); await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); @@ -2232,13 +2232,13 @@ describe("SellerHandler", function () { pendingSellerUpdateStruct, emptyAuthTokenStruct, emptyAuthTokenStruct, - other1.address + await other1.getAddress() ); }); it("Should update admin and assistant in a single call ", async function () { - seller.admin = other1.address; - seller.assistant = other1.address; + seller.admin = await other1.getAddress(); + seller.assistant = await other1.getAddress(); sellerStruct = seller.toStruct(); await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); @@ -2255,13 +2255,13 @@ describe("SellerHandler", function () { pendingSellerUpdateStruct, emptyAuthTokenStruct, emptyAuthTokenStruct, - other1.address + await other1.getAddress() ); }); it("Should update assistant and auth token in a single call when addresses are the same ", async function () { seller.admin = ZeroAddress; - seller.assistant = authTokenOwner.address; + seller.assistant = await authTokenOwner.getAddress(); sellerStruct = seller.toStruct(); await accountHandler.connect(admin).updateSeller(seller, authToken); @@ -2278,7 +2278,7 @@ describe("SellerHandler", function () { pendingSellerUpdateStruct, authTokenStruct, emptyAuthTokenStruct, - authTokenOwner.address + await authTokenOwner.getAddress() ); }); @@ -2298,7 +2298,7 @@ describe("SellerHandler", function () { pendingSellerUpdateStruct, authTokenStruct, emptyAuthTokenStruct, - authTokenOwner.address + await authTokenOwner.getAddress() ); }); @@ -2309,7 +2309,7 @@ describe("SellerHandler", function () { await accountHandler.connect(authTokenOwner).optInToSellerUpdate(seller.id, [SellerUpdateFields.AuthToken]); // Update seller to not use auth token anymore - seller.admin = other1.address; + seller.admin = await other1.getAddress(); await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); await accountHandler.connect(other1).optInToSellerUpdate(seller.id, [SellerUpdateFields.Admin]); @@ -2327,12 +2327,12 @@ describe("SellerHandler", function () { pendingSellerUpdateStruct, authTokenStruct, emptyAuthTokenStruct, - authTokenOwner.address + await authTokenOwner.getAddress() ); }); it("If updateSeller is called twice with no optIn in between, pendingSellerUpdate is populated with the data from second call", async function () { - seller.assistant = other1.address; + seller.assistant = await other1.getAddress(); pendingSellerUpdate = seller.clone(); pendingSellerUpdate.id = "0"; @@ -2345,9 +2345,9 @@ describe("SellerHandler", function () { await expect(accountHandler.connect(admin).updateSeller(seller, emptyAuthToken)) .to.emit(accountHandler, "SellerUpdatePending") - .withArgs(seller.id, pendingSellerUpdateStruct, emptyAuthTokenStruct, admin.address); + .withArgs(seller.id, pendingSellerUpdateStruct, emptyAuthTokenStruct, await admin.getAddress()); - seller.assistant = other2.address; + seller.assistant = await other2.getAddress(); sellerStruct = seller.toStruct(); const pendingSellerUpdate2 = pendingSellerUpdate.clone(); @@ -2368,7 +2368,7 @@ describe("SellerHandler", function () { pendingSellerUpdate2Struct, emptyAuthTokenStruct, emptyAuthTokenStruct, - other2.address + await other2.getAddress() ); // Set admin == zero address because seller will be created with auth token @@ -2377,7 +2377,7 @@ describe("SellerHandler", function () { await expect(accountHandler.connect(admin).updateSeller(seller, authToken)) .to.emit(accountHandler, "SellerUpdatePending") - .withArgs(seller.id, pendingSellerUpdate2Struct, authTokenStruct, admin.address); + .withArgs(seller.id, pendingSellerUpdate2Struct, authTokenStruct, await admin.getAddress()); // Set different token Id, keeping auth token type the same const authToken2 = authToken.clone(); @@ -2389,7 +2389,7 @@ describe("SellerHandler", function () { await expect(accountHandler.connect(admin).updateSeller(seller, authToken2)) .to.emit(accountHandler, "SellerUpdatePending") - .withArgs(seller.id, pendingSellerUpdate2Struct, authToken2Struct, admin.address); + .withArgs(seller.id, pendingSellerUpdate2Struct, authToken2Struct, await admin.getAddress()); await expect( accountHandler.connect(authTokenOwner).optInToSellerUpdate(seller.id, [SellerUpdateFields.AuthToken]) @@ -2403,12 +2403,12 @@ describe("SellerHandler", function () { pendingSellerUpdate2Struct, authToken2Struct, emptyAuthTokenStruct, - rando.address + await rando.getAddress() ); }); it("Should not emit 'SellerUpdateApplied' event if caller doesn't specify any field", async function () { - seller.assistant = other1.address; + seller.assistant = await other1.getAddress(); await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); await expect(accountHandler.connect(other1).optInToSellerUpdate(seller.id, [])).to.not.emit( @@ -2418,7 +2418,7 @@ describe("SellerHandler", function () { }); it("Should not emit 'SellerUpdateApplied'event if there is no pending update for specified field", async function () { - seller.assistant = other1.address; + seller.assistant = await other1.getAddress(); await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); await expect( @@ -2428,8 +2428,8 @@ describe("SellerHandler", function () { context("💔 Revert Reasons", async function () { it("There are no pending updates", async function () { - seller.admin = other1.address; - seller.assistant = other1.address; + seller.admin = await other1.getAddress(); + seller.assistant = await other1.getAddress(); sellerStruct = seller.toStruct(); // No pending update auth token @@ -2447,7 +2447,7 @@ describe("SellerHandler", function () { pendingSellerUpdateStruct, emptyAuthTokenStruct, emptyAuthTokenStruct, - other1.address + await other1.getAddress() ); await expect(accountHandler.connect(other1).optInToSellerUpdate(seller.id, [])).to.revertedWith( @@ -2464,14 +2464,14 @@ describe("SellerHandler", function () { await mockAuthERC721Contract .connect(authTokenOwner) - .transferFrom(authTokenOwner.address, rando.address, 8400); + .transferFrom(await authTokenOwner.getAddress(), await rando.getAddress(), 8400); const newAuthTokenOwner = rando; seller2 = mockSeller( - newAuthTokenOwner.address, + await newAuthTokenOwner.getAddress(), ZeroAddress, ZeroAddress, - newAuthTokenOwner.address + await newAuthTokenOwner.getAddress() ); expect(seller2.isValid()).is.true; @@ -2485,7 +2485,7 @@ describe("SellerHandler", function () { }); it("Caller is not the new admin", async function () { - seller.admin = other1.address; + seller.admin = await other1.getAddress(); await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); @@ -2495,7 +2495,7 @@ describe("SellerHandler", function () { }); it("Caller is not the new assistant", async function () { - seller.assistant = other1.address; + seller.assistant = await other1.getAddress(); await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); @@ -2515,7 +2515,7 @@ describe("SellerHandler", function () { }); it("The sellers region of protocol is paused", async function () { - seller.assistant = other1.address; + seller.assistant = await other1.getAddress(); await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); @@ -2529,11 +2529,11 @@ describe("SellerHandler", function () { it("Admin is not unique to this seller", async function () { // Update seller admin - seller.admin = other1.address; + seller.admin = await other1.getAddress(); await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); // Create seller with same admin - seller2 = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); + seller2 = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); expect(seller2.isValid()).is.true; await accountHandler.connect(other1).createSeller(seller2, emptyAuthToken, voucherInitValues); @@ -2546,11 +2546,11 @@ describe("SellerHandler", function () { it("Assistant is not unique to this seller", async function () { // Update seller assistant - seller.assistant = other1.address; + seller.assistant = await other1.getAddress(); await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); // Create seller with same assistant - seller2 = mockSeller(other1.address, other1.address, ZeroAddress, other1.address); + seller2 = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); expect(seller2.isValid()).is.true; await accountHandler.connect(other1).createSeller(seller2, emptyAuthToken, voucherInitValues); @@ -2562,7 +2562,7 @@ describe("SellerHandler", function () { }); it("Seller tries to update the clerk", async function () { - seller.assistant = other1.address; + seller.assistant = await other1.getAddress(); await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); diff --git a/test/protocol/TwinHandlerTest.js b/test/protocol/TwinHandlerTest.js index 9df71aadc..96308d42e 100644 --- a/test/protocol/TwinHandlerTest.js +++ b/test/protocol/TwinHandlerTest.js @@ -98,7 +98,7 @@ describe("IBosonTwinHandler", function () { id = "1"; // argument sent to contract for createSeller will be ignored // Create a valid seller, then set fields in tests directly - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); expect(seller.isValid()).is.true; // VoucherInitValues @@ -115,7 +115,7 @@ describe("IBosonTwinHandler", function () { invalidTwinId = "222"; // Create a valid twin, then set fields in tests directly - twin = mockTwin(bosonToken.address); + twin = mockTwin(await bosonToken.getAddress()); expect(twin.isValid()).is.true; // How that twin looks as a returned struct @@ -129,10 +129,10 @@ describe("IBosonTwinHandler", function () { context("👉 createTwin()", async function () { it("should emit a TwinCreated event", async function () { - twin.tokenAddress = bosonToken.address; + twin.tokenAddress = await bosonToken.getAddress(); // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // Create a twin, testing for the event const tx = await twinHandler.connect(assistant).createTwin(twin); @@ -153,7 +153,7 @@ describe("IBosonTwinHandler", function () { twin.id = "444"; // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // Create a twin, testing for the event const tx = await twinHandler.connect(assistant).createTwin(twin); @@ -188,11 +188,11 @@ describe("IBosonTwinHandler", function () { }); it("should emit a TwinCreated event for ERC721 token address", async function () { - twin.tokenAddress = foreign721.address; + twin.tokenAddress = await foreign721.getAddress(); // Mint a token and approve twinHandler contract to transfer it await foreign721.connect(assistant).mint(twin.tokenId, "1"); - await foreign721.connect(assistant).setApprovalForAll(twinHandler.address, true); + await foreign721.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); // Create a twin, testing for the event const tx = await twinHandler.connect(assistant).createTwin(twin); @@ -210,11 +210,11 @@ describe("IBosonTwinHandler", function () { }); it("should emit a TwinCreated event for ERC1155 token address", async function () { - twin.tokenAddress = foreign1155.address; + twin.tokenAddress = await foreign1155.getAddress(); // Mint a token and approve twinHandler contract to transfer it await foreign1155.connect(assistant).mint(twin.tokenId, twin.amount); - await foreign1155.connect(assistant).setApprovalForAll(twinHandler.address, true); + await foreign1155.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); // Create a twin, testing for the event const tx = await twinHandler.connect(assistant).createTwin(twin); @@ -235,12 +235,12 @@ describe("IBosonTwinHandler", function () { twin.supplyAvailable = "10"; twin.amount = "0"; twin.tokenId = "5"; - twin.tokenAddress = foreign721.address; + twin.tokenAddress = await foreign721.getAddress(); twin.tokenType = TokenType.NonFungibleToken; // Mint a token and approve twinHandler contract to transfer it await foreign721.connect(assistant).mint(twin.tokenId, twin.supplyAvailable); - await foreign721.connect(assistant).setApprovalForAll(twinHandler.address, true); + await foreign721.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); // Create first twin with ids range: ["5"..."14"] await twinHandler.connect(assistant).createTwin(twin); @@ -255,7 +255,7 @@ describe("IBosonTwinHandler", function () { twin.supplyAvailable = constants.MaxUint256.toString(); twin.amount = "0"; twin.tokenId = "0"; - twin.tokenAddress = foreign721.address; + twin.tokenAddress = await foreign721.getAddress(); twin.tokenType = TokenType.NonFungibleToken; // another erc721 token @@ -263,11 +263,11 @@ describe("IBosonTwinHandler", function () { let twin2 = twin.clone(); twin2.supplyAvailable = "1500"; - twin2.tokenAddress = foreign721_2.address; + twin2.tokenAddress = await foreign721_2.getAddress(); // Approve twinHandler contract to transfer it - await foreign721.connect(assistant).setApprovalForAll(twinHandler.address, true); - await foreign721_2.connect(assistant).setApprovalForAll(twinHandler.address, true); + await foreign721.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); + await foreign721_2.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); // Create a twin with limited supply await twinHandler.connect(assistant).createTwin(twin); @@ -280,7 +280,7 @@ describe("IBosonTwinHandler", function () { twin.supplyAvailable = constants.MaxUint256.toString(); twin.amount = "0"; twin.tokenId = "0"; - twin.tokenAddress = foreign721.address; + twin.tokenAddress = await foreign721.getAddress(); twin.tokenType = TokenType.NonFungibleToken; // another erc721 token @@ -288,11 +288,11 @@ describe("IBosonTwinHandler", function () { let twin2 = twin.clone(); twin2.supplyAvailable = "1500"; - twin2.tokenAddress = foreign721_2.address; + twin2.tokenAddress = await foreign721_2.getAddress(); // Approve twinHandler contract to transfer it - await foreign721.connect(assistant).setApprovalForAll(twinHandler.address, true); - await foreign721_2.connect(assistant).setApprovalForAll(twinHandler.address, true); + await foreign721.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); + await foreign721_2.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); // Create a twin with unlimited supply await twinHandler.connect(assistant).createTwin(twin); @@ -303,10 +303,10 @@ describe("IBosonTwinHandler", function () { it("Should ignore twin id set by seller and use nextAccountId on twins entity", async function () { twin.id = "666"; - twin.tokenAddress = bosonToken.address; + twin.tokenAddress = await bosonToken.getAddress(); // Approve twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); await twinHandler.connect(assistant).createTwin(twin); @@ -336,7 +336,7 @@ describe("IBosonTwinHandler", function () { it("protocol is not approved to transfer the ERC20 token", async function () { //ERC20 token address - twin.tokenAddress = bosonToken.address; + twin.tokenAddress = await bosonToken.getAddress(); await expect(twinHandler.connect(assistant).createTwin(twin)).to.revertedWith( RevertReasons.NO_TRANSFER_APPROVED @@ -345,7 +345,7 @@ describe("IBosonTwinHandler", function () { it("protocol is not approved to transfer the ERC721 token", async function () { //ERC721 token address - twin.tokenAddress = foreign721.address; + twin.tokenAddress = await foreign721.getAddress(); await expect(twinHandler.connect(assistant).createTwin(twin)).to.revertedWith( RevertReasons.NO_TRANSFER_APPROVED @@ -354,7 +354,7 @@ describe("IBosonTwinHandler", function () { it("protocol is not approved to transfer the ERC1155 token", async function () { //ERC1155 token address - twin.tokenAddress = foreign1155.address; + twin.tokenAddress = await foreign1155.getAddress(); await expect(twinHandler.connect(assistant).createTwin(twin)).to.revertedWith( RevertReasons.NO_TRANSFER_APPROVED @@ -364,12 +364,12 @@ describe("IBosonTwinHandler", function () { it("supplyAvailable is zero", async function () { // Mint a token and approve twinHandler contract to transfer it await foreign721.connect(assistant).mint(twin.tokenId, "1"); - await foreign721.connect(assistant).setApprovalForAll(twinHandler.address, true); + await foreign721.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); twin.supplyAvailable = "0"; twin.amount = "0"; twin.tokenId = "1"; - twin.tokenAddress = foreign721.address; + twin.tokenAddress = await foreign721.getAddress(); twin.tokenType = TokenType.NonFungibleToken; await expect(twinHandler.connect(assistant).createTwin(twin)).to.be.revertedWith( @@ -379,11 +379,11 @@ describe("IBosonTwinHandler", function () { it("Amount is greater than supply available and token type is FungibleToken", async function () { // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); twin.supplyAvailable = "10"; twin.amount = "20"; - twin.tokenAddress = bosonToken.address; + twin.tokenAddress = await bosonToken.getAddress(); twin.tokenType = TokenType.FungibleToken; await expect(twinHandler.connect(assistant).createTwin(twin)).to.be.revertedWith( @@ -394,11 +394,11 @@ describe("IBosonTwinHandler", function () { it("Amount is greater than supply available and token type is MultiToken", async function () { // Mint a token and approve twinHandler contract to transfer it await foreign1155.connect(assistant).mint(twin.tokenId, "1"); - await foreign1155.connect(assistant).setApprovalForAll(twinHandler.address, true); + await foreign1155.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); twin.supplyAvailable = "10"; twin.amount = "20"; - twin.tokenAddress = foreign1155.address; + twin.tokenAddress = await foreign1155.getAddress(); twin.tokenType = TokenType.MultiToken; await expect(twinHandler.connect(assistant).createTwin(twin)).to.be.revertedWith( @@ -408,10 +408,10 @@ describe("IBosonTwinHandler", function () { it("Amount is zero and token type is FungibleToken", async function () { // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); twin.amount = "0"; - twin.tokenAddress = bosonToken.address; + twin.tokenAddress = await bosonToken.getAddress(); twin.tokenType = TokenType.FungibleToken; await expect(twinHandler.connect(assistant).createTwin(twin)).to.be.revertedWith( @@ -422,10 +422,10 @@ describe("IBosonTwinHandler", function () { it("Amount is zero and token type is MultiToken", async function () { // Mint a token and approve twinHandler contract to transfer it await foreign1155.connect(assistant).mint(twin.tokenId, "1"); - await foreign1155.connect(assistant).setApprovalForAll(twinHandler.address, true); + await foreign1155.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); twin.amount = "0"; - twin.tokenAddress = foreign1155.address; + twin.tokenAddress = await foreign1155.getAddress(); twin.tokenType = TokenType.MultiToken; await expect(twinHandler.connect(assistant).createTwin(twin)).to.be.revertedWith( @@ -434,14 +434,14 @@ describe("IBosonTwinHandler", function () { }); it("Amount is zero and token type is NonFungibleToken", async function () { - twin.tokenAddress = foreign721.address; + twin.tokenAddress = await foreign721.getAddress(); twin.tokenType = TokenType.NonFungibleToken; twin.amount = "1"; twin.tokenId = "1"; // Mint a token and approve twinHandler contract to transfer it await foreign721.connect(assistant).mint(twin.tokenId, "1"); - await foreign721.connect(assistant).setApprovalForAll(twinHandler.address, true); + await foreign721.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); await expect(twinHandler.connect(assistant).createTwin(twin)).to.be.revertedWith( RevertReasons.INVALID_TWIN_PROPERTY @@ -452,12 +452,12 @@ describe("IBosonTwinHandler", function () { twin.supplyAvailable = "10"; twin.amount = "0"; twin.tokenId = "5"; - twin.tokenAddress = foreign721.address; + twin.tokenAddress = await foreign721.getAddress(); twin.tokenType = TokenType.NonFungibleToken; // Mint a token and approve twinHandler contract to transfer it await foreign721.connect(assistant).mint(twin.tokenId, twin.supplyAvailable); - await foreign721.connect(assistant).setApprovalForAll(twinHandler.address, true); + await foreign721.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); // Create first twin with ids range: ["5"..."14"] await twinHandler.connect(assistant).createTwin(twin); @@ -492,10 +492,10 @@ describe("IBosonTwinHandler", function () { it("token address has been used in another twin with unlimited supply", async function () { twin.supplyAvailable = constants.MaxUint256; twin.tokenType = TokenType.NonFungibleToken; - twin.tokenAddress = foreign721.address; + twin.tokenAddress = await foreign721.getAddress(); twin.amount = "0"; - await foreign721.connect(assistant).setApprovalForAll(twinHandler.address, true); + await foreign721.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); // Create twin with unlimited supply await twinHandler.connect(assistant).createTwin(twin); @@ -510,11 +510,11 @@ describe("IBosonTwinHandler", function () { it("Supply range overflow", async function () { twin.supplyAvailable = constants.MaxUint256/10*8.toString(); twin.tokenType = TokenType.NonFungibleToken; - twin.tokenAddress = foreign721.address; + twin.tokenAddress = await foreign721.getAddress(); twin.amount = "0"; twin.tokenId = constants.MaxUint256-twin.supplyAvailable+1.toString(); - await foreign721.connect(assistant).setApprovalForAll(twinHandler.address, true); + await foreign721.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); // Create new twin with same token address await expect(twinHandler.connect(assistant).createTwin(twin)).to.be.revertedWith( @@ -525,11 +525,11 @@ describe("IBosonTwinHandler", function () { it("Token with unlimited supply with starting tokenId to high", async function () { twin.supplyAvailable = constants.MaxUint256.toString(); twin.tokenType = TokenType.NonFungibleToken; - twin.tokenAddress = foreign721.address; + twin.tokenAddress = await foreign721.getAddress(); twin.amount = "0"; twin.tokenId = constants.MaxUint256+1/2+1.toString(); - await foreign721.connect(assistant).setApprovalForAll(twinHandler.address, true); + await foreign721.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); // Create new twin with same token address await expect(twinHandler.connect(assistant).createTwin(twin)).to.be.revertedWith( @@ -547,7 +547,7 @@ describe("IBosonTwinHandler", function () { }); it("Token address is a contract address that does not support the isApprovedForAll", async function () { - twin.tokenAddress = twinHandler.address; + twin.tokenAddress = await twinHandler.getAddress(); await expect(twinHandler.connect(assistant).createTwin(twin)).to.be.revertedWith( RevertReasons.UNSUPPORTED_TOKEN @@ -555,7 +555,7 @@ describe("IBosonTwinHandler", function () { }); it("Token address is a contract that reverts from a fallback method", async function () { - twin.tokenAddress = fallbackError.address; + twin.tokenAddress = await fallbackError.getAddress(); await expect(twinHandler.connect(assistant).createTwin(twin)).to.be.revertedWith( RevertReasons.UNSUPPORTED_TOKEN @@ -563,9 +563,9 @@ describe("IBosonTwinHandler", function () { }); it("Token address is a contract that doesn't implement IERC721 interface when selected token type is NonFungible", async function () { - await bosonToken.connect(assistant).approve(twinHandler.address, 1); + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); twin.tokenType = TokenType.NonFungibleToken; - twin.tokenAddress = bosonToken.address; + twin.tokenAddress = await bosonToken.getAddress(); await expect(twinHandler.connect(assistant).createTwin(twin)).to.be.revertedWith( RevertReasons.INVALID_TOKEN_ADDRESS @@ -573,9 +573,9 @@ describe("IBosonTwinHandler", function () { }); it("Token address is a contract that doesn't implement IERC1155 interface when selected token type is MultiToken", async function () { - await bosonToken.connect(assistant).approve(twinHandler.address, 1); + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); twin.tokenType = TokenType.MultiToken; - twin.tokenAddress = bosonToken.address; + twin.tokenAddress = await bosonToken.getAddress(); await expect(twinHandler.connect(assistant).createTwin(twin)).to.be.revertedWith( RevertReasons.INVALID_TOKEN_ADDRESS @@ -588,7 +588,7 @@ describe("IBosonTwinHandler", function () { context("👉 removeTwin()", async function () { beforeEach(async function () { // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // Create a twin await twinHandler.connect(assistant).createTwin(twin); @@ -602,7 +602,7 @@ describe("IBosonTwinHandler", function () { // Remove the twin, testing for the event. await expect(twinHandler.connect(assistant).removeTwin(twin.id)) .to.emit(twinHandler, "TwinDeleted") - .withArgs(twin.id, twin.sellerId, assistant.address); + .withArgs(twin.id, twin.sellerId, await assistant.getAddress()); // Expect twin to be not found. [success] = await twinHandler.connect(rando).getTwin(twin.id); @@ -611,11 +611,11 @@ describe("IBosonTwinHandler", function () { it("should make twin range available again if token type is NonFungible", async function () { twin.tokenType = TokenType.NonFungibleToken; - twin.tokenAddress = foreign721.address; + twin.tokenAddress = await foreign721.getAddress(); twin.amount = "0"; const expectedNewTwinId = "2"; - await foreign721.connect(assistant).setApprovalForAll(twinHandler.address, true); + await foreign721.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); // Create a twin with range: [0,1499] await twinHandler.connect(assistant).createTwin(twin); @@ -632,7 +632,7 @@ describe("IBosonTwinHandler", function () { // Create a twin with range: [0,1499] let twin1 = twin.clone(); twin1.tokenType = TokenType.NonFungibleToken; - twin1.tokenAddress = foreign721.address; + twin1.tokenAddress = await foreign721.getAddress(); twin1.amount = "0"; twin1.id = "2"; @@ -646,7 +646,7 @@ describe("IBosonTwinHandler", function () { twin3.tokenId = "5000"; twin3.id = "3"; - await foreign721.connect(assistant).setApprovalForAll(twinHandler.address, true); + await foreign721.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); await twinHandler.connect(assistant).createTwin(twin1); await twinHandler.connect(assistant).createTwin(twin2); @@ -731,7 +731,7 @@ describe("IBosonTwinHandler", function () { context("👉 getTwin()", async function () { beforeEach(async function () { // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // Create a twin await twinHandler.connect(assistant).createTwin(twin); @@ -771,7 +771,7 @@ describe("IBosonTwinHandler", function () { context("👉 getNextTwinId()", async function () { beforeEach(async function () { // Create another valid seller. - seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); expect(seller.isValid()).is.true; // AuthToken @@ -780,7 +780,7 @@ describe("IBosonTwinHandler", function () { await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(rando).approve(twinHandler.address, 1); + await bosonToken.connect(rando).approve(await twinHandler.getAddress(), 1); // Create a twin await twinHandler.connect(rando).createTwin(twin); @@ -807,7 +807,7 @@ describe("IBosonTwinHandler", function () { it("should be incremented after a twin is created", async function () { // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // Create another twin await twinHandler.connect(assistant).createTwin(twin); diff --git a/test/protocol/clients/BeaconClientProxy.js b/test/protocol/clients/BeaconClientProxy.js index 20037f986..63565e21a 100644 --- a/test/protocol/clients/BeaconClientProxy.js +++ b/test/protocol/clients/BeaconClientProxy.js @@ -14,7 +14,7 @@ describe("BeaconClientProxy", function () { [protocol, rando] = await getSigners(); // deploy proxy - const protocolClientArgs = [protocol.address]; + const protocolClientArgs = [await protocol.getAddress()]; const [, , proxies] = await deployProtocolClients(protocolClientArgs, maxPriorityFeePerGas); [proxy] = proxies; }); @@ -22,7 +22,7 @@ describe("BeaconClientProxy", function () { context("initializable", function () { context("💔 Revert Reasons", async function () { it("should revert if trying to initialize again", async function () { - await expect(proxy.connect(rando).initialize(rando.address)).to.be.revertedWith( + await expect(proxy.connect(rando).initialize(await rando.getAddress())).to.be.revertedWith( "Initializable: contract is already initialized" ); }); diff --git a/test/protocol/clients/BosonVoucherTest.js b/test/protocol/clients/BosonVoucherTest.js index b9649440b..4fac2e843 100644 --- a/test/protocol/clients/BosonVoucherTest.js +++ b/test/protocol/clients/BosonVoucherTest.js @@ -88,7 +88,7 @@ describe("IBosonVoucher", function () { contractInstances: { accountHandler, offerHandler, exchangeHandler, fundsHandler, configHandler }, extraReturnValues: { bosonVoucher, beacon, accessController }, } = await setupTestEnvironment(contracts, { - forwarderAddress: [forwarder.address], + forwarderAddress: [await forwarder.getAddress()], })); // make all account the same @@ -98,16 +98,16 @@ describe("IBosonVoucher", function () { [deployer] = await getSigners(); // Grant protocol role to eoa so it's easier to test - await accessController.grantRole(Role.PROTOCOL, protocol.address); + await accessController.grantRole(Role.PROTOCOL, await protocol.getAddress()); // Initialize voucher contract const sellerId = 1; // prepare the VoucherInitValues voucherInitValues = mockVoucherInitValues(); - const bosonVoucherInit = await getContractAt("BosonVoucher", bosonVoucher.address); + const bosonVoucherInit = await getContractAt("BosonVoucher", await bosonVoucher.getAddress()); - await bosonVoucherInit.initializeVoucher(sellerId, assistant.address, voucherInitValues); + await bosonVoucherInit.initializeVoucher(sellerId, await assistant.getAddress(), voucherInitValues); [foreign20] = await deployMockTokens(["Foreign20", "BosonToken"]); @@ -141,19 +141,19 @@ describe("IBosonVoucher", function () { context("General", async function () { it("Contract can receive native token", async function () { - const balanceBefore = await provider.getBalance(bosonVoucher.address); + const balanceBefore = await provider.getBalance(await bosonVoucher.getAddress()); const amount = parseUnits("1", "ether"); - await admin.sendTransaction({ to: bosonVoucher.address, value: amount }); + await admin.sendTransaction({ to: await bosonVoucher.getAddress(), value: amount }); - const balanceAfter = await provider.getBalance(bosonVoucher.address); + const balanceAfter = await provider.getBalance(await bosonVoucher.getAddress()); expect(balanceAfter-balanceBefore).to.eq(amount); }); it("Cannot initialize voucher twice", async function () { - const initalizableClone = await getContractAt("IInitializableVoucherClone", bosonVoucher.address); - await expect(initalizableClone.initializeVoucher(2, assistant.address, voucherInitValues)).to.be.revertedWith( + const initalizableClone = await getContractAt("IInitializableVoucherClone", await bosonVoucher.getAddress()); + await expect(initalizableClone.initializeVoucher(2, await assistant.getAddress(), voucherInitValues)).to.be.revertedWith( RevertReasons.INITIALIZABLE_ALREADY_INITIALIZED ); }); @@ -164,7 +164,7 @@ describe("IBosonVoucher", function () { let buyerWallet; beforeEach(function () { - buyerStruct = mockBuyer(buyer.address).toStruct(); + buyerStruct = mockBuyer(await buyer.getAddress()).toStruct(); buyerWallet = buyerStruct[1]; }); @@ -174,10 +174,10 @@ describe("IBosonVoucher", function () { }); it("should issue a voucher with success", async function () { - const balanceBefore = await bosonVoucher.balanceOf(buyer.address); + const balanceBefore = await bosonVoucher.balanceOf(await buyer.getAddress()); await bosonVoucher.connect(protocol).issueVoucher(0, buyerWallet); - const balanceAfter = await bosonVoucher.balanceOf(buyer.address); + const balanceAfter = await bosonVoucher.balanceOf(await buyer.getAddress()); expect(balanceAfter-balanceBefore).eq(1); }); @@ -192,7 +192,7 @@ describe("IBosonVoucher", function () { await deployMockProtocol(); // Reserve a range - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, assistant.address); + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); // Token id just below the range await expect(() => @@ -213,12 +213,12 @@ describe("IBosonVoucher", function () { ); // Grant PROTOCOL role to random user address - await accessController.grantRole(Role.PROTOCOL, rando.address); + await accessController.grantRole(Role.PROTOCOL, await rando.getAddress()); // Attempt to issue voucher again as a random user - const balanceBefore = await bosonVoucher.balanceOf(buyer.address); + const balanceBefore = await bosonVoucher.balanceOf(await buyer.getAddress()); await bosonVoucher.connect(rando).issueVoucher(0, buyerWallet); - const balanceAfter = await bosonVoucher.balanceOf(buyer.address); + const balanceAfter = await bosonVoucher.balanceOf(await buyer.getAddress()); expect(balanceAfter-balanceBefore).eq(1); }); @@ -233,7 +233,7 @@ describe("IBosonVoucher", function () { await deployMockProtocol(); // Reserve a range - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, assistant.address); + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); // Expect revert if random user attempts to issue voucher await expect(bosonVoucher.connect(protocol).issueVoucher(tokenId, buyerWallet)).to.be.revertedWith( @@ -253,19 +253,19 @@ describe("IBosonVoucher", function () { length = "123"; const tokenStartId = deriveTokenId(offerId, start); - range = new Range(tokenStartId.toString(), length, "0", "0", assistant.address); + range = new Range(tokenStartId.toString(), length, "0", "0", await assistant.getAddress()); }); it("Should emit event RangeReserved", async function () { // Reserve range, test for event - await expect(bosonVoucher.connect(protocol).reserveRange(offerId, start, length, assistant.address)) + await expect(bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress())) .to.emit(bosonVoucher, "RangeReserved") .withArgs(offerId, range.toStruct()); }); it("Should update state", async function () { // Reserve range - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, assistant.address); + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); // Get range object from contract const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); @@ -292,19 +292,19 @@ describe("IBosonVoucher", function () { context("Owner range is contract", async function () { beforeEach(async function () { - range.owner = bosonVoucher.address; + range.owner = await bosonVoucher.getAddress(); }); it("Should emit event RangeReserved", async function () { // Reserve range, test for event - await expect(bosonVoucher.connect(protocol).reserveRange(offerId, start, length, bosonVoucher.address)) + await expect(bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await bosonVoucher.getAddress())) .to.emit(bosonVoucher, "RangeReserved") .withArgs(offerId, range.toStruct()); }); it("Should update state", async function () { // Reserve range - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, bosonVoucher.address); + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await bosonVoucher.getAddress()); // Get range object from contract const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); @@ -333,7 +333,7 @@ describe("IBosonVoucher", function () { context("💔 Revert Reasons", async function () { it("caller does not have PROTOCOL role", async function () { await expect( - bosonVoucher.connect(rando).reserveRange(offerId, start, length, assistant.address) + bosonVoucher.connect(rando).reserveRange(offerId, start, length, await assistant.getAddress()) ).to.be.revertedWith(RevertReasons.ACCESS_DENIED); }); @@ -343,7 +343,7 @@ describe("IBosonVoucher", function () { // Try to reserve range, it should fail await expect( - bosonVoucher.connect(protocol).reserveRange(offerId, start, length, assistant.address) + bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()) ).to.be.revertedWith(RevertReasons.INVALID_RANGE_START); }); @@ -353,7 +353,7 @@ describe("IBosonVoucher", function () { // Try to reserve range, it should fail await expect( - bosonVoucher.connect(protocol).reserveRange(offerId, start, length, assistant.address) + bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()) ).to.be.revertedWith(RevertReasons.INVALID_RANGE_LENGTH); }); @@ -364,26 +364,26 @@ describe("IBosonVoucher", function () { // Try to reserve range, it should fail await expect( - bosonVoucher.connect(protocol).reserveRange(offerId, start, length, assistant.address) + bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()) ).to.be.revertedWith(RevertReasons.INVALID_RANGE_LENGTH); }); it("Offer id is already associated with a range", async function () { // Reserve range for an offer - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, assistant.address); + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); start = Number(start) + Number(length) + 1; // Try to reserve range for the same offer, it should fail await expect( - bosonVoucher.connect(protocol).reserveRange(offerId, start, length, assistant.address) + bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()) ).to.be.revertedWith(RevertReasons.OFFER_RANGE_ALREADY_RESERVED); }); it("_to address isn't contract address or contract owner address", async function () { // Try to reserve range for rando address, it should fail await expect( - bosonVoucher.connect(protocol).reserveRange(offerId, start, length, rando.address) + bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await rando.getAddress()) ).to.be.revertedWith(RevertReasons.INVALID_TO_ADDRESS); }); }); @@ -412,7 +412,7 @@ describe("IBosonVoucher", function () { offerId = "5"; start = 10; length = "1000"; - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, assistant.address); + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); // amount to mint amount = 50; @@ -427,7 +427,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(ZeroAddress, assistant.address, start+i); + .withArgs(ZeroAddress, await assistant.getAddress(), start+i); } }); @@ -455,7 +455,7 @@ describe("IBosonVoucher", function () { // reserve a range start = "1010"; length = "1000"; - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, bosonVoucher.address); + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await bosonVoucher.getAddress()); }); it("Transfer event should emit contract address", async function () { @@ -467,12 +467,12 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(ZeroAddress, bosonVoucher.address, start+i); + .withArgs(ZeroAddress, await bosonVoucher.getAddress(), start+i); } }); it("Should update state", async function () { - let contractBalanceBefore = await bosonVoucher.balanceOf(bosonVoucher.address); + let contractBalanceBefore = await bosonVoucher.balanceOf(await bosonVoucher.getAddress()); // Premint tokens await bosonVoucher.connect(assistant).preMint(offerId, amount); @@ -482,7 +482,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { let tokenId = start+i; let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, bosonVoucher.address, `Wrong token owner for token ${tokenId}`); + assert.equal(tokenOwner, await bosonVoucher.getAddress(), `Wrong token owner for token ${tokenId}`); } // Token that is inside a range, but wasn't preminted yet should not have an owner @@ -491,7 +491,7 @@ describe("IBosonVoucher", function () { ); // Contract's balance should be updated for the total mint amount - let contractBalanceAfter = await bosonVoucher.balanceOf(bosonVoucher.address); + let contractBalanceAfter = await bosonVoucher.balanceOf(await bosonVoucher.getAddress()); assert.equal(contractBalanceAfter.toNumber(), contractBalanceBefore+amount.toNumber(), "Balance mismatch"); // Get available premints from contract @@ -501,7 +501,7 @@ describe("IBosonVoucher", function () { }); it("Should update state", async function () { - let sellerBalanceBefore = await bosonVoucher.balanceOf(assistant.address); + let sellerBalanceBefore = await bosonVoucher.balanceOf(await assistant.getAddress()); // Premint tokens await bosonVoucher.connect(assistant).preMint(offerId, amount); @@ -511,7 +511,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { let tokenId = start+i; let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, assistant.address, `Wrong token owner for token ${tokenId}`); + assert.equal(tokenOwner, await assistant.getAddress(), `Wrong token owner for token ${tokenId}`); } // Token that is inside a range, but wasn't preminted yet should not have an owner @@ -520,7 +520,7 @@ describe("IBosonVoucher", function () { ); // Seller's balance should be updated for the total mint amount - let sellerBalanceAfter = await bosonVoucher.balanceOf(assistant.address); + let sellerBalanceAfter = await bosonVoucher.balanceOf(await assistant.getAddress()); assert.equal(sellerBalanceAfter.toNumber(), sellerBalanceBefore+amount.toNumber(), "Balance mismatch"); // Get available premints from contract @@ -529,7 +529,7 @@ describe("IBosonVoucher", function () { }); it("MetaTx: forwarder can execute preMint on behalf of seller", async function () { - const nonce = Number(await forwarder.getNonce(assistant.address)); + const nonce = Number(await forwarder.getNonce(await assistant.getAddress())); const types = { ForwardRequest: [ @@ -543,8 +543,8 @@ describe("IBosonVoucher", function () { const functionSignature = bosonVoucher.interface.encodeFunctionData("preMint", [offerId, amount]); const message = { - from: assistant.address, - to: bosonVoucher.address, + from: await assistant.getAddress(), + to: await bosonVoucher.getAddress(), nonce: nonce, data: functionSignature, }; @@ -554,7 +554,7 @@ describe("IBosonVoucher", function () { types, "ForwardRequest", message, - forwarder.address, + await forwarder.getAddress(), "MockForwarder", "0.0.1", "0Z" @@ -567,7 +567,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(ZeroAddress, assistant.address, start+i); + .withArgs(ZeroAddress, await assistant.getAddress(), start+i); } }); @@ -664,7 +664,7 @@ describe("IBosonVoucher", function () { // reserve a range start = "10"; length = "1000"; - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, assistant.address); + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); // amount to mint amount = "5"; @@ -689,12 +689,12 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(assistant.address, ZeroAddress, start+i); + .withArgs(await assistant.getAddress(), ZeroAddress, start+i); } }); it("Should update state", async function () { - let sellerBalanceBefore = await bosonVoucher.balanceOf(assistant.address); + let sellerBalanceBefore = await bosonVoucher.balanceOf(await assistant.getAddress()); // Burn tokens await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); @@ -707,7 +707,7 @@ describe("IBosonVoucher", function () { } // Seller's balance should be decreased for the total burn amount - let sellerBalanceAfter = await bosonVoucher.balanceOf(assistant.address); + let sellerBalanceAfter = await bosonVoucher.balanceOf(await assistant.getAddress()); assert.equal(sellerBalanceAfter.toNumber(), sellerBalanceBefore-amount.toNumber(), "Balance mismatch"); // Get available premints from contract @@ -717,7 +717,7 @@ describe("IBosonVoucher", function () { // Last burned id should be updated const tokenIdStart = deriveTokenId(offerId, start); const lastBurnedId = tokenIdStart+amount - 1; - const range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), assistant.address); + const range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), await assistant.getAddress()); const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); }); @@ -725,7 +725,7 @@ describe("IBosonVoucher", function () { context("Contract owner is not owner of preminted vouchers", function () { it("Ownership is transferred", async function () { // Transfer ownership to rando - await bosonVoucher.connect(protocol).transferOwnership(rando.address); + await bosonVoucher.connect(protocol).transferOwnership(await rando.getAddress()); // Burn tokens, test for event let tx; @@ -743,7 +743,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(assistant.address, ZeroAddress, tokenIdStart+i); + .withArgs(await assistant.getAddress(), ZeroAddress, tokenIdStart+i); } }); @@ -757,7 +757,7 @@ describe("IBosonVoucher", function () { // reserve a range start = "2000"; - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, bosonVoucher.address); + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await bosonVoucher.getAddress()); // amount to mint amount = "10"; @@ -785,7 +785,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(bosonVoucher.address, ZeroAddress, tokenIdStart+i); + .withArgs(await bosonVoucher.getAddress(), ZeroAddress, tokenIdStart+i); } }); }); @@ -800,7 +800,7 @@ describe("IBosonVoucher", function () { // Last burned id should be updated const tokenIdStart = deriveTokenId(offerId, start); const lastBurnedId = tokenIdStart+amount - 1; - const range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), assistant.address); + const range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), await assistant.getAddress()); const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); @@ -836,7 +836,7 @@ describe("IBosonVoucher", function () { // Last burned id should be updated const tokenIdStart = deriveTokenId(offerId, start); let lastBurnedId = tokenIdStart+maxPremintedVouchers - 1; - let range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), assistant.address); + let range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), await assistant.getAddress()); let returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); @@ -852,7 +852,7 @@ describe("IBosonVoucher", function () { // Last burned id should be updated lastBurnedId = tokenIdStart+amount - 1; - range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), assistant.address); + range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), await assistant.getAddress()); returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); @@ -875,7 +875,7 @@ describe("IBosonVoucher", function () { await mockProtocol.mock.commitToPreMintedOffer.returns(); await Promise.all( committedVouchers.map((tokenId) => - bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId) + bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) ) ); @@ -896,12 +896,12 @@ describe("IBosonVoucher", function () { let tokenId = startId+i.toString(); if (committedVouchers.includes(tokenId)) { // Check that owner is buyer. - expect(await bosonVoucher.ownerOf(tokenId)).to.equal(buyer.address); + expect(await bosonVoucher.ownerOf(tokenId)).to.equal(await buyer.getAddress()); } else { // Check that Transfer event was emitted and owner does not exist anymore await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(assistant.address, ZeroAddress, tokenId); + .withArgs(await assistant.getAddress(), ZeroAddress, tokenId); await expect(bosonVoucher.ownerOf(tokenId)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); } } @@ -909,7 +909,7 @@ describe("IBosonVoucher", function () { // Last burned id should be updated const tokenIdStart = deriveTokenId(offerId, start); const lastBurnedId = tokenIdStart+amount - 1; - const range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), assistant.address); + const range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), await assistant.getAddress()); const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); }); @@ -934,7 +934,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(assistant.address, ZeroAddress, start+i); + .withArgs(await assistant.getAddress(), ZeroAddress, start+i); } }); @@ -991,7 +991,7 @@ describe("IBosonVoucher", function () { offerId = "5"; start = "10"; length = "1000"; - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, assistant.address); + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); // amount to mint amount = 50; @@ -1091,9 +1091,9 @@ describe("IBosonVoucher", function () { length = "1000"; const tokenIdStart = deriveTokenId(offerId, start); - range = new Range(tokenIdStart.toString(), length, "0", "0", assistant.address); + range = new Range(tokenIdStart.toString(), length, "0", "0", await assistant.getAddress()); - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, assistant.address); + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); const mockProtocol = await deployMockProtocol(); const { offer, offerDates, offerDurations, offerFees } = await mockOffer(); @@ -1140,11 +1140,11 @@ describe("IBosonVoucher", function () { it("Returns true owner if token exists", async function () { let tokenId = "100000"; // Issue ordinary voucher - await bosonVoucher.connect(protocol).issueVoucher(tokenId, buyer.address); + await bosonVoucher.connect(protocol).issueVoucher(tokenId, await buyer.getAddress()); // Token owner should be the buyer let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, buyer.address, "Token owner mismatch"); + assert.equal(tokenOwner, await buyer.getAddress(), "Token owner mismatch"); }); context("💔 Revert Reasons", async function () { @@ -1163,7 +1163,7 @@ describe("IBosonVoucher", function () { offerId = "5"; start = "10"; length = "150"; - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, assistant.address); + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); mockProtocol = await deployMockProtocol(); ({ offer, offerDates, offerDurations, offerFees } = await mockOffer()); @@ -1190,11 +1190,11 @@ describe("IBosonVoucher", function () { await mockProtocol.mock.getExchange.withArgs(tokenId).returns(true, mockExchange({ offerId }), mockVoucher()); // Issue ordinary voucher - await bosonVoucher.connect(protocol).issueVoucher(tokenId, buyer.address); + await bosonVoucher.connect(protocol).issueVoucher(tokenId, await buyer.getAddress()); // Token owner should be the buyer let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, buyer.address, "Token owner mismatch"); + assert.equal(tokenOwner, await buyer.getAddress(), "Token owner mismatch"); }); it("Returns true owner if token exists - via preminted voucher transfer.", async function () { @@ -1207,11 +1207,11 @@ describe("IBosonVoucher", function () { await mockProtocol.mock.commitToPreMintedOffer.returns(); // Transfer preminted token - await bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId); + await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); // Token owner should be the buyer let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, buyer.address, "Token owner mismatch"); + assert.equal(tokenOwner, await buyer.getAddress(), "Token owner mismatch"); }); it("Returns seller if token is preminted and not transferred yet", async function () { @@ -1220,7 +1220,7 @@ describe("IBosonVoucher", function () { let endTokenId = startTokenId+amount; for (let i = startTokenId; i.lt(endTokenId); i = i+1) { let tokenOwner = await bosonVoucher.ownerOf(i); - assert.equal(tokenOwner, assistant.address, `Token owner mismatch ${i.toString()}`); + assert.equal(tokenOwner, await assistant.getAddress(), `Token owner mismatch ${i.toString()}`); } }); @@ -1240,7 +1240,7 @@ describe("IBosonVoucher", function () { start = previousStartId + length + 100; // reserve length - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, assistant.address); + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); // amount to premint amount = length - i * 30; @@ -1268,7 +1268,7 @@ describe("IBosonVoucher", function () { } else if (i <= currentRangeMintEndId) { // tokenId in range and minted. Seller should be the owner let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, assistant.address, `Token owner mismatch ${tokenId.toString()}`); + assert.equal(tokenOwner, await assistant.getAddress(), `Token owner mismatch ${tokenId.toString()}`); } else if (i <= currentRangeEndId) { // tokenId still in range, but not minted yet await expect(bosonVoucher.connect(rando).ownerOf(tokenId)).to.be.revertedWith( @@ -1300,7 +1300,7 @@ describe("IBosonVoucher", function () { let nextAmount = "5"; // reserve length - await bosonVoucher.connect(protocol).reserveRange(nextOfferId, nextStartId, nextLength, assistant.address); + await bosonVoucher.connect(protocol).reserveRange(nextOfferId, nextStartId, nextLength, await assistant.getAddress()); // amount to premint await bosonVoucher.connect(assistant).preMint(nextOfferId, nextAmount); @@ -1310,7 +1310,7 @@ describe("IBosonVoucher", function () { let endTokenId = startTokenId+amount; for (let i = startTokenId; i.lt(endTokenId); i = i+1) { let tokenOwner = await bosonVoucher.ownerOf(i); - assert.equal(tokenOwner, assistant.address, `Token owner mismatch ${i.toString()}`); + assert.equal(tokenOwner, await assistant.getAddress(), `Token owner mismatch ${i.toString()}`); } // First range - not preminted tokens @@ -1326,7 +1326,7 @@ describe("IBosonVoucher", function () { endTokenId = startTokenId+nextAmount; for (let i = startTokenId; i.lt(endTokenId); i = i+1) { let tokenOwner = await bosonVoucher.ownerOf(i); - assert.equal(tokenOwner, assistant.address, `Token owner mismatch ${i.toString()}`); + assert.equal(tokenOwner, await assistant.getAddress(), `Token owner mismatch ${i.toString()}`); } // Second range - not preminted tokens @@ -1368,14 +1368,14 @@ describe("IBosonVoucher", function () { // Token owner should be the seller let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, assistant.address, "Token owner mismatch"); + assert.equal(tokenOwner, await assistant.getAddress(), "Token owner mismatch"); // Transfer preminted token - await bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId); + await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); // Token owner should be the buyer tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, buyer.address, "Token owner mismatch"); + assert.equal(tokenOwner, await buyer.getAddress(), "Token owner mismatch"); // Simulate burn await bosonVoucher.connect(protocol).burnVoucher(tokenId); @@ -1392,7 +1392,7 @@ describe("IBosonVoucher", function () { // Token owner should be the seller let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, assistant.address, "Token owner mismatch"); + assert.equal(tokenOwner, await assistant.getAddress(), "Token owner mismatch"); // Void the offer offer.voided = true; @@ -1439,7 +1439,7 @@ describe("IBosonVoucher", function () { }; beforeEach(async function () { - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); // Prepare the AuthToken and VoucherInitValues emptyAuthToken = mockAuthToken(); @@ -1450,10 +1450,10 @@ describe("IBosonVoucher", function () { // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); @@ -1491,78 +1491,78 @@ describe("IBosonVoucher", function () { .depositFunds(seller.id, ZeroAddress, offer.sellerDeposit, { value: offer.sellerDeposit, }); - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offer.id, { value: offer.price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offer.id, { value: offer.price }); exchangeId = offerId = "1"; tokenId = deriveTokenId(offerId, exchangeId); mockBuyer(); // call it just so accountId is correct // Update boson voucher address to actual seller's voucher - const voucherAddress = calculateContractAddress(accountHandler.address, "1"); + const voucherAddress = calculateContractAddress(await accountHandler.getAddress(), "1"); bosonVoucher = await getContractAt("BosonVoucher", voucherAddress); }); it("Should emit a Transfer event", async function () { await expect( - bosonVoucher.connect(buyer)[selector](buyer.address, rando.address, tokenId, ...additionalArgs) + bosonVoucher.connect(buyer)[selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ) .to.emit(bosonVoucher, "Transfer") - .withArgs(buyer.address, rando.address, tokenId); + .withArgs(await buyer.getAddress(), await rando.getAddress(), tokenId); }); it("Should update state", async function () { // Before transfer, buyer should be the owner let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, buyer.address, "Buyer is not the owner"); + assert.equal(tokenOwner, await buyer.getAddress(), "Buyer is not the owner"); - await bosonVoucher.connect(buyer)[selector](buyer.address, rando.address, tokenId, ...additionalArgs); + await bosonVoucher.connect(buyer)[selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); // After transfer, rando should be the owner tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, rando.address, "Rando is not the owner"); + assert.equal(tokenOwner, await rando.getAddress(), "Rando is not the owner"); }); it("Should call onVoucherTransferred", async function () { const randoBuyer = mockBuyer(); await expect( - bosonVoucher.connect(buyer)[selector](buyer.address, rando.address, tokenId, ...additionalArgs) + bosonVoucher.connect(buyer)[selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ) .to.emit(exchangeHandler, "VoucherTransferred") - .withArgs(offerId, exchangeId, randoBuyer.id, bosonVoucher.address); + .withArgs(offerId, exchangeId, randoBuyer.id, await bosonVoucher.getAddress()); }); it("Transfer on behalf of should work normally", async function () { // Approve another address to transfer the voucher - await bosonVoucher.connect(buyer).setApprovalForAll(rando2.address, true); + await bosonVoucher.connect(buyer).setApprovalForAll(await rando2.getAddress(), true); await expect( - bosonVoucher.connect(rando2)[selector](buyer.address, rando.address, tokenId, ...additionalArgs) + bosonVoucher.connect(rando2)[selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ) .to.emit(bosonVoucher, "Transfer") - .withArgs(buyer.address, rando.address, tokenId); + .withArgs(await buyer.getAddress(), await rando.getAddress(), tokenId); }); it("If seller is the true owner of voucher, transfer should work same as for others", async function () { mockBuyer(); // Call to properly update nextAccountId - await bosonVoucher.connect(buyer)[selector](buyer.address, assistant.address, tokenId, ...additionalArgs); + await bosonVoucher.connect(buyer)[selector](await buyer.getAddress(), await assistant.getAddress(), tokenId, ...additionalArgs); const tx = await bosonVoucher .connect(assistant) - [selector](assistant.address, rando.address, tokenId, ...additionalArgs); + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); - await expect(tx).to.emit(bosonVoucher, "Transfer").withArgs(assistant.address, rando.address, tokenId); + await expect(tx).to.emit(bosonVoucher, "Transfer").withArgs(await assistant.getAddress(), await rando.getAddress(), tokenId); const randoBuyer = mockBuyer(); await expect(tx) .to.emit(exchangeHandler, "VoucherTransferred") - .withArgs(offerId, exchangeId, randoBuyer.id, bosonVoucher.address); + .withArgs(offerId, exchangeId, randoBuyer.id, await bosonVoucher.getAddress()); }); context("💔 Revert Reasons", async function () { it("From does not own the voucher", async function () { await expect( - bosonVoucher.connect(rando)[selector](assistant.address, rando.address, tokenId, ...additionalArgs) + bosonVoucher.connect(rando)[selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ).to.be.revertedWith(RevertReasons.ERC721_CALLER_NOT_OWNER_OR_APPROVED); }); }); @@ -1585,7 +1585,7 @@ describe("IBosonVoucher", function () { ); // Reserve range to assistant - await offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, assistant.address); + await offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, await assistant.getAddress()); // Pool needs to cover both seller deposit and price const pool = BigInt(offer.sellerDeposit)+offer.price; await fundsHandler.connect(admin).depositFunds(seller.id, ZeroAddress, pool, { @@ -1600,7 +1600,7 @@ describe("IBosonVoucher", function () { tokenId = deriveTokenId(offerId, exchangeId); // Update boson voucher address to actual seller's voucher - const voucherAddress = calculateContractAddress(accountHandler.address, "1"); + const voucherAddress = calculateContractAddress(await accountHandler.getAddress(), "1"); bosonVoucher = await getContractAt("BosonVoucher", voucherAddress); // amount to premint @@ -1609,31 +1609,31 @@ describe("IBosonVoucher", function () { it("Should emit a Transfer event", async function () { await expect( - bosonVoucher.connect(assistant)[selector](assistant.address, rando.address, tokenId, ...additionalArgs) + bosonVoucher.connect(assistant)[selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ) .to.emit(bosonVoucher, "Transfer") - .withArgs(assistant.address, rando.address, tokenId); + .withArgs(await assistant.getAddress(), await rando.getAddress(), tokenId); }); it("Should update state", async function () { // Before transfer, seller should be the owner let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, assistant.address, "Seller is not the owner"); + assert.equal(tokenOwner, await assistant.getAddress(), "Seller is not the owner"); await bosonVoucher .connect(assistant) - [selector](assistant.address, rando.address, tokenId, ...additionalArgs); + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); // After transfer, rando should be the owner tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, rando.address, "Rando is not the owner"); + assert.equal(tokenOwner, await rando.getAddress(), "Rando is not the owner"); }); it("Should call commitToPreMintedOffer", async function () { const randoBuyer = mockBuyer(); const tx = await bosonVoucher .connect(assistant) - [selector](assistant.address, rando.address, tokenId, ...additionalArgs); + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); // Get the block timestamp of the confirmed tx const blockNumber = tx.blockNumber; @@ -1656,7 +1656,7 @@ describe("IBosonVoucher", function () { exchangeId, exchange.toStruct(), voucher.toStruct(), - bosonVoucher.address + await bosonVoucher.getAddress() ); }); @@ -1664,34 +1664,34 @@ describe("IBosonVoucher", function () { // First transfer should call commitToPreMintedOffer, and not onVoucherTransferred let tx = await bosonVoucher .connect(assistant) - [selector](assistant.address, rando.address, tokenId, ...additionalArgs); + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); await expect(tx).to.emit(exchangeHandler, "BuyerCommitted"); await expect(tx).to.not.emit(exchangeHandler, "VoucherTransferred"); // Second transfer should call onVoucherTransferred, and not commitToPreMintedOffer tx = await bosonVoucher .connect(rando) - [selector](rando.address, assistant.address, tokenId, ...additionalArgs); + [selector](await rando.getAddress(), await assistant.getAddress(), tokenId, ...additionalArgs); await expect(tx).to.emit(exchangeHandler, "VoucherTransferred"); await expect(tx).to.not.emit(exchangeHandler, "BuyerCommitted"); // Next transfer should call onVoucherTransferred, and not commitToPreMintedOffer, even if seller is the owner tx = await bosonVoucher .connect(assistant) - [selector](assistant.address, rando.address, tokenId, ...additionalArgs); + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); await expect(tx).to.emit(exchangeHandler, "VoucherTransferred"); await expect(tx).to.not.emit(exchangeHandler, "BuyerCommitted"); }); it("Transfer on behalf of should work normally", async function () { // Approve another address to transfer the voucher - await bosonVoucher.connect(assistant).setApprovalForAll(rando2.address, true); + await bosonVoucher.connect(assistant).setApprovalForAll(await rando2.getAddress(), true); await expect( - bosonVoucher.connect(rando2)[selector](assistant.address, rando.address, tokenId, ...additionalArgs) + bosonVoucher.connect(rando2)[selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ) .to.emit(bosonVoucher, "Transfer") - .withArgs(assistant.address, rando.address, tokenId); + .withArgs(await assistant.getAddress(), await rando.getAddress(), tokenId); }); context("💔 Revert Reasons", async function () { @@ -1699,18 +1699,18 @@ describe("IBosonVoucher", function () { // Make first transfer await bosonVoucher .connect(assistant) - [selector](assistant.address, buyer.address, tokenId, ...additionalArgs); + [selector](await assistant.getAddress(), await buyer.getAddress(), tokenId, ...additionalArgs); // Second transfer should fail, since voucher has an owner await expect( - bosonVoucher.connect(assistant)[selector](assistant.address, rando.address, tokenId, ...additionalArgs) + bosonVoucher.connect(assistant)[selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ).to.be.revertedWith(RevertReasons.ERC721_CALLER_NOT_OWNER_OR_APPROVED); }); it("Transfer preminted voucher, which was committed and burned already", async function () { await bosonVoucher .connect(assistant) - [selector](assistant.address, buyer.address, tokenId, ...additionalArgs); + [selector](await assistant.getAddress(), await buyer.getAddress(), tokenId, ...additionalArgs); // Redeem voucher, effectively burning it await setNextBlockTimestamp(BigInt(voucherRedeemableFrom).toHexString()); @@ -1718,7 +1718,7 @@ describe("IBosonVoucher", function () { // Transfer should fail, since voucher has been burned await expect( - bosonVoucher.connect(assistant)[selector](assistant.address, rando.address, tokenId, ...additionalArgs) + bosonVoucher.connect(assistant)[selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); }); @@ -1731,7 +1731,7 @@ describe("IBosonVoucher", function () { // None of reserved but not preminted tokens should have an owner await expect( - bosonVoucher.connect(assistant)[selector](assistant.address, rando.address, tokenId, ...additionalArgs) + bosonVoucher.connect(assistant)[selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); }); @@ -1741,7 +1741,7 @@ describe("IBosonVoucher", function () { // Transfer should fail, since protocol reverts await expect( - bosonVoucher.connect(assistant)[selector](assistant.address, rando.address, tokenId, ...additionalArgs) + bosonVoucher.connect(assistant)[selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ).to.be.revertedWith(RevertReasons.OFFER_HAS_BEEN_VOIDED); }); @@ -1751,23 +1751,23 @@ describe("IBosonVoucher", function () { // Transfer should fail, since protocol reverts await expect( - bosonVoucher.connect(assistant)[selector](assistant.address, rando.address, tokenId, ...additionalArgs) + bosonVoucher.connect(assistant)[selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ).to.be.revertedWith(RevertReasons.OFFER_HAS_EXPIRED); }); it("Transfer preminted voucher, but from is not the voucher owner", async function () { await bosonVoucher .connect(assistant) - [selector](assistant.address, rando.address, tokenId, ...additionalArgs); + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); // next token id. Make sure that assistant is the owner tokenId = tokenId+1; let tokenOwner = await bosonVoucher.ownerOf(tokenId.toString()); - assert.equal(tokenOwner, assistant.address, "Seller is not the owner"); + assert.equal(tokenOwner, await assistant.getAddress(), "Seller is not the owner"); // Following call should fail, since rando is not the owner of preminted voucher await expect( - bosonVoucher.connect(rando)[selector](rando.address, rando.address, tokenId, ...additionalArgs) + bosonVoucher.connect(rando)[selector](await rando.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ).to.be.revertedWith(RevertReasons.NO_SILENT_MINT_ALLOWED); }); }); @@ -1790,11 +1790,11 @@ describe("IBosonVoucher", function () { ); // Update boson voucher address to actual seller's voucher - const voucherAddress = calculateContractAddress(accountHandler.address, "1"); + const voucherAddress = calculateContractAddress(await accountHandler.getAddress(), "1"); bosonVoucher = await getContractAt("BosonVoucher", voucherAddress); // Reserve range to contract - await offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, bosonVoucher.address); + await offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, await bosonVoucher.getAddress()); // Pool needs to cover both seller deposit and price const pool = BigInt(offer.sellerDeposit)+offer.price; @@ -1812,13 +1812,13 @@ describe("IBosonVoucher", function () { it("If voucher contract is the owner of voucher, transfer on behalf of should work normally", async function () { // Approve another address to transfer the voucher - await bosonVoucher.connect(assistant).setApprovalForAllToContract(rando2.address, true); + await bosonVoucher.connect(assistant).setApprovalForAllToContract(await rando2.getAddress(), true); const tx = await bosonVoucher .connect(rando2) - [selector](bosonVoucher.address, rando.address, tokenId, ...additionalArgs); + [selector](await bosonVoucher.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); - await expect(tx).to.emit(bosonVoucher, "Transfer").withArgs(bosonVoucher.address, rando.address, tokenId); + await expect(tx).to.emit(bosonVoucher, "Transfer").withArgs(await bosonVoucher.getAddress(), await rando.getAddress(), tokenId); }); }); }); @@ -1832,15 +1832,15 @@ describe("IBosonVoucher", function () { }); it("should burn a voucher with success", async function () { - const buyerStruct = mockBuyer(buyer.address).toStruct(); + const buyerStruct = mockBuyer(await buyer.getAddress()).toStruct(); const buyerWallet = buyerStruct[1]; await bosonVoucher.connect(protocol).issueVoucher(0, buyerWallet); - const balanceBefore = await bosonVoucher.balanceOf(buyer.address); + const balanceBefore = await bosonVoucher.balanceOf(await buyer.getAddress()); await bosonVoucher.connect(protocol).burnVoucher(0); - const balanceAfter = await bosonVoucher.balanceOf(buyer.address); + const balanceAfter = await bosonVoucher.balanceOf(await buyer.getAddress()); expect(balanceBefore-balanceAfter).eq(1); }); @@ -1850,17 +1850,17 @@ describe("IBosonVoucher", function () { await expect(bosonVoucher.connect(rando).burnVoucher(0)).to.be.revertedWith(RevertReasons.ACCESS_DENIED); // Grant PROTOCOL role to random user address - await accessController.grantRole(Role.PROTOCOL, rando.address); + await accessController.grantRole(Role.PROTOCOL, await rando.getAddress()); // Prepare to burn voucher as a random user - const buyerStruct = mockBuyer(buyer.address).toStruct(); + const buyerStruct = mockBuyer(await buyer.getAddress()).toStruct(); const buyerWallet = buyerStruct[1]; await bosonVoucher.connect(protocol).issueVoucher(0, buyerWallet); - const balanceBefore = await bosonVoucher.balanceOf(buyer.address); + const balanceBefore = await bosonVoucher.balanceOf(await buyer.getAddress()); //Attempt to burn voucher as a random user await bosonVoucher.connect(protocol).burnVoucher(0); - const balanceAfter = await bosonVoucher.balanceOf(buyer.address); + const balanceAfter = await bosonVoucher.balanceOf(await buyer.getAddress()); expect(balanceBefore-balanceAfter).eq(1); }); @@ -1871,7 +1871,7 @@ describe("IBosonVoucher", function () { let bosonVoucher; beforeEach(async function () { - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); // prepare the VoucherInitValues voucherInitValues = mockVoucherInitValues(); @@ -1887,10 +1887,10 @@ describe("IBosonVoucher", function () { // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -1921,7 +1921,7 @@ describe("IBosonVoucher", function () { metadataUri = offer.metadataUri; // Update boson voucher address to actual seller's voucher - const voucherAddress = calculateContractAddress(accountHandler.address, "1"); + const voucherAddress = calculateContractAddress(await accountHandler.getAddress(), "1"); bosonVoucher = await getContractAt("BosonVoucher", voucherAddress); }); @@ -1931,7 +1931,7 @@ describe("IBosonVoucher", function () { }); it("should return the correct tokenURI", async function () { - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offerId, { value: offerPrice }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: offerPrice }); const tokenId = deriveTokenId(offerId, 1); const tokenURI = await bosonVoucher.tokenURI(tokenId); expect(tokenURI).eq(metadataUri); @@ -1948,7 +1948,7 @@ describe("IBosonVoucher", function () { // reserve a range start = "10"; const length = "1"; - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, assistant.address); + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); // premint await bosonVoucher.connect(assistant).preMint(offerId, 1); @@ -1962,7 +1962,7 @@ describe("IBosonVoucher", function () { }); it("should return correct tokenURI when token is preminted and transferred", async function () { - await bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.address, tokenId); + await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); const tokenURI = await bosonVoucher.tokenURI(tokenId); expect(tokenURI).eq(metadataUri); @@ -1972,43 +1972,43 @@ describe("IBosonVoucher", function () { context("transferOwnership()", function () { it("should emit OwnershipTransferred", async function () { - const ownable = await getContractAt("OwnableUpgradeable", bosonVoucher.address); - await expect(bosonVoucher.connect(protocol).transferOwnership(rando.address)) + const ownable = await getContractAt("OwnableUpgradeable", await bosonVoucher.getAddress()); + await expect(bosonVoucher.connect(protocol).transferOwnership(await rando.getAddress())) .to.emit(ownable, "OwnershipTransferred") - .withArgs(assistant.address, rando.address); + .withArgs(await assistant.getAddress(), await rando.getAddress()); }); it("should transfer ownership with success", async function () { - await bosonVoucher.connect(protocol).transferOwnership(assistant.address); + await bosonVoucher.connect(protocol).transferOwnership(await assistant.getAddress()); - const ownable = await getContractAt("OwnableUpgradeable", bosonVoucher.address); + const ownable = await getContractAt("OwnableUpgradeable", await bosonVoucher.getAddress()); const owner = await ownable.owner(); - expect(owner).eq(assistant.address, "Wrong owner"); + expect(owner).eq(await assistant.getAddress(), "Wrong owner"); }); context("💔 Revert Reasons", async function () { it("should revert if caller does not have PROTOCOL role", async function () { - await expect(bosonVoucher.connect(rando).transferOwnership(assistant.address)).to.be.revertedWith( + await expect(bosonVoucher.connect(rando).transferOwnership(await assistant.getAddress())).to.be.revertedWith( RevertReasons.ACCESS_DENIED ); }); it("Even the current owner cannot transfer the ownership", async function () { // successfully transfer to assistant - await bosonVoucher.connect(protocol).transferOwnership(assistant.address); + await bosonVoucher.connect(protocol).transferOwnership(await assistant.getAddress()); // owner tries to transfer, it should fail - await expect(bosonVoucher.connect(assistant).transferOwnership(rando.address)).to.be.revertedWith( + await expect(bosonVoucher.connect(assistant).transferOwnership(await rando.getAddress())).to.be.revertedWith( RevertReasons.ACCESS_DENIED ); }); it("Current owner cannot renounce the ownership", async function () { // successfully transfer to assistant - await bosonVoucher.connect(protocol).transferOwnership(assistant.address); + await bosonVoucher.connect(protocol).transferOwnership(await assistant.getAddress()); - const ownable = await getContractAt("OwnableUpgradeable", bosonVoucher.address); + const ownable = await getContractAt("OwnableUpgradeable", await bosonVoucher.getAddress()); // owner tries to renounce ownership, it should fail await expect(ownable.connect(assistant).renounceOwnership()).to.be.revertedWith(RevertReasons.ACCESS_DENIED); @@ -2026,7 +2026,7 @@ describe("IBosonVoucher", function () { context("setContractURI()", function () { beforeEach(async function () { // give ownership to assistant - await bosonVoucher.connect(protocol).transferOwnership(assistant.address); + await bosonVoucher.connect(protocol).transferOwnership(await assistant.getAddress()); contractURI = "newContractURI"; }); @@ -2060,7 +2060,7 @@ describe("IBosonVoucher", function () { context("EIP2981 NFT Royalty fee", function () { beforeEach(async function () { - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); // prepare the VoucherInitValues voucherInitValues = mockVoucherInitValues(); @@ -2077,10 +2077,10 @@ describe("IBosonVoucher", function () { // Create a valid dispute resolver disputeResolver = mockDisputeResolver( - assistantDR.address, - adminDR.address, - clerkDR.address, - treasuryDR.address, + await assistantDR.getAddress(), + await adminDR.getAddress(), + await clerkDR.getAddress(), + await treasuryDR.getAddress(), true ); expect(disputeResolver.isValid()).is.true; @@ -2103,7 +2103,7 @@ describe("IBosonVoucher", function () { await fundsHandler .connect(admin) .depositFunds(seller.id, ZeroAddress, offer.sellerDeposit, { value: offer.sellerDeposit }); - await exchangeHandler.connect(buyer).commitToOffer(buyer.address, offer.id, { value: offer.price }); + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offer.id, { value: offer.price }); exchangeId = "1"; @@ -2118,7 +2118,7 @@ describe("IBosonVoucher", function () { context("setRoyaltyPercentage()", function () { beforeEach(async function () { // give ownership to assistant - await bosonVoucher.connect(protocol).transferOwnership(assistant.address); + await bosonVoucher.connect(protocol).transferOwnership(await assistant.getAddress()); }); it("should emit RoyaltyPercentageChanged event", async function () { @@ -2185,7 +2185,7 @@ describe("IBosonVoucher", function () { context("getRoyaltyPercentage()", function () { it("should return the royalty fee percentage", async function () { // give ownership to assistant - await bosonVoucher.connect(protocol).transferOwnership(assistant.address); + await bosonVoucher.connect(protocol).transferOwnership(await assistant.getAddress()); royaltyPercentage = "1000"; //10% await bosonVoucher.connect(assistant).setRoyaltyPercentage(royaltyPercentage); @@ -2200,7 +2200,7 @@ describe("IBosonVoucher", function () { context("royaltyInfo()", function () { beforeEach(async function () { // give ownership to assistant - await bosonVoucher.connect(protocol).transferOwnership(assistant.address); + await bosonVoucher.connect(protocol).transferOwnership(await assistant.getAddress()); }); it("should return a recipient and royalty fee", async function () { @@ -2268,7 +2268,7 @@ describe("IBosonVoucher", function () { voucherInitValues = new VoucherInitValues("ContractURI", royaltyPercentage); // create another seller - seller = mockSeller(rando.address, rando.address, ZeroAddress, rando.address); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); seller.id = "2"; // royalty percentage too high, expectig revert @@ -2289,11 +2289,11 @@ describe("IBosonVoucher", function () { emptyAuthToken = mockAuthToken(); expect(emptyAuthToken.isValid()).is.true; - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); await accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues); - await bosonVoucher.connect(protocol).transferOwnership(assistant.address); + await bosonVoucher.connect(protocol).transferOwnership(await assistant.getAddress()); expect(await bosonVoucher.connect(rando).getSellerId()).to.equal(seller.id, "Invalid seller id returned"); @@ -2302,7 +2302,7 @@ describe("IBosonVoucher", function () { }); it("should return 0 if the seller doesn't exist", async function () { - await bosonVoucher.connect(protocol).transferOwnership(rando.address); + await bosonVoucher.connect(protocol).transferOwnership(await rando.getAddress()); expect(await bosonVoucher.getSellerId()).to.equal(0, "Invalid seller id returned"); }); }); @@ -2321,7 +2321,7 @@ describe("IBosonVoucher", function () { }); it("Should call external contract and emit its events", async function () { - const tx = await bosonVoucher.connect(assistant).callExternalContract(mockSimpleContract.address, calldata); + const tx = await bosonVoucher.connect(assistant).callExternalContract(await mockSimpleContract.getAddress(), calldata); const receipt = await tx.wait(); const event = getEvent(receipt, mockSimpleContract, "TestEvent"); @@ -2338,7 +2338,7 @@ describe("IBosonVoucher", function () { it("Caller is not the contract owner", async function () { await expect( - bosonVoucher.connect(rando).callExternalContract(mockSimpleContract.address, calldata) + bosonVoucher.connect(rando).callExternalContract(await mockSimpleContract.getAddress(), calldata) ).to.be.revertedWith(RevertReasons.OWNABLE_NOT_OWNER); }); @@ -2346,32 +2346,32 @@ describe("IBosonVoucher", function () { calldata = mockSimpleContract.interface.encodeFunctionData("testRevert"); await expect( - bosonVoucher.connect(assistant).callExternalContract(mockSimpleContract.address, calldata) + bosonVoucher.connect(assistant).callExternalContract(await mockSimpleContract.getAddress(), calldata) ).to.be.revertedWith("Reverted"); }); it("To address is not a contract", async function () { - await expect(bosonVoucher.connect(assistant).callExternalContract(rando.address, calldata)).to.be.reverted; + await expect(bosonVoucher.connect(assistant).callExternalContract(await rando.getAddress(), calldata)).to.be.reverted; }); it("Owner tries to invoke method to transfer funds", async function () { const erc20 = await getContractFactory("Foreign20"); // transfer - calldata = erc20.interface.encodeFunctionData("transfer", [assistant.address, 20]); - await expect(bosonVoucher.connect(assistant).callExternalContract(rando.address, calldata)).to.be.revertedWith( + calldata = erc20.interface.encodeFunctionData("transfer", [await assistant.getAddress(), 20]); + await expect(bosonVoucher.connect(assistant).callExternalContract(await rando.getAddress(), calldata)).to.be.revertedWith( RevertReasons.FUNCTION_NOT_ALLOWLISTED ); // transferFrom - calldata = erc20.interface.encodeFunctionData("transferFrom", [bosonVoucher.address, assistant.address, 20]); - await expect(bosonVoucher.connect(assistant).callExternalContract(rando.address, calldata)).to.be.revertedWith( + calldata = erc20.interface.encodeFunctionData("transferFrom", [await bosonVoucher.getAddress(), await assistant.getAddress(), 20]); + await expect(bosonVoucher.connect(assistant).callExternalContract(await rando.getAddress(), calldata)).to.be.revertedWith( RevertReasons.FUNCTION_NOT_ALLOWLISTED ); // approve - calldata = erc20.interface.encodeFunctionData("approve", [assistant.address, 20]); - await expect(bosonVoucher.connect(assistant).callExternalContract(rando.address, calldata)).to.be.revertedWith( + calldata = erc20.interface.encodeFunctionData("approve", [await assistant.getAddress(), 20]); + await expect(bosonVoucher.connect(assistant).callExternalContract(await rando.getAddress(), calldata)).to.be.revertedWith( RevertReasons.FUNCTION_NOT_ALLOWLISTED ); @@ -2379,14 +2379,14 @@ describe("IBosonVoucher", function () { const dai = await getContractAt("DAIAliases", ZeroAddress); // push - calldata = dai.interface.encodeFunctionData("push", [assistant.address, 20]); - await expect(bosonVoucher.connect(assistant).callExternalContract(rando.address, calldata)).to.be.revertedWith( + calldata = dai.interface.encodeFunctionData("push", [await assistant.getAddress(), 20]); + await expect(bosonVoucher.connect(assistant).callExternalContract(await rando.getAddress(), calldata)).to.be.revertedWith( RevertReasons.FUNCTION_NOT_ALLOWLISTED ); // move - calldata = dai.interface.encodeFunctionData("move", [bosonVoucher.address, assistant.address, 20]); - await expect(bosonVoucher.connect(assistant).callExternalContract(rando.address, calldata)).to.be.revertedWith( + calldata = dai.interface.encodeFunctionData("move", [await bosonVoucher.getAddress(), await assistant.getAddress(), 20]); + await expect(bosonVoucher.connect(assistant).callExternalContract(await rando.getAddress(), calldata)).to.be.revertedWith( RevertReasons.FUNCTION_NOT_ALLOWLISTED ); }); @@ -2395,15 +2395,15 @@ describe("IBosonVoucher", function () { context("setApprovalForAllToContract", function () { it("Should emit ApprovalForAll event", async function () { - await expect(bosonVoucher.connect(assistant).setApprovalForAllToContract(rando.address, true)) + await expect(bosonVoucher.connect(assistant).setApprovalForAllToContract(await rando.getAddress(), true)) .to.emit(bosonVoucher, "ApprovalForAll") - .withArgs(bosonVoucher.address, rando.address, true); + .withArgs(await bosonVoucher.getAddress(), await rando.getAddress(), true); }); context("💔 Revert Reasons", async function () { it("should revert if caller is not the owner", async function () { // Expect revert if random user attempts to set approval - await expect(bosonVoucher.connect(rando).setApprovalForAllToContract(rando.address, true)).to.revertedWith( + await expect(bosonVoucher.connect(rando).setApprovalForAllToContract(await rando.getAddress(), true)).to.revertedWith( RevertReasons.OWNABLE_NOT_OWNER ); }); @@ -2419,7 +2419,7 @@ describe("IBosonVoucher", function () { context("withdrawToProtocol", function () { beforeEach(async function () { - seller = mockSeller(assistant.address, admin.address, clerk.address, treasury.address); + seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); // Prepare the AuthToken and VoucherInitValues emptyAuthToken = mockAuthToken(); @@ -2439,7 +2439,7 @@ describe("IBosonVoucher", function () { expect(sellersFundsBefore).to.eql(expectedAvailableFunds); const amount = parseUnits("1", "ether"); - await admin.sendTransaction({ to: bosonVoucher.address, value: amount }); + await admin.sendTransaction({ to: await bosonVoucher.getAddress(), value: amount }); await expect(() => bosonVoucher.connect(rando).withdrawToProtocol([ZeroAddress]) @@ -2453,17 +2453,17 @@ describe("IBosonVoucher", function () { expect(sellersFundsBefore).to.eql(expectedAvailableFunds); const amount = parseUnits("1", "ether"); - await foreign20.connect(deployer).mint(deployer.address, amount); - await foreign20.connect(deployer).transfer(bosonVoucher.address, amount); + await foreign20.connect(deployer).mint(await deployer.getAddress(), amount); + await foreign20.connect(deployer).transfer(await bosonVoucher.getAddress(), amount); - await expect(() => bosonVoucher.connect(rando).withdrawToProtocol([foreign20.address])).to.changeTokenBalances( + await expect(() => bosonVoucher.connect(rando).withdrawToProtocol([await foreign20.getAddress()])).to.changeTokenBalances( foreign20, [bosonVoucher, fundsHandler], [amount*-1, amount] ); // Seller's available balance should increase - expectedAvailableFunds = new FundsList([new Funds(foreign20.address, "Foreign20", amount.toString())]); + expectedAvailableFunds = new FundsList([new Funds(await foreign20.getAddress(), "Foreign20", amount.toString())]); const sellerFundsAfter = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); expect(sellerFundsAfter).to.eql(expectedAvailableFunds); }); @@ -2475,13 +2475,13 @@ describe("IBosonVoucher", function () { expect(sellersFundsBefore).to.eql(expectedAvailableFunds); const amount = parseUnits("1", "ether"); - await admin.sendTransaction({ to: bosonVoucher.address, value: amount }); - await foreign20.connect(deployer).mint(deployer.address, amount); - await foreign20.connect(deployer).transfer(bosonVoucher.address, amount); + await admin.sendTransaction({ to: await bosonVoucher.getAddress(), value: amount }); + await foreign20.connect(deployer).mint(await deployer.getAddress(), amount); + await foreign20.connect(deployer).transfer(await bosonVoucher.getAddress(), amount); let tx; await expect(() => { - tx = bosonVoucher.connect(rando).withdrawToProtocol([ZeroAddress, foreign20.address]); + tx = bosonVoucher.connect(rando).withdrawToProtocol([ZeroAddress, await foreign20.getAddress()]); return tx; }).to.changeTokenBalances(foreign20, [bosonVoucher, fundsHandler], [amount*-1, amount]); await expect(() => tx).to.changeEtherBalances([bosonVoucher, fundsHandler], [amount*-1, amount]); @@ -2492,8 +2492,8 @@ describe("IBosonVoucher", function () { it("Should return correct selector value", async function () { const expectedSelector = bosonVoucher.interface.getSighash("onERC721Received(address,address,uint256,bytes)"); const returnedSelector = await bosonVoucher.callStatic.onERC721Received( - assistant.address, - rando.address, + await assistant.getAddress(), + await rando.getAddress(), "1", "0x" ); @@ -2512,9 +2512,9 @@ describe("IBosonVoucher", function () { ]); //deploys mock // Update protocol address on beacon - await beacon.connect(deployer).setProtocolAddress(mockProtocol.address); + await beacon.connect(deployer).setProtocolAddress(await mockProtocol.getAddress()); - await mockProtocol.mock.getAccessControllerAddress.returns(accessController.address); + await mockProtocol.mock.getAccessControllerAddress.returns(await accessController.getAddress()); return mockProtocol; } diff --git a/test/protocol/clients/ClientExternalAddressesTest.js b/test/protocol/clients/ClientExternalAddressesTest.js index b5c8df6fb..fded5ae1f 100644 --- a/test/protocol/clients/ClientExternalAddressesTest.js +++ b/test/protocol/clients/ClientExternalAddressesTest.js @@ -41,14 +41,14 @@ describe("IClientExternalAddresses", function () { context("👉 setImplementation()", async function () { beforeEach(async function () { // set new value for voucher implementation - voucherImplementation = other1.address; // random address, just for test + voucherImplementation = await other1.getAddress(); // random address, just for test }); it("should emit an Upgraded event", async function () { // Set new implementation, testing for the event await expect(beacon.connect(deployer).setImplementation(voucherImplementation)) .to.emit(beacon, "Upgraded") - .withArgs(voucherImplementation, deployer.address); + .withArgs(voucherImplementation, await deployer.getAddress()); }); it("should update state", async function () { @@ -79,14 +79,14 @@ describe("IClientExternalAddresses", function () { context("👉 setProtocolAddress()", async function () { beforeEach(async function () { // set new value for protocol address - protocolAddress = other3.address; // random address, just for test + protocolAddress = await other3.getAddress(); // random address, just for test }); it("should emit a ProtocolAddressChanged event", async function () { // Set new protocol address, testing for the event await expect(beacon.connect(deployer).setProtocolAddress(protocolAddress)) .to.emit(beacon, "ProtocolAddressChanged") - .withArgs(protocolAddress, deployer.address); + .withArgs(protocolAddress, await deployer.getAddress()); }); it("should update state", async function () { diff --git a/test/upgrade/01_generic.js b/test/upgrade/01_generic.js index 2dae360e9..be2d3b7ac 100644 --- a/test/upgrade/01_generic.js +++ b/test/upgrade/01_generic.js @@ -159,14 +159,14 @@ function getGenericContext( // approve token transfer msgValue = 0; await mockToken.connect(buyer.wallet).approve(protocolDiamondAddress, offerPrice); - await mockToken.mint(buyer.wallet.address, offerPrice); + await mockToken.mint(buyer.await wallet.getAddress(), offerPrice); } // Commit to offer const exchangeId = await exchangeHandler.getNextExchangeId(); const tx = await exchangeHandler .connect(buyer.wallet) - .commitToOffer(buyer.wallet.address, offer.id, { value: msgValue }); + .commitToOffer(buyer.await wallet.getAddress(), offer.id, { value: msgValue }); const txReceipt = await tx.wait(); const event = getEvent(txReceipt, exchangeHandler, "BuyerCommitted"); @@ -210,7 +210,7 @@ function getGenericContext( const buyerWallet = preUpgradeEntities.buyers[exchange.buyerIndex].wallet; await expect(exchangeHandler.connect(buyerWallet).redeemVoucher(exchange.exchangeId)) .to.emit(exchangeHandler, "VoucherRedeemed") - .withArgs(exchange.offerId, exchange.exchangeId, buyerWallet.address); + .withArgs(exchange.offerId, exchange.exchangeId, await buyerWallet.getAddress()); }); it("Cancel old voucher", async function () { @@ -218,7 +218,7 @@ function getGenericContext( const buyerWallet = preUpgradeEntities.buyers[exchange.buyerIndex].wallet; await expect(exchangeHandler.connect(buyerWallet).cancelVoucher(exchange.exchangeId)) .to.emit(exchangeHandler, "VoucherCanceled") - .withArgs(exchange.offerId, exchange.exchangeId, buyerWallet.address); + .withArgs(exchange.offerId, exchange.exchangeId, await buyerWallet.getAddress()); }); it("Revoke old voucher", async function () { @@ -227,7 +227,7 @@ function getGenericContext( const seller = preUpgradeEntities.sellers.find((s) => s.seller.id == offer.offer.sellerId); await expect(exchangeHandler.connect(seller.wallet).revokeVoucher(exchange.exchangeId)) .to.emit(exchangeHandler, "VoucherRevoked") - .withArgs(exchange.offerId, exchange.exchangeId, seller.wallet.address); + .withArgs(exchange.offerId, exchange.exchangeId, seller.await wallet.getAddress()); }); it("Escalate old dispute", async function () { @@ -237,7 +237,7 @@ function getGenericContext( const offer = preUpgradeEntities.offers.find((o) => o.offer.id == exchange.offerId); await expect(disputeHandler.connect(buyerWallet).escalateDispute(exchange.exchangeId)) .to.emit(disputeHandler, "DisputeEscalated") - .withArgs(exchange.exchangeId, offer.disputeResolverId, buyerWallet.address); + .withArgs(exchange.exchangeId, offer.disputeResolverId, await buyerWallet.getAddress()); }); it("Old buyer commits to new offer", async function () { @@ -264,7 +264,7 @@ function getGenericContext( const offerPrice = offer.price; const tx = await exchangeHandler .connect(buyer.wallet) - .commitToOffer(buyer.wallet.address, offer.id, { value: offerPrice }); + .commitToOffer(buyer.await wallet.getAddress(), offer.id, { value: offerPrice }); const txReceipt = await tx.wait(); const event = getEvent(txReceipt, exchangeHandler, "BuyerCommitted"); @@ -309,7 +309,7 @@ function getGenericContext( await expect(offerHandler.connect(seller.wallet).voidOffer(offerId)) .to.emit(offerHandler, "OfferVoided") - .withArgs(offerId, seller.seller.id, seller.wallet.address); + .withArgs(offerId, seller.seller.id, seller.await wallet.getAddress()); }); }); }; diff --git a/test/upgrade/2.0.0-2.1.0.js b/test/upgrade/2.0.0-2.1.0.js index f7e3b9094..35f3dd7ce 100644 --- a/test/upgrade/2.0.0-2.1.0.js +++ b/test/upgrade/2.0.0-2.1.0.js @@ -113,10 +113,10 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation const seller = oldSeller.seller.clone(); - seller.admin = admin.address; - seller.assistant = assistant.address; - seller.clerk = clerk.address; - seller.treasury = treasury.address; + seller.admin = await admin.getAddress(); + seller.assistant = await assistant.getAddress(); + seller.clerk = await clerk.getAddress(); + seller.treasury = await treasury.getAddress(); const authToken = mockAuthToken(); @@ -157,10 +157,10 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation disputeResolver.escalationResponsePeriod = Number( Number(disputeResolver.escalationResponsePeriod) - 100 ).toString(); - disputeResolver.assistant = assistant.address; - disputeResolver.admin = admin.address; - disputeResolver.clerk = clerk.address; - disputeResolver.treasury = treasury.address; + disputeResolver.assistant = await assistant.getAddress(); + disputeResolver.admin = await admin.getAddress(); + disputeResolver.clerk = await clerk.getAddress(); + disputeResolver.treasury = await treasury.getAddress(); disputeResolver.metadataUri = "https://ipfs.io/ipfs/updatedUri"; disputeResolver.active = false; @@ -238,10 +238,10 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation const oldSeller = preUpgradeEntities.sellers[3]; const seller = oldSeller.seller.clone(); - seller.treasury = treasury.address; - seller.admin = admin.address; - seller.assistant = assistant.address; - seller.clerk = clerk.address; + seller.treasury = await treasury.getAddress(); + seller.admin = await admin.getAddress(); + seller.assistant = await assistant.getAddress(); + seller.clerk = await clerk.getAddress(); const pendingSellerUpdate = seller.clone(); pendingSellerUpdate.id = "0"; @@ -269,13 +269,13 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation pendingSellerUpdate.toStruct(), oldSellerAuthToken, pendingAuthTokenStruct, - oldSeller.wallet.address + oldSeller.await wallet.getAddress() ); // Testing for the SellerUpdatePending event await expect(tx) .to.emit(accountHandler, "SellerUpdatePending") - .withArgs(seller.id, pendingSellerUpdate.toStruct(), pendingAuthTokenStruct, oldSeller.wallet.address); + .withArgs(seller.id, pendingSellerUpdate.toStruct(), pendingAuthTokenStruct, oldSeller.await wallet.getAddress()); // Update seller assistant tx = await accountHandler.connect(assistant).optInToSellerUpdate(seller.id, [SellerUpdateFields.Assistant]); @@ -292,7 +292,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation pendingSellerUpdate.toStruct(), oldSellerAuthToken, pendingAuthTokenStruct, - assistant.address + await assistant.getAddress() ); // Update seller clerk @@ -310,7 +310,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation pendingSellerUpdate.toStruct(), oldSellerAuthToken, pendingAuthTokenStruct, - clerk.address + await clerk.getAddress() ); // Update seller admin @@ -328,7 +328,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation pendingSellerUpdate.toStruct(), authToken.toStruct(), pendingAuthTokenStruct, - admin.address + await admin.getAddress() ); }); @@ -341,10 +341,10 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation disputeResolver.escalationResponsePeriod = Number( Number(disputeResolver.escalationResponsePeriod) - 100 ).toString(); - disputeResolver.assistant = assistant.address; - disputeResolver.admin = admin.address; - disputeResolver.clerk = clerk.address; - disputeResolver.treasury = treasury.address; + disputeResolver.assistant = await assistant.getAddress(); + disputeResolver.admin = await admin.getAddress(); + disputeResolver.clerk = await clerk.getAddress(); + disputeResolver.treasury = await treasury.getAddress(); disputeResolver.metadataUri = "https://ipfs.io/ipfs/updatedUri"; disputeResolver.active = false; @@ -362,7 +362,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Update dispute resolver await expect(accountHandler.connect(oldDisputeResolver.wallet).updateDisputeResolver(disputeResolver)) .to.emit(accountHandler, "DisputeResolverUpdatePending") - .withArgs(disputeResolver.id, disputeResolverPendingUpdate.toStruct(), oldDisputeResolver.wallet.address); + .withArgs(disputeResolver.id, disputeResolverPendingUpdate.toStruct(), oldDisputeResolver.await wallet.getAddress()); // Approve assistant update expectedDisputeResolver.assistant = disputeResolver.assistant; @@ -378,7 +378,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation disputeResolver.id, expectedDisputeResolver.toStruct(), disputeResolverPendingUpdate.toStruct(), - assistant.address + await assistant.getAddress() ); // Approve admin update @@ -395,7 +395,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation disputeResolver.id, expectedDisputeResolver.toStruct(), disputeResolverPendingUpdate.toStruct(), - admin.address + await admin.getAddress() ); // Approve clerk update @@ -412,7 +412,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation disputeResolver.id, expectedDisputeResolver.toStruct(), disputeResolverPendingUpdate.toStruct(), - clerk.address + await clerk.getAddress() ); }); }); diff --git a/test/upgrade/2.1.0-2.2.0.js b/test/upgrade/2.1.0-2.2.0.js index 63b206e69..4f77cf139 100644 --- a/test/upgrade/2.1.0-2.2.0.js +++ b/test/upgrade/2.1.0-2.2.0.js @@ -194,7 +194,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation const diamondLoupe = await getContractAt("DiamondLoupeFacet", protocolDiamondAddress); for (const selector of selectors) { - expect(await diamondLoupe.facetAddress(selector)).to.equal(orchestrationHandler1.address); + expect(await diamondLoupe.facetAddress(selector)).to.equal(await orchestrationHandler1.getAddress()); } }); }); @@ -212,7 +212,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation expect(exist, "DR should not exist").to.be.false; // New DR must be created with active = true - const DR = mockDisputeResolver(rando.address, rando.address, rando.address, rando.address, true, true); + const DR = mockDisputeResolver(await rando.getAddress(), await rando.getAddress(), await rando.getAddress(), await rando.getAddress(), true, true); DR.id = nextAccountId.toString(); await accountHandler.connect(rando).createDisputeResolver(DR, [], []); @@ -228,11 +228,11 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation const { nextAccountId } = protocolContractState.accountContractState; // Create seller - const seller = mockSeller(assistant.address, assistant.address, assistant.address, assistant.address, true); + const seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), await assistant.getAddress(), await assistant.getAddress(), true); await accountHandler.connect(assistant).createSeller(seller, mockAuthToken(), mockVoucherInitValues()); // Voucher contract - const expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, sellers.length + 1); + const expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), sellers.length + 1); const bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); // Validate voucher name and symbol @@ -320,12 +320,12 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Protocol event await expect(tx) .to.emit(exchangeHandler, "VoucherRedeemed") - .withArgs(exchange.offerId, exchange.exchangeId, buyerWallet.address); + .withArgs(exchange.offerId, exchange.exchangeId, await buyerWallet.getAddress()); // Voucher burned event await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(buyerWallet.address, ZeroAddress, tokenId); + .withArgs(await buyerWallet.getAddress(), ZeroAddress, tokenId); }); it("Cancel old voucher", async function () { @@ -334,12 +334,12 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Protocol event await expect(tx) .to.emit(exchangeHandler, "VoucherCanceled") - .withArgs(exchange.offerId, exchange.exchangeId, buyerWallet.address); + .withArgs(exchange.offerId, exchange.exchangeId, await buyerWallet.getAddress()); // Voucher burned event await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(buyerWallet.address, ZeroAddress, tokenId); + .withArgs(await buyerWallet.getAddress(), ZeroAddress, tokenId); }); it("Revoke old voucher", async function () { @@ -348,12 +348,12 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Protocol event await expect(tx) .to.emit(exchangeHandler, "VoucherRevoked") - .withArgs(exchange.offerId, exchange.exchangeId, sellerWallet.address); + .withArgs(exchange.offerId, exchange.exchangeId, await sellerWallet.getAddress()); // Voucher burned event await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(buyerWallet.address, ZeroAddress, tokenId); + .withArgs(await buyerWallet.getAddress(), ZeroAddress, tokenId); }); }); @@ -367,7 +367,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation let price; ({ id: offerId, price } = preUpgradeEntities.offers[0].offer); - await exchangeHandler.commitToOffer(buyerWallet.address, offerId, { value: price }); + await exchangeHandler.commitToOffer(await buyerWallet.getAddress(), offerId, { value: price }); const offer = preUpgradeEntities.offers.find((o) => o.offer.id == offerId); const seller = preUpgradeEntities.sellers.find((s) => s.seller.id == offer.offer.sellerId); @@ -382,12 +382,12 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Protocol event await expect(tx) .to.emit(exchangeHandler, "VoucherRedeemed") - .withArgs(offerId, exchangeId, buyerWallet.address); + .withArgs(offerId, exchangeId, await buyerWallet.getAddress()); // Voucher burned event await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(buyerWallet.address, ZeroAddress, tokenId); + .withArgs(await buyerWallet.getAddress(), ZeroAddress, tokenId); }); it("Cancel new voucher", async function () { @@ -396,12 +396,12 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Protocol event await expect(tx) .to.emit(exchangeHandler, "VoucherCanceled") - .withArgs(offerId, exchangeId, buyerWallet.address); + .withArgs(offerId, exchangeId, await buyerWallet.getAddress()); // Voucher burned event await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(buyerWallet.address, ZeroAddress, tokenId); + .withArgs(await buyerWallet.getAddress(), ZeroAddress, tokenId); }); it("Revoke new voucher", async function () { @@ -410,12 +410,12 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Protocol event await expect(tx) .to.emit(exchangeHandler, "VoucherRevoked") - .withArgs(offerId, exchangeId, sellerWallet.address); + .withArgs(offerId, exchangeId, await sellerWallet.getAddress()); // Voucher burned event await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(buyerWallet.address, ZeroAddress, tokenId); + .withArgs(await buyerWallet.getAddress(), ZeroAddress, tokenId); }); }); @@ -423,7 +423,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation let seller, functionSignature, metaTransactionType, customTransactionType, nonce, message; beforeEach(async function () { - seller = mockSeller(assistant.address, assistant.address, assistant.address, assistant.address, true); + seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), await assistant.getAddress(), await assistant.getAddress(), true); // Prepare the function signature for the facet function. functionSignature = accountHandler.interface.encodeFunctionData("createSeller", [ @@ -450,8 +450,8 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Prepare the message message = { nonce, - from: assistant.address, - contractAddress: accountHandler.address, + from: await assistant.getAddress(), + contractAddress: await accountHandler.getAddress(), functionName: "createSeller((uint256,address,address,address,address,bool),(uint256,uint8),(string,uint256))", functionSignature: functionSignature, @@ -465,17 +465,17 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // send a meta transaction, check for event await expect( metaTransactionsHandler .connect(deployer) - .executeMetaTransaction(assistant.address, message.functionName, functionSignature, nonce, r, s, v) + .executeMetaTransaction(await assistant.getAddress(), message.functionName, functionSignature, nonce, r, s, v) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") - .withArgs(assistant.address, deployer.address, message.functionName, nonce); + .withArgs(await assistant.getAddress(), await deployer.getAddress(), message.functionName, nonce); }); it("Meta transaction should fail when function name is not allowlisted", async function () { @@ -487,14 +487,14 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation customTransactionType, "MetaTransaction", message, - metaTransactionsHandler.address + await metaTransactionsHandler.getAddress() ); // Execute meta transaction, expecting revert. await expect( metaTransactionsHandler .connect(assistant) - .executeMetaTransaction(assistant.address, message.functionName, functionSignature, nonce, r, s, v) + .executeMetaTransaction(await assistant.getAddress(), message.functionName, functionSignature, nonce, r, s, v) ).to.revertedWith(RevertReasons.FUNCTION_NOT_ALLOWLISTED); }); @@ -537,12 +537,12 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Enable functions await expect(metaTransactionsHandler.connect(deployer).setAllowlistedFunctions(functionHashList, true)) .to.emit(metaTransactionsHandler, "FunctionsAllowlisted") - .withArgs(functionHashList, true, deployer.address); + .withArgs(functionHashList, true, await deployer.getAddress()); // Disable functions await expect(metaTransactionsHandler.connect(deployer).setAllowlistedFunctions(functionHashList, false)) .to.emit(metaTransactionsHandler, "FunctionsAllowlisted") - .withArgs(functionHashList, false, deployer.address); + .withArgs(functionHashList, false, await deployer.getAddress()); }); it("👉 isFunctionAllowlisted(bytes32)", async function () { @@ -612,7 +612,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Set new value await expect(configHandler.connect(deployer).setMaxPremintedVouchers(100)) .to.emit(configHandler, "MaxPremintedVouchersChanged") - .withArgs(100, deployer.address); + .withArgs(100, await deployer.getAddress()); // Verify that new value is stored expect(await configHandler.connect(rando).getMaxPremintedVouchers()).to.equal("100"); @@ -659,9 +659,9 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation DRs: [, disputeResolver], // take DR that has empty allow list } = preUpgradeEntities; - seller = mockSeller(rando.address, rando.address, rando.address, rando.address, true); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), await rando.getAddress(), await rando.getAddress(), true); disputeResolverId = disputeResolver.id; - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, sellers.length + 1); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), sellers.length + 1); ({ offer, offerDates, offerDurations } = await mockOffer()); agentId = 0; @@ -700,7 +700,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation it("👉 createSellerAndOfferWithCondition", async function () { const condition = mockCondition({ - tokenAddress: rando.address, + tokenAddress: await rando.getAddress(), tokenType: TokenType.MultiToken, tokenId: "5150", }); @@ -739,9 +739,9 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation beforeEach(async function () { [bosonToken] = await deployMockTokens(); // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(rando).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(rando).approve(await twinHandler.getAddress(), 1); // approving the twin handler - twin = mockTwin(bosonToken.address); + twin = mockTwin(await bosonToken.getAddress()); }); it("👉 createSellerAndOfferAndTwinWithBundle", async function () { @@ -777,7 +777,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation it("👉 createSellerAndOfferWithConditionAndTwinAndBundle", async function () { const condition = mockCondition({ - tokenAddress: rando.address, + tokenAddress: await rando.getAddress(), tokenType: TokenType.MultiToken, tokenId: "5150", }); @@ -834,7 +834,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation it("👉 createOfferWithCondition", async function () { const condition = mockCondition({ - tokenAddress: rando.address, + tokenAddress: await rando.getAddress(), tokenType: TokenType.MultiToken, tokenId: "5150", }); @@ -870,9 +870,9 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation beforeEach(async function () { [bosonToken] = await deployMockTokens(); // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler - twin = mockTwin(bosonToken.address); + twin = mockTwin(await bosonToken.getAddress()); }); it("👉 createOfferAndTwinWithBundle", async function () { @@ -889,7 +889,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation it("👉 createOfferWithConditionAndTwinAndBundle", async function () { const condition = mockCondition({ - tokenAddress: rando.address, + tokenAddress: await rando.getAddress(), tokenType: TokenType.MultiToken, tokenId: "5150", }); @@ -928,9 +928,9 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation DRs: [, disputeResolver], // take DR that has empty allow list } = preUpgradeEntities; - seller = mockSeller(rando.address, rando.address, rando.address, rando.address, true); + seller = mockSeller(await rando.getAddress(), await rando.getAddress(), await rando.getAddress(), await rando.getAddress(), true); disputeResolverId = disputeResolver.id; - expectedCloneAddress = calculateContractAddress(orchestrationHandler.address, sellers.length + 1); + expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), sellers.length + 1); ({ offer, offerDates, offerDurations } = await mockOffer()); reservedRangeLength = offer.quantityAvailable; @@ -951,7 +951,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation offerDurations, disputeResolverId, reservedRangeLength, - rando.address, + await rando.getAddress(), authToken, voucherInitValues, agentId @@ -974,7 +974,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation it("👉 createSellerAndPremintedOfferWithCondition", async function () { const condition = mockCondition({ - tokenAddress: rando.address, + tokenAddress: await rando.getAddress(), tokenType: TokenType.MultiToken, tokenId: "5150", }); @@ -988,7 +988,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation offerDurations, disputeResolverId, reservedRangeLength, - rando.address, + await rando.getAddress(), condition, authToken, voucherInitValues, @@ -1017,9 +1017,9 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation beforeEach(async function () { [bosonToken] = await deployMockTokens(); // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(rando).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(rando).approve(await twinHandler.getAddress(), 1); // approving the twin handler - twin = mockTwin(bosonToken.address); + twin = mockTwin(await bosonToken.getAddress()); }); it("👉 createSellerAndPremintedOfferAndTwinWithBundle", async function () { @@ -1033,7 +1033,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation offerDurations, disputeResolverId, reservedRangeLength, - rando.address, + await rando.getAddress(), twin, authToken, voucherInitValues, @@ -1059,7 +1059,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation it("👉 createSellerAndPremintedOfferWithConditionAndTwinAndBundle", async function () { const condition = mockCondition({ - tokenAddress: rando.address, + tokenAddress: await rando.getAddress(), tokenType: TokenType.MultiToken, tokenId: "5150", }); @@ -1074,7 +1074,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation offerDurations, disputeResolverId, reservedRangeLength, - rando.address, + await rando.getAddress(), condition, twin, authToken, @@ -1120,13 +1120,13 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation assistant = seller.wallet; // Voucher clone contract - const expectedCloneAddress = calculateContractAddress(accountHandler.address, "1"); + const expectedCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "1"); bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); }); it("👉 createPremintedOfferWithCondition", async function () { const condition = mockCondition({ - tokenAddress: rando.address, + tokenAddress: await rando.getAddress(), tokenType: TokenType.MultiToken, tokenId: "5150", }); @@ -1139,7 +1139,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation offerDurations, disputeResolverId, reservedRangeLength, - assistant.address, + await assistant.getAddress(), condition, agentId ); @@ -1159,7 +1159,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation offerDurations, disputeResolverId, reservedRangeLength, - assistant.address, + await assistant.getAddress(), "1", // seller already has a group with id 1 (from populateProtocolContract) agentId ); @@ -1177,9 +1177,9 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation beforeEach(async function () { [bosonToken] = await deployMockTokens(); // Approving the twinHandler contract to transfer seller's tokens - await bosonToken.connect(assistant).approve(twinHandler.address, 1); // approving the twin handler + await bosonToken.connect(assistant).approve(await twinHandler.getAddress(), 1); // approving the twin handler - twin = mockTwin(bosonToken.address); + twin = mockTwin(await bosonToken.getAddress()); }); it("👉 createPremintedOfferAndTwinWithBundle", async function () { @@ -1192,7 +1192,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation offerDurations, disputeResolverId, reservedRangeLength, - assistant.address, + await assistant.getAddress(), twin, agentId ); @@ -1207,7 +1207,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation it("👉 createPremintedOfferWithConditionAndTwinAndBundle", async function () { const condition = mockCondition({ - tokenAddress: rando.address, + tokenAddress: await rando.getAddress(), tokenType: TokenType.MultiToken, tokenId: "5150", }); @@ -1221,7 +1221,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation offerDurations, disputeResolverId, reservedRangeLength, - assistant.address, + await assistant.getAddress(), condition, twin, agentId @@ -1263,20 +1263,20 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation const tokenId = deriveTokenId(offer.id, exchangeId); // Reserve range - await offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, assistant.address); + await offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, await assistant.getAddress()); // TODO: remove this once newVersion is 2.2.0 (not 2.2.0-rc.1) await configHandler.connect(deployer).setMaxPremintedVouchers(100); // Boson voucher contract address const sellerIndex = sellers.findIndex((s) => s.id === seller.id); - const voucherCloneAddress = calculateContractAddress(accountHandler.address, sellerIndex + 1); + const voucherCloneAddress = calculateContractAddress(await accountHandler.getAddress(), sellerIndex + 1); const bosonVoucher = await getContractAt("BosonVoucher", voucherCloneAddress); await bosonVoucher.connect(assistant).preMint(offer.id, offer.quantityAvailable); // Commit to preminted offer, testing for the event await expect( - bosonVoucher.connect(assistant).transferFrom(assistant.address, buyer.wallet.address, tokenId) + bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), buyer.await wallet.getAddress(), tokenId) ).to.emit(exchangeHandler, "BuyerCommitted"); }); }); @@ -1285,18 +1285,18 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation it("👉 reserveRange for assistant", async function () { // Reserve range await expect( - offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, assistant.address) + offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, await assistant.getAddress()) ).to.emit(offerHandler, "RangeReserved"); }); it("👉 reserveRange to contract", async function () { // Voucher contract const sellerIndex = sellers.findIndex((s) => s.id === seller.id); - const expectedCloneAddress = calculateContractAddress(accountHandler.address, sellerIndex + 1); + const expectedCloneAddress = calculateContractAddress(await accountHandler.getAddress(), sellerIndex + 1); const bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect( - offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, bosonVoucher.address) + offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, await bosonVoucher.getAddress()) ).to.emit(offerHandler, "RangeReserved"); }); }); @@ -1318,7 +1318,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation twin.id = "666"; // Approve twinHandler to transfer assistant tokens - await mockToken.connect(assistant).approve(twinHandler.address, twin.amount); + await mockToken.connect(assistant).approve(await twinHandler.getAddress(), twin.amount); // Create twin await twinHandler.connect(assistant).createTwin(twin); @@ -1349,13 +1349,13 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Reserve range const length = "1"; - const tx = await offerHandler.connect(assistant).reserveRange(offerId, length, assistant.address); + const tx = await offerHandler.connect(assistant).reserveRange(offerId, length, await assistant.getAddress()); const { events } = await tx.wait(); const { startExchangeId } = events.find((e) => e.event === "RangeReserved").args; // Find voucher contract const sellerIndex = sellers.findIndex((s) => s.id === seller.id); - const expectedCloneAddress = calculateContractAddress(accountHandler.address, sellerIndex + 1); + const expectedCloneAddress = calculateContractAddress(await accountHandler.getAddress(), sellerIndex + 1); const bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); // Premint diff --git a/test/upgrade/2.2.0-2.2.1.js b/test/upgrade/2.2.0-2.2.1.js index d5217ace5..729568f66 100644 --- a/test/upgrade/2.2.0-2.2.1.js +++ b/test/upgrade/2.2.0-2.2.1.js @@ -215,7 +215,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation it("New seller has metadataUri field", async function () { const { nextAccountId } = accountContractState; - const seller = mockSeller(rando.address, rando.address, rando.address, rando.address, true, "metadata"); + const seller = mockSeller(await rando.getAddress(), await rando.getAddress(), await rando.getAddress(), await rando.getAddress(), true, "metadata"); const authToken = mockAuthToken(); const voucherInitValues = mockVoucherInitValues(); @@ -225,9 +225,9 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation .withArgs( nextAccountId, seller, - calculateContractAddress(accountHandler.address, nextAccountId), + calculateContractAddress(await accountHandler.getAddress(), nextAccountId), authToken, - rando.address + await rando.getAddress() ); }); }); diff --git a/test/upgrade/clients/01_generic.js b/test/upgrade/clients/01_generic.js index 649ffc5b1..63f17ba3e 100644 --- a/test/upgrade/clients/01_generic.js +++ b/test/upgrade/clients/01_generic.js @@ -88,7 +88,7 @@ function getGenericContext( ); const buyerWallet = buyers[j].wallet; - const buyerIndex = entities.findIndex((e) => e.wallet.address == buyerWallet.address); + const buyerIndex = entities.findIndex((e) => e.await wallet.getAddress() == await buyerWallet.getAddress()); // Update the balance of the buyer voucherData.balanceOf[buyerIndex] = voucherData.balanceOf[buyerIndex]-1; diff --git a/test/upgrade/clients/BosonVoucher-2.1.0-2.2.0.js b/test/upgrade/clients/BosonVoucher-2.1.0-2.2.0.js index 555d73e90..13763f402 100644 --- a/test/upgrade/clients/BosonVoucher-2.1.0-2.2.0.js +++ b/test/upgrade/clients/BosonVoucher-2.1.0-2.2.0.js @@ -158,10 +158,10 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio // Create a seller sellerId = await accountHandler.getNextAccountId(); const seller = mockSeller( - assistant.address, - assistant.address, + await assistant.getAddress(), + await assistant.getAddress(), ZeroAddress, - assistant.address, + await assistant.getAddress(), true ); const voucherInitValues = mockVoucherInitValues(); @@ -173,10 +173,10 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio // Create a valid dispute resolver disputeResolverId = await accountHandler.getNextAccountId(); const disputeResolver = mockDisputeResolver( - assistant.address, - assistant.address, - assistant.address, - assistant.address, + await assistant.getAddress(), + await assistant.getAddress(), + await assistant.getAddress(), + await assistant.getAddress(), true, true ); @@ -205,7 +205,7 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio bosonVoucher = await getContractAt( "BosonVoucher", - calculateContractAddress(exchangeHandler.address, preUpgradeEntities.sellers.length + 1) + calculateContractAddress(await exchangeHandler.getAddress(), preUpgradeEntities.sellers.length + 1) ); // Adjust maximum preminted vouchers @@ -214,7 +214,7 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio it("reserveRange()", async function () { // Reserve range for the assistant, test for event - await expect(offerHandler.connect(assistant).reserveRange(offerId, length, assistant.address)).to.emit( + await expect(offerHandler.connect(assistant).reserveRange(offerId, length, await assistant.getAddress())).to.emit( bosonVoucher, "RangeReserved" ); @@ -226,7 +226,7 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio ++offerId; // Reserve range for the contract, test for event - await expect(offerHandler.connect(assistant).reserveRange(offerId, length, bosonVoucher.address)).to.emit( + await expect(offerHandler.connect(assistant).reserveRange(offerId, length, await bosonVoucher.getAddress())).to.emit( bosonVoucher, "RangeReserved" ); @@ -235,7 +235,7 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio context("preMint()", async function () { it("seller can pre mint vouchers", async function () { // Reserve range - await offerHandler.connect(assistant).reserveRange(offerId, length, assistant.address); + await offerHandler.connect(assistant).reserveRange(offerId, length, await assistant.getAddress()); // Premint tokens, test for event await expect(bosonVoucher.connect(assistant).preMint(offerId, amount)).to.emit(bosonVoucher, "Transfer"); @@ -254,20 +254,20 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio // reassign assistant because signer must be on provider default accounts in order to call eth_signTypedData_v4 assistant = (await getSigners())[2]; - seller.assistant = assistant.address; + seller.assistant = await assistant.getAddress(); await accountHandler.connect(wallet).updateSeller(seller, authToken); await accountHandler.connect(assistant).optInToSellerUpdate(seller.id, [SellerUpdateFields.Assistant]); // Reserve range - await offerHandler.connect(assistant).reserveRange(offerId, length, assistant.address); + await offerHandler.connect(assistant).reserveRange(offerId, length, await assistant.getAddress()); // Get last seller voucher bosonVoucher = await getContractAt( "BosonVoucher", - calculateContractAddress(exchangeHandler.address, sellersLength) + calculateContractAddress(await exchangeHandler.getAddress(), sellersLength) ); - const nonce = Number(await forwarder.getNonce(assistant.address)); + const nonce = Number(await forwarder.getNonce(await assistant.getAddress())); const types = { ForwardRequest: [ @@ -281,8 +281,8 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio const functionSignature = bosonVoucher.interface.encodeFunctionData("preMint", [offerId, amount]); const message = { - from: assistant.address, - to: bosonVoucher.address, + from: await assistant.getAddress(), + to: await bosonVoucher.getAddress(), nonce: nonce, data: functionSignature, }; @@ -292,7 +292,7 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio types, "ForwardRequest", message, - forwarder.address, + await forwarder.getAddress(), "MockForwarder", "0.0.1", "0Z" @@ -305,7 +305,7 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio it("burnPremintedVouchers()", async function () { // Reserve range and premint tokens - await offerHandler.connect(assistant).reserveRange(offerId, length, assistant.address); + await offerHandler.connect(assistant).reserveRange(offerId, length, await assistant.getAddress()); await bosonVoucher.connect(assistant).preMint(offerId, amount); // void the offer @@ -317,10 +317,10 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio it("getRange()", async function () { // Reserve range - await offerHandler.connect(assistant).reserveRange(offerId, length, assistant.address); + await offerHandler.connect(assistant).reserveRange(offerId, length, await assistant.getAddress()); const startTokenId = deriveTokenId(offerId, start); - const range = new Range(startTokenId.toString(), length, "0", "0", assistant.address); + const range = new Range(startTokenId.toString(), length, "0", "0", await assistant.getAddress()); // Get range object from contract const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); @@ -329,7 +329,7 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio it("getAvailablePreMints()", async function () { // Reserve range - await offerHandler.connect(assistant).reserveRange(offerId, length, assistant.address); + await offerHandler.connect(assistant).reserveRange(offerId, length, await assistant.getAddress()); // Get available premints from contract const availablePremints = await bosonVoucher.getAvailablePreMints(offerId); @@ -345,21 +345,21 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio // Generate calldata const calldata = mockSimpleContract.interface.encodeFunctionData("testEvent"); - await expect(bosonVoucher.connect(assistant).callExternalContract(mockSimpleContract.address, calldata)) + await expect(bosonVoucher.connect(assistant).callExternalContract(await mockSimpleContract.getAddress(), calldata)) .to.emit(mockSimpleContract, "TestEvent") .withArgs("1"); }); it("setApprovalForAllToContract()", async function () { - await expect(bosonVoucher.connect(assistant).setApprovalForAllToContract(rando.address, true)) + await expect(bosonVoucher.connect(assistant).setApprovalForAllToContract(await rando.getAddress(), true)) .to.emit(bosonVoucher, "ApprovalForAll") - .withArgs(bosonVoucher.address, rando.address, true); + .withArgs(await bosonVoucher.getAddress(), await rando.getAddress(), true); }); context("withdrawToProtocol()", async function () { beforeEach(async function () { // For some reason, getContractAt and changeEtherBalances don't work together, so we need to explicitly instantiate the contract - bosonVoucher = new Contract(bosonVoucher.address, bosonVoucher.interface, deployer); + bosonVoucher = new Contract(await bosonVoucher.getAddress(), bosonVoucher.interface, deployer); }); it("Can withdraw native token", async function () { @@ -371,7 +371,7 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio expect(sellersFundsBefore).to.eql(expectedAvailableFunds); const amount = parseUnits("1", "ether"); - await deployer.sendTransaction({ to: bosonVoucher.address, value: amount }); + await deployer.sendTransaction({ to: await bosonVoucher.getAddress(), value: amount }); await expect(() => bosonVoucher.connect(rando).withdrawToProtocol([ZeroAddress]) @@ -396,17 +396,17 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio const [foreign20] = await deployMockTokens(["Foreign20"]); const amount = parseUnits("1", "ether"); - await foreign20.connect(deployer).mint(deployer.address, amount); - await foreign20.connect(deployer).transfer(bosonVoucher.address, amount); + await foreign20.connect(deployer).mint(await deployer.getAddress(), amount); + await foreign20.connect(deployer).transfer(await bosonVoucher.getAddress(), amount); - await expect(() => bosonVoucher.connect(rando).withdrawToProtocol([foreign20.address])).to.changeTokenBalances( + await expect(() => bosonVoucher.connect(rando).withdrawToProtocol([await foreign20.getAddress()])).to.changeTokenBalances( foreign20, [bosonVoucher, fundsHandler], [amount*-1, amount] ); // Seller's available balance should increase - expectedAvailableFunds.funds.push(new Funds(foreign20.address, "Foreign20", amount.toString())); + expectedAvailableFunds.funds.push(new Funds(await foreign20.getAddress(), "Foreign20", amount.toString())); const sellerFundsAfter = FundsList.fromStruct(await fundsHandler.getAvailableFunds(sellerId)); expect(sellerFundsAfter).to.eql(expectedAvailableFunds); }); diff --git a/test/util/upgrade.js b/test/util/upgrade.js index 49b5a6708..d7baba4c4 100644 --- a/test/util/upgrade.js +++ b/test/util/upgrade.js @@ -109,10 +109,10 @@ async function deploySuite(deployer, newVersion) { // Get AccessController abstraction const accessControllerInfo = contractsFile.contracts.find((i) => i.name === "AccessController"); - const accessController = await getContractAt("AccessController", accessControllerInfo.address); + const accessController = await getContractAt("AccessController", await accessControllerInfo.getAddress()); // Temporarily grant UPGRADER role to deployer account - await accessController.grantRole(Role.UPGRADER, deployer.address); + await accessController.grantRole(Role.UPGRADER, await deployer.getAddress()); // Get protocolDiamondAddress const protocolDiamondAddress = contractsFile.contracts.find((i) => i.name === "ProtocolDiamond").address; @@ -141,7 +141,7 @@ async function deploySuite(deployer, newVersion) { // create mock token for auth const [mockAuthERC721Contract] = await deployMockTokens(["Foreign721"]); - configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.Lens, mockAuthERC721Contract.address); + configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.Lens, await mockAuthERC721Contract.getAddress()); // create mock token for offers const [mockToken, mockConditionalToken, mockTwin721_1, mockTwin721_2, mockTwin20, mockTwin1155] = @@ -248,7 +248,7 @@ async function upgradeClients() { const clientConfig = { META_TRANSACTION_FORWARDER: { - hardhat: forwarder.address, + hardhat: await forwarder.getAddress(), }, }; @@ -332,7 +332,7 @@ async function populateProtocolContract( const connectedWallet = wallet.connect(provider); //Fund the new wallet let tx = { - to: connectedWallet.address, + to: await connectedWallet.getAddress(), // Convert currency unit from ether to wei value: parseEther("10"), }; @@ -342,19 +342,19 @@ async function populateProtocolContract( switch (entity) { case entityType.DR: { const clerkAddress = versionsWithClerkRole.includes(isBefore ? versionTags.oldVersion : versionTags.newVersion) - ? wallet.address + ? await wallet.getAddress() : ZeroAddress; const disputeResolver = mockDisputeResolver( - wallet.address, - wallet.address, + await wallet.getAddress(), + await wallet.getAddress(), clerkAddress, - wallet.address, + await wallet.getAddress(), true, true ); const disputeResolverFees = [ new DisputeResolverFee(ZeroAddress, "Native", "0"), - new DisputeResolverFee(mockToken.address, "MockToken", "0"), + new DisputeResolverFee(await mockToken.getAddress(), "MockToken", "0"), ]; const sellerAllowList = []; disputeResolver.id = nextAccountId.toString(); @@ -379,9 +379,9 @@ async function populateProtocolContract( case entityType.SELLER: { const clerkAddress = versionsWithClerkRole.includes(isBefore ? versionTags.oldVersion : versionTags.newVersion) - ? wallet.address + ? await wallet.getAddress() : ZeroAddress; - const seller = mockSeller(wallet.address, wallet.address, clerkAddress, wallet.address, true); + const seller = mockSeller(await wallet.getAddress(), await wallet.getAddress(), clerkAddress, await wallet.getAddress(), true); const id = (seller.id = nextAccountId.toString()); let authToken; @@ -400,7 +400,7 @@ async function populateProtocolContract( const voucherInitValues = new VoucherInitValues(`http://seller${id}.com/uri`, id * 10); await accountHandler.connect(connectedWallet).createSeller(seller, authToken, voucherInitValues); - const voucherContractAddress = calculateContractAddress(accountHandler.address, voucherIndex++); + const voucherContractAddress = calculateContractAddress(await accountHandler.getAddress(), voucherIndex++); sellers.push({ wallet: connectedWallet, id, @@ -412,12 +412,12 @@ async function populateProtocolContract( }); // mint mock token to sellers just in case they need them - await mockToken.mint(connectedWallet.address, "10000000000"); + await mockToken.mint(await connectedWallet.getAddress(), "10000000000"); await mockToken.connect(connectedWallet).approve(protocolDiamondAddress, "10000000000"); break; } case entityType.AGENT: { - const agent = mockAgent(wallet.address); + const agent = mockAgent(await wallet.getAddress()); await accountHandler.connect(connectedWallet).createAgent(agent); @@ -427,12 +427,12 @@ async function populateProtocolContract( } case entityType.BUYER: { // no need to explicitly create buyer, since it's done automatically during commitToOffer - const buyer = mockBuyer(wallet.address); + const buyer = mockBuyer(await wallet.getAddress()); buyer.id = nextAccountId.toString(); buyers.push({ wallet: connectedWallet, id: buyer.id, buyer }); // mint them conditional token in case they need it - await mockConditionalToken.mint(wallet.address, "10"); + await mockConditionalToken.mint(await wallet.getAddress(), "10"); break; } } @@ -465,7 +465,7 @@ async function populateProtocolContract( // Default offer is in native token. Change every other to mock token if (offerId % 2 == 0) { - offer.exchangeToken = mockToken.address; + offer.exchangeToken = await mockToken.getAddress(); } // Set unique offer dates based on offer id @@ -511,7 +511,7 @@ async function populateProtocolContract( const seller = sellers[i]; const group = new Group(groupId, seller.seller.id, seller.offerIds); // group all seller's offers const condition = mockCondition({ - tokenAddress: mockConditionalToken.address, + tokenAddress: await mockConditionalToken.getAddress(), maxCommits: "10", }); await groupHandler.connect(seller.wallet).createGroup(group, condition); @@ -560,7 +560,7 @@ async function populateProtocolContract( } // fungible - const twin20 = mockTwin(mockTwin20.address, TokenType.FungibleToken); + const twin20 = mockTwin(await mockTwin20.getAddress(), TokenType.FungibleToken); twin20.id = twinId; twin20.amount = sellerId; @@ -569,7 +569,7 @@ async function populateProtocolContract( await mockTwin20.connect(seller.wallet).approve(protocolDiamondAddress, twin20.supplyAvailable); // mint tokens to be transferred on redeem - await mockTwin20.connect(seller.wallet).mint(seller.wallet.address, twin20.supplyAvailable * twin20.amount); + await mockTwin20.connect(seller.wallet).mint(seller.await wallet.getAddress(), twin20.supplyAvailable * twin20.amount); await twinHandler.connect(seller.wallet).createTwin(twin20); twins.push(twin20); @@ -577,7 +577,7 @@ async function populateProtocolContract( twinId++; // multitoken twin - const twin1155 = mockTwin(mockTwin1155.address, TokenType.MultiToken); + const twin1155 = mockTwin(await mockTwin1155.getAddress(), TokenType.MultiToken); await mockTwin1155.connect(seller.wallet).setApprovalForAll(protocolDiamondAddress, true); for (let j = 0; j < 3; j++) { twin1155.tokenId = `${j * 30000 + sellerId * 300}`; @@ -616,9 +616,9 @@ async function populateProtocolContract( // approve token transfer msgValue = 0; await mockToken.connect(buyerWallet).approve(protocolDiamondAddress, offerPrice); - await mockToken.mint(buyerWallet.address, offerPrice); + await mockToken.mint(await buyerWallet.getAddress(), offerPrice); } - await exchangeHandler.connect(buyerWallet).commitToOffer(buyerWallet.address, offer.id, { value: msgValue }); + await exchangeHandler.connect(buyerWallet).commitToOffer(await buyerWallet.getAddress(), offer.id, { value: msgValue }); exchanges.push({ exchangeId: exchangeId, offerId: offer.id, buyerIndex: j }); exchangeId++; } @@ -756,7 +756,7 @@ async function getAccountContractState(accountHandler, { DRs, sellers, buyers, a } for (const seller of sellers) { - const sellerAddress = seller.wallet.address; + const sellerAddress = seller.await wallet.getAddress(); const sellerAuthToken = seller.authToken; sellerByAddressState.push(await getSeller(accountHandlerRando, sellerAddress, { getBy: "address" })); @@ -767,7 +767,7 @@ async function getAccountContractState(accountHandler, { DRs, sellers, buyers, a const otherAccounts = [...DRs, ...agents, ...buyers]; for (const account of otherAccounts) { - const accountAddress = account.wallet.address; + const accountAddress = account.await wallet.getAddress(); sellerByAddressState.push(await getSeller(accountHandlerRando, accountAddress, { getBy: "address" })); DRbyAddressState.push(await getDisputeResolver(accountHandlerRando, accountAddress, { getBy: "address" })); @@ -1247,7 +1247,7 @@ async function getProtocolLookupsPrivateContractState( const accounts = [...sellers, ...DRs, ...agents, ...buyers]; for (const account of accounts) { - const accountAddress = account.wallet.address; + const accountAddress = account.await wallet.getAddress(); // buyerIdByWallet buyerIdByWallet.push( @@ -1304,7 +1304,7 @@ async function getProtocolLookupsPrivateContractState( ), mockToken: await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(firstMappingStorageSlot, mockToken.address, paddingType.START) + getMappingStoragePosition(firstMappingStorageSlot, await mockToken.getAddress(), paddingType.START) ), }); @@ -1319,7 +1319,7 @@ async function getProtocolLookupsPrivateContractState( ), mockToken: await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(firstMappingStorageSlot, mockToken.address, paddingType.START) + getMappingStoragePosition(firstMappingStorageSlot, await mockToken.getAddress(), paddingType.START) ), }); @@ -1348,13 +1348,13 @@ async function getProtocolLookupsPrivateContractState( ); let ranges = {}; for (let mockTwin of mockTwinTokens) { - ranges[mockTwin.address] = []; - const arraySlot = getMappingStoragePosition(firstMappingStorageSlot, mockTwin.address, paddingType.START); + ranges[await mockTwin.getAddress()] = []; + const arraySlot = getMappingStoragePosition(firstMappingStorageSlot, await mockTwin.getAddress(), paddingType.START); const arrayLength = BigInt(await getStorageAt(protocolDiamondAddress, arraySlot)).toNumber(); const arrayStart = BigInt(keccak256(arraySlot)); for (let i = 0; i < arrayLength * 2; i = i + 2) { // each BosonTypes.TokenRange has length 2 - ranges[mockTwin.address].push({ + ranges[await mockTwin.getAddress()].push({ start: await getStorageAt(protocolDiamondAddress, arrayStart+i), end: await getStorageAt(protocolDiamondAddress, arrayStart+i + 1), }); @@ -1371,12 +1371,12 @@ async function getProtocolLookupsPrivateContractState( ); let twinIds = {}; for (let mockTwin of mockTwinTokens) { - twinIds[mockTwin.address] = []; - const arraySlot = getMappingStoragePosition(firstMappingStorageSlot, mockTwin.address, paddingType.START); + twinIds[await mockTwin.getAddress()] = []; + const arraySlot = getMappingStoragePosition(firstMappingStorageSlot, await mockTwin.getAddress(), paddingType.START); const arrayLength = BigInt(await getStorageAt(protocolDiamondAddress, arraySlot)).toNumber(); const arrayStart = BigInt(keccak256(arraySlot)); for (let i = 0; i < arrayLength; i++) { - twinIds[mockTwin.address].push(await getStorageAt(protocolDiamondAddress, arrayStart+i)); + twinIds[await mockTwin.getAddress()].push(await getStorageAt(protocolDiamondAddress, arrayStart+i)); } } twinIdsByTokenAddressAndBySeller.push(twinIds); @@ -1575,7 +1575,7 @@ async function populateVoucherContract( const connectedWallet = wallet.connect(provider); //Fund the new wallet let tx = { - to: connectedWallet.address, + to: await connectedWallet.getAddress(), // Convert currency unit from ether to wei value: parseEther("10"), }; @@ -1585,16 +1585,16 @@ async function populateVoucherContract( switch (entity) { case entityType.DR: { const disputeResolver = mockDisputeResolver( - wallet.address, - wallet.address, - wallet.address, - wallet.address, + await wallet.getAddress(), + await wallet.getAddress(), + await wallet.getAddress(), + await wallet.getAddress(), true, true ); const disputeResolverFees = [ new DisputeResolverFee(ZeroAddress, "Native", "0"), - new DisputeResolverFee(mockToken.address, "MockToken", "0"), + new DisputeResolverFee(await mockToken.getAddress(), "MockToken", "0"), ]; const sellerAllowList = []; @@ -1618,7 +1618,7 @@ async function populateVoucherContract( break; } case entityType.SELLER: { - const seller = mockSeller(wallet.address, wallet.address, wallet.address, wallet.address, true, undefined, { + const seller = mockSeller(await wallet.getAddress(), await wallet.getAddress(), await wallet.getAddress(), await wallet.getAddress(), true, undefined, { refreshModule: true, }); const id = (seller.id = nextAccountId.toString()); @@ -1629,7 +1629,7 @@ async function populateVoucherContract( await accountHandler.connect(connectedWallet).createSeller(seller, authToken, voucherInitValues); // calculate voucher contract address and cast it to contract instance - const voucherContractAddress = calculateContractAddress(accountHandler.address, voucherIndex++); + const voucherContractAddress = calculateContractAddress(await accountHandler.getAddress(), voucherIndex++); const bosonVoucher = await getContractAt("BosonVoucher", voucherContractAddress); sellers.push({ @@ -1644,13 +1644,13 @@ async function populateVoucherContract( bosonVouchers.push(bosonVoucher); // mint mock token to sellers just in case they need them - await mockToken.mint(connectedWallet.address, "10000000000"); + await mockToken.mint(await connectedWallet.getAddress(), "10000000000"); await mockToken.connect(connectedWallet).approve(protocolDiamondAddress, "10000000000"); break; } case entityType.BUYER: { // no need to explicitly create buyer, since it's done automatically during commitToOffer - const buyer = mockBuyer(wallet.address); + const buyer = mockBuyer(await wallet.getAddress()); buyer.id = nextAccountId.toString(); buyers.push({ wallet: connectedWallet, id: buyer.id, buyer }); break; @@ -1678,7 +1678,7 @@ async function populateVoucherContract( // Default offer is in native token. Change every other to mock token if (offerId % 2 == 0) { - offer.exchangeToken = mockToken.address; + offer.exchangeToken = await mockToken.getAddress(); } // Set unique offer dates based on offer id @@ -1733,9 +1733,9 @@ async function populateVoucherContract( // approve token transfer msgValue = 0; await mockToken.connect(buyerWallet).approve(protocolDiamondAddress, offerPrice); - await mockToken.mint(buyerWallet.address, offerPrice); + await mockToken.mint(await buyerWallet.getAddress(), offerPrice); } - await exchangeHandler.connect(buyerWallet).commitToOffer(buyerWallet.address, offer.id, { value: msgValue }); + await exchangeHandler.connect(buyerWallet).commitToOffer(await buyerWallet.getAddress(), offer.id, { value: msgValue }); exchanges.push({ exchangeId: exchangeId, offerId: offer.id, buyerIndex: j }); exchangeId++; } @@ -1782,7 +1782,7 @@ async function getVoucherContractState({ bosonVouchers, exchanges, sellers, buye // balanceOf(address owner) // isApprovedForAll(address owner, address assistant) - const addresses = [...sellers, ...buyers].map((acc) => acc.wallet.address); + const addresses = [...sellers, ...buyers].map((acc) => acc.await wallet.getAddress()); const balanceOf = await Promise.all(addresses.map((address) => bosonVoucher.balanceOf(address))); const isApprovedForAll = await Promise.all( addresses.map((address1) => diff --git a/test/util/utils.js b/test/util/utils.js index d8f19fbd6..bc9f9d3fb 100644 --- a/test/util/utils.js +++ b/test/util/utils.js @@ -105,7 +105,7 @@ function compareArgs(eventArgs, args) { disputeResolutionTermsStruct, offerFeesStruct, agentId, - assistant.address, + await assistant.getAddress(), ); * * @param {*} returnedOffer @@ -195,7 +195,7 @@ async function prepareDataSignatureParameters( }); // Sign the data - const signature = await provider.send("eth_signTypedData_v4", [user.address, dataToSign]); + const signature = await provider.send("eth_signTypedData_v4", [await user.getAddress(), dataToSign]); // Collect the Signature components const { r, s, v } = getSignatureParameters(signature); @@ -321,16 +321,16 @@ async function setupTestEnvironment(contracts, { bosonTokenAddress, forwarderAdd const [protocolDiamond, , , , accessController] = await deployProtocolDiamond(maxPriorityFeePerGas); // Temporarily grant UPGRADER role to deployer account - await accessController.grantRole(Role.UPGRADER, deployer.address); + await accessController.grantRole(Role.UPGRADER, await deployer.getAddress()); // Grant PROTOCOL role to ProtocolDiamond address and renounces admin - await accessController.grantRole(Role.PROTOCOL, protocolDiamond.address); + await accessController.grantRole(Role.PROTOCOL, await protocolDiamond.getAddress()); // Grant PAUSER role to pauser account - await accessController.grantRole(Role.PAUSER, pauser.address); + await accessController.grantRole(Role.PAUSER, await pauser.getAddress()); // Deploy the Protocol client implementation/proxy pairs (currently just the Boson Voucher) - const protocolClientArgs = [protocolDiamond.address]; + const protocolClientArgs = [await protocolDiamond.getAddress()]; const [implementations, beacons, proxies, clients] = await deployProtocolClients( protocolClientArgs, maxPriorityFeePerGas, @@ -350,10 +350,10 @@ async function setupTestEnvironment(contracts, { bosonTokenAddress, forwarderAdd const protocolConfig = [ // Protocol addresses { - treasury: protocolTreasury.address, - token: bosonTokenAddress || bosonToken.address, - voucherBeacon: beacon.address, - beaconProxy: proxy.address, + treasury: await protocolTreasury.getAddress(), + token: bosonTokenAddress || await bosonToken.getAddress(), + voucherBeacon: await beacon.getAddress(), + beaconProxy: await proxy.getAddress(), }, // Protocol limits { @@ -384,11 +384,11 @@ async function setupTestEnvironment(contracts, { bosonTokenAddress, forwarderAdd const facetsToDeploy = await getFacetsWithArgs(facetNames, protocolConfig); // Cut the protocol handler facets into the Diamond - await deployAndCutFacets(protocolDiamond.address, facetsToDeploy, maxPriorityFeePerGas); + await deployAndCutFacets(await protocolDiamond.getAddress(), facetsToDeploy, maxPriorityFeePerGas); let contractInstances = {}; for (const contract of Object.keys(contracts)) { - contractInstances[contract] = await getContractAt(contracts[contract], protocolDiamond.address); + contractInstances[contract] = await getContractAt(contracts[contract], await protocolDiamond.getAddress()); } const extraReturnValues = { accessController, bosonVoucher, voucherImplementation, beacon }; @@ -397,7 +397,7 @@ async function setupTestEnvironment(contracts, { bosonTokenAddress, forwarderAdd signers: signers.slice(3), contractInstances, protocolConfig, - diamondAddress: protocolDiamond.address, + diamondAddress: await protocolDiamond.getAddress(), extraReturnValues, }; } From f54f3b76605c4bbc71d8af0a7f8d1b29306d0c5f Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Mon, 19 Jun 2023 11:17:38 -0300 Subject: [PATCH 06/32] Continue refactor --- scripts/upgrade-facets.js | 2 +- scripts/util/deploy-protocol-clients.js | 8 +- scripts/util/deploy-protocol-diamond.js | 7 +- .../util/deploy-protocol-handler-facets.js | 23 ++-- scripts/util/diamond-utils.js | 82 +++++++------- scripts/util/utils.js | 2 +- test/integration/seaport/fixtures.js | 6 +- .../seaport/seaport-integration.js | 2 +- test/protocol/AccountHandlerTest.js | 17 ++- test/protocol/MetaTransactionsHandlerTest.js | 2 +- test/protocol/ProtocolDiamondTest.js | 100 +++++++----------- .../ProtocolInitializationHandlerTest.js | 20 ++-- test/util/utils.js | 21 ++-- 13 files changed, 132 insertions(+), 160 deletions(-) diff --git a/scripts/upgrade-facets.js b/scripts/upgrade-facets.js index 5a1879d3f..6e1d882ae 100644 --- a/scripts/upgrade-facets.js +++ b/scripts/upgrade-facets.js @@ -306,7 +306,7 @@ async function main(env, facetConfig, version) { // Get ProtocolInitializationHandlerFacet from deployedFacets when added/replaced in this upgrade or get it from contracts if already deployed let protocolInitializationFacet = await getInitializationFacet(deployedFacets, contracts); const facetsToInit = deployedFacets.filter((facet) => facet.initialize) ?? []; - const initializeCalldata = getInitializeCalldata( + const initializeCalldata = await getInitializeCalldata( facetsToInit, version, true, diff --git a/scripts/util/deploy-protocol-clients.js b/scripts/util/deploy-protocol-clients.js index 488eff07b..aa633802f 100644 --- a/scripts/util/deploy-protocol-clients.js +++ b/scripts/util/deploy-protocol-clients.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { ZeroAddress } = hre.ethers; const { deployProtocolClientImpls } = require("./deploy-protocol-client-impls.js"); const { deployProtocolClientProxies } = require("./deploy-protocol-client-proxies.js"); @@ -22,11 +22,7 @@ const { castProtocolClientProxies } = require("./cast-protocol-client-proxies.js * @param implementationArgs - array of arguments to send to implementation constructor * @returns {Promise<(*|*|*)[]>} */ -async function deployProtocolClients( - protocolClientArgs, - maxPriorityFeePerGas, - implementationArgs = [ZeroAddress] -) { +async function deployProtocolClients(protocolClientArgs, maxPriorityFeePerGas, implementationArgs = [ZeroAddress]) { // Deploy Protocol Client implementation contracts const protocolClientImpls = await deployProtocolClientImpls(implementationArgs, maxPriorityFeePerGas); diff --git a/scripts/util/deploy-protocol-diamond.js b/scripts/util/deploy-protocol-diamond.js index 1b1b1b4b8..c16ea41b6 100644 --- a/scripts/util/deploy-protocol-diamond.js +++ b/scripts/util/deploy-protocol-diamond.js @@ -1,7 +1,7 @@ const { getFacetAddCut } = require("./diamond-utils.js"); const { getInterfaceIds } = require("../config/supported-interfaces.js"); const hre = require("hardhat"); -const { getContractFactory, provider } = hre.ethers; +const { getContractFactory } = hre.ethers; const environments = require("../../environments"); const confirmations = hre.network.name === "hardhat" ? 1 : environments.confirmations; const { getFees } = require("./utils"); @@ -17,6 +17,7 @@ const { getFees } = require("./utils"); async function deployProtocolDiamond(maxPriorityFeePerGas) { // Get interface Ids const InterfaceIds = await getInterfaceIds(); + console.log("interfaceIds", InterfaceIds); // Core interfaces that will be supported at the Diamond address const interfaces = [ @@ -48,8 +49,8 @@ async function deployProtocolDiamond(maxPriorityFeePerGas) { // Arguments for Diamond constructor const diamondArgs = [ - accessController.getAddress(), - [getFacetAddCut(dlf), getFacetAddCut(dcf), getFacetAddCut(erc165f)], + await accessController.getAddress(), + [await getFacetAddCut(dlf), await getFacetAddCut(dcf), await getFacetAddCut(erc165f)], interfaces, ]; diff --git a/scripts/util/deploy-protocol-handler-facets.js b/scripts/util/deploy-protocol-handler-facets.js index 02aa7aa7c..0b48c43e1 100644 --- a/scripts/util/deploy-protocol-handler-facets.js +++ b/scripts/util/deploy-protocol-handler-facets.js @@ -1,6 +1,6 @@ const { getFacetAddCut, cutDiamond, getInitializeCalldata } = require("./diamond-utils.js"); const hre = require("hardhat"); -const ethers = hre.ethers; +const { getContractFactory } = hre.ethers; const environments = require("../../environments"); const confirmations = hre.network.name === "hardhat" ? 1 : environments.confirmations; const { getFees } = require("./utils"); @@ -35,7 +35,7 @@ async function deployAndCutFacets( initializationFacet = initializationFacet || deployedFacets.find((f) => f.name == "ProtocolInitializationHandlerFacet").contract; - const initializeCalldata = getInitializeCalldata( + const initializeCalldata = await getInitializeCalldata( facetsToInit, version, false, @@ -45,14 +45,17 @@ async function deployAndCutFacets( interfacesToAdd ); - deployedFacets = deployedFacets.map((facet) => { - const cut = - facet.name == "ProtocolInitializationHandlerFacet" - ? getFacetAddCut(facet.contract, [initializeCalldata.slice(0, 10)]) - : getFacetAddCut(facet.contract, [facet.initialize && facet.initialize.slice(0, 10)] || []); - facet.cut.push(cut); - return facet; - }); + deployedFacets = await Promise.all( + deployedFacets.map(async (facet) => { + const cut = + facet.name === "ProtocolInitializationHandlerFacet" + ? await getFacetAddCut(facet.contract, [initializeCalldata.slice(0, 10)]) + : await getFacetAddCut(facet.contract, facet.initialize ? [facet.initialize.slice(0, 10)] : []); + + facet.cut.push(cut); + return facet; + }) + ); const cutTransaction = await cutDiamond( diamond, diff --git a/scripts/util/diamond-utils.js b/scripts/util/diamond-utils.js index bc25445ae..a6d8bf675 100644 --- a/scripts/util/diamond-utils.js +++ b/scripts/util/diamond-utils.js @@ -1,15 +1,12 @@ const hre = require("hardhat"); -const { keccak256, toUtf8Bytes, getContractAt, ZeroAddress } = hre.ethers;; +const { keccak256, toUtf8Bytes, getContractAt, ZeroAddress, Interface, getContractFactory, formatBytes32String } = + hre.ethers; const environments = "../../environments.js"; const confirmations = hre.network.name === "hardhat" ? 1 : environments.confirmations; const FacetCutAction = require("../domain/FacetCutAction"); const { interfacesWithMultipleArtifacts } = require("./constants"); const { getFees } = require("./utils"); -function removeNativeFunctions(interface) { - return Object.keys(interface).filter(key => !["deploy", "fragments", "fallback", "receive"].includes(key)); -} - /** * Utilities for testing and interacting with Diamond * @@ -17,16 +14,14 @@ function removeNativeFunctions(interface) { */ // get function selectors from ABI function getSelectors(contract, returnSignatureToNameMapping = false) { - const signatures =removeNativeFunctions(contract.interface); let signatureToNameMapping = {}; - const selectors = signatures.reduce((acc, val) => { - if (val !== "init(bytes)") { - const signature = contract.interface.getSighash(val); - acc.push(signature); - if (returnSignatureToNameMapping) signatureToNameMapping[signature] = val; - } - return acc; - }, []); + const selectors = contract.interface.fragments + .filter((f) => f.type == "function" && f.name !== "init") + .map((f) => { + if (returnSignatureToNameMapping) signatureToNameMapping[f.selector] = f.name; + return f.selector; + }); + selectors.contract = contract; selectors.remove = remove; selectors.get = get; @@ -36,14 +31,14 @@ function getSelectors(contract, returnSignatureToNameMapping = false) { // get interface id async function getInterfaceId(contractName, skipBaseCheck = false, isFullPath = false) { - const contract = await getContractAt(contractName, ZeroAddress); - const signatures = removeNativeFunctions(contract.interface); - const selectors = signatures.reduce((acc, val) => { - acc.push(BigInt(contract[val].getSighash())); + const contract = await getContractAt(contractName, ZeroAddress); + const fragments = contract.interface.fragments.filter((f) => f.type == "function"); + const selectors = fragments.reduce((acc, val) => { + acc.push(val.selector); return acc; }, []); - let interfaceId = selectors.reduce((pv, cv) => pv ^ cv, BigInt(0x00000000)); + let interfaceId = selectors.reduce((pv, cv) => pv ^ BigInt(cv), BigInt(0x00000000)); // If contract inherits other contracts, their interfaces must be xor-ed if (!skipBaseCheck) { @@ -76,24 +71,17 @@ async function getInterfaceId(contractName, skipBaseCheck = false, isFullPath = ); // Remove interface id of base contracts - interfaceId = interfaceId ^baseContractInterfaceId; + interfaceId = interfaceId ^ baseContractInterfaceId; } } - return interfaceId == 0n ? "0x00000000" : hexZeroPad(interfaceId.toHexString(), 4); -} - -// get function selector from function signature -function getSelector(func) { - const abiInterface = new Interface([func]); - return abiInterface.getSighash(Fragment.from(func)); + return interfaceId == 0n ? "0x00000000" : "0x" + interfaceId.toString(16).padStart(8, "0"); } // used with getSelectors to remove selectors from an array of selectors -// functionNames argument is an array of function signatures -function remove(functionNamesOrSignature) { +function remove(selectorsToRemove) { const selectors = this.filter((v) => { - for (const functionName of functionNamesOrSignature) { - if (v === this.contract.interface.getSighash(functionName)) { + for (const selector of selectorsToRemove) { + if (v === selector) { return false; } } @@ -108,14 +96,12 @@ function remove(functionNamesOrSignature) { // used with getSelectors to get selectors from an array of selectors // functionNames argument is an array of function signatures function get(functionNames) { - const selectors = this.filter((v) => { - for (const functionName of functionNames) { - if (v === this.contract.interface.getSighash(functionName)) { - return true; - } - } - return false; - }); + const selectors = this.contract.interface + .fragments(functionNames) + .filter((f) => f.type == "function") + .filter((f) => functionNames.includes(f.name)) + .map((f) => f.selector); + selectors.contract = this.contract; selectors.remove = this.remove; selectors.get = this.get; @@ -125,6 +111,7 @@ function get(functionNames) { // remove selectors using an array of signatures function removeSelectors(selectors, signatures) { const iface = new Interface(signatures.map((v) => "function " + v)); + console.log("iface", iface); const removeSelectors = signatures.map((v) => iface.getSighash(v)); selectors = selectors.filter((v) => !removeSelectors.includes(v)); return selectors; @@ -141,17 +128,20 @@ function findAddressPositionInFacets(facetAddress, facets) { async function getFacetAddCut(facet, omitFunctions = []) { let selectors = omitFunctions.length ? getSelectors(facet).remove(omitFunctions) : getSelectors(facet); - return [await facet.getAddress(), FacetCutAction.Add, selectors]; + const address = await facet.getAddress(); + return [address, FacetCutAction.Add, selectors]; } async function getFacetReplaceCut(facet, omitFunctions = []) { let selectors = omitFunctions.length ? getSelectors(facet).remove(omitFunctions) : getSelectors(facet); - return [await facet.getAddress(), FacetCutAction.Replace, selectors]; + const address = await facet.getAddress(); + return [address, FacetCutAction.Replace, selectors]; } -function getFacetRemoveCut(facet, omitFunctions = []) { +async function getFacetRemoveCut(facet, omitFunctions = []) { let selectors = omitFunctions.length ? getSelectors(facet).remove(omitFunctions) : getSelectors(facet); - return [await facet.getAddress(), FacetCutAction.Remove, selectors]; + const address = await facet.getAddress(); + return [address, FacetCutAction.Remove, selectors]; } async function getStateModifyingFunctions(facetNames, omitFunctions = [], onlyFunctions = []) { @@ -193,7 +183,7 @@ function getStateModifyingFunctionsHashes(facetNames, omitFunctions = [], onlyFu } // Get ProtocolInitializationHandlerFacet initialize calldata to be called on diamondCut -function getInitializeCalldata( +async function getInitializeCalldata( facetsToInitialize, version, isUpgrade, @@ -203,7 +193,8 @@ function getInitializeCalldata( interfacesToAdd = [] ) { version = formatBytes32String(version); - const addresses = facetsToInitialize.map((f) => f.await contract.getAddress()); + const addresses = await facetsToInitialize.map(async (f) => await f.contract.getAddress()); + const calldata = facetsToInitialize.map((f) => f.initialize); return initializationFacet.interface.encodeFunctionData("initialize", [ @@ -246,7 +237,6 @@ async function cutDiamond( } exports.getSelectors = getSelectors; -exports.getSelector = getSelector; exports.FacetCutAction = FacetCutAction; exports.remove = remove; exports.removeSelectors = removeSelectors; diff --git a/scripts/util/utils.js b/scripts/util/utils.js index 54504958e..93f4e1d26 100644 --- a/scripts/util/utils.js +++ b/scripts/util/utils.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const { provider } = hre.ethers; +const { provider, getContractAt } = hre.ethers; const fs = require("fs"); const addressesDirPath = __dirname + `/../../addresses`; diff --git a/test/integration/seaport/fixtures.js b/test/integration/seaport/fixtures.js index 6280b5219..024db442b 100644 --- a/test/integration/seaport/fixtures.js +++ b/test/integration/seaport/fixtures.js @@ -35,9 +35,9 @@ const seaportFixtures = async (seaport) => { orderType = OrderType.FULL_OPEN, startTime, endTime, - zoneHash = constants.HashZero, + zoneHash = ZeroHash, salt = 0, - conduitKey = constants.HashZero + conduitKey = ZeroHash ) { const parameters = { offerer: await offerer.getAddress(), @@ -58,7 +58,7 @@ const seaportFixtures = async (seaport) => { const orderHash = await getAndVerifyOrderHash(orderComponents); - const signature = constants.HashZero; + const signature = ZeroHash; const order = { parameters, diff --git a/test/integration/seaport/seaport-integration.js b/test/integration/seaport/seaport-integration.js index 7adeb1004..4c3e2e874 100644 --- a/test/integration/seaport/seaport-integration.js +++ b/test/integration/seaport/seaport-integration.js @@ -114,7 +114,7 @@ describe("[@skip-on-coverage] Seaport integration", function () { assert(isValidated, "Order is not validated"); assert.equal(totalFilled.toNumber(), 0); - const tx = await seaport.connect(buyer).fulfillOrder(order, constants.HashZero, { value }); + const tx = await seaport.connect(buyer).fulfillOrder(order, ZeroHash, { value }); const receipt = await tx.wait(); const event = getEvent(receipt, seaport, "OrderFulfilled"); diff --git a/test/protocol/AccountHandlerTest.js b/test/protocol/AccountHandlerTest.js index 134eeb7ab..b8bbb961e 100644 --- a/test/protocol/AccountHandlerTest.js +++ b/test/protocol/AccountHandlerTest.js @@ -1,3 +1,5 @@ +const hre = require("hardhat"); +const { ZeroAddress } = hre.ethers; const { expect } = require("chai"); const { DisputeResolverFee } = require("../../scripts/domain/DisputeResolverFee"); @@ -12,7 +14,6 @@ const { accountId, } = require("../util/mock"); const { setupTestEnvironment, getSnapshot, revertToSnapshot } = require("../util/utils"); -const { ethers } = require("hardhat"); /** * Test the Boson Account Handler interface @@ -82,7 +83,12 @@ describe("IBosonAccountHandler", function () { nextAccountId = "1"; // Create a valid seller, then set fields in tests directly - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + await clerk.getAddress(), + await treasury.getAddress() + ); expect(seller.isValid()).is.true; // VoucherInitValues @@ -99,7 +105,12 @@ describe("IBosonAccountHandler", function () { expect(buyer.isValid()).is.true; // Create a valid dispute resolver - disputeResolver = mockDisputeResolver(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + disputeResolver = mockDisputeResolver( + await assistant.getAddress(), + await admin.getAddress(), + await clerk.getAddress(), + await treasury.getAddress() + ); expect(disputeResolver.isValid()).is.true; //Create DisputeResolverFee array diff --git a/test/protocol/MetaTransactionsHandlerTest.js b/test/protocol/MetaTransactionsHandlerTest.js index e7d2cd941..afa6837fa 100644 --- a/test/protocol/MetaTransactionsHandlerTest.js +++ b/test/protocol/MetaTransactionsHandlerTest.js @@ -1146,7 +1146,7 @@ describe("IBosonMetaTransactionsHandler", function () { functionSignature = metaTransactionsHandler.interface.encodeFunctionData("executeMetaTransaction", [ await assistant.getAddress(), "executeMetaTransaction", - constants.HashZero, // hash of zero + ZeroHash, // hash of zero nonce, randomBytes(32), // random bytes32 randomBytes(32), // random bytes32 diff --git a/test/protocol/ProtocolDiamondTest.js b/test/protocol/ProtocolDiamondTest.js index 0c84fad60..f97aaed9e 100644 --- a/test/protocol/ProtocolDiamondTest.js +++ b/test/protocol/ProtocolDiamondTest.js @@ -1,6 +1,6 @@ const { assert, expect } = require("chai"); const hre = require("hardhat"); -const ethers = hre.ethers; +const { getSigners, getContractAt, getContractFactory, Interface, ZeroAddress } = hre.ethers; const Role = require("../../scripts/domain/Role"); const Facet = require("../../scripts/domain/Facet"); @@ -148,7 +148,7 @@ describe("ProtocolDiamond", async function () { // Deploy TestFacet256 const TestFacet256 = await getContractFactory("TestFacet256"); const testFacet256 = await TestFacet256.deploy(); - await testFacet256.deployed(); + await testFacet256.deploymentTransaction(); // Get the TestFacet256 function selectors from the abi selectors = getSelectors(testFacet256); @@ -193,7 +193,7 @@ describe("ProtocolDiamond", async function () { // Deploy Test1Facet to have more selectors Test1Facet = await getContractFactory("Test1Facet"); test1Facet = await Test1Facet.deploy(); - await test1Facet.deployed(); + await test1Facet.deploymentTransaction(); // Get the Test1Facet function selectors from the abi selectors = getSelectors(test1Facet); @@ -208,9 +208,7 @@ describe("ProtocolDiamond", async function () { ]; // Send the DiamondCut transaction - await cutFacetViaDiamond - .connect(upgrader) - .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); + await cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); const addresses = await loupeFacetViaDiamond.facetAddresses(); @@ -263,17 +261,17 @@ describe("ProtocolDiamond", async function () { // Deploy Test1Facet Test1Facet = await getContractFactory("Test1Facet"); test1Facet = await Test1Facet.deploy(); - await test1Facet.deployed(); + await test1Facet.deploymentTransaction(); // Deploy Test2Facet Test2Facet = await getContractFactory("Test2Facet"); test2Facet = await Test2Facet.deploy(); - await test2Facet.deployed(); + await test2Facet.deploymentTransaction(); // Deploy Test3Facet Test3Facet = await getContractFactory("Test3Facet"); test3Facet = await Test3Facet.deploy(); - await test3Facet.deployed(); + await test3Facet.deploymentTransaction(); // N.B. The facets are not yet connected to the diamond in any way, // but following handles prepare us for accessing the diamond via @@ -309,9 +307,7 @@ describe("ProtocolDiamond", async function () { ).to.be.revertedWith(RevertReasons.ONLY_UPGRADER); // UPGRADER attempt - tx = await cutFacetViaDiamond - .connect(upgrader) - .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); + tx = await cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); @@ -336,9 +332,7 @@ describe("ProtocolDiamond", async function () { ]; // Send the DiamondCut transaction - tx = await cutFacetViaDiamond - .connect(upgrader) - .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); + tx = await cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); @@ -365,9 +359,7 @@ describe("ProtocolDiamond", async function () { ]; // Send the DiamondCut transaction - tx = await cutFacetViaDiamond - .connect(upgrader) - .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); + tx = await cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); @@ -383,8 +375,8 @@ describe("ProtocolDiamond", async function () { it("should allow functions from different facets to be added in one transaction", async () => { // Get even numbered selectors from Test1Facet + odd from Test2Facet selectors = [ - getSelectors(test1ViaDiamond).filter((s, i) => i % 2), - getSelectors(test2ViaDiamond).filter((s, i) => !(i % 2)), + getSelectors(test1ViaDiamond).filter((_, i) => i % 2), + getSelectors(test2ViaDiamond).filter((_, i) => !(i % 2)), ]; // Define facet cuts @@ -402,9 +394,7 @@ describe("ProtocolDiamond", async function () { ]; // Send the DiamondCut transaction - tx = await cutFacetViaDiamond - .connect(upgrader) - .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); + tx = await cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Be certain transaction was successful assert.equal(receipt.status, 1, `Diamond upgrade failed: ${tx.hash}`); @@ -447,9 +437,7 @@ describe("ProtocolDiamond", async function () { ]; // Send the DiamondCut transaction - await cutFacetViaDiamond - .connect(upgrader) - .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); + await cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // attempt to add the same selectors again await expect( @@ -475,9 +463,7 @@ describe("ProtocolDiamond", async function () { ]; // Send the DiamondCut transaction - tx = await cutFacetViaDiamond - .connect(upgrader) - .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); + tx = await cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); @@ -501,9 +487,7 @@ describe("ProtocolDiamond", async function () { ]; // Send the DiamondCut transaction - tx = await cutFacetViaDiamond - .connect(upgrader) - .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); + tx = await cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); @@ -531,9 +515,7 @@ describe("ProtocolDiamond", async function () { ]; // Send the DiamondCut transaction - tx = await cutFacetViaDiamond - .connect(upgrader) - .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); + tx = await cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); @@ -571,9 +553,7 @@ describe("ProtocolDiamond", async function () { ]; // Send the DiamondCut transaction - tx = await cutFacetViaDiamond - .connect(upgrader) - .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); + tx = await cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); @@ -660,9 +640,7 @@ describe("ProtocolDiamond", async function () { ]; // Send the DiamondCut transaction that adds immutable functions - await cutFacetViaDiamond - .connect(upgrader) - .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); + await cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Define the facet cut facetCuts = [ @@ -697,9 +675,7 @@ describe("ProtocolDiamond", async function () { ]; // Send the DiamondCut transaction - tx = await cutFacetViaDiamond - .connect(upgrader) - .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); + tx = await cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); @@ -715,7 +691,7 @@ describe("ProtocolDiamond", async function () { // Deploy Test2FacetUpgrade Test2FacetUpgrade = await getContractFactory("Test2FacetUpgrade"); test2FacetUpgrade = await Test2FacetUpgrade.deploy(); - await test2FacetUpgrade.deployed(); + await test2FacetUpgrade.deploymentTransaction(); // Define the facet cut facetCuts = [ @@ -727,9 +703,7 @@ describe("ProtocolDiamond", async function () { ]; // Send the DiamondCut transaction - tx = await cutFacetViaDiamond - .connect(upgrader) - .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); + tx = await cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); @@ -770,9 +744,7 @@ describe("ProtocolDiamond", async function () { ]; // Send the DiamondCut transaction that adds immutable functions - await cutFacetViaDiamond - .connect(upgrader) - .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); + await cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Define the facet cut facetCuts = [ @@ -845,7 +817,7 @@ describe("ProtocolDiamond", async function () { // Deploy Test3Facet Test3Facet = await getContractFactory("Test3Facet"); test3Facet = await Test3Facet.deploy(); - await test3Facet.deployed(); + await test3Facet.deploymentTransaction(); // N.B. The facets are not yet connected to the diamond in any way, // but following handles prepare us for accessing the diamond via @@ -966,7 +938,9 @@ describe("ProtocolDiamond", async function () { // If contract address is supplied Test3Facet's initializer will revert with the specific reason await expect( - cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, await test3Facet.getAddress(), initCallData, { gasLimit }) + cutFacetViaDiamond + .connect(upgrader) + .diamondCut(facetCuts, await test3Facet.getAddress(), initCallData, { gasLimit }) ).to.revertedWith(RevertReasons.CONTRACT_NOT_ALLOWED); }); @@ -991,7 +965,9 @@ describe("ProtocolDiamond", async function () { // If the caller's address is supplied Test3Facet's initializer will revert with no reason // and so the diamondCut function will supply it's own reason await expect( - cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, await test3Facet.getAddress(), initCallData, { gasLimit }) + cutFacetViaDiamond + .connect(upgrader) + .diamondCut(facetCuts, await test3Facet.getAddress(), initCallData, { gasLimit }) ).to.revertedWith(RevertReasons.INIT_REVERTED); }); @@ -1015,9 +991,7 @@ describe("ProtocolDiamond", async function () { // If contract address is supplied but _calldata is empty, diamondCut will revert with it's own reason await expect( - cutFacetViaDiamond - .connect(upgrader) - .diamondCut(facetCuts, ZeroAddress, initCallData, { gasLimit }) + cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, initCallData, { gasLimit }) ).to.revertedWith(RevertReasons.INIT_ZERO_ADDRESS_NON_EMPTY_CALLDATA); }); @@ -1061,7 +1035,9 @@ describe("ProtocolDiamond", async function () { // If contract address has no code, diamondCut will revert with it's own reason await expect( - cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, await deployer.getAddress(), initCallData, { gasLimit }) + cutFacetViaDiamond + .connect(upgrader) + .diamondCut(facetCuts, await deployer.getAddress(), initCallData, { gasLimit }) ).to.revertedWith(RevertReasons.INIT_ADDRESS_WITH_NO_CODE); }); @@ -1090,12 +1066,12 @@ describe("ProtocolDiamond", async function () { // Deploy Test1Facet Test1Facet = await getContractFactory("Test1Facet"); test1Facet = await Test1Facet.deploy(); - await test1Facet.deployed(); + await test1Facet.waitForDeployment(); // Deploy Test2Facet Test2Facet = await getContractFactory("Test2Facet"); test2Facet = await Test2Facet.deploy(); - await test2Facet.deployed(); + await test2Facet.waitForDeployment(); // Cast Diamond to Test1Facet test1ViaDiamond = await getContractAt("Test1Facet", await protocolDiamond.getAddress()); @@ -1118,9 +1094,7 @@ describe("ProtocolDiamond", async function () { ]; // Send the DiamondCut transaction - tx = await cutFacetViaDiamond - .connect(upgrader) - .diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); + tx = await cutFacetViaDiamond.connect(upgrader).diamondCut(facetCuts, ZeroAddress, "0x", { gasLimit }); // Wait for transaction to confirm receipt = await tx.wait(); diff --git a/test/protocol/ProtocolInitializationHandlerTest.js b/test/protocol/ProtocolInitializationHandlerTest.js index 57e38c1da..4f8cb0543 100644 --- a/test/protocol/ProtocolInitializationHandlerTest.js +++ b/test/protocol/ProtocolInitializationHandlerTest.js @@ -1,6 +1,6 @@ const { expect } = require("chai"); const hre = require("hardhat"); -const ethers = hre.ethers; +const { getContractAt, getContractFactory, getSigners, formatBytes32String, defaultAbiCoder, ZeroHash } = hre.ethers; const Role = require("../../scripts/domain/Role"); const { deployProtocolDiamond } = require("../../scripts/util/deploy-protocol-diamond.js"); @@ -76,9 +76,7 @@ describe("ProtocolInitializationHandler", async function () { let protocolInitializationFacetDeployed; beforeEach(async function () { - const ProtocolInitilizationContractFactory = await getContractFactory( - "ProtocolInitializationHandlerFacet" - ); + const ProtocolInitilizationContractFactory = await getContractFactory("ProtocolInitializationHandlerFacet"); protocolInitializationFacetDeployed = await ProtocolInitilizationContractFactory.deploy( await getFees(maxPriorityFeePerGas) ); @@ -115,7 +113,7 @@ describe("ProtocolInitializationHandler", async function () { it("Version is empty", async function () { const callData = protocolInitializationFacetDeployed.interface.encodeFunctionData("initialize", [ - constants.HashZero, + ZeroHash, [], [], true, @@ -274,7 +272,7 @@ describe("ProtocolInitializationHandler", async function () { await diamondCutFacet.diamondCut( [], - deployedProtocolInitializationHandlerFacet.await contract.getAddress(), + await deployedProtocolInitializationHandlerFacet.contract.getAddress(), calldataProtocolInitialization, await getFees(maxPriorityFeePerGas) ); @@ -318,7 +316,7 @@ describe("ProtocolInitializationHandler", async function () { await diamondCutFacet.diamondCut( facetCuts, - deployedProtocolInitializationHandlerFacet.await contract.getAddress(), + await deployedProtocolInitializationHandlerFacet.contract.getAddress(), calldataProtocolInitialization, await getFees(maxPriorityFeePerGas) ); @@ -358,7 +356,7 @@ describe("ProtocolInitializationHandler", async function () { await expect( diamondCutFacet.diamondCut( facetCuts, - deployedProtocolInitializationHandlerFacet.await contract.getAddress(), + await deployedProtocolInitializationHandlerFacet.contract.getAddress(), calldataProtocolInitialization, await getFees(maxPriorityFeePerGas) ) @@ -386,7 +384,7 @@ describe("ProtocolInitializationHandler", async function () { await expect( diamondCutFacet.diamondCut( facetCuts, - deployedProtocolInitializationHandlerFacet.await contract.getAddress(), + await deployedProtocolInitializationHandlerFacet.contract.getAddress(), calldataProtocolInitialization, await getFees(maxPriorityFeePerGas) ) @@ -405,9 +403,7 @@ describe("ProtocolInitializationHandler", async function () { version = "2.1.0"; // Deploy mock protocol initialization facet which simulates state before v2.2.0 - const ProtocolInitilizationContractFactory = await getContractFactory( - "MockProtocolInitializationHandlerFacet" - ); + const ProtocolInitilizationContractFactory = await getContractFactory("MockProtocolInitializationHandlerFacet"); const mockInitializationFacetDeployed = await ProtocolInitilizationContractFactory.deploy( await getFees(maxPriorityFeePerGas) ); diff --git a/test/util/utils.js b/test/util/utils.js index bc9f9d3fb..2d016243c 100644 --- a/test/util/utils.js +++ b/test/util/utils.js @@ -1,5 +1,5 @@ const { ethers } = require("hardhat"); -const { utils, provider, BigNumber, keccak256, RLP, getSigners } = ethers; +const { utils, provider, BigNumber, keccak256, RLP, getSigners, parseUnits, getContractAt } = ethers; const { getFacets } = require("../../scripts/config/facet-deploy.js"); const { oneWeek, oneMonth, maxPriorityFeePerGas } = require("./constants"); const Role = require("../../scripts/domain/Role"); @@ -174,7 +174,7 @@ async function prepareDataSignatureParameters( if (type == "Protocol") { //hardhat default chain id is 31337 - domainData.salt = utils.hexZeroPad(BigInt(31337).toHexString(), 32); + domainData.salt = utils.hexZeroPad(BigInt(31337).toString(), 32); } else { const { chainId } = await provider.getNetwork(); domainData.chainId = chainId; @@ -209,19 +209,20 @@ async function prepareDataSignatureParameters( } function calculateVoucherExpiry(block, voucherRedeemableFromDate, voucherValidDuration) { - const startDate = BigInt(block.timestamp)>BigInt(voucherRedeemableFromDate) - ? BigInt(block.timestamp) - : BigInt(voucherRedeemableFromDate); - return startDate+BigInt(voucherValidDuration).toString(); + const startDate = + BigInt(block.timestamp) > BigInt(voucherRedeemableFromDate) + ? BigInt(block.timestamp) + : BigInt(voucherRedeemableFromDate); + return startDate + BigInt(voucherValidDuration).toString(); } function applyPercentage(base, percentage) { -return BigInt(base)*BigInt(percentage)/BigInt(10000); + return (BigInt(base) * BigInt(percentage)) / BigInt(10000); } function calculateContractAddress(senderAddress, senderNonce) { const nonce = BigInt(senderNonce); - const nonceHex = nonce.eq(0) ? "0x" : nonce.toHexString(); + const nonceHex = nonce.eq(0) ? "0x" : nonce.toString(); const input_arr = [senderAddress, nonceHex]; const rlp_encoded = RLP.encode(input_arr); @@ -351,7 +352,7 @@ async function setupTestEnvironment(contracts, { bosonTokenAddress, forwarderAdd // Protocol addresses { treasury: await protocolTreasury.getAddress(), - token: bosonTokenAddress || await bosonToken.getAddress(), + token: bosonTokenAddress || (await bosonToken.getAddress()), voucherBeacon: await beacon.getAddress(), beaconProxy: await proxy.getAddress(), }, @@ -411,7 +412,7 @@ async function revertToSnapshot(snapshotId) { } function deriveTokenId(offerId, exchangeId) { - return BigInt(offerId).shl(128)+exchangeId; + return BigInt(offerId).shl(128) + exchangeId; } exports.setNextBlockTimestamp = setNextBlockTimestamp; From 529d51bb23285c8b6412e80541971824661a0a63 Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Mon, 19 Jun 2023 21:58:55 -0300 Subject: [PATCH 07/32] Fixing diamond utils and related --- scripts/util/deploy-protocol-diamond.js | 1 - scripts/util/diamond-utils.js | 6 ++---- test/protocol/ProtocolDiamondTest.js | 27 ++++++++++++------------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/scripts/util/deploy-protocol-diamond.js b/scripts/util/deploy-protocol-diamond.js index c16ea41b6..eee90237a 100644 --- a/scripts/util/deploy-protocol-diamond.js +++ b/scripts/util/deploy-protocol-diamond.js @@ -17,7 +17,6 @@ const { getFees } = require("./utils"); async function deployProtocolDiamond(maxPriorityFeePerGas) { // Get interface Ids const InterfaceIds = await getInterfaceIds(); - console.log("interfaceIds", InterfaceIds); // Core interfaces that will be supported at the Diamond address const interfaces = [ diff --git a/scripts/util/diamond-utils.js b/scripts/util/diamond-utils.js index a6d8bf675..cbcead01b 100644 --- a/scripts/util/diamond-utils.js +++ b/scripts/util/diamond-utils.js @@ -96,8 +96,7 @@ function remove(selectorsToRemove) { // used with getSelectors to get selectors from an array of selectors // functionNames argument is an array of function signatures function get(functionNames) { - const selectors = this.contract.interface - .fragments(functionNames) + const selectors = this.contract.interface.fragments .filter((f) => f.type == "function") .filter((f) => functionNames.includes(f.name)) .map((f) => f.selector); @@ -111,8 +110,7 @@ function get(functionNames) { // remove selectors using an array of signatures function removeSelectors(selectors, signatures) { const iface = new Interface(signatures.map((v) => "function " + v)); - console.log("iface", iface); - const removeSelectors = signatures.map((v) => iface.getSighash(v)); + const removeSelectors = iface.fragments.map((f) => f.selector); selectors = selectors.filter((v) => !removeSelectors.includes(v)); return selectors; } diff --git a/test/protocol/ProtocolDiamondTest.js b/test/protocol/ProtocolDiamondTest.js index f97aaed9e..7dcdb3ead 100644 --- a/test/protocol/ProtocolDiamondTest.js +++ b/test/protocol/ProtocolDiamondTest.js @@ -148,7 +148,7 @@ describe("ProtocolDiamond", async function () { // Deploy TestFacet256 const TestFacet256 = await getContractFactory("TestFacet256"); const testFacet256 = await TestFacet256.deploy(); - await testFacet256.deploymentTransaction(); + await testFacet256.waitForDeployment(); // Get the TestFacet256 function selectors from the abi selectors = getSelectors(testFacet256); @@ -193,7 +193,7 @@ describe("ProtocolDiamond", async function () { // Deploy Test1Facet to have more selectors Test1Facet = await getContractFactory("Test1Facet"); test1Facet = await Test1Facet.deploy(); - await test1Facet.deploymentTransaction(); + await test1Facet.waitForDeployment(); // Get the Test1Facet function selectors from the abi selectors = getSelectors(test1Facet); @@ -223,17 +223,16 @@ describe("ProtocolDiamond", async function () { context("👉 facetFunctionSelectors() ", async () => { it("should return the correct function selectors for the DiamondCutFacet", async () => { - // Test cutFacetViaDiamond selectors selectors = getSelectors(cutFacetViaDiamond); result = await loupeFacetViaDiamond.facetFunctionSelectors(await diamondCut.getAddress()); - assert.sameMembers(result, selectors); + assert.sameMembers([...result], selectors); }); it("should return the correct function selectors for the DiamondLoupeFacet", async () => { // Test DiamondLoupeFacet selectors selectors = getSelectors(loupeFacetViaDiamond); result = await loupeFacetViaDiamond.facetFunctionSelectors(await diamondLoupe.getAddress()); - assert.sameMembers(result, selectors); + assert.sameMembers([...result], selectors); }); }); @@ -261,17 +260,17 @@ describe("ProtocolDiamond", async function () { // Deploy Test1Facet Test1Facet = await getContractFactory("Test1Facet"); test1Facet = await Test1Facet.deploy(); - await test1Facet.deploymentTransaction(); + await test1Facet.waitForDeployment(); // Deploy Test2Facet Test2Facet = await getContractFactory("Test2Facet"); test2Facet = await Test2Facet.deploy(); - await test2Facet.deploymentTransaction(); + await test2Facet.waitForDeployment(); // Deploy Test3Facet Test3Facet = await getContractFactory("Test3Facet"); test3Facet = await Test3Facet.deploy(); - await test3Facet.deploymentTransaction(); + await test3Facet.waitForDeployment(); // N.B. The facets are not yet connected to the diamond in any way, // but following handles prepare us for accessing the diamond via @@ -342,7 +341,7 @@ describe("ProtocolDiamond", async function () { // Make sure function selectors for the facet are correct result = await loupeFacetViaDiamond.facetFunctionSelectors(await test1Facet.getAddress()); - assert.sameMembers(result, selectors); + assert.sameMembers([...result], selectors); }); it("should add functions from Test2Facet", async () => { @@ -369,7 +368,7 @@ describe("ProtocolDiamond", async function () { // Make sure function selectors for the facet are correct result = await loupeFacetViaDiamond.facetFunctionSelectors(await test2Facet.getAddress()); - assert.sameMembers(result, selectors); + assert.sameMembers([...result], selectors); }); it("should allow functions from different facets to be added in one transaction", async () => { @@ -861,7 +860,7 @@ describe("ProtocolDiamond", async function () { it("Should call an initializer function if supplied", async () => { // Make sure function selectors for the facet are correct result = await loupeFacetViaDiamond.facetFunctionSelectors(await test3Facet.getAddress()); - assert.sameMembers(result, selectors); + assert.sameMembers([...result], selectors); }); it("Should store initializer state in diamond storage slot when modifier runs", async () => { @@ -885,14 +884,14 @@ describe("ProtocolDiamond", async function () { // Arguments for Diamond constructor const diamondArgs = [ await accessController.getAddress(), - [getFacetAddCut(diamondLoupe), getFacetAddCut(diamondCut), getFacetAddCut(erc165)], + [await getFacetAddCut(diamondLoupe), await getFacetAddCut(diamondCut), await getFacetAddCut(erc165)], interfaces, ]; // Deploy Protocol Diamond const ProtocolDiamond = await getContractFactory("TestInitializableDiamond"); const protocolDiamond = await ProtocolDiamond.deploy(...diamondArgs); - await protocolDiamond.deployTransaction.wait(); + await protocolDiamond.waitForDeployment(); // Cast new Diamond to DiamondCutFacet cutFacetViaDiamond = await getContractAt("DiamondCutFacet", await protocolDiamond.getAddress()); @@ -1048,7 +1047,7 @@ describe("ProtocolDiamond", async function () { // Arguments for Diamond constructor const diamondArgs = [ ZeroAddress, - [getFacetAddCut(diamondLoupe), getFacetAddCut(diamondCut), getFacetAddCut(erc165)], + [await getFacetAddCut(diamondLoupe), await getFacetAddCut(diamondCut), await getFacetAddCut(erc165)], interfaces, ]; From 52781eedad4982c012265184709903574320735d Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Mon, 19 Jun 2023 22:03:44 -0300 Subject: [PATCH 08/32] Remediate scripts --- .../example/SnapshotGate/deploy-snapshot-gate.js | 2 +- scripts/util/cast-protocol-client-proxies.js | 2 +- scripts/util/deploy-mock-tokens.js | 4 ++-- scripts/util/deploy-protocol-client-beacons.js | 4 ++-- scripts/util/deploy-protocol-client-impls.js | 4 ++-- scripts/util/deploy-protocol-client-proxies.js | 4 ++-- scripts/util/deploy-protocol-handler-facets.js | 2 +- scripts/util/diamond-utils.js | 8 ++++---- test/protocol/AccountHandlerTest.js | 4 ++-- test/protocol/BuyerHandlerTest.js | 15 +++++++++++---- .../protocol/ProtocolInitializationHandlerTest.js | 10 +++++----- 11 files changed, 33 insertions(+), 26 deletions(-) diff --git a/scripts/example/SnapshotGate/deploy-snapshot-gate.js b/scripts/example/SnapshotGate/deploy-snapshot-gate.js index 1cab7d0f2..16670413f 100644 --- a/scripts/example/SnapshotGate/deploy-snapshot-gate.js +++ b/scripts/example/SnapshotGate/deploy-snapshot-gate.js @@ -24,7 +24,7 @@ async function deploySnapshotGateExample(snapshotGateArgs, maxPriorityFeePerGas) // Deploy the SnapshotGate const SnapshotGate = await getContractFactory("SnapshotGate"); const snapshotGate = await SnapshotGate.deploy(...snapshotGateArgs, await getFees(maxPriorityFeePerGas)); - await snapshotGate.deployTransaction.wait(confirmations); + await snapshotGate.waitForDeployment(confirmations); return [snapshotGate]; } diff --git a/scripts/util/cast-protocol-client-proxies.js b/scripts/util/cast-protocol-client-proxies.js index 8fecc8e4e..7552aac99 100644 --- a/scripts/util/cast-protocol-client-proxies.js +++ b/scripts/util/cast-protocol-client-proxies.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getContractAt } = hre.ethers; /** * Cast the Protocol Client Proxy contracts to their implementation interfaces diff --git a/scripts/util/deploy-mock-tokens.js b/scripts/util/deploy-mock-tokens.js index de3927c1e..db2322ec0 100644 --- a/scripts/util/deploy-mock-tokens.js +++ b/scripts/util/deploy-mock-tokens.js @@ -41,13 +41,13 @@ async function deployAndMintMockNFTAuthTokens() { //Deploy a mock NFT to represent the Lens Protocol profile NFT let lensTokenContractFactory = await getContractFactory("MockNFTAuth721"); const lensTokenContract = await lensTokenContractFactory.deploy(); - await lensTokenContract.deployTransaction.wait(confirmations); + await lensTokenContract.waitForDeployment(confirmations); console.log(`✅ Mock Lens NFT Token deployed to: ${await lensTokenContract.getAddress()}`); //Deploy a mock NFT to represent the ENS NFT let ensTokenContractFactory = await getContractFactory("MockNFTAuth721"); const ensTokenContract = await ensTokenContractFactory.deploy(); - await ensTokenContract.deployTransaction.wait(confirmations); + await ensTokenContract.waitForDeployment(confirmations); console.log(`✅ Mock ENS NFT Token deployed to: ${await ensTokenContract.getAddress()}`); if (network == "test" || network == "localhost") { diff --git a/scripts/util/deploy-protocol-client-beacons.js b/scripts/util/deploy-protocol-client-beacons.js index 824674d67..6443b1854 100644 --- a/scripts/util/deploy-protocol-client-beacons.js +++ b/scripts/util/deploy-protocol-client-beacons.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getContractFactory } = hre.ethers; const environments = require("../../environments"); const confirmations = hre.network.name === "hardhat" ? 1 : environments.confirmations; const { getFees } = require("./utils"); @@ -34,7 +34,7 @@ async function deployProtocolClientBeacons(protocolClients, protocolClientArgs, await bosonVoucherImpl.getAddress(), await getFees(maxPriorityFeePerGas) ); - await clientBeacon.deployTransaction.wait(confirmations); + await clientBeacon.waitForDeployment(confirmations); return [clientBeacon]; } diff --git a/scripts/util/deploy-protocol-client-impls.js b/scripts/util/deploy-protocol-client-impls.js index 1357bf743..928b89990 100644 --- a/scripts/util/deploy-protocol-client-impls.js +++ b/scripts/util/deploy-protocol-client-impls.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getContractFactory } = hre.ethers; const environments = require("../../environments"); const confirmations = hre.network.name === "hardhat" ? 1 : environments.confirmations; const { getFees } = require("./utils"); @@ -23,7 +23,7 @@ async function deployProtocolClientImpls(implementationArgs, maxPriorityFeePerGa // Deploy the BosonVoucher contract const BosonVoucher = await getContractFactory("BosonVoucher"); const bosonVoucher = await BosonVoucher.deploy(...implementationArgs, await getFees(maxPriorityFeePerGas)); - await bosonVoucher.deployTransaction.wait(confirmations); + await bosonVoucher.waitForDeployment(confirmations); return [bosonVoucher]; } diff --git a/scripts/util/deploy-protocol-client-proxies.js b/scripts/util/deploy-protocol-client-proxies.js index 68fb3b0c3..0f537b673 100644 --- a/scripts/util/deploy-protocol-client-proxies.js +++ b/scripts/util/deploy-protocol-client-proxies.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getContractFactory } = hre.ethers; const environments = require("../../environments"); const confirmations = hre.network.name === "hardhat" ? 1 : environments.confirmations; const { getFees } = require("./utils"); @@ -31,7 +31,7 @@ async function deployProtocolClientProxies(protocolClients, maxPriorityFeePerGas // Deploy the ClientProxy for BosonVoucher const ClientProxy = await getContractFactory("BeaconClientProxy"); const clientProxy = await ClientProxy.deploy(await getFees(maxPriorityFeePerGas)); - await clientProxy.deployTransaction.wait(confirmations); + await clientProxy.waitForDeployment(confirmations); // init instead of constructors let transactionResponse = await clientProxy.initialize( diff --git a/scripts/util/deploy-protocol-handler-facets.js b/scripts/util/deploy-protocol-handler-facets.js index 0b48c43e1..4178d7e53 100644 --- a/scripts/util/deploy-protocol-handler-facets.js +++ b/scripts/util/deploy-protocol-handler-facets.js @@ -88,7 +88,7 @@ async function deployProtocolFacets(facetNames, facetsToInit, maxPriorityFeePerG let FacetContractFactory = await getContractFactory(facetName); const constructorArgs = (facetsToInit[facetName] && facetsToInit[facetName].constructorArgs) || []; const facetContract = await FacetContractFactory.deploy(...constructorArgs, await getFees(maxPriorityFeePerGas)); - await facetContract.deployTransaction.wait(confirmations); + await facetContract.waitForDeployment(confirmations); const deployedFacet = { name: facetName, diff --git a/scripts/util/diamond-utils.js b/scripts/util/diamond-utils.js index cbcead01b..b7cc58495 100644 --- a/scripts/util/diamond-utils.js +++ b/scripts/util/diamond-utils.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const { keccak256, toUtf8Bytes, getContractAt, ZeroAddress, Interface, getContractFactory, formatBytes32String } = +const { keccak256, toUtf8Bytes, getContractAt, ZeroAddress, Interface, getContractFactory, encodeBytes32String } = hre.ethers; const environments = "../../environments.js"; const confirmations = hre.network.name === "hardhat" ? 1 : environments.confirmations; @@ -146,7 +146,7 @@ async function getStateModifyingFunctions(facetNames, omitFunctions = [], onlyFu let stateModifyingFunctions = []; for (const facetName of facetNames) { let FacetContractFactory = await getContractFactory(facetName); - const functions = FacetContractFactory.interface.functions; + const functions = FacetContractFactory.interface.fragments; const functionNames = Object.keys(functions); const facetStateModifyingFunctions = functionNames.filter((fn) => { if (functions[fn].stateMutability !== "view" && !omitFunctions.includes(fn)) { @@ -190,8 +190,8 @@ async function getInitializeCalldata( interfacesToRemove = [], interfacesToAdd = [] ) { - version = formatBytes32String(version); - const addresses = await facetsToInitialize.map(async (f) => await f.contract.getAddress()); + version = encodeBytes32String(version); + const addresses = await facetsToInitialize.map((f) => f.contract.target); const calldata = facetsToInitialize.map((f) => f.initialize); diff --git a/test/protocol/AccountHandlerTest.js b/test/protocol/AccountHandlerTest.js index b8bbb961e..a8b230949 100644 --- a/test/protocol/AccountHandlerTest.js +++ b/test/protocol/AccountHandlerTest.js @@ -86,7 +86,7 @@ describe("IBosonAccountHandler", function () { seller = mockSeller( await assistant.getAddress(), await admin.getAddress(), - await clerk.getAddress(), + clerk.address, await treasury.getAddress() ); expect(seller.isValid()).is.true; @@ -108,7 +108,7 @@ describe("IBosonAccountHandler", function () { disputeResolver = mockDisputeResolver( await assistant.getAddress(), await admin.getAddress(), - await clerk.getAddress(), + clerk.address, await treasury.getAddress() ); expect(disputeResolver.isValid()).is.true; diff --git a/test/protocol/BuyerHandlerTest.js b/test/protocol/BuyerHandlerTest.js index a4686fb66..9827faaa8 100644 --- a/test/protocol/BuyerHandlerTest.js +++ b/test/protocol/BuyerHandlerTest.js @@ -1,4 +1,4 @@ -const { ethers } = require("hardhat"); +const { ZeroAddress, getContractAt } = require("hardhat"); const { expect } = require("chai"); const Buyer = require("../../scripts/domain/Buyer"); @@ -323,7 +323,12 @@ describe("BuyerHandler", function () { let agentId = "0"; // agent id is optional while creating an offer // Create a valid seller - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + await clerk.getAddress(), + await treasury.getAddress() + ); seller.id = id.toString(); expect(seller.isValid()).is.true; @@ -349,7 +354,7 @@ describe("BuyerHandler", function () { await treasury.getAddress(), true ); - disputeResolver.id = id+1.toString(); + disputeResolver.id = (id + 1).toString(); expect(disputeResolver.isValid()).is.true; //Create DisputeResolverFee array @@ -390,7 +395,9 @@ describe("BuyerHandler", function () { .depositFunds(seller.id, ZeroAddress, sellerDeposit, { value: sellerDeposit }); //Commit to offer - await exchangeHandler.connect(other1).commitToOffer(await other1.getAddress(), offerId, { value: offer.price }); + await exchangeHandler + .connect(other1) + .commitToOffer(await other1.getAddress(), offerId, { value: offer.price }); const bosonVoucherCloneAddress = calculateContractAddress(await exchangeHandler.getAddress(), "1"); bosonVoucher = await getContractAt("IBosonVoucher", bosonVoucherCloneAddress); diff --git a/test/protocol/ProtocolInitializationHandlerTest.js b/test/protocol/ProtocolInitializationHandlerTest.js index 4f8cb0543..6324619b5 100644 --- a/test/protocol/ProtocolInitializationHandlerTest.js +++ b/test/protocol/ProtocolInitializationHandlerTest.js @@ -81,7 +81,7 @@ describe("ProtocolInitializationHandler", async function () { await getFees(maxPriorityFeePerGas) ); - await protocolInitializationFacetDeployed.deployTransaction.wait(); + await protocolInitializationFacetDeployed.waitForDeployment(); }); it("Addresses and calldata length mismatch", async function () { @@ -161,7 +161,7 @@ describe("ProtocolInitializationHandler", async function () { // Mock a new facet to add to diamond so we can call initialize again let FacetTestFactory = await getContractFactory("Test3Facet"); const testFacet = await FacetTestFactory.deploy(await getFees(maxPriorityFeePerGas)); - await testFacet.deployTransaction.wait(); + await testFacet.waitForDeployment(); const calldataTestFacet = testFacet.interface.encodeFunctionData("initialize", [await rando.getAddress()]); @@ -296,7 +296,7 @@ describe("ProtocolInitializationHandler", async function () { it("Should call facet initializer internally when _addresses and _calldata are supplied", async function () { let FacetTestFactory = await getContractFactory("Test3Facet"); const testFacet = await FacetTestFactory.deploy(await getFees(maxPriorityFeePerGas)); - await testFacet.deployTransaction.wait(); + await testFacet.waitForDeployment(); const calldataTestFacet = testFacet.interface.encodeFunctionData("initialize", [await rando.getAddress()]); @@ -332,7 +332,7 @@ describe("ProtocolInitializationHandler", async function () { beforeEach(async function () { let FacetTestFactory = await getContractFactory("Test3Facet"); testFacet = await FacetTestFactory.deploy(await getFees(maxPriorityFeePerGas)); - await testFacet.deployTransaction.wait(); + await testFacet.waitForDeployment(); version = formatBytes32String("2.3.0"); }); @@ -408,7 +408,7 @@ describe("ProtocolInitializationHandler", async function () { await getFees(maxPriorityFeePerGas) ); - await mockInitializationFacetDeployed.deployTransaction.wait(); + await mockInitializationFacetDeployed.waitForDeployment(); const facetNames = [ "SellerHandlerFacet", From 9288716d40351f3fffc582309133e2aa349ddc56 Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Tue, 20 Jun 2023 18:11:42 -0300 Subject: [PATCH 09/32] Continue remediation --- scripts/domain/AuthToken.js | 2 +- scripts/domain/Dispute.js | 2 +- scripts/util/deploy-mock-tokens.js | 12 +- test/protocol/AgentHandlerTest.js | 2 +- test/protocol/BundleHandlerTest.js | 33 +- test/protocol/BuyerHandlerTest.js | 11 +- test/protocol/ConfigHandlerTest.js | 66 ++-- test/protocol/DisputeHandlerTest.js | 120 +++--- test/protocol/DisputeResolverHandlerTest.js | 70 +++- test/protocol/ExchangeHandlerTest.js | 394 +++++++++++++------- test/protocol/SellerHandlerTest.js | 152 ++++---- test/util/constants.js | 10 +- test/util/utils.js | 34 +- 13 files changed, 594 insertions(+), 314 deletions(-) diff --git a/scripts/domain/AuthToken.js b/scripts/domain/AuthToken.js index f5d965a04..cdfdad661 100644 --- a/scripts/domain/AuthToken.js +++ b/scripts/domain/AuthToken.js @@ -42,7 +42,7 @@ class AuthToken { return AuthToken.fromObject({ tokenId: tokenId.toString(), - tokenType: tokenType, + tokenType: Number(tokenType), }); } diff --git a/scripts/domain/Dispute.js b/scripts/domain/Dispute.js index 6f9037a7a..9e6dd9038 100644 --- a/scripts/domain/Dispute.js +++ b/scripts/domain/Dispute.js @@ -43,7 +43,7 @@ class Dispute { return Dispute.fromObject({ exchangeId: exchangeId.toString(), buyerPercent: buyerPercent.toString(), - state, + state: Number(state), }); } diff --git a/scripts/util/deploy-mock-tokens.js b/scripts/util/deploy-mock-tokens.js index db2322ec0..b42d11ffe 100644 --- a/scripts/util/deploy-mock-tokens.js +++ b/scripts/util/deploy-mock-tokens.js @@ -1,7 +1,7 @@ const hre = require("hardhat"); const { expect } = require("chai"); const environments = require("../../environments"); -const ethers = hre.ethers; +const { getContractFactory, provider, ZeroAddress, getAddress } = hre.ethers; const network = hre.network.name; const confirmations = hre.network.name == "hardhat" ? 1 : environments.confirmations; @@ -20,7 +20,7 @@ async function deployMockTokens(tokens = ["BosonToken", "Foreign721", "Foreign11 let token = tokens.shift(); let TokenContractFactory = await getContractFactory(token); const tokenContract = await TokenContractFactory.deploy(); - await tokenContract.deployed(); + await tokenContract.waitForDeployment(); deployedTokens.push(tokenContract); } @@ -72,13 +72,9 @@ async function deployAndMintMockNFTAuthTokens() { tx1 = await lensTokenContract.mint(to, BigInt(lensTokenId)); tx2 = await ensTokenContract.mint(to, BigInt(ensTokenId)); - await expect(tx1) - .to.emit(lensTokenContract, "Transfer") - .withArgs(ZeroAddress, getAddress(to), lensTokenId); + await expect(tx1).to.emit(lensTokenContract, "Transfer").withArgs(ZeroAddress, getAddress(to), lensTokenId); - await expect(tx2) - .to.emit(ensTokenContract, "Transfer") - .withArgs(ZeroAddress, getAddress(to), ensTokenId); + await expect(tx2).to.emit(ensTokenContract, "Transfer").withArgs(ZeroAddress, getAddress(to), ensTokenId); let lensOwner = await lensTokenContract.ownerOf(BigInt(lensTokenId)); let ensOwner = await ensTokenContract.ownerOf(BigInt(ensTokenId)); diff --git a/test/protocol/AgentHandlerTest.js b/test/protocol/AgentHandlerTest.js index c2421e4a4..1147cec43 100644 --- a/test/protocol/AgentHandlerTest.js +++ b/test/protocol/AgentHandlerTest.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { ZeroAddress } = hre.ethers; const { expect } = require("chai"); const Agent = require("../../scripts/domain/Agent"); diff --git a/test/protocol/BundleHandlerTest.js b/test/protocol/BundleHandlerTest.js index d8893a537..f94d644bd 100644 --- a/test/protocol/BundleHandlerTest.js +++ b/test/protocol/BundleHandlerTest.js @@ -1,5 +1,5 @@ const { ethers } = require("hardhat"); -const { MaxUnit256, getContractAt } = ethers; +const { ZeroAddress, getContractFactory, MaxUint256 } = ethers; const { expect, assert } = require("chai"); const Bundle = require("../../scripts/domain/Bundle"); @@ -131,7 +131,12 @@ describe("IBosonBundleHandler", function () { agentId = "0"; // agent id is optional while creating an offer // Create a valid seller, then set fields in tests directly - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + clerk.address, + await treasury.getAddress() + ); expect(seller.isValid()).is.true; // VoucherInitValues @@ -148,7 +153,7 @@ describe("IBosonBundleHandler", function () { disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -295,7 +300,7 @@ describe("IBosonBundleHandler", function () { it("If sum of offers' quantities is more than maxUint256, total quantity is maxUint256", async function () { // create two offers with close to unlimited supply const newOffer = offer.clone(); - newOffer.quantityAvailable = MaxUint256/10*9; + newOffer.quantityAvailable = ((MaxUint256 / 10n) * 9n).toString(); const newOffer2 = newOffer.clone(); const newOfferId = "6"; const newOfferId2 = "7"; @@ -310,7 +315,7 @@ describe("IBosonBundleHandler", function () { // create a twin with almost unlimited supply twin = mockTwin(await bosonToken.getAddress()); - twin.supplyAvailable = MaxUint256-1; + twin.supplyAvailable = MaxUint256 - 1n; expect(twin.isValid()).is.true; // Approving the twinHandler contract to transfer seller's tokens @@ -387,7 +392,12 @@ describe("IBosonBundleHandler", function () { it("Caller is not the seller of all offers", async function () { // create another seller and an offer let expectedNewOfferId = "6"; - seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); + seller = mockSeller( + await rando.getAddress(), + await rando.getAddress(), + ZeroAddress, + await rando.getAddress() + ); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); const tx = await offerHandler @@ -427,7 +437,12 @@ describe("IBosonBundleHandler", function () { it("Caller is not the seller of all twins", async function () { // create another seller and a twin let expectedNewTwinId = "6"; - seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); + seller = mockSeller( + await rando.getAddress(), + await rando.getAddress(), + ZeroAddress, + await rando.getAddress() + ); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); await bosonToken.connect(rando).approve(await twinHandler.getAddress(), 1); // approving the twin handler @@ -524,7 +539,9 @@ describe("IBosonBundleHandler", function () { // Commit to an offer let offerIdToCommit = bundle.offerIds[0]; - await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerIdToCommit, { value: price }); + await exchangeHandler + .connect(buyer) + .commitToOffer(await buyer.getAddress(), offerIdToCommit, { value: price }); // Attempt to Create a bundle, expecting revert await expect(bundleHandler.connect(assistant).createBundle(bundle)).to.revertedWith( diff --git a/test/protocol/BuyerHandlerTest.js b/test/protocol/BuyerHandlerTest.js index 9827faaa8..8b9decf94 100644 --- a/test/protocol/BuyerHandlerTest.js +++ b/test/protocol/BuyerHandlerTest.js @@ -1,4 +1,5 @@ -const { ZeroAddress, getContractAt } = require("hardhat"); +const { ethers } = require("hardhat"); +const { getContractAt, ZeroAddress } = ethers; const { expect } = require("chai"); const Buyer = require("../../scripts/domain/Buyer"); @@ -315,7 +316,7 @@ describe("BuyerHandler", function () { await expect(accountHandler.connect(other1).updateBuyer(buyer)).to.revertedWith(RevertReasons.NOT_BUYER_WALLET); }); - context("💔 Revert Reasons", async function () { + context.only("💔 Revert Reasons", async function () { beforeEach(async function () { // Initial ids for all the things id = await accountHandler.connect(rando).getNextAccountId(); @@ -326,7 +327,7 @@ describe("BuyerHandler", function () { seller = mockSeller( await assistant.getAddress(), await admin.getAddress(), - await clerk.getAddress(), + clerk.address, await treasury.getAddress() ); seller.id = id.toString(); @@ -350,11 +351,11 @@ describe("BuyerHandler", function () { disputeResolver = mockDisputeResolver( await assistant.getAddress(), await admin.getAddress(), - await clerk.getAddress(), + clerk.address, await treasury.getAddress(), true ); - disputeResolver.id = (id + 1).toString(); + disputeResolver.id = id + 1n; expect(disputeResolver.isValid()).is.true; //Create DisputeResolverFee array diff --git a/test/protocol/ConfigHandlerTest.js b/test/protocol/ConfigHandlerTest.js index 925f885fc..23208c321 100644 --- a/test/protocol/ConfigHandlerTest.js +++ b/test/protocol/ConfigHandlerTest.js @@ -1,4 +1,5 @@ const { ethers } = require("hardhat"); +const { getSigners, getContractAt, ZeroAddress, parseUnits } = ethers; const { expect } = require("chai"); const Role = require("../../scripts/domain/Role"); @@ -554,9 +555,9 @@ describe("IBosonConfigHandler", function () { it("treasury address is the zero address", async function () { // Attempt to set new treasury address, expecting revert - await expect( - configHandler.connect(deployer).setTreasuryAddress(ZeroAddress) - ).to.revertedWith(RevertReasons.INVALID_ADDRESS); + await expect(configHandler.connect(deployer).setTreasuryAddress(ZeroAddress)).to.revertedWith( + RevertReasons.INVALID_ADDRESS + ); }); }); }); @@ -586,16 +587,16 @@ describe("IBosonConfigHandler", function () { context("💔 Revert Reasons", async function () { it("caller is not the admin", async function () { // Attempt to set new beacon address, expecting revert - await expect(configHandler.connect(rando).setVoucherBeaconAddress(await beacon.getAddress())).to.revertedWith( - RevertReasons.ACCESS_DENIED - ); + await expect( + configHandler.connect(rando).setVoucherBeaconAddress(await beacon.getAddress()) + ).to.revertedWith(RevertReasons.ACCESS_DENIED); }); it("voucher beacon address is the zero address", async function () { // Attempt to set new beacon address, expecting revert - await expect( - configHandler.connect(deployer).setVoucherBeaconAddress(ZeroAddress) - ).to.revertedWith(RevertReasons.INVALID_ADDRESS); + await expect(configHandler.connect(deployer).setVoucherBeaconAddress(ZeroAddress)).to.revertedWith( + RevertReasons.INVALID_ADDRESS + ); }); }); }); @@ -632,9 +633,9 @@ describe("IBosonConfigHandler", function () { it("beacon proxy address is the zero address", async function () { // Attempt to set new proxy address, expecting revert - await expect( - configHandler.connect(deployer).setBeaconProxyAddress(ZeroAddress) - ).to.revertedWith(RevertReasons.INVALID_ADDRESS); + await expect(configHandler.connect(deployer).setBeaconProxyAddress(ZeroAddress)).to.revertedWith( + RevertReasons.INVALID_ADDRESS + ); }); }); }); @@ -794,7 +795,7 @@ describe("IBosonConfigHandler", function () { let maxEscalationResponsePeriod; beforeEach(async function () { // set new value - maxEscalationResponsePeriod = BigInt(oneMonth)+oneWeek; + maxEscalationResponsePeriod = oneMonth + oneWeek; }); it("should emit a MaxEscalationResponsePeriodChanged event", async function () { @@ -1013,7 +1014,9 @@ describe("IBosonConfigHandler", function () { it("should emit an AuthTokenContractChanged event", async function () { // Set new auth token contract, testing for the event await expect( - configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.Lens, await authTokenContract.getAddress()) + configHandler + .connect(deployer) + .setAuthTokenContract(AuthTokenType.Lens, await authTokenContract.getAddress()) ) .to.emit(configHandler, "AuthTokenContractChanged") .withArgs(AuthTokenType.Lens, await authTokenContract.getAddress(), await deployer.getAddress()); @@ -1021,7 +1024,9 @@ describe("IBosonConfigHandler", function () { it("should update state", async function () { // Set new auth token contract, - await configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.ENS, await authTokenContract.getAddress()); + await configHandler + .connect(deployer) + .setAuthTokenContract(AuthTokenType.ENS, await authTokenContract.getAddress()); // Verify that new value is stored expect(await configHandler.connect(rando).getAuthTokenContract(AuthTokenType.ENS)).to.equal( @@ -1040,14 +1045,18 @@ describe("IBosonConfigHandler", function () { it("_authTokenType is None", async function () { // Attempt to set new auth token contract, expecting revert await expect( - configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.None, await authTokenContract.getAddress()) + configHandler + .connect(deployer) + .setAuthTokenContract(AuthTokenType.None, await authTokenContract.getAddress()) ).to.revertedWith(RevertReasons.INVALID_AUTH_TOKEN_TYPE); }); it("_authTokenType is Custom", async function () { // Attempt to set new auth token contract, expecting revert await expect( - configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.Custom, await authTokenContract.getAddress()) + configHandler + .connect(deployer) + .setAuthTokenContract(AuthTokenType.Custom, await authTokenContract.getAddress()) ).to.revertedWith(RevertReasons.INVALID_AUTH_TOKEN_TYPE); }); @@ -1103,7 +1112,7 @@ describe("IBosonConfigHandler", function () { let maxResolutionPeriod; beforeEach(async function () { // set new value - maxResolutionPeriod = BigInt(oneMonth)+oneWeek; + maxResolutionPeriod = oneMonth + oneWeek; }); it("should emit a MaxResolutionPeriodChanged event", async function () { @@ -1142,7 +1151,7 @@ describe("IBosonConfigHandler", function () { let minDisputePeriod; beforeEach(async function () { // set new value - minDisputePeriod = BigInt(oneMonth)-oneWeek; + minDisputePeriod = oneMonth - oneWeek; }); it("should emit a MinDisputePeriodChanged event", async function () { @@ -1225,7 +1234,9 @@ describe("IBosonConfigHandler", function () { it("should emit an AccessControllerAddressChanged event", async function () { // Set new access controller address - await expect(configHandler.connect(deployer).setAccessControllerAddress(await newAccessController.getAddress())) + await expect( + configHandler.connect(deployer).setAccessControllerAddress(await newAccessController.getAddress()) + ) .to.emit(configHandler, "AccessControllerAddressChanged") .withArgs(await newAccessController.getAddress(), await deployer.getAddress()); }); @@ -1235,7 +1246,9 @@ describe("IBosonConfigHandler", function () { await configHandler.connect(deployer).setAccessControllerAddress(await newAccessController.getAddress()); // Verify that new value is stored - expect(await configHandler.connect(rando).getAccessControllerAddress()).to.equal(await newAccessController.getAddress()); + expect(await configHandler.connect(rando).getAccessControllerAddress()).to.equal( + await newAccessController.getAddress() + ); }); context("💔 Revert Reasons", async function () { @@ -1248,9 +1261,9 @@ describe("IBosonConfigHandler", function () { it("_accessControllerAddress is the zero address", async function () { // Attempt to set new value, expecting revert - await expect( - configHandler.connect(deployer).setAccessControllerAddress(ZeroAddress) - ).to.revertedWith(RevertReasons.INVALID_ADDRESS); + await expect(configHandler.connect(deployer).setAccessControllerAddress(ZeroAddress)).to.revertedWith( + RevertReasons.INVALID_ADDRESS + ); }); }); }); @@ -1266,7 +1279,10 @@ describe("IBosonConfigHandler", function () { await treasury.getAddress(), "Invalid treasury address" ); - expect(await configHandler.connect(rando).getTokenAddress()).to.equal(await token.getAddress(), "Invalid token address"); + expect(await configHandler.connect(rando).getTokenAddress()).to.equal( + await token.getAddress(), + "Invalid token address" + ); expect(await configHandler.connect(rando).getVoucherBeaconAddress()).to.equal( await beacon.getAddress(), "Invalid voucher address" diff --git a/test/protocol/DisputeHandlerTest.js b/test/protocol/DisputeHandlerTest.js index a2169eb19..af58a28a5 100644 --- a/test/protocol/DisputeHandlerTest.js +++ b/test/protocol/DisputeHandlerTest.js @@ -1,6 +1,6 @@ const { ethers } = require("hardhat"); +const { ZeroAddress, provider } = ethers; const { expect, assert } = require("chai"); - const Exchange = require("../../scripts/domain/Exchange"); const Dispute = require("../../scripts/domain/Dispute"); const DisputeState = require("../../scripts/domain/DisputeState"); @@ -149,7 +149,12 @@ describe("IBosonDisputeHandler", function () { agentId = "0"; // agent id is optional while creating an offer // Create a valid seller - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + clerk.address, + await treasury.getAddress() + ); expect(seller.isValid()).is.true; // VoucherInitValues @@ -166,7 +171,7 @@ describe("IBosonDisputeHandler", function () { disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -209,7 +214,7 @@ describe("IBosonDisputeHandler", function () { escalationPeriod = disputeResolver.escalationResponsePeriod; // Deposit seller funds so the commit will succeed - const fundsToDeposit = BigInt(sellerDeposit)*quantityAvailable; + const fundsToDeposit = BigInt(sellerDeposit) * BigInt(quantityAvailable); await fundsHandler .connect(assistant) .depositFunds(seller.id, ZeroAddress, fundsToDeposit, { value: fundsToDeposit }); @@ -247,15 +252,16 @@ describe("IBosonDisputeHandler", function () { .withArgs(exchangeId, buyerId, seller.id, await buyer.getAddress()); }); - it("should update state", async function () { + it.only("should update state", async function () { // Raise a dispute tx = await disputeHandler.connect(buyer).raiseDispute(exchangeId); // Get the block timestamp of the confirmed tx and set disputedDate blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); - disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate)+resolutionPeriod.toString(); + disputedDate = block.timestamp; + timeout = disputedDate + resolutionPeriod; + console.log(timeout); // expected values dispute = new Dispute(exchangeId, DisputeState.Resolving, buyerPercentBasisPoints); @@ -344,7 +350,7 @@ describe("IBosonDisputeHandler", function () { const voucherRedeemedDate = voucherStruct.redeemedDate; // Set time forward past the dispute period - await setNextBlockTimestamp(voucherRedeemedDate+disputePeriod+1.toNumber()); + await setNextBlockTimestamp((voucherRedeemedDate + disputePeriod + 1).toNumber()); // Attempt to raise a dispute, expecting revert await expect(disputeHandler.connect(buyer).raiseDispute(exchangeId)).to.revertedWith( @@ -363,7 +369,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate)+resolutionPeriod.toString(); + timeout = BigInt(disputedDate) + resolutionPeriod.toString(); }); it("should emit a DisputeRetracted event", async function () { @@ -505,10 +511,10 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate)+resolutionPeriod.toString(); + timeout = BigInt(disputedDate) + resolutionPeriod.toString(); // extend timeout for a month - newDisputeTimeout = BigInt(timeout)+oneMonth.toString(); + newDisputeTimeout = BigInt(timeout) + oneMonth.toString(); }); it("should emit a DisputeTimeoutExtended event", async function () { @@ -555,7 +561,7 @@ describe("IBosonDisputeHandler", function () { await setNextBlockTimestamp(Number(timeout) + Number(oneWeek)); // extend for another week - newDisputeTimeout = BigInt(newDisputeTimeout)+oneWeek.toString(); + newDisputeTimeout = BigInt(newDisputeTimeout) + oneWeek.toString(); // Extend the dispute timeout, testing for the event await expect(disputeHandler.connect(assistant).extendDisputeTimeout(exchangeId, newDisputeTimeout)) @@ -614,7 +620,7 @@ describe("IBosonDisputeHandler", function () { }); it("new dispute timeout is before the current dispute timeout", async function () { - newDisputeTimeout = BigInt(timeout)-oneWeek.toString(); + newDisputeTimeout = BigInt(timeout) - oneWeek.toString(); // Attempt to extend the dispute timeout, expecting revert await expect( @@ -643,7 +649,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate)+resolutionPeriod.toString(); + timeout = BigInt(disputedDate) + resolutionPeriod.toString(); }); it("should emit a DisputeExpired event", async function () { @@ -782,7 +788,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate)+resolutionPeriod.toString(); + timeout = BigInt(disputedDate) + resolutionPeriod.toString(); buyerPercentBasisPoints = "1234"; @@ -867,7 +873,12 @@ describe("IBosonDisputeHandler", function () { it("Buyer can also have a seller account and this will work", async function () { // Create a valid seller with buyer's wallet - seller = mockSeller(await buyer.getAddress(), await buyer.getAddress(), ZeroAddress, await buyer.getAddress()); + seller = mockSeller( + await buyer.getAddress(), + await buyer.getAddress(), + ZeroAddress, + await buyer.getAddress() + ); expect(seller.isValid()).is.true; await accountHandler.connect(buyer).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -890,11 +901,7 @@ describe("IBosonDisputeHandler", function () { it("Dispute can be mutually resolved even if it's in escalated state and past the resolution period", async function () { // Set time forward before the dispute original expiration date - await setNextBlockTimestamp( - BigInt(disputedDate) - +resolutionPeriod / 2 - .toNumber() - ); + await setNextBlockTimestamp(BigInt(disputedDate) + resolutionPeriod / (2).toNumber()); // escalate dispute await disputeHandler.connect(buyer).escalateDispute(exchangeId, { value: buyerEscalationDepositNative }); @@ -1011,11 +1018,7 @@ describe("IBosonDisputeHandler", function () { it("Dispute can be mutually resolved even if it's in escalated state and past the resolution period", async function () { // Set time forward before the dispute original expiration date - await setNextBlockTimestamp( - BigInt(disputedDate) - +resolutionPeriod / 2 - .toNumber() - ); + await setNextBlockTimestamp(BigInt(disputedDate) + resolutionPeriod / (2).toNumber()); // escalate dispute await disputeHandler.connect(buyer).escalateDispute(exchangeId, { value: buyerEscalationDepositNative }); @@ -1118,7 +1121,12 @@ describe("IBosonDisputeHandler", function () { // Wallet with seller account, but not the seller in this exchange // Create a valid seller - seller = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); + seller = mockSeller( + await other1.getAddress(), + await other1.getAddress(), + ZeroAddress, + await other1.getAddress() + ); expect(seller.isValid()).is.true; await accountHandler.connect(other1).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -1249,7 +1257,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate)+resolutionPeriod.toString(); + timeout = BigInt(disputedDate) + resolutionPeriod.toString(); }); it("should emit a DisputeEscalated event", async function () { @@ -1272,7 +1280,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); escalatedDate = block.timestamp.toString(); - timeout = BigInt(escalatedDate)+escalationPeriod.toString(); + timeout = BigInt(escalatedDate) + escalationPeriod.toString(); dispute = new Dispute(exchangeId, DisputeState.Escalated, "0"); disputeDates = new DisputeDates(disputedDate, escalatedDate, "0", timeout); @@ -1300,7 +1308,7 @@ describe("IBosonDisputeHandler", function () { // Protocol balance should increase for buyer escalation deposit const escrowBalanceAfter = await provider.getBalance(await disputeHandler.getAddress()); - expect(escrowBalanceAfter-escrowBalanceBefore).to.equal( + expect(escrowBalanceAfter - escrowBalanceBefore).to.equal( buyerEscalationDepositNative, "Escrow balance mismatch" ); @@ -1319,7 +1327,7 @@ describe("IBosonDisputeHandler", function () { // Protocol balance should increase for buyer escalation deposit const escrowBalanceAfter = await mockToken.balanceOf(await disputeHandler.getAddress()); - expect(escrowBalanceAfter-escrowBalanceBefore).to.equal( + expect(escrowBalanceAfter - escrowBalanceBefore).to.equal( buyerEscalationDepositToken, "Escrow balance mismatch" ); @@ -1412,7 +1420,7 @@ describe("IBosonDisputeHandler", function () { // Attempt to escalate the dispute, expecting revert await expect( disputeHandler.connect(buyer).escalateDispute(exchangeId, { - value: BigInt(buyerEscalationDepositNative)-"1".toString(), + value: BigInt(buyerEscalationDepositNative) - "1".toString(), }) ).to.revertedWith(RevertReasons.INSUFFICIENT_VALUE_RECEIVED); }); @@ -1456,7 +1464,7 @@ describe("IBosonDisputeHandler", function () { // not approved await mockToken .connect(buyer) - .approve(await protocolDiamond.getAddress(), BigInt(buyerEscalationDepositToken)-"1".toString()); + .approve(await protocolDiamond.getAddress(), BigInt(buyerEscalationDepositToken) - "1".toString()); // Attempt to commit to an offer, expecting revert await expect(disputeHandler.connect(buyer).escalateDispute(exchangeId)).to.revertedWith( @@ -1490,7 +1498,10 @@ describe("IBosonDisputeHandler", function () { // mint tokens and approve buyerEscalationDepositToken = applyPercentage(DRFeeToken, buyerEscalationDepositPercentage); await Foreign20WithFee.mint(await buyer.getAddress(), buyerEscalationDepositToken); - await Foreign20WithFee.connect(buyer).approve(await protocolDiamond.getAddress(), buyerEscalationDepositToken); + await Foreign20WithFee.connect(buyer).approve( + await protocolDiamond.getAddress(), + buyerEscalationDepositToken + ); // Commit to offer and put exchange all the way to dispute await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offer.id); @@ -1522,7 +1533,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); escalatedDate = block.timestamp.toString(); - timeout = BigInt(escalatedDate)+escalationPeriod.toString(); + timeout = BigInt(escalatedDate) + escalationPeriod.toString(); // buyer percent used in tests buyerPercentBasisPoints = "4321"; @@ -1666,7 +1677,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); escalatedDate = block.timestamp.toString(); - timeout = BigInt(escalatedDate)+escalationPeriod.toString(); + timeout = BigInt(escalatedDate) + escalationPeriod.toString(); }); it("should emit a EscalatedDisputeExpired event", async function () { @@ -1815,7 +1826,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); escalatedDate = block.timestamp.toString(); - timeout = BigInt(escalatedDate)+escalationPeriod.toString(); + timeout = BigInt(escalatedDate) + escalationPeriod.toString(); }); it("should emit a EscalatedDisputeRefused event", async function () { @@ -1957,7 +1968,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate)+resolutionPeriod.toString(); + timeout = BigInt(disputedDate) + resolutionPeriod.toString(); // Expected value for dispute dispute = new Dispute(exchangeId, DisputeState.Resolving, buyerPercentBasisPoints); @@ -2043,7 +2054,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate)+resolutionPeriod.toString(); + timeout = BigInt(disputedDate) + resolutionPeriod.toString(); }); it("should return true for exists if exchange id is valid", async function () { @@ -2100,7 +2111,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate)+resolutionPeriod.toString(); + timeout = BigInt(disputedDate) + resolutionPeriod.toString(); buyerPercentBasisPoints = "1234"; @@ -2157,7 +2168,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); escalatedDate = block.timestamp.toString(); - timeout = BigInt(escalatedDate)+escalationPeriod.toString(); + timeout = BigInt(escalatedDate) + escalationPeriod.toString(); // buyer percent used in tests buyerPercentBasisPoints = "4321"; @@ -2196,7 +2207,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate)+resolutionPeriod.toString(); + timeout = BigInt(disputedDate) + resolutionPeriod.toString(); }); it("should return true for exists if exchange id is valid", async function () { @@ -2382,8 +2393,9 @@ describe("IBosonDisputeHandler", function () { // Get the block timestamp of the confirmed tx and set disputedDate blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); - disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate)+resolutionPeriod.toString(); + disputedDate = block.timestamp; + timeout = disputedDate + resolutionPeriod; + console.log("before each itmeout", timeout); dispute[exchangeId] = new Dispute(exchangeId, DisputeState.Retracted, buyerPercentBasisPoints); disputeDates[exchangeId] = new DisputeDates(disputedDate, "0", finalizedDate, timeout); @@ -2396,16 +2408,22 @@ describe("IBosonDisputeHandler", function () { // Expire the disputes, testing for the event const tx = disputeHandler.connect(rando).expireDisputeBatch(disputesToExpire); - await expect(tx).to.emit(disputeHandler, "DisputeExpired").withArgs("2", await rando.getAddress()); + await expect(tx) + .to.emit(disputeHandler, "DisputeExpired") + .withArgs("2", await rando.getAddress()); - await expect(tx).to.emit(disputeHandler, "DisputeExpired").withArgs("3", await rando.getAddress()); + await expect(tx) + .to.emit(disputeHandler, "DisputeExpired") + .withArgs("3", await rando.getAddress()); - await expect(tx).to.emit(disputeHandler, "DisputeExpired").withArgs("4", await rando.getAddress()); + await expect(tx) + .to.emit(disputeHandler, "DisputeExpired") + .withArgs("4", await rando.getAddress()); }); - it("should update state", async function () { + it.only("should update state", async function () { // Set time forward past the dispute resolution period - await setNextBlockTimestamp(Number(timeout) + Number(oneWeek)); + await setNextBlockTimestamp(timeout + oneWeek); // Expire the dispute tx = await disputeHandler.connect(rando).expireDisputeBatch(disputesToExpire); @@ -2428,9 +2446,13 @@ describe("IBosonDisputeHandler", function () { // Returned values should match the expected dispute and dispute dates for (const [key, value] of Object.entries(dispute[exchangeId])) { + console.log(key, value); + console.log(returnedDisputeDates[key]); expect(JSON.stringify(returnedDispute[key]) === JSON.stringify(value)).is.true; } for (const [key, value] of Object.entries(disputeDates[exchangeId])) { + console.log(key, value); + console.log(returnedDisputeDates[key]); expect(JSON.stringify(returnedDisputeDates[key]) === JSON.stringify(value)).is.true; } diff --git a/test/protocol/DisputeResolverHandlerTest.js b/test/protocol/DisputeResolverHandlerTest.js index 50ad51c15..98b1a2245 100644 --- a/test/protocol/DisputeResolverHandlerTest.js +++ b/test/protocol/DisputeResolverHandlerTest.js @@ -1,5 +1,6 @@ const { ethers } = require("hardhat"); const { expect, assert } = require("chai"); +const { ZeroAddress } = ethers; const DisputeResolver = require("../../scripts/domain/DisputeResolver"); const { DisputeResolverFee, DisputeResolverFeeList } = require("../../scripts/domain/DisputeResolverFee"); @@ -126,9 +127,24 @@ describe("DisputeResolverHandler", function () { expect(emptyAuthToken.isValid()).is.true; // Create two additional sellers and create seller allow list - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); - seller2 = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); - let seller3 = mockSeller(await other2.getAddress(), await other2.getAddress(), ZeroAddress, await other2.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + await clerk.getAddress(), + await treasury.getAddress() + ); + seller2 = mockSeller( + await other1.getAddress(), + await other1.getAddress(), + ZeroAddress, + await other1.getAddress() + ); + let seller3 = mockSeller( + await other2.getAddress(), + await other2.getAddress(), + ZeroAddress, + await other2.getAddress() + ); // VoucherInitValues voucherInitValues = mockVoucherInitValues(); @@ -142,7 +158,12 @@ describe("DisputeResolverHandler", function () { sellerAllowList = ["3", "1"]; // Create a valid dispute resolver, then set fields in tests directly - disputeResolver = mockDisputeResolver(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + disputeResolver = mockDisputeResolver( + await assistant.getAddress(), + await admin.getAddress(), + await clerk.getAddress(), + await treasury.getAddress() + ); expect(disputeResolver.isValid()).is.true; // How that dispute resolver looks as a returned struct @@ -1128,7 +1149,12 @@ describe("DisputeResolverHandler", function () { // Update new dispute resolver with same treasury address, testing for the event await expect(accountHandler.connect(rando).updateDisputeResolver(disputeResolver2)) .to.emit(accountHandler, "DisputeResolverUpdateApplied") - .withArgs(disputeResolver2.id, disputeResolver2Struct, disputeResolverPendingUpdateStruct, await rando.getAddress()); + .withArgs( + disputeResolver2.id, + disputeResolver2Struct, + disputeResolverPendingUpdateStruct, + await rando.getAddress() + ); }); it("should be possible to use the same address for assistant, admin and treasury", async function () { @@ -1650,7 +1676,11 @@ describe("DisputeResolverHandler", function () { }); it("should update DisputeResolverFee state only if all DisputeResolverFees are removed", async function () { - const feeTokenAddressesToRemove = [await other1.getAddress(), await other2.getAddress(), await other3.getAddress()]; + const feeTokenAddressesToRemove = [ + await other1.getAddress(), + await other2.getAddress(), + await other3.getAddress(), + ]; // Remove fees from dispute resolver await accountHandler @@ -1761,7 +1791,12 @@ describe("DisputeResolverHandler", function () { .createDisputeResolver(disputeResolver, disputeResolverFees, sellerAllowList); // make another seller with id = "5" - let seller4 = mockSeller(await other3.getAddress(), await other3.getAddress(), ZeroAddress, await other3.getAddress()); + let seller4 = mockSeller( + await other3.getAddress(), + await other3.getAddress(), + ZeroAddress, + await other3.getAddress() + ); await accountHandler.connect(other3).createSeller(seller4, emptyAuthToken, voucherInitValues); @@ -1924,7 +1959,12 @@ describe("DisputeResolverHandler", function () { .createDisputeResolver(disputeResolver, disputeResolverFees, sellerAllowList); // make another seller with id = "5" - const seller4 = mockSeller(await other3.getAddress(), await other3.getAddress(), ZeroAddress, await other3.getAddress()); + const seller4 = mockSeller( + await other3.getAddress(), + await other3.getAddress(), + ZeroAddress, + await other3.getAddress() + ); // AuthToken emptyAuthToken = mockAuthToken(); @@ -2018,7 +2058,12 @@ describe("DisputeResolverHandler", function () { expect(returnedSellerAllowList.toString()).to.eql(expectedSellerAllowList.toString(), "Allowed list wrong"); // make another seller with id = "6" - const seller6 = mockSeller(await other4.getAddress(), await other4.getAddress(), ZeroAddress, await other4.getAddress()); + const seller6 = mockSeller( + await other4.getAddress(), + await other4.getAddress(), + ZeroAddress, + await other4.getAddress() + ); await accountHandler.connect(other4).createSeller(seller6, emptyAuthToken, voucherInitValues); // check that mappings of allowed selleres were updated @@ -2084,7 +2129,12 @@ describe("DisputeResolverHandler", function () { it("Seller id is not approved", async function () { // make another seller with id = "6" - const seller6 = mockSeller(await other4.getAddress(), await other4.getAddress(), ZeroAddress, await other4.getAddress()); + const seller6 = mockSeller( + await other4.getAddress(), + await other4.getAddress(), + ZeroAddress, + await other4.getAddress() + ); await accountHandler.connect(other4).createSeller(seller6, emptyAuthToken, voucherInitValues); // seller exists, it's not approved diff --git a/test/protocol/ExchangeHandlerTest.js b/test/protocol/ExchangeHandlerTest.js index 2ec7b20c9..d80afa165 100644 --- a/test/protocol/ExchangeHandlerTest.js +++ b/test/protocol/ExchangeHandlerTest.js @@ -1,4 +1,15 @@ const { ethers } = require("hardhat"); +const { + ZeroAddress, + getSigners, + getContractAt, + provider, + parseUnits, + getContractFactory, + MaxUint256, + parseEther, + getImpersonatedSigner, +} = ethers; const { expect, assert } = require("chai"); const Role = require("../../scripts/domain/Role"); @@ -196,10 +207,7 @@ describe("IBosonExchangeHandler", function () { assert.equal(receipt.status, 1, `Diamond upgrade failed: ${tx.hash}`); // Cast Diamond to MockMetaTransactionsHandlerFacet - mockMetaTransactionsHandler = await getContractAt( - "MockMetaTransactionsHandlerFacet", - protocolDiamondAddress - ); + mockMetaTransactionsHandler = await getContractAt("MockMetaTransactionsHandlerFacet", protocolDiamondAddress); } // Interface support (ERC-156 provided by ProtocolDiamond, others by deployed facets) @@ -223,7 +231,12 @@ describe("IBosonExchangeHandler", function () { agentId = "0"; // agent id is optional while creating an offer // Create a valid seller - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + clerk.address, + await treasury.getAddress() + ); expect(seller.isValid()).is.true; // AuthToken @@ -243,7 +256,7 @@ describe("IBosonExchangeHandler", function () { disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -297,9 +310,7 @@ describe("IBosonExchangeHandler", function () { exchange.finalizedDate = "0"; // Deposit seller funds so the commit will succeed - await fundsHandler - .connect(assistant) - .depositFunds(seller.id, ZeroAddress, sellerPool, { value: sellerPool }); + await fundsHandler.connect(assistant).depositFunds(seller.id, ZeroAddress, sellerPool, { value: sellerPool }); }); afterEach(async function () { @@ -308,7 +319,7 @@ describe("IBosonExchangeHandler", function () { }); context("👉 commitToOffer()", async function () { - it("should emit a BuyerCommitted event", async function () { + it.only("should emit a BuyerCommitted event", async function () { // Commit to offer, retrieving the event tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); txReceipt = await tx.wait(); @@ -370,38 +381,53 @@ describe("IBosonExchangeHandler", function () { await offerHandler.connect(rando).createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId); // Deposit seller funds so the commit will succeed - await fundsHandler - .connect(rando) - .depositFunds(seller.id, ZeroAddress, sellerPool, { value: sellerPool }); + await fundsHandler.connect(rando).depositFunds(seller.id, ZeroAddress, sellerPool, { value: sellerPool }); const buyer2 = newOwner; // Commit to offer, creating a new exchange tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); const tokenId1 = deriveTokenId(offerId, "1"); - const tx2 = await exchangeHandler.connect(deployer).commitToOffer(await buyer2.getAddress(), ++offerId, { value: price }); + const tx2 = await exchangeHandler + .connect(deployer) + .commitToOffer(await buyer2.getAddress(), ++offerId, { value: price }); const tokenId2 = deriveTokenId(offerId, "2"); await expect(tx) .to.emit(bosonVoucherClone, "Transfer") - .withArgs(constants.Zero, await buyer.getAddress(), tokenId1); + .withArgs(0n, await buyer.getAddress(), tokenId1); await expect(tx2) .to.emit(bosonVoucherClone2, "Transfer") - .withArgs(constants.Zero, await buyer2.getAddress(), tokenId2); + .withArgs(0n, await buyer2.getAddress(), tokenId2); // buyer should own 1 voucher on the clone1 address and buyer2 should own 1 voucher on clone2 - expect(await bosonVoucherClone.balanceOf(await buyer.getAddress())).to.equal("1", "Clone 1: buyer 1 balance should be 1"); - expect(await bosonVoucherClone.balanceOf(await buyer2.getAddress())).to.equal("0", "Clone 1: buyer 2 balance should be 0"); - expect(await bosonVoucherClone2.balanceOf(await buyer.getAddress())).to.equal("0", "Clone 2: buyer 1 balance should be 0"); + expect(await bosonVoucherClone.balanceOf(await buyer.getAddress())).to.equal( + "1", + "Clone 1: buyer 1 balance should be 1" + ); + expect(await bosonVoucherClone.balanceOf(await buyer2.getAddress())).to.equal( + "0", + "Clone 1: buyer 2 balance should be 0" + ); + expect(await bosonVoucherClone2.balanceOf(await buyer.getAddress())).to.equal( + "0", + "Clone 2: buyer 1 balance should be 0" + ); expect(await bosonVoucherClone2.balanceOf(await buyer2.getAddress())).to.equal( "1", "Clone 2: buyer 2 balance should be 1" ); // Make sure that vouchers belong to correct buyers and that exist on the correct clone - expect(await bosonVoucherClone.ownerOf(tokenId1)).to.equal(await buyer.getAddress(), "Voucher 1: Wrong buyer address"); + expect(await bosonVoucherClone.ownerOf(tokenId1)).to.equal( + await buyer.getAddress(), + "Voucher 1: Wrong buyer address" + ); await expect(bosonVoucherClone.ownerOf(tokenId2)).to.revertedWith(RevertReasons.ERC721_NON_EXISTENT); - expect(await bosonVoucherClone2.ownerOf(tokenId2)).to.equal(await buyer2.getAddress(), "Voucher 2: Wrong buyer address"); + expect(await bosonVoucherClone2.ownerOf(tokenId2)).to.equal( + await buyer2.getAddress(), + "Voucher 2: Wrong buyer address" + ); await expect(bosonVoucherClone2.ownerOf(tokenId1)).to.revertedWith(RevertReasons.ERC721_NON_EXISTENT); // reference boson voucher proxy should not have any vouchers @@ -457,38 +483,53 @@ describe("IBosonExchangeHandler", function () { await offerHandler.connect(rando).createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId); // Deposit seller funds so the commit will succeed - await fundsHandler - .connect(rando) - .depositFunds(seller.id, ZeroAddress, sellerPool, { value: sellerPool }); + await fundsHandler.connect(rando).depositFunds(seller.id, ZeroAddress, sellerPool, { value: sellerPool }); const buyer2 = newOwner; // Commit to offer, creating a new exchange tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); const tokenId1 = deriveTokenId(offerId, "1"); - const tx2 = await exchangeHandler.connect(deployer).commitToOffer(await buyer2.getAddress(), ++offerId, { value: price }); + const tx2 = await exchangeHandler + .connect(deployer) + .commitToOffer(await buyer2.getAddress(), ++offerId, { value: price }); const tokenId2 = deriveTokenId(offerId, "2"); await expect(tx) .to.emit(bosonVoucherClone, "Transfer") - .withArgs(constants.Zero, await buyer.getAddress(), tokenId1); + .withArgs(0n, await buyer.getAddress(), tokenId1); await expect(tx2) .to.emit(bosonVoucherClone2, "Transfer") - .withArgs(constants.Zero, await buyer2.getAddress(), tokenId2); + .withArgs(0n, await buyer2.getAddress(), tokenId2); // buyer should own 1 voucher on the clone1 address and buyer2 should own 1 voucher on clone2 - expect(await bosonVoucherClone.balanceOf(await buyer.getAddress())).to.equal("1", "Clone 1: buyer 1 balance should be 1"); - expect(await bosonVoucherClone.balanceOf(await buyer2.getAddress())).to.equal("0", "Clone 1: buyer 2 balance should be 0"); - expect(await bosonVoucherClone2.balanceOf(await buyer.getAddress())).to.equal("0", "Clone 2: buyer 1 balance should be 0"); + expect(await bosonVoucherClone.balanceOf(await buyer.getAddress())).to.equal( + "1", + "Clone 1: buyer 1 balance should be 1" + ); + expect(await bosonVoucherClone.balanceOf(await buyer2.getAddress())).to.equal( + "0", + "Clone 1: buyer 2 balance should be 0" + ); + expect(await bosonVoucherClone2.balanceOf(await buyer.getAddress())).to.equal( + "0", + "Clone 2: buyer 1 balance should be 0" + ); expect(await bosonVoucherClone2.balanceOf(await buyer2.getAddress())).to.equal( "1", "Clone 2: buyer 2 balance should be 1" ); // Make sure that vouchers belong to correct buyers and that exist on the correct clone - expect(await bosonVoucherClone.ownerOf(tokenId1)).to.equal(await buyer.getAddress(), "Voucher 1: Wrong buyer address"); + expect(await bosonVoucherClone.ownerOf(tokenId1)).to.equal( + await buyer.getAddress(), + "Voucher 1: Wrong buyer address" + ); await expect(bosonVoucherClone.ownerOf(tokenId2)).to.revertedWith(RevertReasons.ERC721_NON_EXISTENT); - expect(await bosonVoucherClone2.ownerOf(tokenId2)).to.equal(await buyer2.getAddress(), "Voucher 2: Wrong buyer address"); + expect(await bosonVoucherClone2.ownerOf(tokenId2)).to.equal( + await buyer2.getAddress(), + "Voucher 2: Wrong buyer address" + ); await expect(bosonVoucherClone2.ownerOf(tokenId1)).to.revertedWith(RevertReasons.ERC721_NON_EXISTENT); // Make sure that vouchers have correct royalty fee for exchangeId 1 @@ -579,7 +620,7 @@ describe("IBosonExchangeHandler", function () { it("Should not decrement quantityAvailable if offer is unlimited", async function () { // Create an offer with unlimited quantity let { offer, ...details } = await mockOffer(); - offer.quantityAvailable = constants.MaxUint256.toString(); + offer.quantityAvailable = MaxUint256.toString(); // Delete unnecessary field delete details.offerFees; @@ -596,7 +637,7 @@ describe("IBosonExchangeHandler", function () { // Offer qunantityAvailable should not be decremented [, offer] = await offerHandler.connect(rando).getOffer(offerId); - expect(offer.quantityAvailable).to.equal(constants.MaxUint256, "Quantity available should be unlimited"); + expect(offer.quantityAvailable).to.equal(MaxUint256, "Quantity available should be unlimited"); }); it("Should not decrement seller funds if offer price and sellerDeposit is 0", async function () { @@ -692,10 +733,8 @@ describe("IBosonExchangeHandler", function () { const now = block.timestamp.toString(); // set validFrom date in the past - offerDates.validFrom = BigInt(now) - +oneMonth * 6 - .toString(); // 6 months in the future - offerDates.validUntil = BigInt(offerDates.validFrom)+10.toString(); // just after the valid from so it succeeds. + offerDates.validFrom = BigInt(now) + oneMonth * (6).toString(); // 6 months in the future + offerDates.validUntil = BigInt(offerDates.validFrom + 10).toString(); // just after the valid from so it succeeds. await offerHandler .connect(assistant) @@ -738,7 +777,9 @@ describe("IBosonExchangeHandler", function () { let tokenId; beforeEach(async function () { // Reserve range - await offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, await assistant.getAddress()); + await offerHandler + .connect(assistant) + .reserveRange(offer.id, offer.quantityAvailable, await assistant.getAddress()); // expected address of the first clone const voucherCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "1"); @@ -751,7 +792,9 @@ describe("IBosonExchangeHandler", function () { it("should emit a BuyerCommitted event", async function () { // Commit to preminted offer, retrieving the event - tx = await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); + tx = await bosonVoucher + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); txReceipt = await tx.wait(); event = getEvent(txReceipt, exchangeHandler, "BuyerCommitted"); @@ -786,7 +829,9 @@ describe("IBosonExchangeHandler", function () { let nextExchangeIdBefore = await exchangeHandler.connect(rando).getNextExchangeId(); // Commit to preminted offer, creating a new exchange - await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); + await bosonVoucher + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); // Get the next exchange id and ensure it was incremented by the creation of the offer nextExchangeId = await exchangeHandler.connect(rando).getNextExchangeId(); @@ -801,7 +846,9 @@ describe("IBosonExchangeHandler", function () { await expect(bosonVoucher.ownerOf(nextExchangeId)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); // Commit to preminted offer, creating a new exchange - await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); + await bosonVoucher + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); // Voucher with nextExchangeId still should not exist await expect(bosonVoucher.ownerOf(nextExchangeId)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); @@ -818,7 +865,9 @@ describe("IBosonExchangeHandler", function () { assert.equal(royaltyAmount.toString(), "0", "Royalty amount is incorrect"); // Commit to preminted offer, creating a new exchange - await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); + await bosonVoucher + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); // After voucher is transferred, it should have royalty fee [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(tokenId, offer.price); @@ -836,7 +885,9 @@ describe("IBosonExchangeHandler", function () { const quantityAvailableBefore = offer.quantityAvailable; // Commit to preminted offer - await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); + await bosonVoucher + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); // Offer qunantityAvailable should be decremented [, offer] = await offerHandler.connect(rando).getOffer(offerId); @@ -880,7 +931,9 @@ describe("IBosonExchangeHandler", function () { // Attempt to create an exchange, expecting revert await expect( - bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) + bosonVoucher + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) ).to.revertedWith(RevertReasons.REGION_PAUSED); }); @@ -890,7 +943,9 @@ describe("IBosonExchangeHandler", function () { // Attempt to create a buyer, expecting revert await expect( - bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) + bosonVoucher + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) ).to.revertedWith(RevertReasons.REGION_PAUSED); }); @@ -903,7 +958,9 @@ describe("IBosonExchangeHandler", function () { it("Exchange exists already", async function () { // Commit to preminted offer, creating a new exchange - await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); + await bosonVoucher + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); // impersonate voucher contract and give it some funds const impersonatedBosonVoucher = await getImpersonatedSigner(await bosonVoucher.getAddress()); @@ -914,7 +971,9 @@ describe("IBosonExchangeHandler", function () { // Simulate a second commit with the same token id await expect( - exchangeHandler.connect(impersonatedBosonVoucher).commitToPreMintedOffer(await buyer.getAddress(), offerId, exchangeId) + exchangeHandler + .connect(impersonatedBosonVoucher) + .commitToPreMintedOffer(await buyer.getAddress(), offerId, exchangeId) ).to.revertedWith(RevertReasons.EXCHANGE_ALREADY_EXISTS); }); @@ -924,7 +983,9 @@ describe("IBosonExchangeHandler", function () { // Attempt to commit to the voided offer, expecting revert await expect( - bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) + bosonVoucher + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) ).to.revertedWith(RevertReasons.OFFER_HAS_BEEN_VOIDED); }); @@ -937,10 +998,8 @@ describe("IBosonExchangeHandler", function () { // Get next offer id offerId = await offerHandler.getNextOfferId(); // set validFrom date in the past - offerDates.validFrom = BigInt(now) - +oneMonth * 6 - .toString(); // 6 months in the future - offerDates.validUntil = BigInt(offerDates.validFrom)+10.toString(); // just after the valid from so it succeeds. + offerDates.validFrom = BigInt(now + oneMonth * 6n).toString(); // 6 months in the future + offerDates.validUntil = BigInt(offerDates.validFrom + 10n).toString(); // just after the valid from so it succeeds. await offerHandler .connect(assistant) @@ -955,7 +1014,9 @@ describe("IBosonExchangeHandler", function () { // Attempt to commit to the not available offer, expecting revert await expect( - bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) + bosonVoucher + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) ).to.revertedWith(RevertReasons.OFFER_NOT_AVAILABLE); }); @@ -965,7 +1026,9 @@ describe("IBosonExchangeHandler", function () { // Attempt to commit to the expired offer, expecting revert await expect( - bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) + bosonVoucher + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) ).to.revertedWith(RevertReasons.OFFER_HAS_EXPIRED); }); @@ -1009,10 +1072,9 @@ describe("IBosonExchangeHandler", function () { // Commit to offer. // We're only concerned that the event is emitted, indicating the condition was met - await expect(exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price })).to.emit( - exchangeHandler, - "BuyerCommitted" - ); + await expect( + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) + ).to.emit(exchangeHandler, "BuyerCommitted"); }); it("should allow buyer to commit up to the max times for the group", async function () { @@ -1080,10 +1142,9 @@ describe("IBosonExchangeHandler", function () { // Commit to offer. // We're only concerned that the event is emitted, indicating the condition was met - await expect(exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price })).to.emit( - exchangeHandler, - "BuyerCommitted" - ); + await expect( + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) + ).to.emit(exchangeHandler, "BuyerCommitted"); }); it("should allow buyer to commit up to the max times for the group", async function () { @@ -1152,10 +1213,9 @@ describe("IBosonExchangeHandler", function () { // Commit to offer. // We're only concerned that the event is emitted, indicating the condition was met - await expect(exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price })).to.emit( - exchangeHandler, - "BuyerCommitted" - ); + await expect( + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) + ).to.emit(exchangeHandler, "BuyerCommitted"); }); it("should allow buyer to commit up to the max times for the group", async function () { @@ -1225,10 +1285,9 @@ describe("IBosonExchangeHandler", function () { // Commit to offer. // We're only concerned that the event is emitted, indicating the condition was met - await expect(exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price })).to.emit( - exchangeHandler, - "BuyerCommitted" - ); + await expect( + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) + ).to.emit(exchangeHandler, "BuyerCommitted"); }); it("should allow buyer to commit up to the max times for the group", async function () { @@ -1298,10 +1357,9 @@ describe("IBosonExchangeHandler", function () { it("should emit a BuyerCommitted event", async function () { // Commit to offer. // We're only concerned that the event is emitted, indicating the condition was met - await expect(exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price })).to.emit( - exchangeHandler, - "BuyerCommitted" - ); + await expect( + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }) + ).to.emit(exchangeHandler, "BuyerCommitted"); }); }); }); @@ -1354,7 +1412,7 @@ describe("IBosonExchangeHandler", function () { block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = BigInt(block.timestamp)+disputePeriod+1.toNumber(); + newTime = BigInt(block.timestamp + disputePeriod + 1); await setNextBlockTimestamp(newTime); // Complete exchange @@ -1375,7 +1433,7 @@ describe("IBosonExchangeHandler", function () { block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = BigInt(block.timestamp)+disputePeriod+1.toNumber(); + newTime = BigInt(block.timestamp + disputePeriod + 1); await setNextBlockTimestamp(newTime); // Complete exchange @@ -1396,7 +1454,7 @@ describe("IBosonExchangeHandler", function () { block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = BigInt(block.timestamp)+disputePeriod+1.toNumber(); + newTime = BigInt(block.timestamp + disputePeriod + 1); await setNextBlockTimestamp(newTime); // Create a rando buyer account @@ -1555,7 +1613,7 @@ describe("IBosonExchangeHandler", function () { block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = BigInt(block.timestamp)+disputePeriod+1.toNumber(); + newTime = BigInt(block.timestamp + disputePeriod + 1); await setNextBlockTimestamp(newTime); // Complete exchange @@ -1587,7 +1645,7 @@ describe("IBosonExchangeHandler", function () { block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = BigInt(block.timestamp)+disputePeriod+1.toNumber(); + newTime = BigInt(block.timestamp + disputePeriod + 1); await setNextBlockTimestamp(newTime); // Complete exchange @@ -1781,7 +1839,9 @@ describe("IBosonExchangeHandler", function () { tokenId = deriveTokenId(offerId, exchange.id); bosonVoucherCloneAddress = calculateContractAddress(await exchangeHandler.getAddress(), "1"); bosonVoucherClone = await getContractAt("IBosonVoucher", bosonVoucherCloneAddress); - await bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await newOwner.getAddress(), tokenId); + await bosonVoucherClone + .connect(buyer) + .transferFrom(await buyer.getAddress(), await newOwner.getAddress(), tokenId); // Cancel the voucher, expecting event await expect(exchangeHandler.connect(newOwner).cancelVoucher(exchange.id)) @@ -2137,7 +2197,14 @@ describe("IBosonExchangeHandler", function () { // Redeem the voucher await expect(exchangeHandler.connect(buyer).redeemVoucher(exchange.id)) .to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin20.id, twin20.tokenAddress, exchange.id, twin20.tokenId, twin20.amount, await buyer.getAddress()); + .withArgs( + twin20.id, + twin20.tokenAddress, + exchange.id, + twin20.tokenId, + twin20.amount, + await buyer.getAddress() + ); // Check the buyer's balance of the ERC20 balance = await foreign20.balanceOf(await buyer.getAddress()); @@ -2156,7 +2223,7 @@ describe("IBosonExchangeHandler", function () { it("Should not decrease twin supplyAvailable if supply is unlimited", async function () { // Change twin supply to unlimited - twin20.supplyAvailable = constants.MaxUint256.toString(); + twin20.supplyAvailable = MaxUint256.toString(); twin20.id = "4"; // Create a new twin @@ -2241,7 +2308,14 @@ describe("IBosonExchangeHandler", function () { await expect(tx) .to.emit(exchangeHandler, "TwinTransferFailed") - .withArgs(twin20.id, twin20.tokenAddress, exchange.id, twin20.tokenId, twin20.amount, await buyer.getAddress()); + .withArgs( + twin20.id, + twin20.tokenAddress, + exchange.id, + twin20.tokenId, + twin20.amount, + await buyer.getAddress() + ); // Get the exchange state [, response] = await exchangeHandler.connect(rando).getExchangeState(exchange.id); @@ -2454,7 +2528,7 @@ describe("IBosonExchangeHandler", function () { .createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId); // Change twin supply to unlimited and token address to the new token - twin721.supplyAvailable = constants.MaxUint256.toString(); + twin721.supplyAvailable = MaxUint256.toString(); twin721.tokenAddress = await other721.getAddress(); twin721.id = "4"; @@ -2562,7 +2636,14 @@ describe("IBosonExchangeHandler", function () { await expect(tx) .to.emit(exchangeHandler, "TwinTransferFailed") - .withArgs(twin721.id, twin721.tokenAddress, exchange.id, "9", "0", await testProtocolFunctions.getAddress()); + .withArgs( + twin721.id, + twin721.tokenAddress, + exchange.id, + "9", + "0", + await testProtocolFunctions.getAddress() + ); // Get the exchange state [, response] = await exchangeHandler.connect(rando).getExchangeState(exchange.id); @@ -2597,7 +2678,14 @@ describe("IBosonExchangeHandler", function () { // Redeem the voucher await expect(exchangeHandler.connect(buyer).redeemVoucher(exchange.id)) .to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin1155.id, twin1155.tokenAddress, exchange.id, tokenId, twin1155.amount, await buyer.getAddress()); + .withArgs( + twin1155.id, + twin1155.tokenAddress, + exchange.id, + tokenId, + twin1155.amount, + await buyer.getAddress() + ); // Check the buyer's balance of the ERC1155 balance = await foreign1155.balanceOf(await buyer.getAddress(), tokenId); @@ -2616,7 +2704,7 @@ describe("IBosonExchangeHandler", function () { it("Should not decrease twin supplyAvailable if supply is unlimited", async function () { // Change twin supply to unlimited - twin1155.supplyAvailable = constants.MaxUint256.toString(); + twin1155.supplyAvailable = MaxUint256.toString(); twin1155.id = "4"; // Create a new twin @@ -2810,7 +2898,14 @@ describe("IBosonExchangeHandler", function () { await expect(tx) .and.to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin721.id, twin721.tokenAddress, exchangeId, tokenIdNonFungible, twin721.amount, await buyer.getAddress()); + .withArgs( + twin721.id, + twin721.tokenAddress, + exchangeId, + tokenIdNonFungible, + twin721.amount, + await buyer.getAddress() + ); // Check the buyer's balance of the ERC20 balance = await foreign20.balanceOf(await buyer.getAddress()); @@ -2880,7 +2975,14 @@ describe("IBosonExchangeHandler", function () { await expect(tx) .and.to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin721.id, twin721.tokenAddress, exchange.id, twin721.tokenId, twin721.amount, await buyer.getAddress()); + .withArgs( + twin721.id, + twin721.tokenAddress, + exchange.id, + twin721.tokenId, + twin721.amount, + await buyer.getAddress() + ); await expect(tx) .and.to.emit(exchangeHandler, "TwinTransferred") @@ -2929,18 +3031,18 @@ describe("IBosonExchangeHandler", function () { .createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId); // Change twin supply to unlimited and token address to the new token - twin721.supplyAvailable = constants.MaxUint256.toString(); + twin721.supplyAvailable = MaxUint256.toString(); twin721.tokenAddress = await other721.getAddress(); twin721.id = "4"; // Create a new ERC721 twin with the new token address await twinHandler.connect(assistant).createTwin(twin721.toStruct()); - twin20.supplyAvailable = constants.MaxUint256.toString(); + twin20.supplyAvailable = MaxUint256.toString(); twin20.id = "5"; // Create a new ERC20 twin with the new token address await twinHandler.connect(assistant).createTwin(twin20.toStruct()); - twin1155.supplyAvailable = constants.MaxUint256.toString(); + twin1155.supplyAvailable = MaxUint256.toString(); twin1155.id = "6"; // Create a new ERC1155 twin with the new token address await twinHandler.connect(assistant).createTwin(twin1155.toStruct()); @@ -2969,7 +3071,14 @@ describe("IBosonExchangeHandler", function () { await expect(tx) .to.emit(exchangeHandler, "TwinTransferred") - .withArgs(twin20.id, twin20.tokenAddress, exchange.id, twin20.tokenId, twin20.amount, await buyer.getAddress()); + .withArgs( + twin20.id, + twin20.tokenAddress, + exchange.id, + twin20.tokenId, + twin20.amount, + await buyer.getAddress() + ); await expect(tx) .to.emit(exchangeHandler, "TwinTransferred") @@ -3091,11 +3200,25 @@ describe("IBosonExchangeHandler", function () { await expect(tx) .to.emit(exchangeHandler, "TwinTransferFailed") - .withArgs(twin20.id, twin20.tokenAddress, exchangeId, "0", twin20.amount, await testProtocolFunctions.getAddress()); + .withArgs( + twin20.id, + twin20.tokenAddress, + exchangeId, + "0", + twin20.amount, + await testProtocolFunctions.getAddress() + ); await expect(tx) .to.emit(exchangeHandler, "TwinTransferFailed") - .withArgs(twin721.id, twin721.tokenAddress, exchangeId, "9", "0", await testProtocolFunctions.getAddress()); + .withArgs( + twin721.id, + twin721.tokenAddress, + exchangeId, + "9", + "0", + await testProtocolFunctions.getAddress() + ); await expect(tx) .to.emit(exchangeHandler, "TwinTransferFailed") @@ -3134,7 +3257,7 @@ describe("IBosonExchangeHandler", function () { voucher.validUntilDate = calculateVoucherExpiry(block, voucherRedeemableFrom, voucherValid); // New expiry date for extensions - validUntilDate = BigInt(voucher.validUntilDate)+oneMonth.toString(); + validUntilDate = BigInt(voucher.validUntilDate) + oneMonth.toString(); }); it("should emit an VoucherExtended event when seller's assistant calls", async function () { @@ -3196,7 +3319,7 @@ describe("IBosonExchangeHandler", function () { it("new date is not later than the current one", async function () { // New expiry date is older than current - validUntilDate = BigInt(voucher.validUntilDate)-oneMonth.toString(); + validUntilDate = BigInt(voucher.validUntilDate) - oneMonth.toString(); // Attempt to extend voucher, expecting revert await expect(exchangeHandler.connect(assistant).extendVoucher(exchange.id, validUntilDate)).to.revertedWith( @@ -3223,7 +3346,9 @@ describe("IBosonExchangeHandler", function () { nextAccountId = await accountHandler.connect(rando).getNextAccountId(); // Call onVoucherTransferred, expecting event - await expect(bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await newOwner.getAddress(), tokenId)) + await expect( + bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await newOwner.getAddress(), tokenId) + ) .to.emit(exchangeHandler, "VoucherTransferred") .withArgs(offerId, exchange.id, nextAccountId, await bosonVoucherClone.getAddress()); }); @@ -3236,7 +3361,9 @@ describe("IBosonExchangeHandler", function () { await accountHandler.connect(newOwner).createBuyer(mockBuyer(await newOwner.getAddress())); // Call onVoucherTransferred - await bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await newOwner.getAddress(), tokenId); + await bosonVoucherClone + .connect(buyer) + .transferFrom(await buyer.getAddress(), await newOwner.getAddress(), tokenId); // Get the exchange [exists, response] = await exchangeHandler.connect(rando).getExchange(exchange.id); @@ -3254,7 +3381,9 @@ describe("IBosonExchangeHandler", function () { nextAccountId = await accountHandler.connect(rando).getNextAccountId(); // Call onVoucherTransferred - await bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await newOwner.getAddress(), tokenId); + await bosonVoucherClone + .connect(buyer) + .transferFrom(await buyer.getAddress(), await newOwner.getAddress(), tokenId); // Get the exchange [exists, response] = await exchangeHandler.connect(rando).getExchange(exchange.id); @@ -3269,10 +3398,9 @@ describe("IBosonExchangeHandler", function () { it("should be triggered when a voucher is transferred", async function () { // Transfer voucher, expecting event - await expect(bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await newOwner.getAddress(), tokenId)).to.emit( - exchangeHandler, - "VoucherTransferred" - ); + await expect( + bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await newOwner.getAddress(), tokenId) + ).to.emit(exchangeHandler, "VoucherTransferred"); }); it("should not be triggered when a voucher is issued", async function () { @@ -3286,10 +3414,9 @@ describe("IBosonExchangeHandler", function () { await accessController.grantRole(Role.PROTOCOL, await rando.getAddress()); // Issue voucher, expecting no event - await expect(bosonVoucherClone.connect(rando).issueVoucher(nextExchangeId, await buyer.getAddress())).to.not.emit( - exchangeHandler, - "VoucherTransferred" - ); + await expect( + bosonVoucherClone.connect(rando).issueVoucher(nextExchangeId, await buyer.getAddress()) + ).to.not.emit(exchangeHandler, "VoucherTransferred"); }); it("should not be triggered when a voucher is burned", async function () { @@ -3305,18 +3432,16 @@ describe("IBosonExchangeHandler", function () { it("Should not be triggered when from and to addresses are the same", async function () { // Transfer voucher, expecting event - await expect(bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await buyer.getAddress(), tokenId)).to.not.emit( - exchangeHandler, - "VoucherTransferred" - ); + await expect( + bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await buyer.getAddress(), tokenId) + ).to.not.emit(exchangeHandler, "VoucherTransferred"); }); it("Should not be triggered when first transfer of preminted voucher happens", async function () { // Transfer voucher, expecting event - await expect(bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await buyer.getAddress(), tokenId)).to.not.emit( - exchangeHandler, - "VoucherTransferred" - ); + await expect( + bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await buyer.getAddress(), tokenId) + ).to.not.emit(exchangeHandler, "VoucherTransferred"); }); context("💔 Revert Reasons", async function () { @@ -3326,7 +3451,9 @@ describe("IBosonExchangeHandler", function () { // Attempt to create a buyer, expecting revert await expect( - bosonVoucherClone.connect(buyer).transferFrom(await buyer.getAddress(), await newOwner.getAddress(), tokenId) + bosonVoucherClone + .connect(buyer) + .transferFrom(await buyer.getAddress(), await newOwner.getAddress(), tokenId) ).to.revertedWith(RevertReasons.REGION_PAUSED); }); @@ -3339,7 +3466,12 @@ describe("IBosonExchangeHandler", function () { it("Caller is not a clone address associated with the seller", async function () { // Create a new seller to get new clone - seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); + seller = mockSeller( + await rando.getAddress(), + await rando.getAddress(), + ZeroAddress, + await rando.getAddress() + ); expect(seller.isValid()).is.true; await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -3356,7 +3488,9 @@ describe("IBosonExchangeHandler", function () { // Attempt to call onVoucherTransferred, expecting revert await expect( - bosonVoucherClone2.connect(buyer).transferFrom(await buyer.getAddress(), await newOwner.getAddress(), exchange.id) + bosonVoucherClone2 + .connect(buyer) + .transferFrom(await buyer.getAddress(), await newOwner.getAddress(), exchange.id) ).to.revertedWith(RevertReasons.ACCESS_DENIED); }); @@ -3443,7 +3577,7 @@ describe("IBosonExchangeHandler", function () { block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = BigInt(voucherRedeemableFrom)+disputePeriod+1.toNumber(); + newTime = BigInt(voucherRedeemableFrom + disputePeriod + 1); await setNextBlockTimestamp(newTime); // Complete exchange @@ -4057,7 +4191,9 @@ describe("IBosonExchangeHandler", function () { await setNextBlockTimestamp(Number(voucherRedeemableFrom)); // Commit to offer - let tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); + let tx = await exchangeHandler + .connect(buyer) + .commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; @@ -4155,7 +4291,9 @@ describe("IBosonExchangeHandler", function () { await setNextBlockTimestamp(Number(voucherRedeemableFrom)); // Commit to offer - let tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); + let tx = await exchangeHandler + .connect(buyer) + .commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Get the block timestamp of the confirmed tx blockNumber = tx.blockNumber; @@ -4270,7 +4408,9 @@ describe("IBosonExchangeHandler", function () { await foreign20.connect(buyer).mint(await buyer.getAddress(), condition.threshold); // Commit to offer - let tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); + let tx = await exchangeHandler + .connect(buyer) + .commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Decrease offer quantityAvailable offer.quantityAvailable = "9"; @@ -4358,7 +4498,7 @@ describe("IBosonExchangeHandler", function () { await accountHandler.connect(rando).createAgent(agent); // Update agentFee - const agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); + const agentFee = (BigInt(offer.price) * agent.feePercentage) / "10000".toString(); offerFees.agentFee = agentFee; // Create a new offer @@ -4382,7 +4522,9 @@ describe("IBosonExchangeHandler", function () { .createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId); // Commit to offer - let tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); + let tx = await exchangeHandler + .connect(buyer) + .commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Decrease offer quantityAvailable offer.quantityAvailable = "0"; diff --git a/test/protocol/SellerHandlerTest.js b/test/protocol/SellerHandlerTest.js index 8cf521cbb..3fbbdcb65 100644 --- a/test/protocol/SellerHandlerTest.js +++ b/test/protocol/SellerHandlerTest.js @@ -1,4 +1,5 @@ const { ethers } = require("hardhat"); +const { ZeroAddress, getContractAt, getSigners } = ethers; const { expect, assert } = require("chai"); const Seller = require("../../scripts/domain/Seller"); const AuthToken = require("../../scripts/domain/AuthToken"); @@ -76,13 +77,17 @@ describe("SellerHandler", function () { [mockAuthERC721Contract, mockAuthERC721Contract2] = await deployMockTokens(["Foreign721", "Foreign721"]); await expect( - configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.Lens, await mockAuthERC721Contract.getAddress()) + configHandler + .connect(deployer) + .setAuthTokenContract(AuthTokenType.Lens, await mockAuthERC721Contract.getAddress()) ) .to.emit(configHandler, "AuthTokenContractChanged") .withArgs(AuthTokenType.Lens, await mockAuthERC721Contract.getAddress(), await deployer.getAddress()); await expect( - configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.ENS, await mockAuthERC721Contract2.getAddress()) + configHandler + .connect(deployer) + .setAuthTokenContract(AuthTokenType.ENS, await mockAuthERC721Contract2.getAddress()) ) .to.emit(configHandler, "AuthTokenContractChanged") .withArgs(AuthTokenType.ENS, await mockAuthERC721Contract2.getAddress(), await deployer.getAddress()); @@ -106,7 +111,7 @@ describe("SellerHandler", function () { seller = mockSeller( await assistant.getAddress(), await admin.getAddress(), - await clerk.getAddress(), + clerk.address, await treasury.getAddress(), true, "https://ipfs.io/ipfs/originalUri" @@ -395,12 +400,23 @@ describe("SellerHandler", function () { // second seller expectedCloneAddress = calculateContractAddress(await accountHandler.getAddress(), "2"); - seller = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); + seller = mockSeller( + await other1.getAddress(), + await other1.getAddress(), + ZeroAddress, + await other1.getAddress() + ); // Create a seller, testing for the event await expect(accountHandler.connect(other1).createSeller(seller, emptyAuthToken, voucherInitValues)) .to.emit(accountHandler, "SellerCreated") - .withArgs(seller.id, seller.toStruct(), expectedCloneAddress, emptyAuthTokenStruct, await other1.getAddress()); + .withArgs( + seller.id, + seller.toStruct(), + expectedCloneAddress, + emptyAuthTokenStruct, + await other1.getAddress() + ); }); it("should be possible to create a seller with same auth token id but different type", async function () { @@ -553,7 +569,13 @@ describe("SellerHandler", function () { // Create a seller, testing for the event await expect(accountHandler.connect(rando).createSeller(seller, authToken, voucherInitValues)) .to.emit(accountHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, authTokenStruct, await newAuthTokenOwner.getAddress()); + .withArgs( + seller.id, + sellerStruct, + expectedCloneAddress, + authTokenStruct, + await newAuthTokenOwner.getAddress() + ); }); context("💔 Revert Reasons", async function () { @@ -794,7 +816,12 @@ describe("SellerHandler", function () { await accountHandler.connect(authTokenOwner).createSeller(seller, authToken, voucherInitValues); // Create a another seller - seller2 = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); + seller2 = mockSeller( + await other1.getAddress(), + await other1.getAddress(), + ZeroAddress, + await other1.getAddress() + ); expect(seller2.isValid()).is.true; await accountHandler.connect(other1).createSeller(seller2, emptyAuthToken, voucherInitValues); @@ -871,7 +898,12 @@ describe("SellerHandler", function () { await accountHandler.connect(authTokenOwner).createSeller(seller, authToken, voucherInitValues); // Create a another seller - seller2 = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); + seller2 = mockSeller( + await other1.getAddress(), + await other1.getAddress(), + ZeroAddress, + await other1.getAddress() + ); expect(seller2.isValid()).is.true; contractURI = `https://ipfs.io/ipfs/QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ`; @@ -1052,7 +1084,12 @@ describe("SellerHandler", function () { await accountHandler.connect(authTokenOwner).createSeller(seller, authToken, voucherInitValues); // Create seller 2 - seller2 = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); + seller2 = mockSeller( + await other1.getAddress(), + await other1.getAddress(), + ZeroAddress, + await other1.getAddress() + ); expect(seller2.isValid()).is.true; contractURI = `https://ipfs.io/ipfs/QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ`; @@ -1060,12 +1097,7 @@ describe("SellerHandler", function () { await accountHandler.connect(other1).createSeller(seller2, emptyAuthToken, voucherInitValues); // Create seller 3 - seller3 = mockSeller( - await other5.getAddress(), - ZeroAddress, - ZeroAddress, - await treasury.getAddress() - ); + seller3 = mockSeller(await other5.getAddress(), ZeroAddress, ZeroAddress, await treasury.getAddress()); expect(seller3.isValid()).is.true; contractURI = `https://ipfs.io/ipfs/QmPChd2hVbrJ6bfo3WBcTW4iZnpHm8TEzWkLHmLpXhF68A`; @@ -1125,12 +1157,7 @@ describe("SellerHandler", function () { expect(authToken3.isValid()).is.true; // Create seller 4 - seller4 = mockSeller( - await rando.getAddress(), - ZeroAddress, - ZeroAddress, - await treasury.getAddress() - ); + seller4 = mockSeller(await rando.getAddress(), ZeroAddress, ZeroAddress, await treasury.getAddress()); expect(seller4.isValid()).is.true; await mockAuthERC721Contract2.connect(rando).mint(authToken3.tokenId, 1); @@ -1181,12 +1208,7 @@ describe("SellerHandler", function () { expect(authToken3.isValid()).is.true; // Create seller 4 - seller4 = mockSeller( - await rando.getAddress(), - ZeroAddress, - ZeroAddress, - await treasury.getAddress() - ); + seller4 = mockSeller(await rando.getAddress(), ZeroAddress, ZeroAddress, await treasury.getAddress()); expect(seller4.isValid()).is.true; await mockAuthERC721Contract.connect(rando).mint(authToken3.tokenId, 1); @@ -1322,7 +1344,9 @@ describe("SellerHandler", function () { const bosonVoucherCloneAddress = calculateContractAddress(await exchangeHandler.getAddress(), "1"); bosonVoucher = await getContractAt("OwnableUpgradeable", bosonVoucherCloneAddress); - await expect(tx).to.emit(bosonVoucher, "OwnershipTransferred").withArgs(await assistant.getAddress(), await other1.getAddress()); + await expect(tx) + .to.emit(bosonVoucher, "OwnershipTransferred") + .withArgs(await assistant.getAddress(), await other1.getAddress()); pendingSellerUpdate.assistant = ZeroAddress; pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); @@ -1442,16 +1466,13 @@ describe("SellerHandler", function () { }); it("should update state from auth token to empty auth token", async function () { - seller2 = mockSeller( - await other1.getAddress(), - ZeroAddress, - ZeroAddress, - await other1.getAddress() - ); + seller2 = mockSeller(await other1.getAddress(), ZeroAddress, ZeroAddress, await other1.getAddress()); expect(seller2.isValid()).is.true; // msg.sender must be equal to seller's assistant - await mockAuthERC721Contract.connect(authTokenOwner).transferFrom(await authTokenOwner.getAddress(), await other1.getAddress(), 8400); + await mockAuthERC721Contract + .connect(authTokenOwner) + .transferFrom(await authTokenOwner.getAddress(), await other1.getAddress(), 8400); const newAuthTokenOwner = other1; // Create a seller with auth token @@ -1518,16 +1539,13 @@ describe("SellerHandler", function () { }); it("should update state from auth token to new auth token", async function () { - seller2 = mockSeller( - await other1.getAddress(), - ZeroAddress, - ZeroAddress, - await other1.getAddress() - ); + seller2 = mockSeller(await other1.getAddress(), ZeroAddress, ZeroAddress, await other1.getAddress()); expect(seller2.isValid()).is.true; // msg.sender must be equal to seller's assistant - await mockAuthERC721Contract.connect(authTokenOwner).transferFrom(await authTokenOwner.getAddress(), await other1.getAddress(), 8400); + await mockAuthERC721Contract + .connect(authTokenOwner) + .transferFrom(await authTokenOwner.getAddress(), await other1.getAddress(), 8400); const newAuthTokenOwner = other1; // Create a seller with auth token @@ -1626,12 +1644,7 @@ describe("SellerHandler", function () { it("should update the correct seller", async function () { // Configure another seller - seller2 = mockSeller( - await other1.getAddress(), - ZeroAddress, - ZeroAddress, - await other1.getAddress() - ); + seller2 = mockSeller(await other1.getAddress(), ZeroAddress, ZeroAddress, await other1.getAddress()); expect(seller2.isValid()).is.true; contractURI = `https://ipfs.io/ipfs/QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ`; @@ -1796,7 +1809,9 @@ describe("SellerHandler", function () { pendingSellerUpdateStruct = pendingSellerUpdate.toStruct(); // Transfer ownership of auth token because owner must be different from old admin - await mockAuthERC721Contract.connect(authTokenOwner).transferFrom(await authTokenOwner.getAddress(), await other1.getAddress(), 8400); + await mockAuthERC721Contract + .connect(authTokenOwner) + .transferFrom(await authTokenOwner.getAddress(), await other1.getAddress(), 8400); const newAuthTokenOwner = other1; // Update seller @@ -2100,7 +2115,12 @@ describe("SellerHandler", function () { await accountHandler.connect(authTokenOwner).optInToSellerUpdate(seller.id, [SellerUpdateFields.AuthToken]); //Set seller 2's auth token to empty - seller2 = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); + seller2 = mockSeller( + await other1.getAddress(), + await other1.getAddress(), + ZeroAddress, + await other1.getAddress() + ); expect(seller2.isValid()).is.true; // Create a seller with auth token @@ -2129,12 +2149,7 @@ describe("SellerHandler", function () { it("seller is not owner of auth token currently stored for seller", async function () { const authTokenOwner = other1; //Create seller 2 with auth token - seller2 = mockSeller( - await other1.getAddress(), - ZeroAddress, - ZeroAddress, - await other1.getAddress() - ); + seller2 = mockSeller(await other1.getAddress(), ZeroAddress, ZeroAddress, await other1.getAddress()); expect(seller2.isValid()).is.true; //Create auth token for token Id that seller does not own @@ -2147,7 +2162,9 @@ describe("SellerHandler", function () { await accountHandler.connect(authTokenOwner).createSeller(seller2, authToken2, voucherInitValues); //Transfer the token to a different address - await mockAuthERC721Contract2.connect(authTokenOwner).transferFrom(await authTokenOwner.getAddress(), await other7.getAddress(), 0); + await mockAuthERC721Contract2 + .connect(authTokenOwner) + .transferFrom(await authTokenOwner.getAddress(), await other7.getAddress(), 0); // Attempt to update seller2 for token that seller doesn't own await expect(accountHandler.connect(authTokenOwner).updateSeller(seller2, authToken2)).to.revertedWith( @@ -2159,12 +2176,7 @@ describe("SellerHandler", function () { const authTokenOwner = other1; //Create seller 2 with auth token - seller2 = mockSeller( - await other1.getAddress(), - ZeroAddress, - ZeroAddress, - await other1.getAddress() - ); + seller2 = mockSeller(await other1.getAddress(), ZeroAddress, ZeroAddress, await other1.getAddress()); expect(seller2.isValid()).is.true; //Create auth token for token Id that seller does not own @@ -2533,7 +2545,12 @@ describe("SellerHandler", function () { await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); // Create seller with same admin - seller2 = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); + seller2 = mockSeller( + await other1.getAddress(), + await other1.getAddress(), + ZeroAddress, + await other1.getAddress() + ); expect(seller2.isValid()).is.true; await accountHandler.connect(other1).createSeller(seller2, emptyAuthToken, voucherInitValues); @@ -2550,7 +2567,12 @@ describe("SellerHandler", function () { await accountHandler.connect(admin).updateSeller(seller, emptyAuthToken); // Create seller with same assistant - seller2 = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); + seller2 = mockSeller( + await other1.getAddress(), + await other1.getAddress(), + ZeroAddress, + await other1.getAddress() + ); expect(seller2.isValid()).is.true; await accountHandler.connect(other1).createSeller(seller2, emptyAuthToken, voucherInitValues); diff --git a/test/util/constants.js b/test/util/constants.js index 18dd46800..e47811188 100644 --- a/test/util/constants.js +++ b/test/util/constants.js @@ -3,16 +3,16 @@ const hre = require("hardhat"); const ethers = hre.ethers; // Some periods in seconds -const oneDay = 86400; // 1 day in seconds -const ninetyDays = oneDay * 90; // 90 days in seconds -const oneWeek = oneDay * 7; // 7 days in seconds -const oneMonth = oneDay * 31; // 31 days in seconds +const oneDay = 86400n; // 1 day in seconds +const ninetyDays = oneDay * 90n; // 90 days in seconds +const oneWeek = oneDay * 7n; // 7 days in seconds +const oneMonth = oneDay * 31n; // 31 days in seconds const VOUCHER_NAME = "Boson Voucher (rNFT)"; const VOUCHER_SYMBOL = "BOSON_VOUCHER_RNFT"; const SEAPORT_ADDRESS = "0x00000000000001ad428e4906aE43D8F9852d0dD6"; // 1.4 const tipMultiplier = BigInt(environments.tipMultiplier); const tipSuggestion = "1500000000"; // js always returns this constant, it does not vary per block -const maxPriorityFeePerGas = BigInt(tipSuggestion)*tipMultiplier; +const maxPriorityFeePerGas = BigInt(tipSuggestion) * tipMultiplier; exports.oneDay = oneDay; exports.ninetyDays = ninetyDays; diff --git a/test/util/utils.js b/test/util/utils.js index 2d016243c..c1c9228cd 100644 --- a/test/util/utils.js +++ b/test/util/utils.js @@ -1,5 +1,17 @@ const { ethers } = require("hardhat"); -const { utils, provider, BigNumber, keccak256, RLP, getSigners, parseUnits, getContractAt } = ethers; +const { + getAddress, + provider, + keccak256, + encodeRlp, + getSigners, + parseUnits, + getContractAt, + toBeArray, + isHexString, + zeroPadValue, + Interface, +} = ethers; const { getFacets } = require("../../scripts/config/facet-deploy.js"); const { oneWeek, oneMonth, maxPriorityFeePerGas } = require("./constants"); const Role = require("../../scripts/domain/Role"); @@ -9,8 +21,10 @@ const Offer = require("../../scripts/domain/Offer"); function getEvent(receipt, factory, eventName) { let found = false; - const eventFragment = factory.interface.fragments.filter((e) => e.name == eventName); - const iface = new utils.Interface(eventFragment); + console.log(eventName); + console.log(factory.interface.fragments); + const eventFragment = factory.interface.fragments.filter((e) => e !== null && e.name == eventName); + const iface = new Interface(eventFragment); for (const log in receipt.logs) { const topics = receipt.logs[log].topics; @@ -45,7 +59,7 @@ function eventEmittedWithArgs(receipt, factory, eventName, args) { let match = false; const eventFragment = factory.interface.fragments.filter((e) => e.name == eventName); - const iface = new utils.Interface(eventFragment); + const iface = new Interface(eventFragment); for (const log in receipt.logs) { const topics = receipt.logs[log].topics; @@ -124,7 +138,7 @@ async function setNextBlockTimestamp(timestamp) { } function getSignatureParameters(signature) { - if (!utils.isHexString(signature)) { + if (!isHexString(signature)) { throw new Error('Given value "'.concat(signature, '" is not a valid hex string.')); } @@ -174,7 +188,7 @@ async function prepareDataSignatureParameters( if (type == "Protocol") { //hardhat default chain id is 31337 - domainData.salt = utils.hexZeroPad(BigInt(31337).toString(), 32); + domainData.salt = zeroPadValue(BigInt(31337), 32); } else { const { chainId } = await provider.getNetwork(); domainData.chainId = chainId; @@ -222,16 +236,16 @@ function applyPercentage(base, percentage) { function calculateContractAddress(senderAddress, senderNonce) { const nonce = BigInt(senderNonce); - const nonceHex = nonce.eq(0) ? "0x" : nonce.toString(); + const nonceHex = nonce == 0n ? "0x" : toBeArray(nonce); const input_arr = [senderAddress, nonceHex]; - const rlp_encoded = RLP.encode(input_arr); + const rlp_encoded = encodeRlp(input_arr); const contract_address_long = keccak256(rlp_encoded); const contract_address = "0x" + contract_address_long.substring(26); //Trim the first 24 characters. - return utils.getAddress(contract_address); + return getAddress(contract_address); } const paddingType = { @@ -412,7 +426,7 @@ async function revertToSnapshot(snapshotId) { } function deriveTokenId(offerId, exchangeId) { - return BigInt(offerId).shl(128) + exchangeId; + return BigInt(offerId) * BigInt(2) ** BigInt(128) + BigInt(exchangeId); } exports.setNextBlockTimestamp = setNextBlockTimestamp; From 7d1d6d39bb7e55c5e326c266cf5bb88deb919156 Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Tue, 20 Jun 2023 19:29:39 -0300 Subject: [PATCH 10/32] Refactor until GroupHandler --- scripts/domain/Condition.js | 2 +- scripts/domain/Exchange.js | 2 +- scripts/domain/Receipt.js | 5 +- scripts/domain/TwinReceipt.js | 2 +- scripts/util/estimate-limits.js | 2 +- test/protocol/DisputeHandlerTest.js | 2 +- test/protocol/ExchangeHandlerTest.js | 34 ++-- test/protocol/GroupHandlerTest.js | 28 ++- test/protocol/MetaTransactionsHandlerTest.js | 174 ++++++++++++++----- test/protocol/OfferHandlerTest.js | 10 +- test/protocol/OrchestrationHandlerTest.js | 14 +- test/protocol/TwinHandlerTest.js | 14 +- test/protocol/clients/BosonVoucherTest.js | 4 +- test/util/mock.js | 6 +- test/util/utils.js | 17 +- 15 files changed, 215 insertions(+), 101 deletions(-) diff --git a/scripts/domain/Condition.js b/scripts/domain/Condition.js index 21a4930af..79a10e136 100644 --- a/scripts/domain/Condition.js +++ b/scripts/domain/Condition.js @@ -51,7 +51,7 @@ class Condition { return Condition.fromObject({ method: parseInt(method), - tokenType, + tokenType: Number(tokenType), tokenAddress, tokenId: tokenId.toString(), threshold: threshold.toString(), diff --git a/scripts/domain/Exchange.js b/scripts/domain/Exchange.js index 03db4eb9a..f330eb857 100644 --- a/scripts/domain/Exchange.js +++ b/scripts/domain/Exchange.js @@ -51,7 +51,7 @@ class Exchange { offerId: offerId.toString(), buyerId: buyerId.toString(), finalizedDate: finalizedDate.toString(), - state, + state: Number(state), }); } diff --git a/scripts/domain/Receipt.js b/scripts/domain/Receipt.js index b5f88cddf..c3aa9b824 100644 --- a/scripts/domain/Receipt.js +++ b/scripts/domain/Receipt.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const { ZeroAddress} = hre.ethers; +const { ZeroAddress } = hre.ethers; const DisputeState = require("./DisputeState"); const OfferFees = require("./OfferFees.js"); const TwinReceipt = require("./TwinReceipt.js"); @@ -121,6 +121,7 @@ class Receipt { twinReceipts, ] = struct; + console.log(twinReceipts); return Receipt.fromObject({ exchangeId: exchangeId.toString(), offerId: offerId.toString(), @@ -140,7 +141,7 @@ class Receipt { disputeResolverId: disputeResolverId.toString(), disputedDate: disputedDate.toString(), escalatedDate: escalatedDate.toString(), - disputeState, + disputeState: Number(disputeState), twinReceipts: twinReceipts.map((twinReceipt) => TwinReceipt.fromStruct(twinReceipt)), }); } diff --git a/scripts/domain/TwinReceipt.js b/scripts/domain/TwinReceipt.js index bb0db399e..1ff00b649 100644 --- a/scripts/domain/TwinReceipt.js +++ b/scripts/domain/TwinReceipt.js @@ -48,7 +48,7 @@ class TwinReceipt { tokenId: tokenId.toString(), amount: amount.toString(), tokenAddress: tokenAddress, - tokenType, + tokenType: Number(tokenType), }); } diff --git a/scripts/util/estimate-limits.js b/scripts/util/estimate-limits.js index 9d64c1e5b..c31a581e5 100644 --- a/scripts/util/estimate-limits.js +++ b/scripts/util/estimate-limits.js @@ -697,7 +697,7 @@ setupEnvironment["maxPremintedVouchers"] = async function (tokenCount = 10) { // create the offer const { offer, offerDates, offerDurations } = await mockOffer(); - offer.quantityAvailable = constants.MaxUint256; + offer.quantityAvailable = MaxUint256; await offerHandler.connect(sellerWallet1).createOffer(offer, offerDates, offerDurations, disputeResolver.id, agentId); // reserve range diff --git a/test/protocol/DisputeHandlerTest.js b/test/protocol/DisputeHandlerTest.js index af58a28a5..100febf90 100644 --- a/test/protocol/DisputeHandlerTest.js +++ b/test/protocol/DisputeHandlerTest.js @@ -1196,7 +1196,7 @@ describe("IBosonDisputeHandler", function () { await expect( disputeHandler .connect(assistant) - .resolveDispute(exchangeId, buyerPercentBasisPoints, r, constants.MaxUint256, v) + .resolveDispute(exchangeId, buyerPercentBasisPoints, r, MaxUint256, v) ).to.revertedWith(RevertReasons.INVALID_SIGNATURE); }); diff --git a/test/protocol/ExchangeHandlerTest.js b/test/protocol/ExchangeHandlerTest.js index d80afa165..e4223c8e7 100644 --- a/test/protocol/ExchangeHandlerTest.js +++ b/test/protocol/ExchangeHandlerTest.js @@ -9,6 +9,7 @@ const { MaxUint256, parseEther, getImpersonatedSigner, + toBeHex, } = ethers; const { expect, assert } = require("chai"); @@ -186,7 +187,7 @@ describe("IBosonExchangeHandler", function () { // Deploy MockMetaTransactionsHandlerFacet const MockMetaTransactionsHandlerFacet = await getContractFactory("MockMetaTransactionsHandlerFacet"); const mockMetaTransactionsHandlerFacet = await MockMetaTransactionsHandlerFacet.deploy(); - await mockMetaTransactionsHandlerFacet.deployed(); + await mockMetaTransactionsHandlerFacet.waitForDeployment(); // Define the facet cut const facetCuts = [ @@ -319,7 +320,7 @@ describe("IBosonExchangeHandler", function () { }); context("👉 commitToOffer()", async function () { - it.only("should emit a BuyerCommitted event", async function () { + it("should emit a BuyerCommitted event", async function () { // Commit to offer, retrieving the event tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); txReceipt = await tx.wait(); @@ -730,10 +731,9 @@ describe("IBosonExchangeHandler", function () { // Create an offer with staring date in the future // get current block timestamp const block = await provider.getBlock("latest"); - const now = block.timestamp.toString(); // set validFrom date in the past - offerDates.validFrom = BigInt(now) + oneMonth * (6).toString(); // 6 months in the future + offerDates.validFrom = (BigInt(block.timestamp) + oneMonth * 6n).toString(); // 6 months in the future offerDates.validUntil = BigInt(offerDates.validFrom + 10).toString(); // just after the valid from so it succeeds. await offerHandler @@ -966,7 +966,7 @@ describe("IBosonExchangeHandler", function () { const impersonatedBosonVoucher = await getImpersonatedSigner(await bosonVoucher.getAddress()); await provider.send("hardhat_setBalance", [ await impersonatedBosonVoucher.getAddress(), - parseEther("10").toHexString(), + toBeHex(parseEther("10")), ]); // Simulate a second commit with the same token id @@ -1412,7 +1412,7 @@ describe("IBosonExchangeHandler", function () { block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = BigInt(block.timestamp + disputePeriod + 1); + newTime = BigInt(block.timestamp + disputePeriod + 1).toString(); await setNextBlockTimestamp(newTime); // Complete exchange @@ -1433,7 +1433,7 @@ describe("IBosonExchangeHandler", function () { block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = BigInt(block.timestamp + disputePeriod + 1); + newTime = BigInt(block.timestamp + disputePeriod + 1).toString(); await setNextBlockTimestamp(newTime); // Complete exchange @@ -1454,7 +1454,7 @@ describe("IBosonExchangeHandler", function () { block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = BigInt(block.timestamp + disputePeriod + 1); + newTime = BigInt(block.timestamp + disputePeriod + 1).toString(); await setNextBlockTimestamp(newTime); // Create a rando buyer account @@ -1613,7 +1613,7 @@ describe("IBosonExchangeHandler", function () { block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = BigInt(block.timestamp + disputePeriod + 1); + newTime = BigInt(block.timestamp + disputePeriod + 1).toString(); await setNextBlockTimestamp(newTime); // Complete exchange @@ -1645,7 +1645,7 @@ describe("IBosonExchangeHandler", function () { block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = BigInt(block.timestamp + disputePeriod + 1); + newTime = BigInt(block.timestamp + disputePeriod + 1).toString(); await setNextBlockTimestamp(newTime); // Complete exchange @@ -2372,7 +2372,7 @@ describe("IBosonExchangeHandler", function () { // Deploy contract to test redeem called by another contract let TestProtocolFunctionsFactory = await getContractFactory("TestProtocolFunctions"); const testProtocolFunctions = await TestProtocolFunctionsFactory.deploy(protocolDiamondAddress); - await testProtocolFunctions.deployed(); + await testProtocolFunctions.waitForDeployment(); await testProtocolFunctions.commit(offerId, { value: price }); @@ -2623,7 +2623,7 @@ describe("IBosonExchangeHandler", function () { // Deploy contract to test redeem called by another contract let TestProtocolFunctionsFactory = await getContractFactory("TestProtocolFunctions"); const testProtocolFunctions = await TestProtocolFunctionsFactory.deploy(protocolDiamondAddress); - await testProtocolFunctions.deployed(); + await testProtocolFunctions.waitForDeployment(); await testProtocolFunctions.commit(offerId, { value: price }); @@ -2816,7 +2816,7 @@ describe("IBosonExchangeHandler", function () { // Deploy contract to test redeem called by another contract let TestProtocolFunctionsFactory = await getContractFactory("TestProtocolFunctions"); const testProtocolFunctions = await TestProtocolFunctionsFactory.deploy(protocolDiamondAddress); - await testProtocolFunctions.deployed(); + await testProtocolFunctions.waitForDeployment(); await testProtocolFunctions.commit(offerId, { value: price }); @@ -3186,7 +3186,7 @@ describe("IBosonExchangeHandler", function () { // Deploy contract to test redeem called by another contract let TestProtocolFunctionsFactory = await getContractFactory("TestProtocolFunctions"); const testProtocolFunctions = await TestProtocolFunctionsFactory.deploy(protocolDiamondAddress); - await testProtocolFunctions.deployed(); + await testProtocolFunctions.waitForDeployment(); await testProtocolFunctions.commit(offerId, { value: price }); @@ -3319,7 +3319,7 @@ describe("IBosonExchangeHandler", function () { it("new date is not later than the current one", async function () { // New expiry date is older than current - validUntilDate = BigInt(voucher.validUntilDate) - oneMonth.toString(); + validUntilDate = BigInt(voucher.validUntilDate) - oneMonth; // Attempt to extend voucher, expecting revert await expect(exchangeHandler.connect(assistant).extendVoucher(exchange.id, validUntilDate)).to.revertedWith( @@ -3577,7 +3577,7 @@ describe("IBosonExchangeHandler", function () { block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = BigInt(voucherRedeemableFrom + disputePeriod + 1); + newTime = Number(voucherRedeemableFrom + disputePeriod + 1); await setNextBlockTimestamp(newTime); // Complete exchange @@ -4498,7 +4498,7 @@ describe("IBosonExchangeHandler", function () { await accountHandler.connect(rando).createAgent(agent); // Update agentFee - const agentFee = (BigInt(offer.price) * agent.feePercentage) / "10000".toString(); + const agentFee = ((BigInt(offer.price) * BigInt(agent.feePercentage)) / 10000n).toString(); offerFees.agentFee = agentFee; // Create a new offer diff --git a/test/protocol/GroupHandlerTest.js b/test/protocol/GroupHandlerTest.js index f0987a105..2044504b7 100644 --- a/test/protocol/GroupHandlerTest.js +++ b/test/protocol/GroupHandlerTest.js @@ -1,4 +1,5 @@ const { ethers } = require("hardhat"); +const { ZeroAddress, getSigners, parseUnits, getContractFactory } = ethers; const { assert, expect } = require("chai"); const Group = require("../../scripts/domain/Group"); @@ -103,7 +104,12 @@ describe("IBosonGroupHandler", function () { agentId = "0"; // agent id is optional while creating an offer // Create a valid seller, then set fields in tests directly - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + clerk.address, + await treasury.getAddress() + ); expect(seller.isValid()).is.true; // VoucherInitValues @@ -120,7 +126,7 @@ describe("IBosonGroupHandler", function () { disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -151,8 +157,8 @@ describe("IBosonGroupHandler", function () { offer.sellerDeposit = parseUnits(`${0.25 + i * 0.1}`, "ether").toString(); offer.buyerCancelPenalty = parseUnits(`${0.05 + i * 0.1}`, "ether").toString(); offer.quantityAvailable = `${(i + 1) * 2}`; - offerDates.validFrom = BigInt(Date.now() + oneMonth * i).toString(); - offerDates.validUntil = BigInt(Date.now() + oneMonth * 6 * (i + 1)).toString(); + offerDates.validFrom = (BigInt(Date.now()) + oneMonth * BigInt(i)).toString(); + offerDates.validUntil = (BigInt(Date.now()) + oneMonth * 6n * BigInt(i + 1)).toString(); // Check if domains are valid expect(offer.isValid()).is.true; @@ -304,7 +310,12 @@ describe("IBosonGroupHandler", function () { it("Caller is not the seller of all offers", async function () { // create another seller and an offer - seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); + seller = mockSeller( + await rando.getAddress(), + await rando.getAddress(), + ZeroAddress, + await rando.getAddress() + ); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); await offerHandler.connect(rando).createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId); // creates an offer with id 6 @@ -572,7 +583,12 @@ describe("IBosonGroupHandler", function () { it("Caller is not the seller of all offers", async function () { // create another seller and an offer - seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); + seller = mockSeller( + await rando.getAddress(), + await rando.getAddress(), + ZeroAddress, + await rando.getAddress() + ); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); await offerHandler.connect(rando).createOffer(offer, offerDates, offerDurations, disputeResolverId, agentId); // creates an offer with id 6 diff --git a/test/protocol/MetaTransactionsHandlerTest.js b/test/protocol/MetaTransactionsHandlerTest.js index afa6837fa..8bc4bd33b 100644 --- a/test/protocol/MetaTransactionsHandlerTest.js +++ b/test/protocol/MetaTransactionsHandlerTest.js @@ -1,6 +1,15 @@ const { ethers } = require("hardhat"); const { - utils: { keccak256, toUtf8Bytes }, + keccak256, + toUtf8Bytes, + ZeroAddress, + getContractAt, + getContractFactory, + getSigners, + randomBytes, + zeroPadBytes, + ZeroHash, + MaxUint256, } = ethers; const { expect, assert } = require("chai"); @@ -200,10 +209,7 @@ describe("IBosonMetaTransactionsHandler", function () { assert.equal(receipt.status, 1, `Diamond upgrade failed: ${tx.hash}`); // Cast Diamond to MockMetaTransactionsHandlerFacet - mockMetaTransactionsHandler = await getContractAt( - "MockMetaTransactionsHandlerFacet", - protocolDiamondAddress - ); + mockMetaTransactionsHandler = await getContractAt("MockMetaTransactionsHandlerFacet", protocolDiamondAddress); } // Interface support (ERC-156 provided by ProtocolDiamond, others by deployed facets) @@ -246,7 +252,12 @@ describe("IBosonMetaTransactionsHandler", function () { assert.equal(result, expectedResult, "Nonce is used"); // Create a valid seller for meta transaction - seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), ZeroAddress, await assistant.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await assistant.getAddress(), + ZeroAddress, + await assistant.getAddress() + ); expect(seller.isValid()).is.true; // VoucherInitValues @@ -511,7 +522,12 @@ describe("IBosonMetaTransactionsHandler", function () { context("👉 AccountHandlerFacet 👉 createSeller()", async function () { beforeEach(async function () { // Create a valid seller for meta transaction - seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), ZeroAddress, await assistant.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await assistant.getAddress(), + ZeroAddress, + await assistant.getAddress() + ); expect(seller.isValid()).is.true; // VoucherInitValues @@ -554,7 +570,15 @@ describe("IBosonMetaTransactionsHandler", function () { await expect( metaTransactionsHandler .connect(deployer) - .executeMetaTransaction(await assistant.getAddress(), message.functionName, functionSignature, nonce, r, s, v) + .executeMetaTransaction( + await assistant.getAddress(), + message.functionName, + functionSignature, + nonce, + r, + s, + v + ) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") .withArgs(await assistant.getAddress(), await deployer.getAddress(), message.functionName, nonce); @@ -593,7 +617,15 @@ describe("IBosonMetaTransactionsHandler", function () { await expect( metaTransactionsHandler .connect(deployer) - .executeMetaTransaction(await assistant.getAddress(), message.functionName, functionSignature, nonce, r, s, v) + .executeMetaTransaction( + await assistant.getAddress(), + message.functionName, + functionSignature, + nonce, + r, + s, + v + ) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") .withArgs(await assistant.getAddress(), await deployer.getAddress(), message.functionName, nonce); @@ -665,7 +697,15 @@ describe("IBosonMetaTransactionsHandler", function () { await expect( metaTransactionsHandler .connect(deployer) - .executeMetaTransaction(await assistant.getAddress(), message.functionName, functionSignature, nonce, r, s, v) + .executeMetaTransaction( + await assistant.getAddress(), + message.functionName, + functionSignature, + nonce, + r, + s, + v + ) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") .withArgs(await assistant.getAddress(), await deployer.getAddress(), message.functionName, nonce); @@ -678,7 +718,7 @@ describe("IBosonMetaTransactionsHandler", function () { // send a meta transaction again, check for event seller.assistant = await assistantDR.getAddress(); seller.admin = await adminDR.getAddress(); - seller.clerk = await clerkDR.getAddress(); + seller.clerk = clerkDR.address; seller.treasury = await treasuryDR.getAddress(); message.from = await adminDR.getAddress(); @@ -704,14 +744,24 @@ describe("IBosonMetaTransactionsHandler", function () { await expect( metaTransactionsHandler .connect(rando) - .executeMetaTransaction(await adminDR.getAddress(), message.functionName, functionSignature, nonce, r, s, v) + .executeMetaTransaction( + await adminDR.getAddress(), + message.functionName, + functionSignature, + nonce, + r, + s, + v + ) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") .withArgs(await adminDR.getAddress(), await rando.getAddress(), message.functionName, nonce); // Verify that nonce is used. Expect true. expectedResult = true; - result = await metaTransactionsHandler.connect(assistantDR).isUsedNonce(await assistantDR.getAddress(), nonce); + result = await metaTransactionsHandler + .connect(assistantDR) + .isUsedNonce(await assistantDR.getAddress(), nonce); assert.equal(result, expectedResult, "Nonce is unused"); }); @@ -744,7 +794,15 @@ describe("IBosonMetaTransactionsHandler", function () { await expect( metaTransactionsHandler .connect(deployer) - .executeMetaTransaction(await assistant.getAddress(), message.functionName, functionSignature, nonce, r, s, v) + .executeMetaTransaction( + await assistant.getAddress(), + message.functionName, + functionSignature, + nonce, + r, + s, + v + ) ).to.revertedWith(RevertReasons.REGION_PAUSED); }); @@ -1025,7 +1083,7 @@ describe("IBosonMetaTransactionsHandler", function () { functionSignature, nonce, r, - constants.MaxUint256, // invalid s signature component + MaxUint256, // invalid s signature component v ) ).to.revertedWith(RevertReasons.INVALID_SIGNATURE); @@ -1038,7 +1096,7 @@ describe("IBosonMetaTransactionsHandler", function () { functionSignature, nonce, r, - hexZeroPad("0x", 32), // invalid s signature component + zeroPadBytes("0x", 32), // invalid s signature component v ) ).to.revertedWith(RevertReasons.INVALID_SIGNATURE); @@ -1050,7 +1108,7 @@ describe("IBosonMetaTransactionsHandler", function () { message.functionName, functionSignature, nonce, - hexZeroPad("0x", 32), // invalid r signature component + zeroPadBytes("0x", 32), // invalid r signature component s, v ) @@ -1062,7 +1120,12 @@ describe("IBosonMetaTransactionsHandler", function () { context("👉TwinHandler 👉 removeTwin()", async function () { beforeEach(async function () { // Create a valid seller for meta transaction - seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), ZeroAddress, await assistant.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await assistant.getAddress(), + ZeroAddress, + await assistant.getAddress() + ); expect(seller.isValid()).is.true; // VoucherInitValues @@ -1183,7 +1246,12 @@ describe("IBosonMetaTransactionsHandler", function () { it("Returns default revert reason if called function reverts without a reason", async function () { // Create a valid seller for meta transaction - seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), ZeroAddress, await assistant.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await assistant.getAddress(), + ZeroAddress, + await assistant.getAddress() + ); voucherInitValues = mockVoucherInitValues(); emptyAuthToken = mockAuthToken(); await accountHandler.connect(assistant).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -1225,7 +1293,12 @@ describe("IBosonMetaTransactionsHandler", function () { context("Reentrancy guard", async function () { beforeEach(async function () { // Create a valid seller for meta transaction - seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), ZeroAddress, await assistant.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await assistant.getAddress(), + ZeroAddress, + await assistant.getAddress() + ); expect(seller.isValid()).is.true; // VoucherInitValues @@ -1252,7 +1325,7 @@ describe("IBosonMetaTransactionsHandler", function () { disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -1298,7 +1371,9 @@ describe("IBosonMetaTransactionsHandler", function () { await maliciousToken.connect(buyer).approve(protocolDiamondAddress, price); // Deposit to seller's pool - await fundsHandler.connect(assistant).depositFunds(seller.id, await maliciousToken.getAddress(), sellerDeposit); + await fundsHandler + .connect(assistant) + .depositFunds(seller.id, await maliciousToken.getAddress(), sellerDeposit); // Commit to the offer await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id); @@ -1308,7 +1383,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Expected payoffs - they are the same for token and native currency // Buyer: price - buyerCancelPenalty - buyerPayoff = BigInt(offerToken.price)-offerToken.buyerCancelPenalty.toString(); + buyerPayoff = BigInt(offerToken.price) - offerToken.buyerCancelPenalty.toString(); // Prepare validFundDetails tokenListBuyer = [await maliciousToken.getAddress()]; @@ -1443,7 +1518,15 @@ describe("IBosonMetaTransactionsHandler", function () { await expect( metaTransactionsHandler .connect(deployer) - .executeMetaTransaction(await rando.getAddress(), message.functionName, functionSignature, nonce, r, s, v) + .executeMetaTransaction( + await rando.getAddress(), + message.functionName, + functionSignature, + nonce, + r, + s, + v + ) ).to.revertedWith(RevertReasons.REENTRANCY_GUARD); }); }); @@ -1454,7 +1537,12 @@ describe("IBosonMetaTransactionsHandler", function () { offerId = "1"; // Create a valid seller - seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), ZeroAddress, await assistant.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await assistant.getAddress(), + ZeroAddress, + await assistant.getAddress() + ); expect(seller.isValid()).is.true; // VoucherInitValues @@ -1470,7 +1558,7 @@ describe("IBosonMetaTransactionsHandler", function () { disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -3013,7 +3101,12 @@ describe("IBosonMetaTransactionsHandler", function () { offerId = "1"; // Create a valid seller - seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), ZeroAddress, await assistant.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await assistant.getAddress(), + ZeroAddress, + await assistant.getAddress() + ); expect(seller.isValid()).is.true; // VoucherInitValues @@ -3030,7 +3123,7 @@ describe("IBosonMetaTransactionsHandler", function () { disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -3245,13 +3338,18 @@ describe("IBosonMetaTransactionsHandler", function () { }); }); - context("👉 FundsHandlerFacet 👉 withdrawFunds()", async function () { + context.only("👉 FundsHandlerFacet 👉 withdrawFunds()", async function () { beforeEach(async function () { // Initial ids for all the things exchangeId = "1"; // Create a valid seller - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + clerk.address, + await treasury.getAddress() + ); expect(seller.isValid()).is.true; // VoucherInitValues @@ -3267,7 +3365,7 @@ describe("IBosonMetaTransactionsHandler", function () { disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -3340,11 +3438,11 @@ describe("IBosonMetaTransactionsHandler", function () { // expected payoffs - they are the same for token and native currency // buyer: price - buyerCancelPenalty - buyerPayoff = BigInt(offerToken.price)-offerToken.buyerCancelPenalty.toString(); + buyerPayoff = BigInt(offerToken.price) - BigInt(offerToken.buyerCancelPenalty); // prepare validFundDetails tokenListBuyer = [await mockToken.getAddress(), ZeroAddress]; - tokenAmountsBuyer = [buyerPayoff, BigInt(buyerPayoff)/"2".toString()]; + tokenAmountsBuyer = [buyerPayoff, (BigInt(buyerPayoff) / 2n).toString()]; validFundDetails = { entityId: buyerId, tokenList: tokenListBuyer, @@ -3442,11 +3540,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Chain state should match the expected available funds after the withdrawal // Since all tokens are withdrawn, token should be removed from the list expectedBuyerAvailableFunds = new FundsList([ - new Funds( - ZeroAddress, - "Native currency", - BigInt(buyerPayoff)/"2".toString() - ), + new Funds(ZeroAddress, "Native currency", BigInt(buyerPayoff) / "2".toString()), ]); expect(buyerAvailableFunds).to.eql( expectedBuyerAvailableFunds, @@ -3454,7 +3548,7 @@ describe("IBosonMetaTransactionsHandler", function () { ); // Token balance is increased for the buyer payoff - expect(buyerBalanceAfter).to.eql(buyerBalanceBefore+buyerPayoff, "Buyer token balance mismatch"); + expect(buyerBalanceAfter).to.eql(buyerBalanceBefore + buyerPayoff, "Buyer token balance mismatch"); // Verify that nonce is used. Expect true. let expectedResult = true; @@ -3516,7 +3610,7 @@ describe("IBosonMetaTransactionsHandler", function () { ); // Token balance is increased for the buyer payoff - expect(buyerBalanceAfter).to.eql(buyerBalanceBefore+buyerPayoff, "Buyer token balance mismatch"); + expect(buyerBalanceAfter).to.eql(buyerBalanceBefore + buyerPayoff, "Buyer token balance mismatch"); // Verify that nonce is used. Expect true. let expectedResult = true; diff --git a/test/protocol/OfferHandlerTest.js b/test/protocol/OfferHandlerTest.js index 72163ff34..d19dca416 100644 --- a/test/protocol/OfferHandlerTest.js +++ b/test/protocol/OfferHandlerTest.js @@ -436,7 +436,7 @@ describe("IBosonOfferHandler", function () { it("Should allow creation of an offer with unlimited supply", async function () { // Prepare an absolute zero offer - offer.quantityAvailable = constants.MaxUint256.toString(); + offer.quantityAvailable = MaxUint256.toString(); // Create a new offer await expect( @@ -1305,7 +1305,7 @@ describe("IBosonOfferHandler", function () { it("It's possible to reserve a range with maximum allowed length", async function () { // Create an unlimited offer - offer.quantityAvailable = constants.MaxUint256.toString(); + offer.quantityAvailable = MaxUint256.toString(); await offerHandler .connect(assistant) .createOffer(offer, offerDates, offerDurations, disputeResolver.id, agentId); @@ -1320,7 +1320,7 @@ describe("IBosonOfferHandler", function () { it("Reserving range of unlimited offer does not decrease quantity available", async function () { // Create an unlimited offer - offer.quantityAvailable = constants.MaxUint256.toString(); + offer.quantityAvailable = MaxUint256.toString(); await offerHandler .connect(assistant) .createOffer(offer, offerDates, offerDurations, disputeResolver.id, agentId); @@ -1479,7 +1479,7 @@ describe("IBosonOfferHandler", function () { it("Range length is greater than maximum allowed range length", async function () { // Create an unlimited offer - offer.quantityAvailable = constants.MaxUint256.toString(); + offer.quantityAvailable = MaxUint256.toString(); await offerHandler .connect(assistant) .createOffer(offer, offerDates, offerDurations, disputeResolver.id, agentId); @@ -1794,7 +1794,7 @@ describe("IBosonOfferHandler", function () { offers[2].exchangeToken = await bosonToken.getAddress(); offerFeesList[2].protocolFee = protocolFeeFlatBoson; offerFeesStructs[2] = offerFeesList[2].toStruct(); - offers[2].quantityAvailable = constants.MaxUint256.toString(); + offers[2].quantityAvailable = MaxUint256.toString(); offerStructs[2] = offers[2].toStruct(); disputeResolutionTermsList[2] = new DisputeResolutionTerms( disputeResolver.id, diff --git a/test/protocol/OrchestrationHandlerTest.js b/test/protocol/OrchestrationHandlerTest.js index 37d64864b..22f3a8762 100644 --- a/test/protocol/OrchestrationHandlerTest.js +++ b/test/protocol/OrchestrationHandlerTest.js @@ -1047,7 +1047,7 @@ describe("IBosonOrchestrationHandler", function () { it("Should allow creation of an offer with unlimited supply", async function () { // Prepare an offer with unlimited supply - offer.quantityAvailable = constants.MaxUint256.toString(); + offer.quantityAvailable = MaxUint256.toString(); // Create a seller and an offer, testing for the event await expect( @@ -2447,7 +2447,7 @@ describe("IBosonOrchestrationHandler", function () { it("Should allow creation of an offer with unlimited supply", async function () { // Prepare an absolute zero offer - offer.quantityAvailable = constants.MaxUint256.toString(); + offer.quantityAvailable = MaxUint256.toString(); // Create an offer with condition, testing for the events await expect( @@ -3137,7 +3137,7 @@ describe("IBosonOrchestrationHandler", function () { it("Should allow creation of an offer with unlimited supply", async function () { // Prepare an absolute zero offer - offer.quantityAvailable = constants.MaxUint256.toString(); + offer.quantityAvailable = MaxUint256.toString(); // Create an offer, add it to the group, testing for the events await expect( @@ -3806,9 +3806,9 @@ describe("IBosonOrchestrationHandler", function () { it("Should allow creation of an offer with unlimited supply", async function () { // Prepare an offer with unlimited supply - offer.quantityAvailable = constants.MaxUint256.toString(); + offer.quantityAvailable = MaxUint256.toString(); // Twin supply should be unlimited as well - twin.supplyAvailable = constants.MaxUint256.toString(); + twin.supplyAvailable = MaxUint256.toString(); // Create an offer, a twin and a bundle, testing for the events await expect( @@ -4663,9 +4663,9 @@ describe("IBosonOrchestrationHandler", function () { it("Should allow creation of an offer with unlimited supply", async function () { // Prepare an offer with unlimited supply - offer.quantityAvailable = constants.MaxUint256.toString(); + offer.quantityAvailable = MaxUint256.toString(); // Twin supply should be unlimited as well - twin.supplyAvailable = constants.MaxUint256.toString(); + twin.supplyAvailable = MaxUint256.toString(); // Create an offer with condition, twin and bundle testing for the events await expect( diff --git a/test/protocol/TwinHandlerTest.js b/test/protocol/TwinHandlerTest.js index 96308d42e..96ad2266f 100644 --- a/test/protocol/TwinHandlerTest.js +++ b/test/protocol/TwinHandlerTest.js @@ -252,7 +252,7 @@ describe("IBosonTwinHandler", function () { }); it("It is possible to add an ERC721 with unlimited supply if token is not used yet", async function () { - twin.supplyAvailable = constants.MaxUint256.toString(); + twin.supplyAvailable = MaxUint256.toString(); twin.amount = "0"; twin.tokenId = "0"; twin.tokenAddress = await foreign721.getAddress(); @@ -277,7 +277,7 @@ describe("IBosonTwinHandler", function () { }); it("It is possible to add ERC721 even if another ERC721 with unlimited supply exists", async function () { - twin.supplyAvailable = constants.MaxUint256.toString(); + twin.supplyAvailable = MaxUint256.toString(); twin.amount = "0"; twin.tokenId = "0"; twin.tokenAddress = await foreign721.getAddress(); @@ -490,7 +490,7 @@ describe("IBosonTwinHandler", function () { }); it("token address has been used in another twin with unlimited supply", async function () { - twin.supplyAvailable = constants.MaxUint256; + twin.supplyAvailable = MaxUint256; twin.tokenType = TokenType.NonFungibleToken; twin.tokenAddress = await foreign721.getAddress(); twin.amount = "0"; @@ -508,11 +508,11 @@ describe("IBosonTwinHandler", function () { }); it("Supply range overflow", async function () { - twin.supplyAvailable = constants.MaxUint256/10*8.toString(); + twin.supplyAvailable = MaxUint256/10*8.toString(); twin.tokenType = TokenType.NonFungibleToken; twin.tokenAddress = await foreign721.getAddress(); twin.amount = "0"; - twin.tokenId = constants.MaxUint256-twin.supplyAvailable+1.toString(); + twin.tokenId = MaxUint256-twin.supplyAvailable+1.toString(); await foreign721.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); @@ -523,11 +523,11 @@ describe("IBosonTwinHandler", function () { }); it("Token with unlimited supply with starting tokenId to high", async function () { - twin.supplyAvailable = constants.MaxUint256.toString(); + twin.supplyAvailable = MaxUint256.toString(); twin.tokenType = TokenType.NonFungibleToken; twin.tokenAddress = await foreign721.getAddress(); twin.amount = "0"; - twin.tokenId = constants.MaxUint256+1/2+1.toString(); + twin.tokenId = MaxUint256+1/2+1.toString(); await foreign721.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); diff --git a/test/protocol/clients/BosonVoucherTest.js b/test/protocol/clients/BosonVoucherTest.js index 4fac2e843..5d7439341 100644 --- a/test/protocol/clients/BosonVoucherTest.js +++ b/test/protocol/clients/BosonVoucherTest.js @@ -359,8 +359,8 @@ describe("IBosonVoucher", function () { it("Range length is too large, i.e., would cause an overflow", async function () { // Set such numbers that would cause an overflow - start = constants.MaxUint256/2+2; - length = constants.MaxUint256/2; + start = MaxUint256/2+2; + length = MaxUint256/2; // Try to reserve range, it should fail await expect( diff --git a/test/util/mock.js b/test/util/mock.js index f1f077122..cc18ff4d3 100644 --- a/test/util/mock.js +++ b/test/util/mock.js @@ -54,8 +54,8 @@ async function mockOfferDates() { const block = await provider.getBlock(blockNumber); const validFrom = BigInt(block.timestamp).toString(); // valid from now - const validUntil = BigInt(block.timestamp) + BigInt(oneMonth) * BigInt(6); // until 6 months - const voucherRedeemableFrom = BigInt(block.timestamp)+ BigInt(oneWeek); // redeemable in 1 week + const validUntil = (BigInt(block.timestamp) + BigInt(oneMonth) * BigInt(6)).toString(); // until 6 months + const voucherRedeemableFrom = (BigInt(block.timestamp) + BigInt(oneWeek)).toString(); // redeemable in 1 week const voucherRedeemableUntil = "0"; // mocks use voucher valid duration rather than fixed date, override in tests as needed // Create a valid offerDates, then set fields in tests directly @@ -162,7 +162,7 @@ function mockAgent(wallet) { } function mockOfferFees(protocolFee, agentFee) { - return new OfferFees(protocolFee, agentFee); + return new OfferFees(protocolFee.toString(), agentFee.toString()); } function mockVoucherInitValues() { diff --git a/test/util/utils.js b/test/util/utils.js index c1c9228cd..58076d76a 100644 --- a/test/util/utils.js +++ b/test/util/utils.js @@ -21,9 +21,7 @@ const Offer = require("../../scripts/domain/Offer"); function getEvent(receipt, factory, eventName) { let found = false; - console.log(eventName); - console.log(factory.interface.fragments); - const eventFragment = factory.interface.fragments.filter((e) => e !== null && e.name == eventName); + const eventFragment = factory.interface.fragments.filter((e) => e.name == eventName); const iface = new Interface(eventFragment); for (const log in receipt.logs) { @@ -36,8 +34,9 @@ function getEvent(receipt, factory, eventName) { // CHECK IF TOPIC CORRESPONDS TO THE EVENT GIVEN TO FN const event = iface.getEvent(encodedTopic); - if (event.name == eventName) { + if (event && event.name == eventName) { found = true; + const eventArgs = iface.parseLog(receipt.logs[log]).args; return eventArgs; } @@ -188,7 +187,7 @@ async function prepareDataSignatureParameters( if (type == "Protocol") { //hardhat default chain id is 31337 - domainData.salt = zeroPadValue(BigInt(31337), 32); + domainData.salt = zeroPadValue("0x" + 31337n.toString(16), 32); } else { const { chainId } = await provider.getNetwork(); domainData.chainId = chainId; @@ -200,6 +199,10 @@ async function prepareDataSignatureParameters( }; metaTxTypes = Object.assign({}, metaTxTypes, customTransactionTypes); + console.log(metaTxTypes); + console.log(domainData); + console.log(primaryType); + console.log(message); // Prepare the data to sign let dataToSign = JSON.stringify({ types: metaTxTypes, @@ -227,11 +230,11 @@ function calculateVoucherExpiry(block, voucherRedeemableFromDate, voucherValidDu BigInt(block.timestamp) > BigInt(voucherRedeemableFromDate) ? BigInt(block.timestamp) : BigInt(voucherRedeemableFromDate); - return startDate + BigInt(voucherValidDuration).toString(); + return (startDate + BigInt(voucherValidDuration)).toString(); } function applyPercentage(base, percentage) { - return (BigInt(base) * BigInt(percentage)) / BigInt(10000); + return ((BigInt(base) * BigInt(percentage)) / BigInt(10000)).toString(); } function calculateContractAddress(senderAddress, senderNonce) { From 14fe23d88759b21bb60de354edce00ae5f8de2b2 Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Wed, 21 Jun 2023 10:51:22 -0300 Subject: [PATCH 11/32] Continue remediation --- scripts/domain/Twin.js | 4 +- test/protocol/MetaTransactionsHandlerTest.js | 2 +- test/protocol/OfferHandlerTest.js | 283 ++++++++++------- test/protocol/OrchestrationHandlerTest.js | 301 +++++++++++++++---- test/protocol/ProtocolDiamondTest.js | 4 +- test/protocol/TwinHandlerTest.js | 8 +- 6 files changed, 418 insertions(+), 184 deletions(-) diff --git a/scripts/domain/Twin.js b/scripts/domain/Twin.js index 176d8129b..ca16e0ea3 100644 --- a/scripts/domain/Twin.js +++ b/scripts/domain/Twin.js @@ -55,9 +55,9 @@ class Twin { sellerId: sellerId.toString(), amount: amount.toString(), supplyAvailable: supplyAvailable ? supplyAvailable.toString() : "", - tokenId: tokenId ? tokenId.toString() : "", + tokenId: tokenId ? tokenId.toString() : "0", tokenAddress, - tokenType, + tokenType: Number(tokenType), }); } diff --git a/test/protocol/MetaTransactionsHandlerTest.js b/test/protocol/MetaTransactionsHandlerTest.js index 8bc4bd33b..d42d26c6b 100644 --- a/test/protocol/MetaTransactionsHandlerTest.js +++ b/test/protocol/MetaTransactionsHandlerTest.js @@ -3338,7 +3338,7 @@ describe("IBosonMetaTransactionsHandler", function () { }); }); - context.only("👉 FundsHandlerFacet 👉 withdrawFunds()", async function () { + context("👉 FundsHandlerFacet 👉 withdrawFunds()", async function () { beforeEach(async function () { // Initial ids for all the things exchangeId = "1"; diff --git a/test/protocol/OfferHandlerTest.js b/test/protocol/OfferHandlerTest.js index d19dca416..9e642c9ba 100644 --- a/test/protocol/OfferHandlerTest.js +++ b/test/protocol/OfferHandlerTest.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getContractAt, ZeroAddress, getSigners, MaxUint256, provider, parseUnits } = hre.ethers; const { assert, expect } = require("chai"); const Offer = require("../../scripts/domain/Offer"); @@ -163,7 +163,12 @@ describe("IBosonOfferHandler", function () { id = nextAccountId = "1"; // argument sent to contract for createSeller will be ignored // Create a valid seller, then set fields in tests directly - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + clerk.address, + await treasury.getAddress() + ); expect(seller.isValid()).is.true; // VoucherInitValues @@ -179,7 +184,7 @@ describe("IBosonOfferHandler", function () { disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -548,7 +553,7 @@ describe("IBosonOfferHandler", function () { it("Valid from date is greater than valid until date", async function () { // Reverse the from and until dates - offerDates.validFrom = BigInt(Date.now() + oneMonth * 6).toString(); // 6 months from now + offerDates.validFrom = (BigInt(Date.now()) + oneMonth * 6n).toString(); // 6 months from now offerDates.validUntil = BigInt(Date.now()).toString(); // now // Attempt to Create an offer, expecting revert @@ -563,10 +568,10 @@ describe("IBosonOfferHandler", function () { const now = block.timestamp.toString(); // set validFrom date in the past - offerDates.validFrom = BigInt(now - oneMonth * 6).toString(); // 6 months ago + offerDates.validFrom = (BigInt(now) - oneMonth * 6n).toString(); // 6 months ago // set valid until > valid from - offerDates.validUntil = BigInt(now - oneMonth).toString(); // 1 month ago + offerDates.validUntil = (BigInt(now) - oneMonth).toString(); // 1 month ago // Attempt to Create an offer, expecting revert await expect( @@ -576,7 +581,7 @@ describe("IBosonOfferHandler", function () { it("Buyer cancel penalty is greater than price", async function () { // Set buyer cancel penalty higher than offer price - offer.buyerCancelPenalty = BigInt(offer.price)+"10".toString(); + offer.buyerCancelPenalty = BigInt(offer.price) + "10".toString(); // Attempt to Create an offer, expecting revert await expect( @@ -596,7 +601,7 @@ describe("IBosonOfferHandler", function () { it("Both voucher expiration date and voucher expiration period are defined", async function () { // Set both voucherRedeemableUntil and voucherValid - offerDates.voucherRedeemableUntil = (Number(offerDates.voucherRedeemableFrom) + oneMonth).toString(); + offerDates.voucherRedeemableUntil = (BigInt(offerDates.voucherRedeemableFrom) + oneMonth).toString(); offerDurations.voucherValid = oneMonth.toString(); // Attempt to Create an offer, expecting revert @@ -641,7 +646,7 @@ describe("IBosonOfferHandler", function () { it("Dispute period is less than minimum dispute period", async function () { // Set dispute period to less than minDisputePeriod (oneWeek) - offerDurations.disputePeriod = BigInt(oneWeek)-1000.toString(); + offerDurations.disputePeriod = (oneWeek - 1000n).toString(); // Attempt to Create an offer, expecting revert await expect( @@ -772,7 +777,12 @@ describe("IBosonOfferHandler", function () { it("Seller is not on dispute resolver's seller allow list", async function () { // Create new seller so sellerAllowList can have an entry - seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); + seller = mockSeller( + await rando.getAddress(), + await rando.getAddress(), + ZeroAddress, + await rando.getAddress() + ); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -807,7 +817,7 @@ describe("IBosonOfferHandler", function () { // Create an agent await accountHandler.connect(rando).createAgent(agent); - agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); + agentFee = ((BigInt(offer.price) * BigInt(agent.feePercentage)) / 10000n).toString(); offerFees.agentFee = agentFee; offerFeesStruct = offerFees.toStruct(); }); @@ -845,7 +855,7 @@ describe("IBosonOfferHandler", function () { offerFees.protocolFee = protocolFee; // Calculate the new agent fee amount. - let newOfferAgentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); + let newOfferAgentFee = ((BigInt(offer.price) * BigInt(agent.feePercentage)) / 10000n).toString(); offerFees.agentFee = newOfferAgentFee; offerFeesStruct = offerFees.toStruct(); @@ -876,7 +886,7 @@ describe("IBosonOfferHandler", function () { let oldOfferId = await offerHandler.getNextOfferId(); // Calculate the new agent fee amount. - let oldOfferAgentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); + let oldOfferAgentFee = ((BigInt(offer.price) * BigInt(agent.feePercentage)) / 10000n).toString(); // Create a new offer await offerHandler @@ -889,7 +899,7 @@ describe("IBosonOfferHandler", function () { // Creating 2nd offer // Calculate the new agent fee amount. - let newOfferAgentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); + let newOfferAgentFee = ((BigInt(offer.price) * BigInt(agent.feePercentage)) / 10000n).toString(); let newOfferId = await offerHandler.getNextOfferId(); @@ -1016,7 +1026,12 @@ describe("IBosonOfferHandler", function () { // caller is an assistant of another seller // Create a valid seller, then set fields in tests directly - seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); + seller = mockSeller( + await rando.getAddress(), + await rando.getAddress(), + ZeroAddress, + await rando.getAddress() + ); // AuthToken emptyAuthToken = mockAuthToken(); @@ -1051,7 +1066,7 @@ describe("IBosonOfferHandler", function () { id = nextOfferId++; // update the values - offerDates.validUntil = BigInt(offerDates.validUntil)+"10000".toString(); + offerDates.validUntil = (BigInt(offerDates.validUntil) + 10000n).toString(); offerStruct = offer.toStruct(); }); @@ -1116,7 +1131,12 @@ describe("IBosonOfferHandler", function () { // caller is an assistant of another seller // Create a valid seller, then set fields in tests directly - seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); + seller = mockSeller( + await rando.getAddress(), + await rando.getAddress(), + ZeroAddress, + await rando.getAddress() + ); // AuthToken emptyAuthToken = mockAuthToken(); @@ -1141,14 +1161,14 @@ describe("IBosonOfferHandler", function () { it("New valid until date is lower than the existing valid until date", async function () { // Make the valid until date the same as the existing offer - offerDates.validUntil = BigInt(offerDates.validUntil)-"10000".toString(); + offerDates.validUntil = (BigInt(offerDates.validUntil) - 10000n).toString(); await expect(offerHandler.connect(assistant).extendOffer(offer.id, offerDates.validUntil)).to.revertedWith( RevertReasons.OFFER_PERIOD_INVALID ); // Make new the valid until date less than existing one - offerDates.validUntil = BigInt(offerDates.validUntil)-"1".toString(); + offerDates.validUntil = (BigInt(offerDates.validUntil) - 1n).toString(); // Attempt to update an offer, expecting revert await expect(offerHandler.connect(assistant).extendOffer(offer.id, offerDates.validUntil)).to.revertedWith( @@ -1158,7 +1178,7 @@ describe("IBosonOfferHandler", function () { it("Valid until date is not in the future", async function () { // Set until date in the past - offerDates.validUntil = BigInt(offerDates.validFrom - oneMonth * 6).toString(); // 6 months ago + offerDates.validUntil = (BigInt(offerDates.validFrom) - oneMonth * 6n).toString(); // 6 months ago // Attempt to update an offer, expecting revert await expect(offerHandler.connect(assistant).extendOffer(offer.id, offerDates.validUntil)).to.revertedWith( @@ -1170,7 +1190,7 @@ describe("IBosonOfferHandler", function () { context("Offers with fixed voucher expiration date", async function () { beforeEach(async function () { - offerDates.voucherRedeemableUntil = BigInt(offerDates.validUntil)+oneMonth.toString(); + offerDates.voucherRedeemableUntil = BigInt(offerDates.validUntil) + oneMonth.toString(); offerDurations.voucherValid = "0"; // only one of voucherRedeemableUntil and voucherValid can be non zero // Create an offer @@ -1182,7 +1202,7 @@ describe("IBosonOfferHandler", function () { id = nextOfferId++; // update the values - offerDates.validUntil = BigInt(offerDates.validUntil)+"10000".toString(); + offerDates.validUntil = BigInt(offerDates.validUntil) + "10000".toString(); offerStruct = offer.toStruct(); }); @@ -1212,7 +1232,7 @@ describe("IBosonOfferHandler", function () { context("💔 Revert Reasons", async function () { it("Offer has voucherRedeemableUntil set and new valid until date is greater than that", async function () { // Set until date in the before offerDates.voucherRedeemableUntil - offerDates.validUntil = BigInt(offerDates.voucherRedeemableUntil)+oneWeek.toString(); // one week after voucherRedeemableUntil + offerDates.validUntil = BigInt(offerDates.voucherRedeemableUntil) + oneWeek.toString(); // one week after voucherRedeemableUntil // Attempt to update an offer, expecting revert await expect(offerHandler.connect(assistant).extendOffer(offer.id, offerDates.validUntil)).to.revertedWith( @@ -1254,7 +1274,14 @@ describe("IBosonOfferHandler", function () { await expect(tx) .to.emit(offerHandler, "RangeReserved") - .withArgs(id, offer.sellerId, firstTokenId, lastTokenId, await assistant.getAddress(), await assistant.getAddress()); + .withArgs( + id, + offer.sellerId, + firstTokenId, + lastTokenId, + await assistant.getAddress(), + await assistant.getAddress() + ); await expect(tx).to.emit(bosonVoucher, "RangeReserved").withArgs(id, range.toStruct()); }); @@ -1271,15 +1298,11 @@ describe("IBosonOfferHandler", function () { // Quantity available should be updated [, offerStruct] = await offerHandler.connect(rando).getOffer(id); const quantityAvailableAfter = offerStruct.quantityAvailable; - assert.equal( - quantityAvailableBefore-quantityAvailableAfter.toNumber(), - length, - "Quantity available mismatch" - ); + assert.equal(quantityAvailableBefore - quantityAvailableAfter, length, "Quantity available mismatch"); // nextExchangeId should be updated const nextExchangeIdAfter = await exchangeHandler.getNextExchangeId(); - assert.equal(nextExchangeIdAfter-nextExchangeIdBefore.toNumber(), length, "nextExchangeId mismatch"); + assert.equal(nextExchangeIdAfter - nextExchangeIdBefore, length, "nextExchangeId mismatch"); // Get range object from the voucher contract const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(id)); @@ -1288,10 +1311,8 @@ describe("IBosonOfferHandler", function () { it("it's possible to reserve range even if somebody already committed to", async function () { // Deposit seller funds so the commit will succeed - const sellerPool = BigInt(offer.sellerDeposit)*2; - await fundsHandler - .connect(assistant) - .depositFunds(seller.id, ZeroAddress, sellerPool, { value: sellerPool }); + const sellerPool = BigInt(offer.sellerDeposit) * 2n; + await fundsHandler.connect(assistant).depositFunds(seller.id, ZeroAddress, sellerPool, { value: sellerPool }); // Commit to the offer twice await exchangeHandler.connect(rando).commitToOffer(await rando.getAddress(), id, { value: price }); @@ -1300,7 +1321,14 @@ describe("IBosonOfferHandler", function () { // Reserve a range, testing for the event await expect(offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress())) .to.emit(offerHandler, "RangeReserved") - .withArgs(id, offer.sellerId, firstTokenId + 2, lastTokenId + 2, await assistant.getAddress(), await assistant.getAddress()); + .withArgs( + id, + offer.sellerId, + firstTokenId + 2, + lastTokenId + 2, + await assistant.getAddress(), + await assistant.getAddress() + ); }); it("It's possible to reserve a range with maximum allowed length", async function () { @@ -1311,11 +1339,10 @@ describe("IBosonOfferHandler", function () { .createOffer(offer, offerDates, offerDurations, disputeResolver.id, agentId); // Set maximum allowed length - length = BigInt(2)**64-1; - await expect(offerHandler.connect(assistant).reserveRange(nextOfferId, length, await assistant.getAddress())).to.emit( - offerHandler, - "RangeReserved" - ); + length = 2n ** 64n - 1n; + await expect( + offerHandler.connect(assistant).reserveRange(nextOfferId, length, await assistant.getAddress()) + ).to.emit(offerHandler, "RangeReserved"); }); it("Reserving range of unlimited offer does not decrease quantity available", async function () { @@ -1353,7 +1380,14 @@ describe("IBosonOfferHandler", function () { await expect(tx) .to.emit(offerHandler, "RangeReserved") - .withArgs(id, offer.sellerId, firstTokenId, lastTokenId, await bosonVoucher.getAddress(), await assistant.getAddress()); + .withArgs( + id, + offer.sellerId, + firstTokenId, + lastTokenId, + await bosonVoucher.getAddress(), + await assistant.getAddress() + ); await expect(tx).to.emit(bosonVoucher, "RangeReserved").withArgs(id, range.toStruct()); }); @@ -1370,15 +1404,11 @@ describe("IBosonOfferHandler", function () { // Quantity available should be updated [, offerStruct] = await offerHandler.connect(rando).getOffer(id); const quantityAvailableAfter = offerStruct.quantityAvailable; - assert.equal( - quantityAvailableBefore-quantityAvailableAfter.toNumber(), - length, - "Quantity available mismatch" - ); + assert.equal(quantityAvailableBefore - quantityAvailableAfter, length, "Quantity available mismatch"); // nextExchangeId should be updated const nextExchangeIdAfter = await exchangeHandler.getNextExchangeId(); - assert.equal(nextExchangeIdAfter-nextExchangeIdBefore.toNumber(), length, "nextExchangeId mismatch"); + assert.equal(nextExchangeIdAfter - nextExchangeIdBefore, length, "nextExchangeId mismatch"); // Get range object from the voucher contract const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(id)); @@ -1392,9 +1422,9 @@ describe("IBosonOfferHandler", function () { await pauseHandler.connect(pauser).pause([PausableRegion.Offers]); // Attempt to reserve a range, expecting revert - await expect(offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( - RevertReasons.REGION_PAUSED - ); + await expect( + offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress()) + ).to.revertedWith(RevertReasons.REGION_PAUSED); }); it("The exchanges region of protocol is paused", async function () { @@ -1402,9 +1432,9 @@ describe("IBosonOfferHandler", function () { await pauseHandler.connect(pauser).pause([PausableRegion.Exchanges]); // Attempt to reserve a range, expecting revert - await expect(offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( - RevertReasons.REGION_PAUSED - ); + await expect( + offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress()) + ).to.revertedWith(RevertReasons.REGION_PAUSED); }); it("Offer does not exist", async function () { @@ -1412,17 +1442,17 @@ describe("IBosonOfferHandler", function () { id = "444"; // Attempt to reserve a range, expecting revert - await expect(offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( - RevertReasons.NO_SUCH_OFFER - ); + await expect( + offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress()) + ).to.revertedWith(RevertReasons.NO_SUCH_OFFER); // Set invalid id id = "0"; // Attempt to reserve a range, expecting revert - await expect(offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( - RevertReasons.NO_SUCH_OFFER - ); + await expect( + offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress()) + ).to.revertedWith(RevertReasons.NO_SUCH_OFFER); }); it("Offer already voided", async function () { @@ -1430,21 +1460,26 @@ describe("IBosonOfferHandler", function () { await offerHandler.connect(assistant).voidOffer(id); // Attempt to reserve a range, expecting revert - await expect(offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( - RevertReasons.OFFER_HAS_BEEN_VOIDED - ); + await expect( + offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress()) + ).to.revertedWith(RevertReasons.OFFER_HAS_BEEN_VOIDED); }); it("Caller is not seller", async function () { // caller is not the assistant of any seller // Attempt to reserve a range, expecting revert - await expect(offerHandler.connect(rando).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( - RevertReasons.NOT_ASSISTANT - ); + await expect( + offerHandler.connect(rando).reserveRange(id, length, await assistant.getAddress()) + ).to.revertedWith(RevertReasons.NOT_ASSISTANT); // caller is an assistant of another seller // Create a valid seller, then set fields in tests directly - seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); + seller = mockSeller( + await rando.getAddress(), + await rando.getAddress(), + ZeroAddress, + await rando.getAddress() + ); // AuthToken emptyAuthToken = mockAuthToken(); @@ -1452,9 +1487,9 @@ describe("IBosonOfferHandler", function () { await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); // Attempt to reserve a range, expecting revert - await expect(offerHandler.connect(rando).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( - RevertReasons.NOT_ASSISTANT - ); + await expect( + offerHandler.connect(rando).reserveRange(id, length, await assistant.getAddress()) + ).to.revertedWith(RevertReasons.NOT_ASSISTANT); }); it("Range length is zero", async function () { @@ -1462,9 +1497,9 @@ describe("IBosonOfferHandler", function () { length = 0; // Attempt to reserve a range, expecting revert - await expect(offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( - RevertReasons.INVALID_RANGE_LENGTH - ); + await expect( + offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress()) + ).to.revertedWith(RevertReasons.INVALID_RANGE_LENGTH); }); it("Range length is greater than quantity available", async function () { @@ -1472,9 +1507,9 @@ describe("IBosonOfferHandler", function () { length = Number(offer.quantityAvailable) + 1; // Attempt to reserve a range, expecting revert - await expect(offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( - RevertReasons.INVALID_RANGE_LENGTH - ); + await expect( + offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress()) + ).to.revertedWith(RevertReasons.INVALID_RANGE_LENGTH); }); it("Range length is greater than maximum allowed range length", async function () { @@ -1485,7 +1520,7 @@ describe("IBosonOfferHandler", function () { .createOffer(offer, offerDates, offerDurations, disputeResolver.id, agentId); // Set length to more than maximum allowed range length - length = BigInt(2)**64; + length = 2n ** 64n; // Attempt to reserve a range, expecting revert await expect( @@ -1498,16 +1533,16 @@ describe("IBosonOfferHandler", function () { await offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress()); // Attempt to reserve the same range again, expecting revert - await expect(offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress())).to.revertedWith( - RevertReasons.OFFER_RANGE_ALREADY_RESERVED - ); + await expect( + offerHandler.connect(assistant).reserveRange(id, length, await assistant.getAddress()) + ).to.revertedWith(RevertReasons.OFFER_RANGE_ALREADY_RESERVED); }); it("_to address isn't contract address or contract owner address", async function () { // Try to reserve range for rando address, it should fail - await expect(offerHandler.connect(assistant).reserveRange(id, length, await rando.getAddress())).to.be.revertedWith( - RevertReasons.INVALID_TO_ADDRESS - ); + await expect( + offerHandler.connect(assistant).reserveRange(id, length, await rando.getAddress()) + ).to.be.revertedWith(RevertReasons.INVALID_TO_ADDRESS); }); }); }); @@ -1677,7 +1712,12 @@ describe("IBosonOfferHandler", function () { id = sellerId = nextAccountId = "1"; // argument sent to contract for createSeller will be ignored // Create a valid seller, then set fields in tests directly - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + clerk.address, + await treasury.getAddress() + ); expect(seller.isValid()).is.true; // VoucherInitValues @@ -1693,7 +1733,7 @@ describe("IBosonOfferHandler", function () { disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -1716,7 +1756,7 @@ describe("IBosonOfferHandler", function () { .createDisputeResolver(disputeResolver, disputeResolverFees, sellerAllowList); // Necessary to cover all offers resolution periods - await configHandler.setMaxResolutionPeriod(oneWeek * 5); + await configHandler.setMaxResolutionPeriod(oneWeek * 5n); // create 5 offers offers = []; @@ -1743,16 +1783,12 @@ describe("IBosonOfferHandler", function () { offer.quantityAvailable = `${(i + 1) * 2}`; let now = offerDates.validFrom; - offerDates.validFrom = validFrom = BigInt(now) - +oneMonth * i - .toString(); - offerDates.validUntil = validUntil = BigInt(now) - +oneMonth * 6 * (i + 1) - .toString(); + offerDates.validFrom = validFrom = (BigInt(now) + oneMonth * BigInt(i)).toString(); + offerDates.validUntil = validUntil = (BigInt(now) + oneMonth * 6n * BigInt(i + 1)).toString(); - offerDurations.disputePeriod = disputePeriod = `${(i + 1) * oneMonth}`; - offerDurations.voucherValid = voucherValid = `${(i + 1) * oneMonth}`; - offerDurations.resolutionPeriod = resolutionPeriod = `${(i + 1) * oneWeek}`; + offerDurations.disputePeriod = disputePeriod = `${BigInt(i + 1) * oneMonth}`; + offerDurations.voucherValid = voucherValid = `${BigInt(i + 1) * oneMonth}`; + offerDurations.resolutionPeriod = resolutionPeriod = `${BigInt(i + 1) * oneWeek}`; offerFees.protocolFee = applyPercentage(offer.price, protocolFeePercentage); @@ -2167,7 +2203,7 @@ describe("IBosonOfferHandler", function () { it("Valid from date is greater than valid until date in some offer", async function () { // Reverse the from and until dates - offerDatesList[4].validFrom = BigInt(Date.now() + oneMonth * 6).toString(); // 6 months from now + offerDatesList[4].validFrom = (BigInt(Date.now()) + oneMonth * 6n).toString(); // 6 months from now offerDatesList[4].validUntil = BigInt(Date.now()).toString(); // now // Attempt to Create an offer, expecting revert @@ -2182,10 +2218,10 @@ describe("IBosonOfferHandler", function () { let now = offerDatesList[0].validFrom; // set validFrom date in the past - offerDatesList[0].validFrom = BigInt(now - oneMonth * 6).toString(); // 6 months ago + offerDatesList[0].validFrom = (BigInt(now) - oneMonth * 6n).toString(); // 6 months ago // set valid until > valid from - offerDatesList[0].validUntil = BigInt(now - oneMonth).toString(); // 1 month ago + offerDatesList[0].validUntil = (BigInt(now) - oneMonth).toString(); // 1 month ago // Attempt to Create an offer, expecting revert await expect( @@ -2197,7 +2233,7 @@ describe("IBosonOfferHandler", function () { it("Buyer cancel penalty is greater than price", async function () { // Set buyer cancel penalty higher than offer price - offers[0].buyerCancelPenalty = BigInt(offers[0].price)+"10".toString(); + offers[0].buyerCancelPenalty = BigInt(offers[0].price) + "10".toString(); // Attempt to Create an offer, expecting revert await expect( @@ -2247,9 +2283,8 @@ describe("IBosonOfferHandler", function () { it("For some offer, both voucher expiration date and voucher expiration period are defined", async function () { // Set both voucherRedeemableUntil and voucherValid - offerDatesList[2].voucherRedeemableUntil = BigInt(offerDatesList[2].voucherRedeemableFrom) - +oneMonth - .toString(); + offerDatesList[2].voucherRedeemableUntil = + BigInt(offerDatesList[2].voucherRedeemableFrom) + oneMonth.toString(); offerDurationsList[2].voucherValid = oneMonth.toString(); // Attempt to Create an offer, expecting revert @@ -2275,9 +2310,7 @@ describe("IBosonOfferHandler", function () { it("For some offer, voucher redeemable period is fixed, but it ends before it starts", async function () { // Set both voucherRedeemableUntil that is less than voucherRedeemableFrom - offerDatesList[0].voucherRedeemableUntil = BigInt(offerDatesList[0].voucherRedeemableFrom) - -10 - .toString(); + offerDatesList[0].voucherRedeemableUntil = (BigInt(offerDatesList[0].voucherRedeemableFrom) - 10n).toString(); offerDurationsList[0].voucherValid = "0"; // Attempt to Create an offer, expecting revert @@ -2304,7 +2337,7 @@ describe("IBosonOfferHandler", function () { it("For some offer, Dispute period is less than minimum dispute period", async function () { // Set dispute period to less than minDisputePeriod (oneWeek) - offerDurationsList[1].disputePeriod = BigInt(oneWeek)-1000.toString(); + offerDurationsList[1].disputePeriod = BigInt(oneWeek - 1000n).toString(); // Attempt to Create an offer, expecting revert await expect( @@ -2436,7 +2469,12 @@ describe("IBosonOfferHandler", function () { it("For some offer seller is not on dispute resolver's seller allow list", async function () { // Create new seller so sellerAllowList can have an entry - seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); + seller = mockSeller( + await rando.getAddress(), + await rando.getAddress(), + ZeroAddress, + await rando.getAddress() + ); await accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -2550,12 +2588,12 @@ describe("IBosonOfferHandler", function () { // Set updated offerFees let protocolFee; - if (offers[i].exchangeToken == await bosonToken.getAddress()) { + if (offers[i].exchangeToken == (await bosonToken.getAddress())) { protocolFee = protocolFeeFlatBoson; } else { protocolFee = applyPercentage(offers[i].price, protocolFeePercentage); } - let agentFee = BigInt(offers[i].price)*agent.feePercentage/"10000".toString(); + let agentFee = ((BigInt(offers[i].price) * BigInt(agent.feePercentage)) / 10000n).toString(); offerFees = new OfferFees(protocolFee, agentFee); offerFeesList.push(offerFees); @@ -2790,7 +2828,12 @@ describe("IBosonOfferHandler", function () { ); // caller is an assistant of another seller - seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); + seller = mockSeller( + await rando.getAddress(), + await rando.getAddress(), + ZeroAddress, + await rando.getAddress() + ); // AuthToken emptyAuthToken = mockAuthToken(); @@ -2843,7 +2886,7 @@ describe("IBosonOfferHandler", function () { .createOfferBatch(offers, offerDatesList, offerDurationsList, disputeResolverIds, agentIds); offersToExtend = ["1", "3", "5"]; - newValidUntilDate = BigInt(offerDatesList[4].validUntil)+"10000".toString(); // offer "5" has the highest validUntilDate so we need to set something greater + newValidUntilDate = (BigInt(offerDatesList[4].validUntil) + 10000n).toString(); // offer "5" has the highest validUntilDate so we need to set something greater for (const offerToExtend of offersToExtend) { let i = offerToExtend - 1; @@ -2921,7 +2964,12 @@ describe("IBosonOfferHandler", function () { ); // caller is an assistant of another seller - seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); + seller = mockSeller( + await rando.getAddress(), + await rando.getAddress(), + ZeroAddress, + await rando.getAddress() + ); // AuthToken emptyAuthToken = mockAuthToken(); @@ -2946,14 +2994,17 @@ describe("IBosonOfferHandler", function () { it("New valid until date is lower than the existing valid until date", async function () { // Make the valid until date the same as the existing offer - newValidUntilDate = BigInt(offers[4].validUntilDate)-"10000".toString(); // same as that validUntilDate of offer 5 + newValidUntilDate = (BigInt(offers[4].validUntilDate) - 10000n).toString(); // same as that validUntilDate of offer 5 + + console.log(offers[4].validUntilDate); + console.log(newValidUntilDate); await expect( offerHandler.connect(assistant).extendOfferBatch(offersToExtend, newValidUntilDate) ).to.revertedWith(RevertReasons.OFFER_PERIOD_INVALID); // Make new the valid until date less than existing one - newValidUntilDate = BigInt(newValidUntilDate)-"1".toString(); // less that validUntilDate of offer 5 + newValidUntilDate = (BigInt(newValidUntilDate) - 1n).toString(); // less that validUntilDate of offer 5 // Attempt to extend the offers, expecting revert await expect( @@ -2963,7 +3014,7 @@ describe("IBosonOfferHandler", function () { it("Valid until date is not in the future", async function () { // Set until date in the past - newValidUntilDate = BigInt(offerDatesList[0].validFrom - oneMonth * 6).toString(); // 6 months ago + newValidUntilDate = (BigInt(offerDatesList[0].validFrom) - oneMonth * 6n).toString(); // 6 months ago // Attempt to extend the offers, expecting revert await expect( @@ -2974,7 +3025,7 @@ describe("IBosonOfferHandler", function () { it("Offer has voucherRedeemableUntil set and new valid until date is greater than that", async function () { // create a new offer with vouchers with fix expiration date offer.id++; - offerDates.voucherRedeemableUntil = BigInt(offerDates.validUntil)+oneMonth.toString(); + offerDates.voucherRedeemableUntil = BigInt(offerDates.validUntil) + oneMonth.toString(); offerDurations.voucherValid = "0"; // only one of voucherRedeemableUntil and voucherValid can be non zero await offerHandler .connect(assistant) @@ -2982,7 +3033,7 @@ describe("IBosonOfferHandler", function () { offersToExtend.push(offer.id); // Set until date in after the offerDates.voucherRedeemableUntil - newValidUntilDate = BigInt(offerDates.voucherRedeemableUntil)+oneWeek.toString(); // one week after voucherRedeemableUntil + newValidUntilDate = BigInt(offerDates.voucherRedeemableUntil) + oneWeek.toString(); // one week after voucherRedeemableUntil // Attempt to extend the offers, expecting revert await expect( diff --git a/test/protocol/OrchestrationHandlerTest.js b/test/protocol/OrchestrationHandlerTest.js index 22f3a8762..1fbf06579 100644 --- a/test/protocol/OrchestrationHandlerTest.js +++ b/test/protocol/OrchestrationHandlerTest.js @@ -1,4 +1,5 @@ const { ethers } = require("hardhat"); +const { ZeroAddress, getSigners, provider, getContractAt, MaxUint256, parseUnits } = ethers; const { assert, expect } = require("chai"); const Seller = require("../../scripts/domain/Seller"); @@ -198,7 +199,7 @@ describe("IBosonOrchestrationHandler", function () { disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -222,7 +223,12 @@ describe("IBosonOrchestrationHandler", function () { .createDisputeResolver(disputeResolver, disputeResolverFees, sellerAllowList); // Create a valid seller, then set fields in tests directly - seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await assistant.getAddress(), + clerk.address, + await treasury.getAddress() + ); expect(seller.isValid()).is.true; // How that seller looks as a returned struct @@ -244,7 +250,9 @@ describe("IBosonOrchestrationHandler", function () { // deploy mock auth token and mint one to assistant const [mockAuthERC721Contract] = await deployMockTokens(["Foreign721"]); - await configHandler.connect(deployer).setAuthTokenContract(AuthTokenType.Lens, await mockAuthERC721Contract.getAddress()); + await configHandler + .connect(deployer) + .setAuthTokenContract(AuthTokenType.Lens, await mockAuthERC721Contract.getAddress()); await mockAuthERC721Contract.connect(assistant).mint(authToken.tokenId, 1); // The first offer id @@ -348,7 +356,7 @@ describe("IBosonOrchestrationHandler", function () { escalationPeriod = disputeResolver.escalationResponsePeriod; // Deposit seller funds so the commit will succeed - const fundsToDeposit = BigInt(sellerDeposit)*quantityAvailable; + const fundsToDeposit = BigInt(sellerDeposit) * BigInt(quantityAvailable); await fundsHandler .connect(assistant) .depositFunds(seller.id, ZeroAddress, fundsToDeposit, { value: fundsToDeposit }); @@ -402,7 +410,7 @@ describe("IBosonOrchestrationHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = escalatedDate = block.timestamp.toString(); - timeout = BigInt(escalatedDate)+escalationPeriod.toString(); + timeout = (BigInt(escalatedDate) + BigInt(escalationPeriod)).toString(); dispute = new Dispute(exchangeId, DisputeState.Escalated, "0"); disputeDates = new DisputeDates(disputedDate, escalatedDate, "0", timeout); @@ -431,7 +439,7 @@ describe("IBosonOrchestrationHandler", function () { // Protocol balance should increase for buyer escalation deposit const escrowBalanceAfter = await provider.getBalance(protocolDiamondAddress); - expect(escrowBalanceAfter-escrowBalanceBefore).to.equal( + expect(escrowBalanceAfter - escrowBalanceBefore).to.equal( buyerEscalationDepositNative, "Escrow balance mismatch" ); @@ -450,7 +458,7 @@ describe("IBosonOrchestrationHandler", function () { // Protocol balance should increase for buyer escalation deposit const escrowBalanceAfter = await mockToken.balanceOf(protocolDiamondAddress); - expect(escrowBalanceAfter-escrowBalanceBefore).to.equal( + expect(escrowBalanceAfter - escrowBalanceBefore).to.equal( buyerEscalationDepositToken, "Escrow balance mismatch" ); @@ -559,7 +567,7 @@ describe("IBosonOrchestrationHandler", function () { const voucherRedeemedDate = voucherStruct.redeemedDate; // Set time forward past the dispute period - await setNextBlockTimestamp(voucherRedeemedDate+disputePeriod+1.toNumber()); + await setNextBlockTimestamp(Number(voucherRedeemedDate + disputePeriod + 1)); // Attempt to raise a dispute, expecting revert await expect( @@ -1160,7 +1168,13 @@ describe("IBosonOrchestrationHandler", function () { firstTokenId = 1; lastTokenId = firstTokenId + reservedRangeLength - 1; const tokenIdStart = deriveTokenId(offer.id, firstTokenId); - range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", await assistant.getAddress()); + range = new Range( + tokenIdStart.toString(), + reservedRangeLength.toString(), + "0", + "0", + await assistant.getAddress() + ); }); it("should emit a SellerCreated, OfferCreated and RangeReserved events with auth token", async function () { @@ -1205,7 +1219,14 @@ describe("IBosonOrchestrationHandler", function () { await expect(tx) .to.emit(orchestrationHandler, "RangeReserved") - .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, await assistant.getAddress(), await assistant.getAddress()); + .withArgs( + nextOfferId, + offer.sellerId, + firstTokenId, + lastTokenId, + await assistant.getAddress(), + await assistant.getAddress() + ); // Voucher clone contract bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); @@ -1583,7 +1604,7 @@ describe("IBosonOrchestrationHandler", function () { it("Valid from date is greater than valid until date", async function () { // Reverse the from and until dates - offerDates.validFrom = BigInt(Date.now() + oneMonth * 6).toString(); // 6 months from now + offerDates.validFrom = (BigInt(Date.now()) + oneMonth * 6n).toString(); // 6 months from now offerDates.validUntil = BigInt(Date.now()).toString(); // now // Attempt to create a seller and an offer, expecting revert @@ -1609,9 +1630,7 @@ describe("IBosonOrchestrationHandler", function () { const block = await provider.getBlock(blockNumber); // Set until date in the past - offerDates.validUntil = BigInt(block.timestamp) - -oneMonth * 6 - .toString(); // 6 months ago + offerDates.validUntil = (BigInt(block.timestamp) - oneMonth * 6n).toString(); // 6 months ago // Attempt to create a seller and an offer, expecting revert await expect( @@ -1632,7 +1651,7 @@ describe("IBosonOrchestrationHandler", function () { it("Buyer cancel penalty is less than item price", async function () { // Set buyer cancel penalty higher than offer price - offer.buyerCancelPenalty = BigInt(offer.price)+10.toString(); + offer.buyerCancelPenalty = BigInt(offer.price + 10).toString(); // Attempt to create a seller and an offer, expecting revert await expect( @@ -1674,7 +1693,7 @@ describe("IBosonOrchestrationHandler", function () { it("Both voucher expiration date and voucher expiration period are defined", async function () { // Set both voucherRedeemableUntil and voucherValid - offerDates.voucherRedeemableUntil = (Number(offerDates.voucherRedeemableFrom) + oneMonth).toString(); + offerDates.voucherRedeemableUntil = (BigInt(offerDates.voucherRedeemableFrom) + oneMonth).toString(); offerDurations.voucherValid = oneMonth.toString(); // Attempt to create a seller and an offer, expecting revert @@ -1763,7 +1782,7 @@ describe("IBosonOrchestrationHandler", function () { it("Dispute period is less than minimum dispute period", async function () { // Set dispute period to less than minDisputePeriod (oneWeek) - offerDurations.disputePeriod = BigInt(oneWeek)-1000.toString(); + offerDurations.disputePeriod = (oneWeek - 1000n).toString(); // Attempt to create a seller and an offer, expecting revert await expect( @@ -1805,7 +1824,7 @@ describe("IBosonOrchestrationHandler", function () { it("Resolution period is set above the maximum resolution period", async function () { // Set dispute duration period to 0 - offerDurations.resolutionPeriod = oneMonth + 1; + offerDurations.resolutionPeriod = oneMonth + 1n; // Attempt to create a seller and an offer, expecting revert await expect( @@ -1960,7 +1979,12 @@ describe("IBosonOrchestrationHandler", function () { it("Seller is not on dispute resolver's seller allow list", async function () { // Create new seller so sellerAllowList can have an entry - const newSeller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); + const newSeller = mockSeller( + await rando.getAddress(), + await rando.getAddress(), + ZeroAddress, + await rando.getAddress() + ); await accountHandler.connect(rando).createSeller(newSeller, emptyAuthToken, voucherInitValues); @@ -2053,7 +2077,7 @@ describe("IBosonOrchestrationHandler", function () { it("Reserved range length is greater than maximum allowed range length", async function () { // Set reserved range length to more than maximum allowed range length - let reservedRangeLength = BigInt(2)**64-1; + let reservedRangeLength = 2n ** 64n - 1n; // Attempt to create a seller and an offer, expecting revert await expect( @@ -2093,7 +2117,7 @@ describe("IBosonOrchestrationHandler", function () { // Create an agent await accountHandler.connect(rando).createAgent(agent); - agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); + agentFee = ((BigInt(offer.price) * BigInt(agent.feePercentage)) / 10000n).toString(); offerFees.agentFee = agentFee; offerFeesStruct = offerFees.toStruct(); }); @@ -2210,7 +2234,11 @@ describe("IBosonOrchestrationHandler", function () { seller.id = "2"; // "1" is dispute resolver offerIds = ["1"]; - condition = mockCondition({ tokenAddress: await other2.getAddress(), tokenType: TokenType.MultiToken, tokenId: "5150" }); + condition = mockCondition({ + tokenAddress: await other2.getAddress(), + tokenType: TokenType.MultiToken, + tokenId: "5150", + }); expect(condition.isValid()).to.be.true; group = new Group(nextGroupId, seller.id, offerIds); @@ -2547,7 +2575,7 @@ describe("IBosonOrchestrationHandler", function () { // Create an agent await accountHandler.connect(rando).createAgent(agent); - agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); + agentFee = ((BigInt(offer.price) * BigInt(agent.feePercentage)) / 10000n).toString(); offerFees.agentFee = agentFee; offerFeesStruct = offerFees.toStruct(); }); @@ -2584,7 +2612,11 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(eventGroupCreated.groupId.toString(), group.id, "Group Id is incorrect"); assert.equal(eventGroupCreated.sellerId.toString(), group.sellerId, "Seller Id is incorrect"); - assert.equal(eventGroupCreated.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); + assert.equal( + eventGroupCreated.executedBy.toString(), + await assistant.getAddress(), + "Executed by is incorrect" + ); assert.equal(groupInstance.toString(), group.toString(), "Group struct is incorrect"); }); }); @@ -2603,7 +2635,13 @@ describe("IBosonOrchestrationHandler", function () { bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); const tokenIdStart = deriveTokenId(offer.id, firstTokenId); - range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", await bosonVoucher.getAddress()); + range = new Range( + tokenIdStart.toString(), + reservedRangeLength.toString(), + "0", + "0", + await bosonVoucher.getAddress() + ); }); it("should emit an OfferCreated, a GroupCreated and a RangeReserved events", async function () { @@ -2640,7 +2678,14 @@ describe("IBosonOrchestrationHandler", function () { // RangeReserved event (on protocol contract) await expect(tx) .to.emit(orchestrationHandler, "RangeReserved") - .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, await bosonVoucher.getAddress(), await assistant.getAddress()); + .withArgs( + nextOfferId, + offer.sellerId, + firstTokenId, + lastTokenId, + await bosonVoucher.getAddress(), + await assistant.getAddress() + ); // Events with structs that contain arrays must be tested differently const txReceipt = await tx.wait(); @@ -2653,7 +2698,11 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(eventGroupCreated.groupId.toString(), group.id, "Group Id is incorrect"); assert.equal(eventGroupCreated.sellerId.toString(), group.sellerId, "Seller Id is incorrect"); - assert.equal(eventGroupCreated.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); + assert.equal( + eventGroupCreated.executedBy.toString(), + await assistant.getAddress(), + "Executed by is incorrect" + ); assert.equal(groupInstance.toString(), group.toString(), "Group struct is incorrect"); // RangeReserved event (on voucher contract) @@ -2863,8 +2912,8 @@ describe("IBosonOrchestrationHandler", function () { offer.quantityAvailable = `${(i + 1) * 2}`; offer.sellerId = seller.id; // "2" is dispute resolver - offerDates.validFrom = BigInt(Date.now() + oneMonth * i).toString(); - offerDates.validUntil = BigInt(Date.now() + oneMonth * 6 * (i + 1)).toString(); + offerDates.validFrom = (BigInt(Date.now()) + oneMonth * BigInt(i)).toString(); + offerDates.validUntil = (BigInt(Date.now()) + oneMonth * 6n * BigInt(i + 1)).toString(); disputeResolver.id = "1"; agentId = "0"; @@ -3237,7 +3286,7 @@ describe("IBosonOrchestrationHandler", function () { // Create an agent await accountHandler.connect(rando).createAgent(agent); - agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); + agentFee = ((BigInt(offer.price) * BigInt(agent.feePercentage)) / 10000n).toString(); offerFees.agentFee = agentFee; offerFeesStruct = offerFees.toStruct(); }); @@ -3287,7 +3336,13 @@ describe("IBosonOrchestrationHandler", function () { firstTokenId = 1; lastTokenId = firstTokenId + reservedRangeLength - 1; const tokenIdStart = deriveTokenId(offer.id, firstTokenId); - range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", await assistant.getAddress()); + range = new Range( + tokenIdStart.toString(), + reservedRangeLength.toString(), + "0", + "0", + await assistant.getAddress() + ); // Voucher clone contract expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); @@ -3327,7 +3382,14 @@ describe("IBosonOrchestrationHandler", function () { // RangeReserved event (on protocol contract) await expect(tx) .to.emit(orchestrationHandler, "RangeReserved") - .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, await assistant.getAddress(), await assistant.getAddress()); + .withArgs( + nextOfferId, + offer.sellerId, + firstTokenId, + lastTokenId, + await assistant.getAddress(), + await assistant.getAddress() + ); // Events with structs that contain arrays must be tested differently const txReceipt = await tx.wait(); @@ -3908,7 +3970,7 @@ describe("IBosonOrchestrationHandler", function () { // Create an agent await accountHandler.connect(rando).createAgent(agent); - agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); + agentFee = ((BigInt(offer.price) * BigInt(agent.feePercentage)) / 10000n).toString(); offerFees.agentFee = agentFee; offerFeesStruct = offerFees.toStruct(); }); @@ -3973,7 +4035,13 @@ describe("IBosonOrchestrationHandler", function () { bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); const tokenIdStart = deriveTokenId(offer.id, firstTokenId); - range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", await bosonVoucher.getAddress()); + range = new Range( + tokenIdStart.toString(), + reservedRangeLength.toString(), + "0", + "0", + await bosonVoucher.getAddress() + ); }); it("should emit an OfferCreated, a TwinCreated, a BundleCreated and a RangeReserved events", async function () { @@ -4009,7 +4077,14 @@ describe("IBosonOrchestrationHandler", function () { // RangeReserved event (on protocol contract) await expect(tx) .to.emit(orchestrationHandler, "RangeReserved") - .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, await bosonVoucher.getAddress(), await assistant.getAddress()); + .withArgs( + nextOfferId, + offer.sellerId, + firstTokenId, + lastTokenId, + await bosonVoucher.getAddress(), + await assistant.getAddress() + ); // Events with structs that contain arrays must be tested differently const txReceipt = await tx.wait(); @@ -4261,7 +4336,11 @@ describe("IBosonOrchestrationHandler", function () { // Required constructor params for Group offerIds = ["1"]; - condition = mockCondition({ tokenType: TokenType.MultiToken, tokenAddress: await other2.getAddress(), tokenId: "5150" }); + condition = mockCondition({ + tokenType: TokenType.MultiToken, + tokenAddress: await other2.getAddress(), + tokenId: "5150", + }); expect(condition.isValid()).to.be.true; group = new Group(nextGroupId, seller.id, offerIds); @@ -4798,7 +4877,7 @@ describe("IBosonOrchestrationHandler", function () { // Create an agent await accountHandler.connect(rando).createAgent(agent); - agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); + agentFee = ((BigInt(offer.price) * BigInt(agent.feePercentage)) / 10000n).toString(); offerFees.agentFee = agentFee; offerFeesStruct = offerFees.toStruct(); }); @@ -4876,7 +4955,13 @@ describe("IBosonOrchestrationHandler", function () { firstTokenId = 1; lastTokenId = firstTokenId + reservedRangeLength - 1; const tokenIdStart = deriveTokenId(offer.id, firstTokenId); - range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", await assistant.getAddress()); + range = new Range( + tokenIdStart.toString(), + reservedRangeLength.toString(), + "0", + "0", + await assistant.getAddress() + ); // Voucher clone contract expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), "1"); @@ -4917,7 +5002,14 @@ describe("IBosonOrchestrationHandler", function () { // RangeReserved event (on protocol contract) await expect(tx) .to.emit(orchestrationHandler, "RangeReserved") - .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, await assistant.getAddress(), await assistant.getAddress()); + .withArgs( + nextOfferId, + offer.sellerId, + firstTokenId, + lastTokenId, + await assistant.getAddress(), + await assistant.getAddress() + ); // Events with structs that contain arrays must be tested differently const txReceipt = await tx.wait(); @@ -5185,7 +5277,11 @@ describe("IBosonOrchestrationHandler", function () { // Required constructor params for Group offerIds = ["1"]; - condition = mockCondition({ tokenType: TokenType.MultiToken, tokenAddress: await other2.getAddress(), tokenId: "5150" }); + condition = mockCondition({ + tokenType: TokenType.MultiToken, + tokenAddress: await other2.getAddress(), + tokenId: "5150", + }); expect(condition.isValid()).to.be.true; group = new Group(nextGroupId, seller.id, offerIds); @@ -5524,7 +5620,7 @@ describe("IBosonOrchestrationHandler", function () { // Create an agent await accountHandler.connect(rando).createAgent(agent); - agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); + agentFee = ((BigInt(offer.price) * BigInt(agent.feePercentage)) / 10000n).toString(); offerFees.agentFee = agentFee; offerFeesStruct = offerFees.toStruct(); }); @@ -5594,7 +5690,13 @@ describe("IBosonOrchestrationHandler", function () { firstTokenId = 1; lastTokenId = firstTokenId + reservedRangeLength - 1; const tokenIdStart = deriveTokenId(offer.id, firstTokenId); - range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", await assistant.getAddress()); + range = new Range( + tokenIdStart.toString(), + reservedRangeLength.toString(), + "0", + "0", + await assistant.getAddress() + ); }); it("should emit a SellerCreated, an OfferCreated, a GroupCreated and a RangeReserved event", async function () { @@ -5620,7 +5722,13 @@ describe("IBosonOrchestrationHandler", function () { // SellerCreated and OfferCreated RangeReserved events await expect(tx) .to.emit(orchestrationHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await assistant.getAddress()); + .withArgs( + seller.id, + sellerStruct, + expectedCloneAddress, + emptyAuthTokenStruct, + await assistant.getAddress() + ); await expect(tx) .to.emit(orchestrationHandler, "OfferCreated") @@ -5638,7 +5746,14 @@ describe("IBosonOrchestrationHandler", function () { await expect(tx) .to.emit(orchestrationHandler, "RangeReserved") - .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, await assistant.getAddress(), await assistant.getAddress()); + .withArgs( + nextOfferId, + offer.sellerId, + firstTokenId, + lastTokenId, + await assistant.getAddress(), + await assistant.getAddress() + ); // Events with structs that contain arrays must be tested differently const txReceipt = await tx.wait(); @@ -5975,7 +6090,11 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(eventBundleCreated.bundleId.toString(), bundle.id, "Bundle Id is incorrect"); assert.equal(eventBundleCreated.sellerId.toString(), bundle.sellerId, "Seller Id is incorrect"); - assert.equal(eventBundleCreated.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); + assert.equal( + eventBundleCreated.executedBy.toString(), + await assistant.getAddress(), + "Executed by is incorrect" + ); assert.equal(bundleInstance.toString(), bundle.toString(), "Bundle struct is incorrect"); // Voucher clone contract @@ -6287,7 +6406,7 @@ describe("IBosonOrchestrationHandler", function () { // Create an agent await accountHandler.connect(rando).createAgent(agent); - agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); + agentFee = ((BigInt(offer.price) * BigInt(agent.feePercentage)) / 10000n).toString(); offerFees.agentFee = agentFee; offerFeesStruct = offerFees.toStruct(); }); @@ -6347,7 +6466,11 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(eventTwinCreated.twinId.toString(), twin.id, "Twin Id is incorrect"); assert.equal(eventTwinCreated.sellerId.toString(), twin.sellerId, "Seller Id is incorrect"); - assert.equal(eventTwinCreated.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); + assert.equal( + eventTwinCreated.executedBy.toString(), + await assistant.getAddress(), + "Executed by is incorrect" + ); assert.equal(twinInstance.toString(), twin.toString(), "Twin struct is incorrect"); // BundleCreated event @@ -6358,7 +6481,11 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(eventBundleCreated.bundleId.toString(), bundle.id, "Bundle Id is incorrect"); assert.equal(eventBundleCreated.sellerId.toString(), bundle.sellerId, "Seller Id is incorrect"); - assert.equal(eventBundleCreated.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); + assert.equal( + eventBundleCreated.executedBy.toString(), + await assistant.getAddress(), + "Executed by is incorrect" + ); assert.equal(bundleInstance.toString(), bundle.toString(), "Bundle struct is incorrect"); }); }); @@ -6372,7 +6499,13 @@ describe("IBosonOrchestrationHandler", function () { firstTokenId = 1; lastTokenId = firstTokenId + reservedRangeLength - 1; const tokenIdStart = deriveTokenId(offer.id, firstTokenId); - range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", await assistant.getAddress()); + range = new Range( + tokenIdStart.toString(), + reservedRangeLength.toString(), + "0", + "0", + await assistant.getAddress() + ); }); it("should emit a SellerCreated, an OfferCreated, a TwinCreated, a BundleCreated and RangeReserved event", async function () { @@ -6401,7 +6534,13 @@ describe("IBosonOrchestrationHandler", function () { // SellerCreated, OfferCreated and RangeReserved events await expect(tx) .to.emit(orchestrationHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await assistant.getAddress()); + .withArgs( + seller.id, + sellerStruct, + expectedCloneAddress, + emptyAuthTokenStruct, + await assistant.getAddress() + ); await expect(tx) .to.emit(orchestrationHandler, "OfferCreated") @@ -6419,7 +6558,14 @@ describe("IBosonOrchestrationHandler", function () { await expect(tx) .to.emit(orchestrationHandler, "RangeReserved") - .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, await assistant.getAddress(), await assistant.getAddress()); + .withArgs( + nextOfferId, + offer.sellerId, + firstTokenId, + lastTokenId, + await assistant.getAddress(), + await assistant.getAddress() + ); // Events with structs that contain arrays must be tested differently const txReceipt = await tx.wait(); @@ -6432,7 +6578,11 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(eventTwinCreated.twinId.toString(), twin.id, "Twin Id is incorrect"); assert.equal(eventTwinCreated.sellerId.toString(), twin.sellerId, "Seller Id is incorrect"); - assert.equal(eventTwinCreated.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); + assert.equal( + eventTwinCreated.executedBy.toString(), + await assistant.getAddress(), + "Executed by is incorrect" + ); assert.equal(twinInstance.toString(), twin.toString(), "Twin struct is incorrect"); // BundleCreated event @@ -6443,7 +6593,11 @@ describe("IBosonOrchestrationHandler", function () { assert.equal(eventBundleCreated.bundleId.toString(), bundle.id, "Bundle Id is incorrect"); assert.equal(eventBundleCreated.sellerId.toString(), bundle.sellerId, "Seller Id is incorrect"); - assert.equal(eventBundleCreated.executedBy.toString(), await assistant.getAddress(), "Executed by is incorrect"); + assert.equal( + eventBundleCreated.executedBy.toString(), + await assistant.getAddress(), + "Executed by is incorrect" + ); assert.equal(bundleInstance.toString(), bundle.toString(), "Bundle struct is incorrect"); // Voucher clone contract @@ -6717,7 +6871,11 @@ describe("IBosonOrchestrationHandler", function () { offerIds = ["1"]; - condition = mockCondition({ tokenType: TokenType.MultiToken, tokenAddress: await other2.getAddress(), tokenId: "5150" }); + condition = mockCondition({ + tokenType: TokenType.MultiToken, + tokenAddress: await other2.getAddress(), + tokenId: "5150", + }); expect(condition.isValid()).to.be.true; group = new Group(nextGroupId, seller.id, offerIds); @@ -7169,7 +7327,7 @@ describe("IBosonOrchestrationHandler", function () { // Create an agent await accountHandler.connect(rando).createAgent(agent); - agentFee = BigInt(offer.price)*agent.feePercentage/"10000".toString(); + agentFee = ((BigInt(offer.price) * BigInt(agent.feePercentage)) / 10000n).toString(); offerFees.agentFee = agentFee; offerFeesStruct = offerFees.toStruct(); }); @@ -7199,7 +7357,13 @@ describe("IBosonOrchestrationHandler", function () { // SellerCreated and OfferCreated events await expect(tx) .to.emit(orchestrationHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await assistant.getAddress()); + .withArgs( + seller.id, + sellerStruct, + expectedCloneAddress, + emptyAuthTokenStruct, + await assistant.getAddress() + ); await expect(tx) .to.emit(orchestrationHandler, "OfferCreated") @@ -7273,7 +7437,13 @@ describe("IBosonOrchestrationHandler", function () { firstTokenId = 1; lastTokenId = firstTokenId + reservedRangeLength - 1; const tokenIdStart = deriveTokenId(offer.id, firstTokenId); - range = new Range(tokenIdStart.toString(), reservedRangeLength.toString(), "0", "0", await assistant.getAddress()); + range = new Range( + tokenIdStart.toString(), + reservedRangeLength.toString(), + "0", + "0", + await assistant.getAddress() + ); }); it("should emit a SellerCreated, an OfferCreated, a GroupCreated, a TwinCreated, a BundleCreated and a RangeReserved event", async function () { @@ -7303,7 +7473,13 @@ describe("IBosonOrchestrationHandler", function () { // SellerCreated, OfferCreated and RangeReserved events await expect(tx) .to.emit(orchestrationHandler, "SellerCreated") - .withArgs(seller.id, sellerStruct, expectedCloneAddress, emptyAuthTokenStruct, await assistant.getAddress()); + .withArgs( + seller.id, + sellerStruct, + expectedCloneAddress, + emptyAuthTokenStruct, + await assistant.getAddress() + ); await expect(tx) .to.emit(orchestrationHandler, "OfferCreated") @@ -7321,7 +7497,14 @@ describe("IBosonOrchestrationHandler", function () { await expect(tx) .to.emit(orchestrationHandler, "RangeReserved") - .withArgs(nextOfferId, offer.sellerId, firstTokenId, lastTokenId, await assistant.getAddress(), await assistant.getAddress()); + .withArgs( + nextOfferId, + offer.sellerId, + firstTokenId, + lastTokenId, + await assistant.getAddress(), + await assistant.getAddress() + ); // Events with structs that contain arrays must be tested differently const txReceipt = await tx.wait(); diff --git a/test/protocol/ProtocolDiamondTest.js b/test/protocol/ProtocolDiamondTest.js index 7dcdb3ead..8be65e4f6 100644 --- a/test/protocol/ProtocolDiamondTest.js +++ b/test/protocol/ProtocolDiamondTest.js @@ -690,7 +690,7 @@ describe("ProtocolDiamond", async function () { // Deploy Test2FacetUpgrade Test2FacetUpgrade = await getContractFactory("Test2FacetUpgrade"); test2FacetUpgrade = await Test2FacetUpgrade.deploy(); - await test2FacetUpgrade.deploymentTransaction(); + await test2FacetUpgrade.waitForDeployment(); // Define the facet cut facetCuts = [ @@ -816,7 +816,7 @@ describe("ProtocolDiamond", async function () { // Deploy Test3Facet Test3Facet = await getContractFactory("Test3Facet"); test3Facet = await Test3Facet.deploy(); - await test3Facet.deploymentTransaction(); + await test3Facet.waitForDeployment(); // N.B. The facets are not yet connected to the diamond in any way, // but following handles prepare us for accessing the diamond via diff --git a/test/protocol/TwinHandlerTest.js b/test/protocol/TwinHandlerTest.js index 96ad2266f..1f642a5be 100644 --- a/test/protocol/TwinHandlerTest.js +++ b/test/protocol/TwinHandlerTest.js @@ -489,7 +489,7 @@ describe("IBosonTwinHandler", function () { ); }); - it("token address has been used in another twin with unlimited supply", async function () { + it.only("token address has been used in another twin with unlimited supply", async function () { twin.supplyAvailable = MaxUint256; twin.tokenType = TokenType.NonFungibleToken; twin.tokenAddress = await foreign721.getAddress(); @@ -507,7 +507,7 @@ describe("IBosonTwinHandler", function () { ); }); - it("Supply range overflow", async function () { + it.only("Supply range overflow", async function () { twin.supplyAvailable = MaxUint256/10*8.toString(); twin.tokenType = TokenType.NonFungibleToken; twin.tokenAddress = await foreign721.getAddress(); @@ -522,12 +522,12 @@ describe("IBosonTwinHandler", function () { ); }); - it("Token with unlimited supply with starting tokenId to high", async function () { + it.only("Token with unlimited supply with starting tokenId to high", async function () { twin.supplyAvailable = MaxUint256.toString(); twin.tokenType = TokenType.NonFungibleToken; twin.tokenAddress = await foreign721.getAddress(); twin.amount = "0"; - twin.tokenId = MaxUint256+1/2+1.toString(); + twin.tokenId = MaxUint256 + 1n / 2n + 1n.toString(); await foreign721.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); From 70a380ba9646e192f2c17a25d9119268686127ae Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Wed, 21 Jun 2023 21:24:27 -0300 Subject: [PATCH 12/32] Fixing domains --- scripts/util/validations.js | 3 +- test/domain/AgentTest.js | 15 - test/domain/AuthTokenTest.js | 10 - test/domain/BundleTest.js | 20 - test/domain/BuyerTest.js | 12 +- test/domain/ConditionTest.js | 30 - test/domain/DisputeDatesTest.js | 40 -- test/domain/DisputeResolutionTermsTest.js | 40 -- test/domain/DisputeResolverFeeTest.js | 10 - test/domain/DisputeResolverTest.js | 20 - test/domain/DisputeTest.js | 25 - test/domain/ExchangeTest.js | 40 -- test/domain/FacetCutTest.js | 10 - test/domain/FundsTest.js | 10 - test/domain/GroupTest.js | 29 - test/domain/OfferDatesTest.js | 47 +- test/domain/OfferDurationsTest.js | 30 - test/domain/OfferFeesTest.js | 20 - test/domain/OfferTest.js | 60 -- test/domain/RangeTest.js | 40 -- test/domain/ReceiptTest.js | 147 +---- test/domain/SellerTest.js | 10 - test/domain/TwinReceiptTest.js | 40 -- test/domain/TwinTest.js | 50 -- test/domain/VoucherInitValuesTest.js | 10 - test/domain/VoucherTest.js | 30 - test/protocol/FundsHandlerTest.js | 741 ++++++++++++---------- test/protocol/TwinHandlerTest.js | 18 +- test/util/utils.js | 4 - 29 files changed, 410 insertions(+), 1151 deletions(-) diff --git a/scripts/util/validations.js b/scripts/util/validations.js index 8fc5f2ab4..8bf15e294 100644 --- a/scripts/util/validations.js +++ b/scripts/util/validations.js @@ -22,8 +22,7 @@ function bigNumberIsValid(bigNumber, { optional, gt, lte, empty } = {}) { } else { try { const bigNumberValue = BigInt(bigNumber); - valid = (gt == undefined || bigNumberValue > BigInt(gt)) && - (lte == undefined || bigNumberValue <= BigInt(lte)); + valid = (gt == undefined || bigNumberValue > BigInt(gt)) && (lte == undefined || bigNumberValue <= BigInt(lte)); } catch (e) { valid = false; } diff --git a/test/domain/AgentTest.js b/test/domain/AgentTest.js index fd4743c5d..f6275b889 100644 --- a/test/domain/AgentTest.js +++ b/test/domain/AgentTest.js @@ -58,16 +58,6 @@ describe("Agent", function () { expect(agent.idIsValid()).is.false; expect(agent.isValid()).is.false; - // Invalid field value - agent.id = new Date(); - expect(agent.idIsValid()).is.false; - expect(agent.isValid()).is.false; - - // Invalid field value - agent.id = 12; - expect(agent.idIsValid()).is.false; - expect(agent.isValid()).is.false; - // Valid field value agent.id = "0"; expect(agent.idIsValid()).is.true; @@ -90,11 +80,6 @@ describe("Agent", function () { expect(agent.feePercentageIsValid()).is.false; expect(agent.isValid()).is.false; - // Invalid field value - agent.feePercentage = 12; - expect(agent.feePercentageIsValid()).is.false; - expect(agent.isValid()).is.false; - // Invalid field value agent.feePercentage = "10001"; // Value greater than 100% should be invalid expect(agent.feePercentageIsValid()).is.false; diff --git a/test/domain/AuthTokenTest.js b/test/domain/AuthTokenTest.js index 94d8416a3..199304638 100644 --- a/test/domain/AuthTokenTest.js +++ b/test/domain/AuthTokenTest.js @@ -43,16 +43,6 @@ describe("AuthToken", function () { expect(authToken.tokenIdIsValid()).is.false; expect(authToken.isValid()).is.false; - // Invalid field value - authToken.tokenId = new Date(); - expect(authToken.tokenIdIsValid()).is.false; - expect(authToken.isValid()).is.false; - - // Invalid field value - authToken.tokenId = 12; - expect(authToken.tokenIdIsValid()).is.false; - expect(authToken.isValid()).is.false; - // Valid field value authToken.tokenId = "0"; expect(authToken.tokenIdIsValid()).is.true; diff --git a/test/domain/BundleTest.js b/test/domain/BundleTest.js index 1b4b2e86f..0b778bbc3 100644 --- a/test/domain/BundleTest.js +++ b/test/domain/BundleTest.js @@ -40,16 +40,6 @@ describe("Bundle", function () { expect(bundle.idIsValid()).is.false; expect(bundle.isValid()).is.false; - // Invalid field value - bundle.id = new Date(); - expect(bundle.idIsValid()).is.false; - expect(bundle.isValid()).is.false; - - // Invalid field value - bundle.id = 12; - expect(bundle.idIsValid()).is.false; - expect(bundle.isValid()).is.false; - // Valid field value bundle.id = "0"; expect(bundle.idIsValid()).is.true; @@ -67,16 +57,6 @@ describe("Bundle", function () { expect(bundle.sellerIdIsValid()).is.false; expect(bundle.isValid()).is.false; - // Invalid field value - bundle.sellerId = new Date(); - expect(bundle.sellerIdIsValid()).is.false; - expect(bundle.isValid()).is.false; - - // Invalid field value - bundle.sellerId = 12; - expect(bundle.sellerIdIsValid()).is.false; - expect(bundle.isValid()).is.false; - // Valid field value bundle.sellerId = "0"; expect(bundle.sellerIdIsValid()).is.true; diff --git a/test/domain/BuyerTest.js b/test/domain/BuyerTest.js index 97f15110b..38c246e49 100644 --- a/test/domain/BuyerTest.js +++ b/test/domain/BuyerTest.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const { getSigners }= hre.ethers; +const { getSigners } = hre.ethers; const { expect } = require("chai"); const Buyer = require("../../scripts/domain/Buyer"); @@ -50,16 +50,6 @@ describe("Buyer", function () { expect(buyer.idIsValid()).is.false; expect(buyer.isValid()).is.false; - // Invalid field value - buyer.id = new Date(); - expect(buyer.idIsValid()).is.false; - expect(buyer.isValid()).is.false; - - // Invalid field value - buyer.id = 12; - expect(buyer.idIsValid()).is.false; - expect(buyer.isValid()).is.false; - // Valid field value buyer.id = "0"; expect(buyer.idIsValid()).is.true; diff --git a/test/domain/ConditionTest.js b/test/domain/ConditionTest.js index 608fca87d..7e7756e7c 100644 --- a/test/domain/ConditionTest.js +++ b/test/domain/ConditionTest.js @@ -105,16 +105,6 @@ describe("Condition", function () { expect(condition.tokenIdIsValid()).is.false; expect(condition.isValid()).is.false; - // Invalid field value - condition.tokenId = new Date(); - expect(condition.tokenIdIsValid()).is.false; - expect(condition.isValid()).is.false; - - // Invalid field value - condition.tokenId = 12; - expect(condition.tokenIdIsValid()).is.false; - expect(condition.isValid()).is.false; - // Valid field value condition.tokenId = "0"; expect(condition.tokenIdIsValid()).is.true; @@ -132,16 +122,6 @@ describe("Condition", function () { expect(condition.thresholdIsValid()).is.false; expect(condition.isValid()).is.false; - // Invalid field value - condition.threshold = new Date(); - expect(condition.thresholdIsValid()).is.false; - expect(condition.isValid()).is.false; - - // Invalid field value - condition.threshold = 12; - expect(condition.thresholdIsValid()).is.false; - expect(condition.isValid()).is.false; - // Valid field value condition.threshold = "0"; expect(condition.thresholdIsValid()).is.true; @@ -159,16 +139,6 @@ describe("Condition", function () { expect(condition.maxCommitsIsValid()).is.false; expect(condition.isValid()).is.false; - // Invalid field value - condition.maxCommits = new Date(); - expect(condition.maxCommitsIsValid()).is.false; - expect(condition.isValid()).is.false; - - // Invalid field value - condition.maxCommits = 12; - expect(condition.maxCommitsIsValid()).is.false; - expect(condition.isValid()).is.false; - // Valid field value condition.maxCommits = "0"; expect(condition.maxCommitsIsValid()).is.true; diff --git a/test/domain/DisputeDatesTest.js b/test/domain/DisputeDatesTest.js index 75627bbdf..7ce3b6c26 100644 --- a/test/domain/DisputeDatesTest.js +++ b/test/domain/DisputeDatesTest.js @@ -41,16 +41,6 @@ describe("DisputeDates", function () { expect(disputeDates.disputedIsValid()).is.false; expect(disputeDates.isValid()).is.false; - // Invalid field value - disputeDates.disputed = new Date(); - expect(disputeDates.disputedIsValid()).is.false; - expect(disputeDates.isValid()).is.false; - - // Invalid field value - disputeDates.disputed = 12; - expect(disputeDates.disputedIsValid()).is.false; - expect(disputeDates.isValid()).is.false; - // Valid field value disputeDates.disputed = "0"; expect(disputeDates.disputedIsValid()).is.true; @@ -68,16 +58,6 @@ describe("DisputeDates", function () { expect(disputeDates.escalatedIsValid()).is.false; expect(disputeDates.isValid()).is.false; - // Invalid field value - disputeDates.escalated = new Date(); - expect(disputeDates.escalatedIsValid()).is.false; - expect(disputeDates.isValid()).is.false; - - // Invalid field value - disputeDates.escalated = 12; - expect(disputeDates.escalatedIsValid()).is.false; - expect(disputeDates.isValid()).is.false; - // Valid field value disputeDates.escalated = "0"; expect(disputeDates.escalatedIsValid()).is.true; @@ -105,16 +85,6 @@ describe("DisputeDates", function () { expect(disputeDates.finalizedIsValid()).is.false; expect(disputeDates.isValid()).is.false; - // Invalid field value - disputeDates.finalized = new Date(); - expect(disputeDates.finalizedIsValid()).is.false; - expect(disputeDates.isValid()).is.false; - - // Invalid field value - disputeDates.finalized = 12; - expect(disputeDates.finalizedIsValid()).is.false; - expect(disputeDates.isValid()).is.false; - // Valid field value disputeDates.finalized = "0"; expect(disputeDates.finalizedIsValid()).is.true; @@ -142,16 +112,6 @@ describe("DisputeDates", function () { expect(disputeDates.timeoutIsValid()).is.false; expect(disputeDates.isValid()).is.false; - // Invalid field value - disputeDates.timeout = new Date(); - expect(disputeDates.timeoutIsValid()).is.false; - expect(disputeDates.isValid()).is.false; - - // Invalid field value - disputeDates.timeout = 12; - expect(disputeDates.timeoutIsValid()).is.false; - expect(disputeDates.isValid()).is.false; - // Valid field value disputeDates.timeout = "0"; expect(disputeDates.timeoutIsValid()).is.true; diff --git a/test/domain/DisputeResolutionTermsTest.js b/test/domain/DisputeResolutionTermsTest.js index 14ca7e8fc..ec23a23c6 100644 --- a/test/domain/DisputeResolutionTermsTest.js +++ b/test/domain/DisputeResolutionTermsTest.js @@ -52,16 +52,6 @@ describe("DisputeResolutionTerms", function () { expect(disputeResolutionTerms.disputeResolverIdIsValid()).is.false; expect(disputeResolutionTerms.isValid()).is.false; - // Invalid field value - disputeResolutionTerms.disputeResolverId = new Date(); - expect(disputeResolutionTerms.disputeResolverIdIsValid()).is.false; - expect(disputeResolutionTerms.isValid()).is.false; - - // Invalid field value - disputeResolutionTerms.disputeResolverId = 12; - expect(disputeResolutionTerms.disputeResolverIdIsValid()).is.false; - expect(disputeResolutionTerms.isValid()).is.false; - // Valid field value disputeResolutionTerms.disputeResolverId = "0"; expect(disputeResolutionTerms.disputeResolverIdIsValid()).is.true; @@ -79,16 +69,6 @@ describe("DisputeResolutionTerms", function () { expect(disputeResolutionTerms.escalationResponsePeriodIsValid()).is.false; expect(disputeResolutionTerms.isValid()).is.false; - // Invalid field value - disputeResolutionTerms.escalationResponsePeriod = new Date(); - expect(disputeResolutionTerms.escalationResponsePeriodIsValid()).is.false; - expect(disputeResolutionTerms.isValid()).is.false; - - // Invalid field value - disputeResolutionTerms.escalationResponsePeriod = 12; - expect(disputeResolutionTerms.escalationResponsePeriodIsValid()).is.false; - expect(disputeResolutionTerms.isValid()).is.false; - // Valid field value disputeResolutionTerms.escalationResponsePeriod = "0"; expect(disputeResolutionTerms.escalationResponsePeriodIsValid()).is.true; @@ -106,16 +86,6 @@ describe("DisputeResolutionTerms", function () { expect(disputeResolutionTerms.feeAmountIsValid()).is.false; expect(disputeResolutionTerms.isValid()).is.false; - // Invalid field value - disputeResolutionTerms.feeAmount = new Date(); - expect(disputeResolutionTerms.feeAmountIsValid()).is.false; - expect(disputeResolutionTerms.isValid()).is.false; - - // Invalid field value - disputeResolutionTerms.feeAmount = 12; - expect(disputeResolutionTerms.feeAmountIsValid()).is.false; - expect(disputeResolutionTerms.isValid()).is.false; - // Invalid field value disputeResolutionTerms.feeAmount = "12345"; expect(disputeResolutionTerms.feeAmountIsValid()).is.false; @@ -138,16 +108,6 @@ describe("DisputeResolutionTerms", function () { expect(disputeResolutionTerms.buyerEscalationDepositIsValid()).is.false; expect(disputeResolutionTerms.isValid()).is.false; - // Invalid field value - disputeResolutionTerms.buyerEscalationDeposit = new Date(); - expect(disputeResolutionTerms.buyerEscalationDepositIsValid()).is.false; - expect(disputeResolutionTerms.isValid()).is.false; - - // Invalid field value - disputeResolutionTerms.buyerEscalationDeposit = 12; - expect(disputeResolutionTerms.buyerEscalationDepositIsValid()).is.false; - expect(disputeResolutionTerms.isValid()).is.false; - // Valid field value disputeResolutionTerms.buyerEscalationDeposit = "0"; expect(disputeResolutionTerms.buyerEscalationDepositIsValid()).is.true; diff --git a/test/domain/DisputeResolverFeeTest.js b/test/domain/DisputeResolverFeeTest.js index 98156a7b9..e71ee0f30 100644 --- a/test/domain/DisputeResolverFeeTest.js +++ b/test/domain/DisputeResolverFeeTest.js @@ -89,16 +89,6 @@ describe("DisputeResolverFee", function () { expect(disputeResolverFee.feeAmountIsValid()).is.false; expect(disputeResolverFee.isValid()).is.false; - // Invalid field value - disputeResolverFee.feeAmount = new Date(); - expect(disputeResolverFee.feeAmountIsValid()).is.false; - expect(disputeResolverFee.isValid()).is.false; - - // Invalid field value - disputeResolverFee.feeAmount = 12; - expect(disputeResolverFee.feeAmountIsValid()).is.false; - expect(disputeResolverFee.isValid()).is.false; - // Valid field value disputeResolverFee.feeAmount = "0"; expect(disputeResolverFee.feeAmountIsValid()).is.true; diff --git a/test/domain/DisputeResolverTest.js b/test/domain/DisputeResolverTest.js index c4dcdc359..90780b005 100644 --- a/test/domain/DisputeResolverTest.js +++ b/test/domain/DisputeResolverTest.js @@ -74,16 +74,6 @@ describe("DisputeResolver", function () { expect(disputeResolver.idIsValid()).is.false; expect(disputeResolver.isValid()).is.false; - // Invalid field value - disputeResolver.id = new Date(); - expect(disputeResolver.idIsValid()).is.false; - expect(disputeResolver.isValid()).is.false; - - // Invalid field value - disputeResolver.id = 12; - expect(disputeResolver.idIsValid()).is.false; - expect(disputeResolver.isValid()).is.false; - // Valid field value disputeResolver.id = "0"; expect(disputeResolver.idIsValid()).is.true; @@ -101,16 +91,6 @@ describe("DisputeResolver", function () { expect(disputeResolver.escalationResponsePeriodIsValid()).is.false; expect(disputeResolver.isValid()).is.false; - // Invalid field value - disputeResolver.escalationResponsePeriod = new Date(); - expect(disputeResolver.escalationResponsePeriodIsValid()).is.false; - expect(disputeResolver.isValid()).is.false; - - // Invalid field value - disputeResolver.escalationResponsePeriod = 12; - expect(disputeResolver.escalationResponsePeriodIsValid()).is.false; - expect(disputeResolver.isValid()).is.false; - // Valid field value disputeResolver.escalationResponsePeriod = "0"; expect(disputeResolver.escalationResponsePeriodIsValid()).is.true; diff --git a/test/domain/DisputeTest.js b/test/domain/DisputeTest.js index 6f94c273e..6aeb32154 100644 --- a/test/domain/DisputeTest.js +++ b/test/domain/DisputeTest.js @@ -40,16 +40,6 @@ describe("Dispute", function () { expect(dispute.exchangeIdIsValid()).is.false; expect(dispute.isValid()).is.false; - // Invalid field value - dispute.exchangeId = new Date(); - expect(dispute.exchangeIdIsValid()).is.false; - expect(dispute.isValid()).is.false; - - // Invalid field value - dispute.exchangeId = 12; - expect(dispute.exchangeIdIsValid()).is.false; - expect(dispute.isValid()).is.false; - // Valid field value dispute.exchangeId = "0"; expect(dispute.exchangeIdIsValid()).is.true; @@ -77,11 +67,6 @@ describe("Dispute", function () { expect(dispute.stateIsValid()).is.false; expect(dispute.isValid()).is.false; - // Invalid field value - dispute.state = new Date(); - expect(dispute.stateIsValid()).is.false; - expect(dispute.isValid()).is.false; - // Valid field value dispute.state = DisputeState.Resolving; expect(dispute.stateIsValid()).is.true; @@ -94,16 +79,6 @@ describe("Dispute", function () { expect(dispute.buyerPercentIsValid()).is.false; expect(dispute.isValid()).is.false; - // Invalid field value - dispute.buyerPercent = new Date(); - expect(dispute.buyerPercentIsValid()).is.false; - expect(dispute.isValid()).is.false; - - // Invalid field value - dispute.buyerPercent = 12; - expect(dispute.buyerPercentIsValid()).is.false; - expect(dispute.isValid()).is.false; - // Valid field value dispute.buyerPercent = "0"; expect(dispute.buyerPercentIsValid()).is.true; diff --git a/test/domain/ExchangeTest.js b/test/domain/ExchangeTest.js index e4bc01e4e..9034eb27e 100644 --- a/test/domain/ExchangeTest.js +++ b/test/domain/ExchangeTest.js @@ -46,16 +46,6 @@ describe("Exchange", function () { expect(exchange.idIsValid()).is.false; expect(exchange.isValid()).is.false; - // Invalid field value - exchange.id = new Date(); - expect(exchange.idIsValid()).is.false; - expect(exchange.isValid()).is.false; - - // Invalid field value - exchange.id = 12; - expect(exchange.idIsValid()).is.false; - expect(exchange.isValid()).is.false; - // Invalid field value exchange.id = "0"; expect(exchange.idIsValid()).is.false; @@ -73,16 +63,6 @@ describe("Exchange", function () { expect(exchange.offerIdIsValid()).is.false; expect(exchange.isValid()).is.false; - // Invalid field value - exchange.offerId = new Date(); - expect(exchange.offerIdIsValid()).is.false; - expect(exchange.isValid()).is.false; - - // Invalid field value - exchange.offerId = 12; - expect(exchange.offerIdIsValid()).is.false; - expect(exchange.isValid()).is.false; - // Valid field value exchange.offerId = "0"; expect(exchange.offerIdIsValid()).is.false; @@ -100,16 +80,6 @@ describe("Exchange", function () { expect(exchange.buyerIdIsValid()).is.false; expect(exchange.isValid()).is.false; - // Invalid field value - exchange.buyerId = new Date(); - expect(exchange.buyerIdIsValid()).is.false; - expect(exchange.isValid()).is.false; - - // Invalid field value - exchange.buyerId = 12; - expect(exchange.buyerIdIsValid()).is.false; - expect(exchange.isValid()).is.false; - // Valid field value exchange.buyerId = "0"; expect(exchange.buyerIdIsValid()).is.false; @@ -127,16 +97,6 @@ describe("Exchange", function () { expect(exchange.finalizedDateIsValid()).is.false; expect(exchange.isValid()).is.false; - // Invalid field value - exchange.finalizedDate = new Date(); - expect(exchange.finalizedDateIsValid()).is.false; - expect(exchange.isValid()).is.false; - - // Invalid field value - exchange.finalizedDate = 12; - expect(exchange.finalizedDateIsValid()).is.false; - expect(exchange.isValid()).is.false; - // Valid field value exchange.finalizedDate = "0"; expect(exchange.finalizedDateIsValid()).is.false; diff --git a/test/domain/FacetCutTest.js b/test/domain/FacetCutTest.js index cd1a0e8ab..090da4142 100644 --- a/test/domain/FacetCutTest.js +++ b/test/domain/FacetCutTest.js @@ -71,16 +71,6 @@ describe("FacetCut", function () { expect(facet.actionIsValid()).is.false; expect(facet.isValid()).is.false; - // Invalid field value - facet.action = new Date(); - expect(facet.actionIsValid()).is.false; - expect(facet.isValid()).is.false; - - // Invalid field value - facet.action = 12; - expect(facet.actionIsValid()).is.false; - expect(facet.isValid()).is.false; - // Invalid field value facet.action = "0"; expect(facet.actionIsValid()).is.false; diff --git a/test/domain/FundsTest.js b/test/domain/FundsTest.js index 2d9feed40..74d3ebf87 100644 --- a/test/domain/FundsTest.js +++ b/test/domain/FundsTest.js @@ -89,16 +89,6 @@ describe("Funds", function () { expect(funds.availableAmountIsValid()).is.false; expect(funds.isValid()).is.false; - // Invalid field value - funds.availableAmount = new Date(); - expect(funds.availableAmountIsValid()).is.false; - expect(funds.isValid()).is.false; - - // Invalid field value - funds.availableAmount = 12; - expect(funds.availableAmountIsValid()).is.false; - expect(funds.isValid()).is.false; - // Valid field value funds.availableAmount = "0"; expect(funds.availableAmountIsValid()).is.true; diff --git a/test/domain/GroupTest.js b/test/domain/GroupTest.js index ce240fbb6..9095676de 100644 --- a/test/domain/GroupTest.js +++ b/test/domain/GroupTest.js @@ -44,16 +44,6 @@ describe("Group", function () { expect(group.idIsValid()).is.false; expect(group.isValid()).is.false; - // Invalid field value - group.id = new Date(); - expect(group.idIsValid()).is.false; - expect(group.isValid()).is.false; - - // Invalid field value - group.id = 12; - expect(group.idIsValid()).is.false; - expect(group.isValid()).is.false; - // Valid field value group.id = "0"; expect(group.idIsValid()).is.true; @@ -71,16 +61,6 @@ describe("Group", function () { expect(group.sellerIdIsValid()).is.false; expect(group.isValid()).is.false; - // Invalid field value - group.sellerId = new Date(); - expect(group.sellerIdIsValid()).is.false; - expect(group.isValid()).is.false; - - // Invalid field value - group.sellerId = 12; - expect(group.sellerIdIsValid()).is.false; - expect(group.isValid()).is.false; - // Valid field value group.sellerId = "0"; expect(group.sellerIdIsValid()).is.true; @@ -98,15 +78,6 @@ describe("Group", function () { expect(group.offerIdsIsValid()).is.false; expect(group.isValid()).is.false; - // Invalid field value - group.offerIds = new Date(); - expect(group.offerIdsIsValid()).is.false; - - // Invalid field value - group.offerIds = 12; - expect(group.offerIdsIsValid()).is.false; - expect(group.isValid()).is.false; - // Valid field value group.offerIds = ["1", "2"]; expect(group.offerIdsIsValid()).is.true; diff --git a/test/domain/OfferDatesTest.js b/test/domain/OfferDatesTest.js index ee38edca0..9f90f2c54 100644 --- a/test/domain/OfferDatesTest.js +++ b/test/domain/OfferDatesTest.js @@ -1,5 +1,4 @@ const hre = require("hardhat"); -const { getSigners } = hre.ethers; const { expect } = require("chai"); const OfferDates = require("../../scripts/domain/OfferDates"); const { oneWeek, oneMonth } = require("../util/constants"); @@ -15,9 +14,9 @@ describe("OfferDates", function () { beforeEach(async function () { // Required constructor params validFrom = BigInt(Date.now()).toString(); // valid from now - validUntil = BigInt(Date.now() + oneMonth * 6).toString(); // until 6 months - voucherRedeemableFrom = BigInt(Date.now() + oneWeek).toString(); // redeemable in 1 week - voucherRedeemableUntil = BigInt(Date.now() + oneWeek * 3).toString(); // redeemable for 2 weeks + validUntil = (BigInt(Date.now()) + oneMonth * 6n).toString(); // until 6 months + voucherRedeemableFrom = (BigInt(Date.now()) + oneWeek).toString(); // redeemable in 1 week + voucherRedeemableUntil = (BigInt(Date.now()) + oneWeek * 3n).toString(); // redeemable for 2 weeks }); context("📋 Constructor", async function () { @@ -45,16 +44,6 @@ describe("OfferDates", function () { expect(offerDates.validFromIsValid()).is.false; expect(offerDates.isValid()).is.false; - // Invalid field value - offerDates.validFrom = new Date(); - expect(offerDates.validFromIsValid()).is.false; - expect(offerDates.isValid()).is.false; - - // Invalid field value - offerDates.validFrom = 12; - expect(offerDates.validFromIsValid()).is.false; - expect(offerDates.isValid()).is.false; - // Valid field value offerDates.validFrom = "0"; expect(offerDates.validFromIsValid()).is.true; @@ -72,16 +61,6 @@ describe("OfferDates", function () { expect(offerDates.validUntilIsValid()).is.false; expect(offerDates.isValid()).is.false; - // Invalid field value - offerDates.validUntil = new Date(); - expect(offerDates.validUntilIsValid()).is.false; - expect(offerDates.isValid()).is.false; - - // Invalid field value - offerDates.validUntil = 12; - expect(offerDates.validUntilIsValid()).is.false; - expect(offerDates.isValid()).is.false; - // Valid field value offerDates.validUntil = "0"; expect(offerDates.validUntilIsValid()).is.true; @@ -99,16 +78,6 @@ describe("OfferDates", function () { expect(offerDates.voucherRedeemableFromIsValid()).is.false; expect(offerDates.isValid()).is.false; - // Invalid field value - offerDates.voucherRedeemableFrom = new Date(); - expect(offerDates.voucherRedeemableFromIsValid()).is.false; - expect(offerDates.isValid()).is.false; - - // Invalid field value - offerDates.voucherRedeemableFrom = 12; - expect(offerDates.voucherRedeemableFromIsValid()).is.false; - expect(offerDates.isValid()).is.false; - // Valid field value offerDates.voucherRedeemableFrom = "0"; expect(offerDates.voucherRedeemableFromIsValid()).is.true; @@ -126,16 +95,6 @@ describe("OfferDates", function () { expect(offerDates.voucherRedeemableUntilIsValid()).is.false; expect(offerDates.isValid()).is.false; - // Invalid field value - offerDates.voucherRedeemableUntil = new Date(); - expect(offerDates.voucherRedeemableUntilIsValid()).is.false; - expect(offerDates.isValid()).is.false; - - // Invalid field value - offerDates.voucherRedeemableUntil = 12; - expect(offerDates.voucherRedeemableUntilIsValid()).is.false; - expect(offerDates.isValid()).is.false; - // Valid field value offerDates.voucherRedeemableUntil = "0"; expect(offerDates.voucherRedeemableUntilIsValid()).is.true; diff --git a/test/domain/OfferDurationsTest.js b/test/domain/OfferDurationsTest.js index 42ecdc4eb..79d2624d1 100644 --- a/test/domain/OfferDurationsTest.js +++ b/test/domain/OfferDurationsTest.js @@ -41,16 +41,6 @@ describe("OfferDurations", function () { expect(offerDurations.disputePeriodIsValid()).is.false; expect(offerDurations.isValid()).is.false; - // Invalid field value - offerDurations.disputePeriod = new Date(); - expect(offerDurations.disputePeriodIsValid()).is.false; - expect(offerDurations.isValid()).is.false; - - // Invalid field value - offerDurations.disputePeriod = 12; - expect(offerDurations.disputePeriodIsValid()).is.false; - expect(offerDurations.isValid()).is.false; - // Valid field value offerDurations.disputePeriod = "0"; expect(offerDurations.disputePeriodIsValid()).is.true; @@ -68,16 +58,6 @@ describe("OfferDurations", function () { expect(offerDurations.voucherValidIsValid()).is.false; expect(offerDurations.isValid()).is.false; - // Invalid field value - offerDurations.voucherValid = new Date(); - expect(offerDurations.voucherValidIsValid()).is.false; - expect(offerDurations.isValid()).is.false; - - // Invalid field value - offerDurations.voucherValid = 12; - expect(offerDurations.voucherValidIsValid()).is.false; - expect(offerDurations.isValid()).is.false; - // Valid field value offerDurations.voucherValid = "0"; expect(offerDurations.voucherValidIsValid()).is.true; @@ -95,16 +75,6 @@ describe("OfferDurations", function () { expect(offerDurations.resolutionPeriodIsValid()).is.false; expect(offerDurations.isValid()).is.false; - // Invalid field value - offerDurations.resolutionPeriod = new Date(); - expect(offerDurations.resolutionPeriodIsValid()).is.false; - expect(offerDurations.isValid()).is.false; - - // Invalid field value - offerDurations.resolutionPeriod = 12; - expect(offerDurations.resolutionPeriodIsValid()).is.false; - expect(offerDurations.isValid()).is.false; - // Valid field value offerDurations.resolutionPeriod = "0"; expect(offerDurations.resolutionPeriodIsValid()).is.true; diff --git a/test/domain/OfferFeesTest.js b/test/domain/OfferFeesTest.js index cc5bf664d..c1355cde3 100644 --- a/test/domain/OfferFeesTest.js +++ b/test/domain/OfferFeesTest.js @@ -38,16 +38,6 @@ describe("OfferFees", function () { expect(offerFees.protocolFeeIsValid()).is.false; expect(offerFees.isValid()).is.false; - // Invalid field value - offerFees.protocolFee = new Date(); - expect(offerFees.protocolFeeIsValid()).is.false; - expect(offerFees.isValid()).is.false; - - // Invalid field value - offerFees.protocolFee = 12; - expect(offerFees.protocolFeeIsValid()).is.false; - expect(offerFees.isValid()).is.false; - // Valid field value offerFees.protocolFee = "0"; expect(offerFees.protocolFeeIsValid()).is.true; @@ -65,16 +55,6 @@ describe("OfferFees", function () { expect(offerFees.agentFeeIsValid()).is.false; expect(offerFees.isValid()).is.false; - // Invalid field value - offerFees.agentFee = new Date(); - expect(offerFees.agentFeeIsValid()).is.false; - expect(offerFees.isValid()).is.false; - - // Invalid field value - offerFees.agentFee = 12; - expect(offerFees.agentFeeIsValid()).is.false; - expect(offerFees.isValid()).is.false; - // Valid field value offerFees.agentFee = "0"; expect(offerFees.agentFeeIsValid()).is.true; diff --git a/test/domain/OfferTest.js b/test/domain/OfferTest.js index aeb588d42..8ee841fd5 100644 --- a/test/domain/OfferTest.js +++ b/test/domain/OfferTest.js @@ -90,16 +90,6 @@ describe("Offer", function () { expect(offer.idIsValid()).is.false; expect(offer.isValid()).is.false; - // Invalid field value - offer.id = new Date(); - expect(offer.idIsValid()).is.false; - expect(offer.isValid()).is.false; - - // Invalid field value - offer.id = 12; - expect(offer.idIsValid()).is.false; - expect(offer.isValid()).is.false; - // Valid field value offer.id = "0"; expect(offer.idIsValid()).is.true; @@ -117,16 +107,6 @@ describe("Offer", function () { expect(offer.priceIsValid()).is.false; expect(offer.isValid()).is.false; - // Invalid field value - offer.price = new Date(); - expect(offer.priceIsValid()).is.false; - expect(offer.isValid()).is.false; - - // Invalid field value - offer.price = 12; - expect(offer.priceIsValid()).is.false; - expect(offer.isValid()).is.false; - // Valid field value offer.price = "0"; expect(offer.priceIsValid()).is.true; @@ -144,16 +124,6 @@ describe("Offer", function () { expect(offer.sellerDepositIsValid()).is.false; expect(offer.isValid()).is.false; - // Invalid field value - offer.sellerDeposit = new Date(); - expect(offer.sellerDepositIsValid()).is.false; - expect(offer.isValid()).is.false; - - // Invalid field value - offer.sellerDeposit = 12; - expect(offer.sellerDepositIsValid()).is.false; - expect(offer.isValid()).is.false; - // Valid field value offer.sellerDeposit = "0"; expect(offer.sellerDepositIsValid()).is.true; @@ -171,16 +141,6 @@ describe("Offer", function () { expect(offer.buyerCancelPenaltyIsValid()).is.false; expect(offer.isValid()).is.false; - // Invalid field value - offer.buyerCancelPenalty = new Date(); - expect(offer.buyerCancelPenaltyIsValid()).is.false; - expect(offer.isValid()).is.false; - - // Invalid field value - offer.buyerCancelPenalty = 12; - expect(offer.buyerCancelPenaltyIsValid()).is.false; - expect(offer.isValid()).is.false; - // Valid field value offer.buyerCancelPenalty = "0"; expect(offer.buyerCancelPenaltyIsValid()).is.true; @@ -198,16 +158,6 @@ describe("Offer", function () { expect(offer.quantityAvailableIsValid()).is.false; expect(offer.isValid()).is.false; - // Invalid field value - offer.quantityAvailable = new Date(); - expect(offer.quantityAvailableIsValid()).is.false; - expect(offer.isValid()).is.false; - - // Invalid field value - offer.quantityAvailable = 12; - expect(offer.quantityAvailableIsValid()).is.false; - expect(offer.isValid()).is.false; - // Valid field value offer.quantityAvailable = "0"; expect(offer.quantityAvailableIsValid()).is.true; @@ -225,16 +175,6 @@ describe("Offer", function () { expect(offer.sellerIdIsValid()).is.false; expect(offer.isValid()).is.false; - // Invalid field value - offer.sellerId = new Date(); - expect(offer.sellerIdIsValid()).is.false; - expect(offer.isValid()).is.false; - - // Invalid field value - offer.sellerId = 12; - expect(offer.sellerIdIsValid()).is.false; - expect(offer.isValid()).is.false; - // Valid field value offer.sellerId = "0"; expect(offer.sellerIdIsValid()).is.true; diff --git a/test/domain/RangeTest.js b/test/domain/RangeTest.js index a8bf3343c..25ffb89dd 100644 --- a/test/domain/RangeTest.js +++ b/test/domain/RangeTest.js @@ -41,16 +41,6 @@ describe("Range", function () { expect(range.startIsValid()).is.false; expect(range.isValid()).is.false; - // Invalid field value - range.start = new Date(); - expect(range.startIsValid()).is.false; - expect(range.isValid()).is.false; - - // Invalid field value - range.start = 12; - expect(range.startIsValid()).is.false; - expect(range.isValid()).is.false; - // Valid field value range.start = "0"; expect(range.startIsValid()).is.true; @@ -68,16 +58,6 @@ describe("Range", function () { expect(range.lengthIsValid()).is.false; expect(range.isValid()).is.false; - // Invalid field value - range.length = new Date(); - expect(range.lengthIsValid()).is.false; - expect(range.isValid()).is.false; - - // Invalid field value - range.length = 12; - expect(range.lengthIsValid()).is.false; - expect(range.isValid()).is.false; - // Valid field value range.length = "0"; expect(range.lengthIsValid()).is.true; @@ -95,16 +75,6 @@ describe("Range", function () { expect(range.mintedIsValid()).is.false; expect(range.isValid()).is.false; - // Invalid field value - range.minted = new Date(); - expect(range.mintedIsValid()).is.false; - expect(range.isValid()).is.false; - - // Invalid field value - range.minted = 12; - expect(range.mintedIsValid()).is.false; - expect(range.isValid()).is.false; - // Valid field value range.minted = "0"; expect(range.mintedIsValid()).is.true; @@ -122,16 +92,6 @@ describe("Range", function () { expect(range.lastBurnedTokenIdIsValid()).is.false; expect(range.isValid()).is.false; - // Invalid field value - range.lastBurnedTokenId = new Date(); - expect(range.lastBurnedTokenIdIsValid()).is.false; - expect(range.isValid()).is.false; - - // Invalid field value - range.lastBurnedTokenId = 12; - expect(range.lastBurnedTokenIdIsValid()).is.false; - expect(range.isValid()).is.false; - // Valid field value range.lastBurnedTokenId = "0"; expect(range.lastBurnedTokenIdIsValid()).is.true; diff --git a/test/domain/ReceiptTest.js b/test/domain/ReceiptTest.js index 6b1fe5319..bc8239d09 100644 --- a/test/domain/ReceiptTest.js +++ b/test/domain/ReceiptTest.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const { getSigners } = hre.ethers; +const { getSigners, ZeroAddress } = hre.ethers; const { expect } = require("chai"); const Receipt = require("../../scripts/domain/Receipt.js"); const { mockReceipt, mockOffer, mockTwinReceipt, mockCondition } = require("../util/mock"); @@ -57,16 +57,6 @@ describe("Receipt", function () { expect(receipt.exchangeIdIsValid()).is.false; expect(receipt.isValid()).is.false; - // Invalid field value - receipt.exchangeId = new Date(); - expect(receipt.exchangeIdIsValid()).is.false; - expect(receipt.isValid()).is.false; - - // Invalid field value - receipt.exchangeId = 12; - expect(receipt.exchangeIdIsValid()).is.false; - expect(receipt.isValid()).is.false; - // Invalid field value receipt.exchangeId = "0"; expect(receipt.exchangeIdIsValid()).is.false; @@ -84,16 +74,6 @@ describe("Receipt", function () { expect(receipt.offerIdIsValid()).is.false; expect(receipt.isValid()).is.false; - // Invalid field value - receipt.offerId = new Date(); - expect(receipt.offerIdIsValid()).is.false; - expect(receipt.isValid()).is.false; - - // Invalid field value - receipt.offerId = 12; - expect(receipt.offerIdIsValid()).is.false; - expect(receipt.isValid()).is.false; - // Invalid field value receipt.offerId = "0"; expect(receipt.offerIdIsValid()).is.false; @@ -111,16 +91,6 @@ describe("Receipt", function () { expect(receipt.buyerIdIsValid()).is.false; expect(receipt.isValid()).is.false; - // Invalid field value - receipt.buyerId = new Date(); - expect(receipt.buyerIdIsValid()).is.false; - expect(receipt.isValid()).is.false; - - // Invalid field value - receipt.buyerId = 12; - expect(receipt.buyerIdIsValid()).is.false; - expect(receipt.isValid()).is.false; - // Invalid field value receipt.buyerId = "0"; expect(receipt.buyerIdIsValid()).is.false; @@ -138,16 +108,6 @@ describe("Receipt", function () { expect(receipt.priceIsValid()).is.false; expect(receipt.isValid()).is.false; - // Invalid field value - receipt.price = new Date(); - expect(receipt.priceIsValid()).is.false; - expect(receipt.isValid()).is.false; - - // Invalid field value - receipt.price = 12; - expect(receipt.priceIsValid()).is.false; - expect(receipt.isValid()).is.false; - // Valid field value receipt.price = "0"; expect(receipt.priceIsValid()).is.true; @@ -165,16 +125,6 @@ describe("Receipt", function () { expect(receipt.sellerDepositIsValid()).is.false; expect(receipt.isValid()).is.false; - // Invalid field value - receipt.sellerDeposit = new Date(); - expect(receipt.sellerDepositIsValid()).is.false; - expect(receipt.isValid()).is.false; - - // Invalid field value - receipt.sellerDeposit = 12; - expect(receipt.sellerDepositIsValid()).is.false; - expect(receipt.isValid()).is.false; - // Valid field value receipt.sellerDeposit = "0"; expect(receipt.sellerDepositIsValid()).is.true; @@ -192,16 +142,6 @@ describe("Receipt", function () { expect(receipt.buyerCancelPenaltyIsValid()).is.false; expect(receipt.isValid()).is.false; - // Invalid field value - receipt.buyerCancelPenalty = new Date(); - expect(receipt.buyerCancelPenaltyIsValid()).is.false; - expect(receipt.isValid()).is.false; - - // Invalid field value - receipt.buyerCancelPenalty = 12; - expect(receipt.buyerCancelPenaltyIsValid()).is.false; - expect(receipt.isValid()).is.false; - // Valid field value receipt.buyerCancelPenalty = "0"; expect(receipt.buyerCancelPenaltyIsValid()).is.true; @@ -229,11 +169,6 @@ describe("Receipt", function () { expect(receipt.offerFeesIsValid()).is.false; expect(receipt.isValid()).is.false; - // Valid field value - receipt.offerFees = new Date(); - expect(receipt.offerFeesIsValid()).is.false; - expect(receipt.isValid()).is.false; - const mo = await mockOffer(); // Valid field value receipt.offerFees = mo.offerFees; @@ -247,16 +182,6 @@ describe("Receipt", function () { expect(receipt.agentIdIsValid()).is.false; expect(receipt.isValid()).is.false; - // Invalid field value - receipt.agentId = new Date(); - expect(receipt.agentIdIsValid()).is.false; - expect(receipt.isValid()).is.false; - - // Invalid field value - receipt.agentId = 12; - expect(receipt.agentIdIsValid()).is.false; - expect(receipt.isValid()).is.false; - // Valid field value receipt.agentId = "0"; expect(receipt.priceIsValid()).is.true; @@ -296,16 +221,6 @@ describe("Receipt", function () { expect(receipt.finalizedDateIsValid()).is.false; expect(receipt.isValid()).is.false; - // Invalid field value - receipt.finalizedDate = new Date(); - expect(receipt.finalizedDateIsValid()).is.false; - expect(receipt.isValid()).is.false; - - // Invalid field value - receipt.finalizedDate = 12; - expect(receipt.finalizedDateIsValid()).is.false; - expect(receipt.isValid()).is.false; - // Invalid field value receipt.finalizedDate = "0"; expect(receipt.finalizedDateIsValid()).is.false; @@ -323,16 +238,6 @@ describe("Receipt", function () { expect(receipt.conditionIsValid()).is.false; expect(receipt.isValid()).is.false; - // Invalid field value - receipt.condition = new Date(); - expect(receipt.conditionIsValid()).is.false; - expect(receipt.isValid()).is.false; - - // Invalid field value - receipt.condition = 12; - expect(receipt.conditionIsValid()).is.false; - expect(receipt.isValid()).is.false; - // Valid field value receipt.condition = "126"; expect(receipt.conditionIsValid()).is.false; @@ -350,16 +255,6 @@ describe("Receipt", function () { expect(receipt.committedDateIsValid()).is.false; expect(receipt.isValid()).is.false; - // Invalid field value - receipt.committedDate = new Date(); - expect(receipt.committedDateIsValid()).is.false; - expect(receipt.isValid()).is.false; - - // Invalid field value - receipt.committedDate = 12; - expect(receipt.committedDateIsValid()).is.false; - expect(receipt.isValid()).is.false; - // Valid field value receipt.committedDate = "126"; expect(receipt.committedDateIsValid()).is.true; @@ -372,16 +267,6 @@ describe("Receipt", function () { expect(receipt.redeemedDateIsValid()).is.false; expect(receipt.isValid()).is.false; - // Invalid field value - receipt.redeemedDate = new Date(); - expect(receipt.redeemedDateIsValid()).is.false; - expect(receipt.isValid()).is.false; - - // Invalid field value - receipt.redeemedDate = 12; - expect(receipt.redeemedDateIsValid()).is.false; - expect(receipt.isValid()).is.false; - // Valid field value receipt.redeemedDate = "0"; expect(receipt.redeemedDateIsValid()).is.true; @@ -421,16 +306,6 @@ describe("Receipt", function () { expect(receipt.disputeResolverIdIsValid()).is.false; expect(receipt.isValid()).is.false; - // Invalid field value - receipt.disputeResolverId = new Date(); - expect(receipt.disputeResolverIdIsValid()).is.false; - expect(receipt.isValid()).is.false; - - // Invalid field value - receipt.disputeResolverId = 12; - expect(receipt.disputeResolverIdIsValid()).is.false; - expect(receipt.isValid()).is.false; - // Valid field value receipt.disputeResolverId = "0"; expect(receipt.disputeResolverIdIsValid()).is.true; @@ -448,16 +323,6 @@ describe("Receipt", function () { expect(receipt.disputedDateIsValid()).is.false; expect(receipt.isValid()).is.false; - // Invalid field value - receipt.disputedDate = new Date(); - expect(receipt.disputedDateIsValid()).is.false; - expect(receipt.isValid()).is.false; - - // Invalid field value - receipt.disputedDate = 12; - expect(receipt.disputedDateIsValid()).is.false; - expect(receipt.isValid()).is.false; - // Valid field value receipt.disputedDate = "0"; expect(receipt.disputedDateIsValid()).is.true; @@ -475,16 +340,6 @@ describe("Receipt", function () { expect(receipt.escalatedDateIsValid()).is.false; expect(receipt.isValid()).is.false; - // Invalid field value - receipt.escalatedDate = new Date(); - expect(receipt.escalatedDateIsValid()).is.false; - expect(receipt.isValid()).is.false; - - // Invalid field value - receipt.escalatedDate = 12; - expect(receipt.escalatedDateIsValid()).is.false; - expect(receipt.isValid()).is.false; - // Valid field value receipt.escalatedDate = "0"; expect(receipt.escalatedDateIsValid()).is.true; diff --git a/test/domain/SellerTest.js b/test/domain/SellerTest.js index 763240319..bffa2fabc 100644 --- a/test/domain/SellerTest.js +++ b/test/domain/SellerTest.js @@ -53,16 +53,6 @@ describe("Seller", function () { expect(seller.idIsValid()).is.false; expect(seller.isValid()).is.false; - // Invalid field value - seller.id = new Date(); - expect(seller.idIsValid()).is.false; - expect(seller.isValid()).is.false; - - // Invalid field value - seller.id = 12; - expect(seller.idIsValid()).is.false; - expect(seller.isValid()).is.false; - // Valid field value seller.id = "0"; expect(seller.idIsValid()).is.true; diff --git a/test/domain/TwinReceiptTest.js b/test/domain/TwinReceiptTest.js index a9a3b9af4..135d9c0b4 100644 --- a/test/domain/TwinReceiptTest.js +++ b/test/domain/TwinReceiptTest.js @@ -44,16 +44,6 @@ describe("TwinReceipt", function () { expect(twinReceipt.twinIdIsValid()).is.false; expect(twinReceipt.isValid()).is.false; - // Invalid field value - twinReceipt.twinId = new Date(); - expect(twinReceipt.twinIdIsValid()).is.false; - expect(twinReceipt.isValid()).is.false; - - // Invalid field value - twinReceipt.twinId = 12; - expect(twinReceipt.twinIdIsValid()).is.false; - expect(twinReceipt.isValid()).is.false; - // Valid field value twinReceipt.twinId = "0"; expect(twinReceipt.twinIdIsValid()).is.true; @@ -71,16 +61,6 @@ describe("TwinReceipt", function () { expect(twinReceipt.amountIsValid()).is.false; expect(twinReceipt.isValid()).is.false; - // Invalid field value - twinReceipt.amount = new Date(); - expect(twinReceipt.amountIsValid()).is.false; - expect(twinReceipt.isValid()).is.false; - - // Invalid field value - twinReceipt.amount = 12; - expect(twinReceipt.amountIsValid()).is.false; - expect(twinReceipt.isValid()).is.false; - // Valid field value twinReceipt.amount = "0"; expect(twinReceipt.amountIsValid()).is.true; @@ -98,16 +78,6 @@ describe("TwinReceipt", function () { expect(twinReceipt.tokenIdIsValid()).is.false; expect(twinReceipt.isValid()).is.false; - // Invalid field value - twinReceipt.tokenId = new Date(); - expect(twinReceipt.tokenIdIsValid()).is.false; - expect(twinReceipt.isValid()).is.false; - - // Invalid field value - twinReceipt.tokenId = 12; - expect(twinReceipt.tokenIdIsValid()).is.false; - expect(twinReceipt.isValid()).is.false; - // Valid field value twinReceipt.tokenId = "0"; expect(twinReceipt.tokenIdIsValid()).is.true; @@ -147,16 +117,6 @@ describe("TwinReceipt", function () { expect(twinReceipt.tokenTypeIsValid()).is.false; expect(twinReceipt.isValid()).is.false; - // Invalid field value - twinReceipt.tokenType = new Date(); - expect(twinReceipt.tokenTypeIsValid()).is.false; - expect(twinReceipt.isValid()).is.false; - - // Invalid field value - twinReceipt.tokenType = 12; - expect(twinReceipt.tokenTypeIsValid()).is.false; - expect(twinReceipt.isValid()).is.false; - // Invalid field value twinReceipt.tokenType = "0"; expect(twinReceipt.tokenTypeIsValid()).is.false; diff --git a/test/domain/TwinTest.js b/test/domain/TwinTest.js index 9710133cd..1bdcd8170 100644 --- a/test/domain/TwinTest.js +++ b/test/domain/TwinTest.js @@ -46,16 +46,6 @@ describe("Twin", function () { expect(twin.idIsValid()).is.false; expect(twin.isValid()).is.false; - // Invalid field value - twin.id = new Date(); - expect(twin.idIsValid()).is.false; - expect(twin.isValid()).is.false; - - // Invalid field value - twin.id = 12; - expect(twin.idIsValid()).is.false; - expect(twin.isValid()).is.false; - // Valid field value twin.id = "0"; expect(twin.idIsValid()).is.true; @@ -73,16 +63,6 @@ describe("Twin", function () { expect(twin.sellerIdIsValid()).is.false; expect(twin.isValid()).is.false; - // Invalid field value - twin.sellerId = new Date(); - expect(twin.sellerIdIsValid()).is.false; - expect(twin.isValid()).is.false; - - // Invalid field value - twin.sellerId = 12; - expect(twin.sellerIdIsValid()).is.false; - expect(twin.isValid()).is.false; - // Valid field value twin.sellerId = "0"; expect(twin.sellerIdIsValid()).is.true; @@ -100,16 +80,6 @@ describe("Twin", function () { expect(twin.amountIsValid()).is.false; expect(twin.isValid()).is.false; - // Invalid field value - twin.amount = new Date(); - expect(twin.amountIsValid()).is.false; - expect(twin.isValid()).is.false; - - // Invalid field value - twin.amount = 12; - expect(twin.amountIsValid()).is.false; - expect(twin.isValid()).is.false; - // Valid field value twin.amount = "0"; expect(twin.amountIsValid()).is.true; @@ -127,16 +97,6 @@ describe("Twin", function () { expect(twin.supplyAvailableIsValid()).is.false; expect(twin.isValid()).is.false; - // Invalid field value - twin.supplyAvailable = new Date(); - expect(twin.supplyAvailableIsValid()).is.false; - expect(twin.isValid()).is.false; - - // Invalid field value - twin.supplyAvailable = 12; - expect(twin.supplyAvailableIsValid()).is.false; - expect(twin.isValid()).is.false; - // Invalid field value twin.supplyAvailable = ["1", "2"]; expect(twin.supplyAvailableIsValid()).is.false; @@ -154,16 +114,6 @@ describe("Twin", function () { expect(twin.tokenIdIsValid()).is.false; expect(twin.isValid()).is.false; - // Invalid field value - twin.tokenId = new Date(); - expect(twin.tokenIdIsValid()).is.false; - expect(twin.isValid()).is.false; - - // Invalid field value - twin.tokenId = 12; - expect(twin.tokenIdIsValid()).is.false; - expect(twin.isValid()).is.false; - // Valid field value twin.tokenId = "0"; expect(twin.tokenIdIsValid()).is.true; diff --git a/test/domain/VoucherInitValuesTest.js b/test/domain/VoucherInitValuesTest.js index 575d89bfc..a01a86c4d 100644 --- a/test/domain/VoucherInitValuesTest.js +++ b/test/domain/VoucherInitValuesTest.js @@ -60,16 +60,6 @@ describe("VoucherInitValues", function () { expect(voucherInitValues.royaltyPercentageIsValid()).is.false; expect(voucherInitValues.isValid()).is.false; - // Invalid field value - voucherInitValues.royaltyPercentage = new Date(); - expect(voucherInitValues.royaltyPercentageIsValid()).is.false; - expect(voucherInitValues.isValid()).is.false; - - // Invalid field value - voucherInitValues.royaltyPercentage = 12; - expect(voucherInitValues.royaltyPercentageIsValid()).is.false; - expect(voucherInitValues.isValid()).is.false; - // Invalid field value voucherInitValues.royaltyPercentage = "10001"; // Value greater than 100% should be invalid expect(voucherInitValues.royaltyPercentageIsValid()).is.false; diff --git a/test/domain/VoucherTest.js b/test/domain/VoucherTest.js index 0bcff4bba..986eef895 100644 --- a/test/domain/VoucherTest.js +++ b/test/domain/VoucherTest.js @@ -50,16 +50,6 @@ describe("Voucher", function () { expect(voucher.committedDateIsValid()).is.false; expect(voucher.isValid()).is.false; - // Invalid field value - voucher.committedDate = new Date(); - expect(voucher.committedDateIsValid()).is.false; - expect(voucher.isValid()).is.false; - - // Invalid field value - voucher.committedDate = 12; - expect(voucher.committedDateIsValid()).is.false; - expect(voucher.isValid()).is.false; - // Valid field value voucher.committedDate = "0"; expect(voucher.committedDateIsValid()).is.false; @@ -77,16 +67,6 @@ describe("Voucher", function () { expect(voucher.validUntilDateIsValid()).is.false; expect(voucher.isValid()).is.false; - // Invalid field value - voucher.validUntilDate = new Date(); - expect(voucher.validUntilDateIsValid()).is.false; - expect(voucher.isValid()).is.false; - - // Invalid field value - voucher.validUntilDate = 12; - expect(voucher.validUntilDateIsValid()).is.false; - expect(voucher.isValid()).is.false; - // Valid field value voucher.validUntilDate = "0"; expect(voucher.validUntilDateIsValid()).is.false; @@ -104,16 +84,6 @@ describe("Voucher", function () { expect(voucher.redeemedDateIsValid()).is.false; expect(voucher.isValid()).is.false; - // Invalid field value - voucher.redeemedDate = new Date(); - expect(voucher.redeemedDateIsValid()).is.false; - expect(voucher.isValid()).is.false; - - // Invalid field value - voucher.redeemedDate = 12; - expect(voucher.redeemedDateIsValid()).is.false; - expect(voucher.isValid()).is.false; - // Valid field value voucher.redeemedDate = "0"; expect(voucher.redeemedDateIsValid()).is.false; diff --git a/test/protocol/FundsHandlerTest.js b/test/protocol/FundsHandlerTest.js index 2f1beef27..d1f40b27c 100644 --- a/test/protocol/FundsHandlerTest.js +++ b/test/protocol/FundsHandlerTest.js @@ -1,4 +1,5 @@ const { ethers } = require("hardhat"); +const { ZeroAddress, getSigners, provider, parseUnits, getContractAt, getContractFactory } = ethers; const { expect, assert } = require("chai"); const Role = require("../../scripts/domain/Role"); const { Funds, FundsList } = require("../../scripts/domain/Funds"); @@ -168,7 +169,12 @@ describe("IBosonFundsHandler", function () { context("📋 Funds Handler Methods", async function () { beforeEach(async function () { // Create a valid seller, then set fields in tests directly - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + clerk.address, + await treasury.getAddress() + ); expect(seller.isValid()).is.true; // VoucherInitValues @@ -188,7 +194,7 @@ describe("IBosonFundsHandler", function () { await mockToken.connect(assistant).approve(protocolDiamondAddress, "1000000"); // set the deposit amount - depositAmount = "100"; + depositAmount = 100n; // Set agent id as zero as it is optional for createOffer(). agentId = "0"; @@ -203,15 +209,15 @@ describe("IBosonFundsHandler", function () { it("should emit a FundsDeposited event", async function () { // Deposit funds, testing for the event // Deposit token - await expect(fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), depositAmount)) + await expect( + fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), depositAmount) + ) .to.emit(fundsHandler, "FundsDeposited") .withArgs(seller.id, await assistant.getAddress(), await mockToken.getAddress(), depositAmount); // Deposit native currency await expect( - fundsHandler - .connect(rando) - .depositFunds(seller.id, ZeroAddress, depositAmount, { value: depositAmount }) + fundsHandler.connect(rando).depositFunds(seller.id, ZeroAddress, depositAmount, { value: depositAmount }) ) .to.emit(fundsHandler, "FundsDeposited") .withArgs(seller.id, await rando.getAddress(), ZeroAddress, depositAmount); @@ -225,13 +231,13 @@ describe("IBosonFundsHandler", function () { let returnedAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); // Chain state should match the expected available funds - let expectedAvailableFunds = new FundsList([new Funds(await mockToken.getAddress(), "Foreign20", depositAmount)]); + let expectedAvailableFunds = new FundsList([ + new Funds(await mockToken.getAddress(), "Foreign20", depositAmount), + ]); expect(returnedAvailableFunds).to.eql(expectedAvailableFunds); // Deposit native currency to the same seller id - await fundsHandler - .connect(rando) - .depositFunds(seller.id, ZeroAddress, depositAmount, { value: depositAmount }); + await fundsHandler.connect(rando).depositFunds(seller.id, ZeroAddress, depositAmount, { value: depositAmount }); // Get new on chain state returnedAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -249,17 +255,21 @@ describe("IBosonFundsHandler", function () { let returnedAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); // Chain state should match the expected available funds - let expectedAvailableFunds = new FundsList([new Funds(await mockToken.getAddress(), "Foreign20", depositAmount)]); + let expectedAvailableFunds = new FundsList([ + new Funds(await mockToken.getAddress(), "Foreign20", depositAmount), + ]); expect(returnedAvailableFunds).to.eql(expectedAvailableFunds); // Deposit the same token again - await fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), 2 * depositAmount); + await fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), 2n * depositAmount); // Get new on chain state returnedAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); // Chain state should match the expected available funds - expectedAvailableFunds = new FundsList([new Funds(await mockToken.getAddress(), "Foreign20", `${3 * depositAmount}`)]); + expectedAvailableFunds = new FundsList([ + new Funds(await mockToken.getAddress(), "Foreign20", 3n * depositAmount), + ]); expect(returnedAvailableFunds).to.eql(expectedAvailableFunds); }); @@ -296,7 +306,7 @@ describe("IBosonFundsHandler", function () { await expect( fundsHandler .connect(rando) - .depositFunds(seller.id, ZeroAddress, depositAmount * 2, { value: depositAmount }) + .depositFunds(seller.id, ZeroAddress, depositAmount * 2n, { value: depositAmount }) ).to.revertedWith(RevertReasons.NATIVE_WRONG_AMOUNT); }); @@ -327,7 +337,7 @@ describe("IBosonFundsHandler", function () { ).to.revertedWith(RevertReasons.ERC20_EXCEEDS_BALANCE); // not approved - depositAmount = "10000000"; + depositAmount = 10000000n; await expect( fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), depositAmount) ).to.revertedWith(RevertReasons.ERC20_INSUFFICIENT_ALLOWANCE); @@ -354,7 +364,9 @@ describe("IBosonFundsHandler", function () { await foreign20ReturnFalse.connect(assistant).approve(protocolDiamondAddress, depositAmount); await expect( - fundsHandler.connect(assistant).depositFunds(seller.id, await foreign20ReturnFalse.getAddress(), depositAmount) + fundsHandler + .connect(assistant) + .depositFunds(seller.id, await foreign20ReturnFalse.getAddress(), depositAmount) ).to.revertedWith(RevertReasons.SAFE_ERC20_NOT_SUCCEEDED); }); }); @@ -369,7 +381,7 @@ describe("IBosonFundsHandler", function () { disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -424,7 +436,10 @@ describe("IBosonFundsHandler", function () { offerTokenProtocolFee = offerNativeProtocolFee = offerFees.protocolFee; // top up seller's and buyer's account - await Promise.all([mockToken.mint(await assistant.getAddress(), sellerDeposit), mockToken.mint(await buyer.getAddress(), price)]); + await Promise.all([ + mockToken.mint(await assistant.getAddress(), sellerDeposit), + mockToken.mint(await buyer.getAddress(), price), + ]); // approve protocol to transfer the tokens await Promise.all([ @@ -435,14 +450,14 @@ describe("IBosonFundsHandler", function () { // deposit to seller's pool await Promise.all([ fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), sellerDeposit), - fundsHandler - .connect(assistant) - .depositFunds(seller.id, ZeroAddress, sellerDeposit, { value: sellerDeposit }), + fundsHandler.connect(assistant).depositFunds(seller.id, ZeroAddress, sellerDeposit, { value: sellerDeposit }), ]); // commit to both offers await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id); - await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerNative.id, { value: offerNative.price }); + await exchangeHandler + .connect(buyer) + .commitToOffer(await buyer.getAddress(), offerNative.id, { value: offerNative.price }); buyerId = accountId.next().value; }); @@ -460,10 +475,10 @@ describe("IBosonFundsHandler", function () { // expected payoffs - they are the same for token and native currency // buyer: price - buyerCancelPenalty - buyerPayoff = BigInt(offerToken.price)-offerToken.buyerCancelPenalty.toString(); + buyerPayoff = BigInt(offerToken.price) - BigInt(offerToken.buyerCancelPenalty); // seller: sellerDeposit + buyerCancelPenalty - sellerPayoff = BigInt(offerToken.sellerDeposit)+offerToken.buyerCancelPenalty.toString(); + sellerPayoff = BigInt(offerToken.sellerDeposit) + BigInt(offerToken.buyerCancelPenalty); }); it("should emit a FundsWithdrawn event", async function () { @@ -473,8 +488,8 @@ describe("IBosonFundsHandler", function () { tokenListBuyer = [ZeroAddress, await mockToken.getAddress()]; // Withdraw amounts - tokenAmountsSeller = [sellerPayoff, BigInt(sellerPayoff)/"2".toString()]; - tokenAmountsBuyer = [buyerPayoff, BigInt(buyerPayoff)/"5".toString()]; + tokenAmountsSeller = [sellerPayoff, (BigInt(sellerPayoff) / 2n).toString()]; + tokenAmountsBuyer = [buyerPayoff, (BigInt(buyerPayoff) / 5n).toString()]; // seller withdrawal const tx = await fundsHandler @@ -482,15 +497,21 @@ describe("IBosonFundsHandler", function () { .withdrawFunds(seller.id, tokenListSeller, tokenAmountsSeller); await expect(tx) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(seller.id, await treasury.getAddress(), await mockToken.getAddress(), sellerPayoff, await assistant.getAddress()); + .withArgs( + seller.id, + await treasury.getAddress(), + await mockToken.getAddress(), + sellerPayoff, + await assistant.getAddress() + ); await expect(tx) .to.emit(fundsHandler, "FundsWithdrawn") .withArgs( seller.id, await treasury.getAddress(), - constants.Zero, - BigInt(sellerPayoff)/"2", + 0n, + BigInt(sellerPayoff) / 2n, await assistant.getAddress() ); @@ -502,13 +523,13 @@ describe("IBosonFundsHandler", function () { buyerId, await buyer.getAddress(), await mockToken.getAddress(), - BigInt(buyerPayoff)/"5", + BigInt(buyerPayoff) / 5n, await buyer.getAddress() ); await expect(tx2) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(buyerId, await buyer.getAddress(), constants.Zero, buyerPayoff, await buyer.getAddress()); + .withArgs(buyerId, await buyer.getAddress(), 0n, buyerPayoff, await buyer.getAddress()); }); it("should update state", async function () { @@ -529,12 +550,8 @@ describe("IBosonFundsHandler", function () { ); // withdraw funds - const withdrawAmount = BigInt(sellerPayoff) - -parseUnits("0.1", "ether") - .toString(); - await fundsHandler - .connect(assistant) - .withdrawFunds(seller.id, [ZeroAddress], [withdrawAmount]); + const withdrawAmount = BigInt(sellerPayoff) - parseUnits("0.1", "ether"); + await fundsHandler.connect(assistant).withdrawFunds(seller.id, [ZeroAddress], [withdrawAmount]); // Read on chain state sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -545,15 +562,16 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[1] = new Funds( ZeroAddress, "Native currency", - BigInt(sellerPayoff)-withdrawAmount.toString() + BigInt(sellerPayoff) - BigInt(withdrawAmount) ); expect(sellersAvailableFunds).to.eql( expectedSellerAvailableFunds, "Seller available funds mismatch after withdrawal" ); + // Native currency balance is increased for the withdrawAmount expect(treasuryBalanceAfter).to.eql( - treasuryBalanceBefore+withdrawAmount, + treasuryBalanceBefore + withdrawAmount, "Treasury token balance mismatch" ); @@ -582,15 +600,13 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds after the withdrawal // Since all tokens are withdrawn, token should be removed from the list - expectedBuyerAvailableFunds = new FundsList([ - new Funds(ZeroAddress, "Native currency", buyerPayoff), - ]); + expectedBuyerAvailableFunds = new FundsList([new Funds(ZeroAddress, "Native currency", buyerPayoff)]); expect(buyerAvailableFunds).to.eql( expectedBuyerAvailableFunds, "Buyer available funds mismatch after withdrawal" ); // Token balance is increased for the buyer payoff - expect(buyerBalanceAfter).to.eql(buyerBalanceBefore+buyerPayoff, "Buyer token balance mismatch"); + expect(buyerBalanceAfter).to.eql(buyerBalanceBefore + buyerPayoff, "Buyer token balance mismatch"); }); it("should allow to withdraw all funds at once", async function () { @@ -626,11 +642,11 @@ describe("IBosonFundsHandler", function () { ); // Native currency balance is increased for the withdrawAmount expect(treasuryNativeBalanceAfter).to.eql( - treasuryNativeBalanceBefore+sellerPayoff, + treasuryNativeBalanceBefore + sellerPayoff, "Treasury native currency balance mismatch" ); expect(treasuryTokenBalanceAfter).to.eql( - treasuryTokenBalanceBefore+sellerPayoff, + treasuryTokenBalanceBefore + sellerPayoff, "Treasury token balance mismatch" ); }); @@ -664,9 +680,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds after the withdrawal // Funds available should still have the entries from above the threshold - expectedSellerAvailableFunds = new FundsList([ - new Funds(ZeroAddress, "Native currency", sellerPayoff), - ]); + expectedSellerAvailableFunds = new FundsList([new Funds(ZeroAddress, "Native currency", sellerPayoff)]); expect(sellersAvailableFunds).to.eql( expectedSellerAvailableFunds, "Seller available funds mismatch after first withdrawal" @@ -677,7 +691,7 @@ describe("IBosonFundsHandler", function () { "Treasury native currency balance mismatch after first withdrawal" ); expect(treasuryTokenBalanceAfter).to.eql( - treasuryTokenBalanceBefore+sellerPayoff, + treasuryTokenBalanceBefore + sellerPayoff, "Treasury token balance mismatch after first withdrawal" ); @@ -697,16 +711,16 @@ describe("IBosonFundsHandler", function () { ); // Native currency balance is increased for the withdrawAmount expect(treasuryNativeBalanceAfter).to.eql( - treasuryNativeBalanceBefore+sellerPayoff, + treasuryNativeBalanceBefore + sellerPayoff, "Treasury native currency balance mismatch after second withdrawal" ); }); it("It's possible to withdraw same toke twice if in total enough available funds", async function () { - let reduction = parseUnits("0.1", "ether").toString(); + let reduction = parseUnits("0.1", "ether"); // Withdraw token tokenListSeller = [await mockToken.getAddress(), await mockToken.getAddress()]; - tokenAmountsSeller = [BigInt(sellerPayoff)-reduction.toString(), reduction]; + tokenAmountsSeller = [BigInt(sellerPayoff) - BigInt(reduction), reduction]; // seller withdrawal const tx = await fundsHandler @@ -718,13 +732,19 @@ describe("IBosonFundsHandler", function () { seller.id, await treasury.getAddress(), await mockToken.getAddress(), - BigInt(sellerPayoff)-reduction.toString(), + BigInt(sellerPayoff) - BigInt(reduction), await assistant.getAddress() ); await expect(tx) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(seller.id, await treasury.getAddress(), await mockToken.getAddress(), reduction, await assistant.getAddress()); + .withArgs( + seller.id, + await treasury.getAddress(), + await mockToken.getAddress(), + reduction, + await assistant.getAddress() + ); }); context("Agent Withdraws funds", async function () { @@ -785,7 +805,9 @@ describe("IBosonFundsHandler", function () { // Check the balance BEFORE withdrawFunds() const feeCollectorNativeBalanceBefore = await mockToken.balanceOf(agent.wallet); - await expect(fundsHandler.connect(other).withdrawFunds(agentId, [await mockToken.getAddress()], [agentPayoff])) + await expect( + fundsHandler.connect(other).withdrawFunds(agentId, [await mockToken.getAddress()], [agentPayoff]) + ) .to.emit(fundsHandler, "FundsWithdrawn") .withArgs(agentId, agent.wallet, await mockToken.getAddress(), agentPayoff, agent.wallet); @@ -793,9 +815,8 @@ describe("IBosonFundsHandler", function () { const feeCollectorNativeBalanceAfter = await mockToken.balanceOf(agent.wallet); // Expected balance - const expectedFeeCollectorNativeBalanceAfter = BigInt(feeCollectorNativeBalanceBefore).add( - agentPayoff - ); + const expectedFeeCollectorNativeBalanceAfter = + BigInt(feeCollectorNativeBalanceBefore) + BigInt(agentPayoff); // Check agent wallet balance and verify the transfer really happened. expect(feeCollectorNativeBalanceAfter).to.eql( @@ -811,12 +832,14 @@ describe("IBosonFundsHandler", function () { // retract from the dispute await disputeHandler.connect(buyer).retractDispute(exchangeId); - agentPayoff = BigInt(agentOffer.price)*agent.feePercentage/"10000".toString(); + agentPayoff = ((BigInt(agentOffer.price) * BigInt(agent.feePercentage)) / 10000n).toString(); // Check the balance BEFORE withdrawFunds() const feeCollectorNativeBalanceBefore = await mockToken.balanceOf(agent.wallet); - await expect(fundsHandler.connect(other).withdrawFunds(agentId, [await mockToken.getAddress()], [agentPayoff])) + await expect( + fundsHandler.connect(other).withdrawFunds(agentId, [await mockToken.getAddress()], [agentPayoff]) + ) .to.emit(fundsHandler, "FundsWithdrawn") .withArgs(agentId, agent.wallet, await mockToken.getAddress(), agentPayoff, agent.wallet); @@ -824,9 +847,8 @@ describe("IBosonFundsHandler", function () { const feeCollectorNativeBalanceAfter = await mockToken.balanceOf(agent.wallet); // Expected balance - const expectedFeeCollectorNativeBalanceAfter = BigInt(feeCollectorNativeBalanceBefore).add( - agentPayoff - ); + const expectedFeeCollectorNativeBalanceAfter = + BigInt(feeCollectorNativeBalanceBefore) + BigInt(agentPayoff); // Check agent wallet balance and verify the transfer really happened. expect(feeCollectorNativeBalanceAfter).to.eql( @@ -842,7 +864,7 @@ describe("IBosonFundsHandler", function () { tokenListBuyer = [ZeroAddress, await mockToken.getAddress()]; // Withdraw amounts - tokenAmountsBuyer = [buyerPayoff, BigInt(buyerPayoff)/"5".toString()]; + tokenAmountsBuyer = [BigInt(buyerPayoff), BigInt(buyerPayoff) / 5n]; // Pause the funds region of the protocol await pauseHandler.connect(pauser).pause([PausableRegion.Funds]); @@ -894,7 +916,7 @@ describe("IBosonFundsHandler", function () { it("Caller tries to withdraw more than they have in the available funds", async function () { // Withdraw token tokenList = [await mockToken.getAddress()]; - tokenAmounts = [BigInt(sellerPayoff)*"2"]; + tokenAmounts = [BigInt(sellerPayoff) * 2n]; // Attempt to withdraw the funds, expecting revert await expect( @@ -1009,10 +1031,14 @@ describe("IBosonFundsHandler", function () { await foreign20ReturnFalse.connect(assistant).mint(await assistant.getAddress(), sellerDeposit); await foreign20ReturnFalse.connect(assistant).approve(protocolDiamondAddress, sellerDeposit); - await fundsHandler.connect(assistant).depositFunds(seller.id, await foreign20ReturnFalse.getAddress(), sellerDeposit); + await fundsHandler + .connect(assistant) + .depositFunds(seller.id, await foreign20ReturnFalse.getAddress(), sellerDeposit); await expect( - fundsHandler.connect(assistant).withdrawFunds(seller.id, [await foreign20ReturnFalse.getAddress()], [sellerDeposit]) + fundsHandler + .connect(assistant) + .withdrawFunds(seller.id, [await foreign20ReturnFalse.getAddress()], [sellerDeposit]) ).to.revertedWith(RevertReasons.SAFE_ERC20_NOT_SUCCEEDED); }); }); @@ -1035,10 +1061,10 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // seller: sellerDeposit + offerToken.price - sellerPayoff = BigInt(offerToken.sellerDeposit)+offerToken.price.toString(); + sellerPayoff = BigInt(offerToken.sellerDeposit) + BigInt(offerToken.price); // protocol: protocolFee - protocolPayoff = offerTokenProtocolFee; + protocolPayoff = BigInt(offerTokenProtocolFee); // grant fee collecor role await accessController.grantRole(Role.FEE_COLLECTOR, await feeCollector.getAddress()); @@ -1056,14 +1082,20 @@ describe("IBosonFundsHandler", function () { const tx = await fundsHandler.connect(feeCollector).withdrawProtocolFees(tokenList, tokenAmounts); await expect(tx) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(protocolId, await protocolTreasury.getAddress(), await mockToken.getAddress(), protocolPayoff, await feeCollector.getAddress()); + .withArgs( + protocolId, + await protocolTreasury.getAddress(), + await mockToken.getAddress(), + protocolPayoff, + await feeCollector.getAddress() + ); await expect(tx) .to.emit(fundsHandler, "FundsWithdrawn") .withArgs( protocolId, await protocolTreasury.getAddress(), - constants.Zero, + 0n, protocolPayoff, await feeCollector.getAddress() ); @@ -1077,18 +1109,17 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds before the withdrawal expectedProtocolAvailableFunds = new FundsList([ - new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff), - new Funds(ZeroAddress, "Native currency", protocolPayoff), + new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff.toString()), + new Funds(ZeroAddress, "Native currency", protocolPayoff.toString()), ]); + expect(protocolAvailableFunds).to.eql( expectedProtocolAvailableFunds, "Protocol available funds mismatch before withdrawal" ); // withdraw funds - const partialFeeWithdrawAmount = BigInt(protocolPayoff) - -parseUnits("0.01", "ether") - .toString(); + const partialFeeWithdrawAmount = BigInt(protocolPayoff) - parseUnits("0.01", "ether"); tx = await fundsHandler .connect(feeCollector) @@ -1099,7 +1130,7 @@ describe("IBosonFundsHandler", function () { // calcualte tx costs txReceipt = await tx.wait(); - txCost = tx.gasPrice*txReceipt.gasUsed; + txCost = tx.gasPrice * txReceipt.gasUsed; // Read on chain state protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -1110,11 +1141,7 @@ describe("IBosonFundsHandler", function () { // Native currency available funds are reduced for the withdrawal amount // Mock token is fully withdrawn expectedProtocolAvailableFunds = new FundsList([ - new Funds( - ZeroAddress, - "Native currency", - BigInt(protocolPayoff)-partialFeeWithdrawAmount.toString() - ), + new Funds(ZeroAddress, "Native currency", (BigInt(protocolPayoff) - partialFeeWithdrawAmount).toString()), ]); expect(protocolAvailableFunds).to.eql( @@ -1123,12 +1150,12 @@ describe("IBosonFundsHandler", function () { ); // Native currency balance is increased for the partialFeeWithdrawAmount expect(protocolTreasuryNativeBalanceAfter).to.eql( - protocolTreasuryNativeBalanceBefore+partialFeeWithdrawAmount, + protocolTreasuryNativeBalanceBefore + partialFeeWithdrawAmount, "Fee collector token balance mismatch" ); // Token balance is increased for the protocol fee expect(protocolTreasuryTokenBalanceAfter).to.eql( - protocolTreasuryTokenBalanceBefore+protocolPayoff, + protocolTreasuryTokenBalanceBefore + BigInt(protocolPayoff), "Fee collector token balance mismatch" ); }); @@ -1141,9 +1168,10 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds before the withdrawal expectedProtocolAvailableFunds = new FundsList([ - new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff), - new Funds(ZeroAddress, "Native currency", protocolPayoff), + new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff.toString()), + new Funds(ZeroAddress, "Native currency", protocolPayoff.toString()), ]); + expect(protocolAvailableFunds).to.eql( expectedProtocolAvailableFunds, "Protocol available funds mismatch before withdrawal" @@ -1154,7 +1182,7 @@ describe("IBosonFundsHandler", function () { // calcualte tx costs txReceipt = await tx.wait(); - txCost = tx.gasPrice*txReceipt.gasUsed; + txCost = tx.gasPrice * txReceipt.gasUsed; // Read on chain state protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -1170,12 +1198,12 @@ describe("IBosonFundsHandler", function () { ); // Native currency balance is increased for the partialFeeWithdrawAmount expect(protocolTreasuryNativeBalanceAfter).to.eql( - protocolTreasuryNativeBalanceBefore+protocolPayoff, + protocolTreasuryNativeBalanceBefore + protocolPayoff, "Fee collector native currency balance mismatch" ); // Token balance is increased for the protocol fee expect(protocolTreasuryTokenBalanceAfter).to.eql( - protocolTreasuryTokenBalanceBefore+protocolPayoff, + protocolTreasuryTokenBalanceBefore + protocolPayoff, "Fee collector token balance mismatch" ); }); @@ -1191,8 +1219,8 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds before the withdrawal expectedProtocolAvailableFunds = new FundsList([ - new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff), - new Funds(ZeroAddress, "Native currency", protocolPayoff), + new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff.toString()), + new Funds(ZeroAddress, "Native currency", protocolPayoff.toString()), ]); expect(protocolAvailableFunds).to.eql( expectedProtocolAvailableFunds, @@ -1204,7 +1232,7 @@ describe("IBosonFundsHandler", function () { // calcualte tx costs txReceipt = await tx.wait(); - txCost = tx.gasPrice*txReceipt.gasUsed; + txCost = tx.gasPrice * txReceipt.gasUsed; // Read on chain state protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -1214,7 +1242,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds after the withdrawal // Funds available should still have the entries from above the threshold expectedProtocolAvailableFunds = new FundsList([ - new Funds(ZeroAddress, "Native currency", protocolPayoff), + new Funds(ZeroAddress, "Native currency", protocolPayoff.toString()), ]); expect(protocolAvailableFunds).to.eql( expectedProtocolAvailableFunds, @@ -1226,7 +1254,7 @@ describe("IBosonFundsHandler", function () { "Fee collector native currency balance mismatch after first withdrawal" ); expect(protocolTreasuryTokenBalanceAfter).to.eql( - protocolTreasuryTokenBalanceBefore+protocolPayoff, + protocolTreasuryTokenBalanceBefore + protocolPayoff, "Fee collector token balance mismatch after first withdrawal" ); @@ -1235,7 +1263,7 @@ describe("IBosonFundsHandler", function () { // calcualte tx costs txReceipt = await tx.wait(); - txCost = tx.gasPrice*txReceipt.gasUsed; + txCost = tx.gasPrice * txReceipt.gasUsed; // Read on chain state protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -1250,16 +1278,16 @@ describe("IBosonFundsHandler", function () { ); // Native currency balance is increased for the protocol fee expect(protocolTreasuryNativeBalanceAfter).to.eql( - protocolTreasuryNativeBalanceBefore+offerTokenProtocolFee, + protocolTreasuryNativeBalanceBefore + BigInt(offerTokenProtocolFee), "Fee collector native currency balance mismatch after second withdrawal" ); }); it("It's possible to withdraw same token twice if in total enough available funds", async function () { - let reduction = parseUnits("0.01", "ether").toString(); + let reduction = parseUnits("0.01", "ether"); // Withdraw token tokenList = [await mockToken.getAddress(), await mockToken.getAddress()]; - tokenAmounts = [BigInt(protocolPayoff)-reduction.toString(), reduction]; + tokenAmounts = [BigInt(protocolPayoff) - reduction, reduction]; // protocol fee withdrawal const tx = await fundsHandler.connect(feeCollector).withdrawProtocolFees(tokenList, tokenAmounts); @@ -1269,13 +1297,19 @@ describe("IBosonFundsHandler", function () { protocolId, await protocolTreasury.getAddress(), await mockToken.getAddress(), - BigInt(protocolPayoff)-reduction.toString(), + BigInt(protocolPayoff) - reduction, await feeCollector.getAddress() ); await expect(tx) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(protocolId, await protocolTreasury.getAddress(), await mockToken.getAddress(), reduction, await feeCollector.getAddress()); + .withArgs( + protocolId, + await protocolTreasury.getAddress(), + await mockToken.getAddress(), + reduction, + await feeCollector.getAddress() + ); }); context("💔 Revert Reasons", async function () { @@ -1324,7 +1358,7 @@ describe("IBosonFundsHandler", function () { it("Caller tries to withdraw more than they have in the available funds", async function () { // Withdraw token tokenList = [await mockToken.getAddress()]; - tokenAmounts = [BigInt(offerTokenProtocolFee)*"2"]; + tokenAmounts = [BigInt(offerTokenProtocolFee) * 2n]; // Attempt to withdraw the funds, expecting revert await expect( @@ -1373,9 +1407,7 @@ describe("IBosonFundsHandler", function () { // attempt to withdraw the funds, expecting revert await expect( - fundsHandler - .connect(feeCollector) - .withdrawProtocolFees([ZeroAddress], [offerNativeProtocolFee]) + fundsHandler.connect(feeCollector).withdrawProtocolFees([ZeroAddress], [offerNativeProtocolFee]) ).to.revertedWith(RevertReasons.TOKEN_TRANSFER_FAILED); }); @@ -1391,9 +1423,7 @@ describe("IBosonFundsHandler", function () { // attempt to withdraw the funds, expecting revert await expect( - fundsHandler - .connect(feeCollector) - .withdrawProtocolFees([ZeroAddress], [offerNativeProtocolFee]) + fundsHandler.connect(feeCollector).withdrawProtocolFees([ZeroAddress], [offerNativeProtocolFee]) ).to.revertedWith(RevertReasons.TOKEN_TRANSFER_FAILED); }); @@ -1447,7 +1477,12 @@ describe("IBosonFundsHandler", function () { context("📋 FundsLib Methods", async function () { beforeEach(async function () { // Create a valid seller - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + clerk.address, + await treasury.getAddress() + ); expect(seller.isValid()).is.true; // VoucherInitValues @@ -1464,7 +1499,7 @@ describe("IBosonFundsHandler", function () { disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -1528,12 +1563,12 @@ describe("IBosonFundsHandler", function () { await mockToken.connect(buyer).approve(protocolDiamondAddress, `${2 * price}`); // deposit to seller's pool - await fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), `${2 * sellerDeposit}`); await fundsHandler .connect(assistant) - .depositFunds(seller.id, ZeroAddress, `${2 * sellerDeposit}`, { - value: `${2 * sellerDeposit}`, - }); + .depositFunds(seller.id, await mockToken.getAddress(), `${2 * sellerDeposit}`); + await fundsHandler.connect(assistant).depositFunds(seller.id, ZeroAddress, `${2 * sellerDeposit}`, { + value: `${2 * sellerDeposit}`, + }); // Agents // Create a valid agent, @@ -1573,7 +1608,9 @@ describe("IBosonFundsHandler", function () { .withArgs(seller.id, await mockToken.getAddress(), sellerDeposit, await buyer.getAddress()); // Commit to an offer with native currency, test for FundsEncumbered event - const tx2 = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerNative.id, { value: price }); + const tx2 = await exchangeHandler + .connect(buyer) + .commitToOffer(await buyer.getAddress(), offerNative.id, { value: price }); await expect(tx2) .to.emit(exchangeHandler, "FundsEncumbered") .withArgs(buyerId, ZeroAddress, price, await buyer.getAddress()); @@ -1598,8 +1635,8 @@ describe("IBosonFundsHandler", function () { const contractTokenBalanceAfter = await mockToken.balanceOf(protocolDiamondAddress); // contract token balance should increase for the incoming price // seller's deposit was already held in the contract's pool before - expect(contractTokenBalanceAfter-contractTokenBalanceBefore.toString()).to.eql( - price, + expect(contractTokenBalanceAfter - contractTokenBalanceBefore).to.eql( + BigInt(price), "Token wrong balance increase" ); @@ -1607,10 +1644,9 @@ describe("IBosonFundsHandler", function () { let sellersAvailableFundsAfter = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); // token is the first on the list of the available funds and the amount should be decreased for the sellerDeposit expect( - BigInt(sellersAvailableFundsBefore.funds[0].availableAmount) - -BigInt(sellersAvailableFundsAfter.funds[0].availableAmount) - .toString() - ).to.eql(sellerDeposit, "Token seller available funds mismatch"); + BigInt(sellersAvailableFundsBefore.funds[0].availableAmount) - + BigInt(sellersAvailableFundsAfter.funds[0].availableAmount) + ).to.eql(BigInt(sellerDeposit), "Token seller available funds mismatch"); // Commit to an offer with native currency await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerNative.id, { value: price }); @@ -1619,8 +1655,8 @@ describe("IBosonFundsHandler", function () { const contractNativeBalanceAfter = await provider.getBalance(protocolDiamondAddress); // contract token balance should increase for the incoming price // seller's deposit was already held in the contract's pool before - expect(contractNativeBalanceAfter-contractNativeBalanceBefore.toString()).to.eql( - price, + expect(contractNativeBalanceAfter - contractNativeBalanceBefore).to.eql( + BigInt(price), "Native currency wrong balance increase" ); @@ -1628,10 +1664,9 @@ describe("IBosonFundsHandler", function () { sellersAvailableFundsAfter = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); // native currency is the second on the list of the available funds and the amount should be decreased for the sellerDeposit expect( - BigInt(sellersAvailableFundsBefore.funds[1].availableAmount) - -BigInt(sellersAvailableFundsAfter.funds[1].availableAmount) - .toString() - ).to.eql(sellerDeposit, "Native currency seller available funds mismatch"); + BigInt(sellersAvailableFundsBefore.funds[1].availableAmount) - + BigInt(sellersAvailableFundsAfter.funds[1].availableAmount) + ).to.eql(BigInt(sellerDeposit), "Native currency seller available funds mismatch"); }); context("seller's available funds drop to 0", async function () { @@ -1643,10 +1678,7 @@ describe("IBosonFundsHandler", function () { await mockToken.getAddress(), "Token contract address mismatch" ); - expect(sellersAvailableFunds.funds[1].tokenAddress).to.eql( - ZeroAddress, - "Native currency address mismatch" - ); + expect(sellersAvailableFunds.funds[1].tokenAddress).to.eql(ZeroAddress, "Native currency address mismatch"); // Commit to offer with token twice to empty the seller's pool await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id); @@ -1655,14 +1687,15 @@ describe("IBosonFundsHandler", function () { // Token address should be removed and have only native currency in the list sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); expect(sellersAvailableFunds.funds.length).to.eql(1, "Funds length mismatch"); - expect(sellersAvailableFunds.funds[0].tokenAddress).to.eql( - ZeroAddress, - "Native currency address mismatch" - ); + expect(sellersAvailableFunds.funds[0].tokenAddress).to.eql(ZeroAddress, "Native currency address mismatch"); // Commit to offer with token twice to empty the seller's pool - await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerNative.id, { value: price }); - await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerNative.id, { value: price }); + await exchangeHandler + .connect(buyer) + .commitToOffer(await buyer.getAddress(), offerNative.id, { value: price }); + await exchangeHandler + .connect(buyer) + .commitToOffer(await buyer.getAddress(), offerNative.id, { value: price }); // Seller available funds must be empty sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -1674,7 +1707,7 @@ describe("IBosonFundsHandler", function () { // Deploy a new mock token let TokenContractFactory = await getContractFactory("Foreign20"); const otherToken = await TokenContractFactory.deploy(); - await otherToken.deployed(); + await otherToken.waitForDeployment(); // Add otherToken to DR fees await accountHandler @@ -1699,18 +1732,19 @@ describe("IBosonFundsHandler", function () { await mockToken.getAddress(), "Token contract address mismatch" ); - expect(sellersAvailableFunds.funds[1].tokenAddress).to.eql( - ZeroAddress, - "Native currency address mismatch" - ); + expect(sellersAvailableFunds.funds[1].tokenAddress).to.eql(ZeroAddress, "Native currency address mismatch"); expect(sellersAvailableFunds.funds[2].tokenAddress).to.eql( await otherToken.getAddress(), "Boson token address mismatch" ); // Commit to offer with token twice to empty the seller's pool - await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerNative.id, { value: price }); - await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerNative.id, { value: price }); + await exchangeHandler + .connect(buyer) + .commitToOffer(await buyer.getAddress(), offerNative.id, { value: price }); + await exchangeHandler + .connect(buyer) + .commitToOffer(await buyer.getAddress(), offerNative.id, { value: price }); // Native currency address should be removed and have only mock token and other token in the list sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -1740,14 +1774,11 @@ describe("IBosonFundsHandler", function () { const randoTokenBalanceAfter = await mockToken.balanceOf(await rando.getAddress()); // buyer's balance should decrease, rando's should remain - expect(buyerTokenBalanceBefore-buyerTokenBalanceAfter.toString()).to.eql( - price, + expect(buyerTokenBalanceBefore - buyerTokenBalanceAfter).to.eql( + BigInt(price), "Buyer's token balance should decrease for a price" ); - expect(randoTokenBalanceAfter.toString()).to.eql( - randoTokenBalanceBefore.toString(), - "Rando's token balance should remain the same" - ); + expect(randoTokenBalanceAfter).to.eql(randoTokenBalanceBefore, "Rando's token balance should remain the same"); // make sure that rando is actually the buyer of the exchange let exchange; [, exchange] = await exchangeHandler.getExchange("1"); @@ -1758,17 +1789,19 @@ describe("IBosonFundsHandler", function () { const randoNativeBalanceBefore = await provider.getBalance(await rando.getAddress()); // commit to an offer with native currency on rando's behalf - tx = await exchangeHandler.connect(buyer).commitToOffer(await rando.getAddress(), offerNative.id, { value: price }); + tx = await exchangeHandler + .connect(buyer) + .commitToOffer(await rando.getAddress(), offerNative.id, { value: price }); txReceipt = await tx.wait(); - txCost = tx.gasPrice*txReceipt.gasUsed; + txCost = tx.gasPrice * txReceipt.gasUsed; // get token balance after the commit const buyerNativeBalanceAfter = await provider.getBalance(await buyer.getAddress()); const randoNativeBalanceAfter = await provider.getBalance(await rando.getAddress()); // buyer's balance should decrease, rando's should remain - expect(buyerNativeBalanceBefore-buyerNativeBalanceAfter.sub(txCost).toString()).to.eql( - price, + expect(buyerNativeBalanceBefore - buyerNativeBalanceAfter - txCost).to.eql( + BigInt(price), "Buyer's native balance should decrease for a price" ); expect(randoNativeBalanceAfter.toString()).to.eql( @@ -1810,10 +1843,12 @@ describe("IBosonFundsHandler", function () { // commit to an offer via preminted voucher let exchangeId = "1"; let tokenId = deriveTokenId(offerToken.id, exchangeId); - tx = await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); + tx = await bosonVoucher + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); // it should emit FundsEncumbered event with amount equal to sellerDeposit + price - let encumberedFunds = BigInt(sellerDeposit)+price; + let encumberedFunds = BigInt(sellerDeposit) + BigInt(price); await expect(tx) .to.emit(exchangeHandler, "FundsEncumbered") .withArgs(seller.id, await mockToken.getAddress(), encumberedFunds, await bosonVoucher.getAddress()); @@ -1822,10 +1857,9 @@ describe("IBosonFundsHandler", function () { let sellersAvailableFundsAfter = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); // token is the first on the list of the available funds and the amount should be decreased for the sellerDeposit and price expect( - BigInt(sellersAvailableFundsBefore.funds[0].availableAmount) - -BigInt(sellersAvailableFundsAfter.funds[0].availableAmount) - .toString() - ).to.eql(encumberedFunds.toString(), "Token seller available funds mismatch"); + BigInt(sellersAvailableFundsBefore.funds[0].availableAmount) - + BigInt(sellersAvailableFundsAfter.funds[0].availableAmount) + ).to.eql(encumberedFunds, "Token seller available funds mismatch"); // buyer's token balance should stay the same const buyerTokenBalanceAfter = await mockToken.balanceOf(await buyer.getAddress()); @@ -1851,10 +1885,12 @@ describe("IBosonFundsHandler", function () { await bosonVoucher.connect(assistant).preMint(offerNative.id, offerNative.quantityAvailable); // commit to an offer via preminted voucher - tx = await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); + tx = await bosonVoucher + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); // it should emit FundsEncumbered event with amount equal to sellerDeposit + price - encumberedFunds = BigInt(sellerDeposit)+price; + encumberedFunds = BigInt(sellerDeposit) + BigInt(price); await expect(tx) .to.emit(exchangeHandler, "FundsEncumbered") .withArgs(seller.id, ZeroAddress, encumberedFunds, await bosonVoucher.getAddress()); @@ -1870,10 +1906,9 @@ describe("IBosonFundsHandler", function () { sellersAvailableFundsAfter = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); // native currency the second on the list of the available funds and the amount should be decreased for the sellerDeposit and price expect( - BigInt(sellersAvailableFundsBefore.funds[1].availableAmount) - -BigInt(sellersAvailableFundsAfter.funds[1].availableAmount) - .toString() - ).to.eql(encumberedFunds.toString(), "Native currency seller available funds mismatch"); + BigInt(sellersAvailableFundsBefore.funds[1].availableAmount) - + BigInt(sellersAvailableFundsAfter.funds[1].availableAmount) + ).to.eql(encumberedFunds, "Native currency seller available funds mismatch"); // make sure that buyer is actually the buyer of the exchange [, exchange] = await exchangeHandler.getExchange(exchangeId); @@ -1886,7 +1921,7 @@ describe("IBosonFundsHandler", function () { await expect( exchangeHandler .connect(buyer) - .commitToOffer(await buyer.getAddress(), offerNative.id, { value: BigInt(price)-"1".toString() }) + .commitToOffer(await buyer.getAddress(), offerNative.id, { value: BigInt(price) - 1n }) ).to.revertedWith(RevertReasons.INSUFFICIENT_VALUE_RECEIVED); }); @@ -1916,9 +1951,9 @@ describe("IBosonFundsHandler", function () { .createOffer(offerToken, offerDates, offerDurations, disputeResolverId, agentId); // Attempt to commit to an offer, expecting revert - await expect(exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id)).to.revertedWith( - RevertReasons.SAFE_ERC20_LOW_LEVEL_CALL - ); + await expect( + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id) + ).to.revertedWith(RevertReasons.SAFE_ERC20_LOW_LEVEL_CALL); }); it("Token address is not a contract", async function () { @@ -1948,35 +1983,33 @@ describe("IBosonFundsHandler", function () { // approve more than account actually have await mockToken.connect(rando).approve(protocolDiamondAddress, price); // Attempt to commit to an offer, expecting revert - await expect(exchangeHandler.connect(rando).commitToOffer(await rando.getAddress(), offerToken.id)).to.revertedWith( - RevertReasons.ERC20_EXCEEDS_BALANCE - ); + await expect( + exchangeHandler.connect(rando).commitToOffer(await rando.getAddress(), offerToken.id) + ).to.revertedWith(RevertReasons.ERC20_EXCEEDS_BALANCE); // not approved - await mockToken - .connect(rando) - .approve(protocolDiamondAddress, BigInt(price)-"1".toString()); + await mockToken.connect(rando).approve(protocolDiamondAddress, BigInt(price) - 1n); // Attempt to commit to an offer, expecting revert - await expect(exchangeHandler.connect(rando).commitToOffer(await rando.getAddress(), offerToken.id)).to.revertedWith( - RevertReasons.ERC20_INSUFFICIENT_ALLOWANCE - ); + await expect( + exchangeHandler.connect(rando).commitToOffer(await rando.getAddress(), offerToken.id) + ).to.revertedWith(RevertReasons.ERC20_INSUFFICIENT_ALLOWANCE); }); it("Seller'a availableFunds is less than the required sellerDeposit", async function () { // create an offer with token with higher seller deposit - offerToken.sellerDeposit = BigInt(offerToken.sellerDeposit)*"4"; + offerToken.sellerDeposit = BigInt(offerToken.sellerDeposit) * 4n; offerToken.id = "3"; await offerHandler .connect(assistant) .createOffer(offerToken, offerDates, offerDurations, disputeResolverId, agentId); // Attempt to commit to an offer, expecting revert - await expect(exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id)).to.revertedWith( - RevertReasons.INSUFFICIENT_AVAILABLE_FUNDS - ); + await expect( + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id) + ).to.revertedWith(RevertReasons.INSUFFICIENT_AVAILABLE_FUNDS); // create an offer with native currency with higher seller deposit - offerNative.sellerDeposit = BigInt(offerNative.sellerDeposit)*"4"; + offerNative.sellerDeposit = BigInt(offerNative.sellerDeposit) * 4n; offerNative.id = "4"; await offerHandler .connect(assistant) @@ -2003,7 +2036,9 @@ describe("IBosonFundsHandler", function () { // Attempt to commit to an offer via preminted voucher, expecting revert let tokenId = deriveTokenId(offerToken.id, "1"); await expect( - bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) + bosonVoucher + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) ).to.revertedWith(RevertReasons.INSUFFICIENT_AVAILABLE_FUNDS); // reserve a range and premint vouchers for offer in native currency @@ -2016,7 +2051,9 @@ describe("IBosonFundsHandler", function () { // Attempt to commit to an offer, expecting revert await expect( - bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) + bosonVoucher + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) ).to.revertedWith(RevertReasons.INSUFFICIENT_AVAILABLE_FUNDS); }); @@ -2048,9 +2085,9 @@ describe("IBosonFundsHandler", function () { await Foreign20WithFee.connect(buyer).approve(protocolDiamondAddress, offerToken.price); // Attempt to commit to offer, expecting revert - await expect(exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id)).to.revertedWith( - RevertReasons.INSUFFICIENT_VALUE_RECEIVED - ); + await expect( + exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id) + ).to.revertedWith(RevertReasons.INSUFFICIENT_VALUE_RECEIVED); }); }); }); @@ -2079,10 +2116,7 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // seller: sellerDeposit + price - protocolFee - sellerPayoff = BigInt(offerToken.sellerDeposit) - +offerToken.price - -offerTokenProtocolFee - .toString(); + sellerPayoff = (BigInt(offerToken.sellerDeposit) + offerToken.price - offerTokenProtocolFee).toString(); // protocol: protocolFee protocolPayoff = offerTokenProtocolFee; @@ -2132,7 +2166,9 @@ describe("IBosonFundsHandler", function () { // protocol: protocolFee // agent: 0 expectedSellerAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", sellerPayoff)); - expectedProtocolAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", offerTokenProtocolFee)); + expectedProtocolAvailableFunds.funds.push( + new Funds(await mockToken.getAddress(), "Foreign20", offerTokenProtocolFee) + ); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -2153,12 +2189,12 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[1] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerPayoff)*2.toString() + BigInt(sellerPayoff) * 2n.toString() ); expectedProtocolAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(protocolPayoff)*2.toString() + BigInt(protocolPayoff) * 2n.toString() ); expect(sellersAvailableFunds).to.eql(expectedSellerAvailableFunds); expect(buyerAvailableFunds).to.eql(expectedBuyerAvailableFunds); @@ -2185,15 +2221,12 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // agentPayoff: agentFee - agentFee = BigInt(agentOffer.price)*agentFeePercentage/"10000".toString(); + agentFee = (BigInt(agentOffer.price) * BigInt(agentFeePercentage)) / 10000n; agentPayoff = agentFee; // seller: sellerDeposit + price - protocolFee - agentFee - sellerPayoff = BigInt(agentOffer.sellerDeposit) - +agentOffer.price - -agentOfferProtocolFee - -agentFee - .toString(); + sellerPayoff = + BigInt(agentOffer.sellerDeposit) + agentOffer.price - agentOfferProtocolFee - agentFee.toString(); // protocol: protocolFee protocolPayoff = agentOfferProtocolFee; @@ -2245,7 +2278,9 @@ describe("IBosonFundsHandler", function () { // protocol: protocolFee // agent: agentFee expectedSellerAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", sellerPayoff)); - expectedProtocolAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", agentOfferProtocolFee)); + expectedProtocolAvailableFunds.funds.push( + new Funds(await mockToken.getAddress(), "Foreign20", agentOfferProtocolFee) + ); expectedAgentAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", agentPayoff)); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -2263,7 +2298,7 @@ describe("IBosonFundsHandler", function () { beforeEach(async function () { // expected payoffs // buyer: sellerDeposit + price - buyerPayoff = BigInt(offerToken.sellerDeposit)+offerToken.price.toString(); + buyerPayoff = BigInt(offerToken.sellerDeposit) + offerToken.price.toString(); // seller: 0 sellerPayoff = 0; @@ -2332,7 +2367,7 @@ describe("IBosonFundsHandler", function () { expectedBuyerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(buyerPayoff)*2.toString() + BigInt(buyerPayoff) * 2n.toString() ); expectedSellerAvailableFunds = new FundsList([ new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), @@ -2363,14 +2398,16 @@ describe("IBosonFundsHandler", function () { await mockToken.connect(buyer).approve(protocolDiamondAddress, `${2 * price}`); // deposit to seller's pool - await fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), `${2 * sellerDeposit}`); + await fundsHandler + .connect(assistant) + .depositFunds(seller.id, await mockToken.getAddress(), `${2 * sellerDeposit}`); // Commit to Offer await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), agentOffer.id); // expected payoffs // buyer: sellerDeposit + price - buyerPayoff = BigInt(agentOffer.sellerDeposit)+agentOffer.price.toString(); + buyerPayoff = BigInt(agentOffer.sellerDeposit) + agentOffer.price.toString(); // seller: 0 sellerPayoff = 0; @@ -2437,7 +2474,7 @@ describe("IBosonFundsHandler", function () { expectedBuyerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(buyerPayoff)*2.toString() + BigInt(buyerPayoff) * 2n.toString() ); expectedSellerAvailableFunds = new FundsList([ new Funds(await mockToken.getAddress(), "Foreign20", `${sellerDeposit}`), @@ -2459,10 +2496,10 @@ describe("IBosonFundsHandler", function () { beforeEach(async function () { // expected payoffs // buyer: price - buyerCancelPenalty - buyerPayoff = BigInt(offerToken.price)-offerToken.buyerCancelPenalty.toString(); + buyerPayoff = BigInt(offerToken.price) - BigInt(offerToken.buyerCancelPenalty); // seller: sellerDeposit + buyerCancelPenalty - sellerPayoff = BigInt(offerToken.sellerDeposit)+offerToken.buyerCancelPenalty.toString(); + sellerPayoff = BigInt(offerToken.sellerDeposit) + BigInt(offerToken.buyerCancelPenalty); // protocol: 0 protocolPayoff = 0; @@ -2513,7 +2550,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit)+sellerPayoff.toString() + BigInt(sellerDeposit) + sellerPayoff.toString() ); expectedBuyerAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff)); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -2542,19 +2579,19 @@ describe("IBosonFundsHandler", function () { await mockToken.connect(buyer).approve(protocolDiamondAddress, `${2 * price}`); // deposit to seller's pool - await fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), `${sellerDeposit}`); + await fundsHandler + .connect(assistant) + .depositFunds(seller.id, await mockToken.getAddress(), `${sellerDeposit}`); // Commit to Offer await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), agentOffer.id); // expected payoffs // buyer: price - buyerCancelPenalty - buyerPayoff = BigInt(agentOffer.price)-agentOffer.buyerCancelPenalty.toString(); + buyerPayoff = BigInt(agentOffer.price) - agentOffer.buyerCancelPenalty.toString(); // seller: sellerDeposit + buyerCancelPenalty - sellerPayoff = BigInt(agentOffer.sellerDeposit) - +agentOffer.buyerCancelPenalty - .toString(); + sellerPayoff = BigInt(agentOffer.sellerDeposit) + agentOffer.buyerCancelPenalty.toString(); // protocol: 0 protocolPayoff = 0; @@ -2596,7 +2633,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit)+sellerPayoff.toString() + BigInt(sellerDeposit) + sellerPayoff.toString() ); expectedBuyerAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff)); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -2626,7 +2663,7 @@ describe("IBosonFundsHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate)+resolutionPeriod.toString(); + timeout = BigInt(disputedDate) + resolutionPeriod.toString(); }); context("Final state DISPUTED - RETRACTED", async function () { @@ -2636,10 +2673,7 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // seller: sellerDeposit + price - protocolFee - sellerPayoff = BigInt(offerToken.sellerDeposit) - +offerToken.price - -offerTokenProtocolFee - .toString(); + sellerPayoff = BigInt(offerToken.sellerDeposit) + offerToken.price - offerTokenProtocolFee.toString(); // protocol: 0 protocolPayoff = offerTokenProtocolFee; @@ -2700,9 +2734,13 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit)+sellerPayoff.toString() + BigInt(sellerDeposit) + sellerPayoff.toString() + ); + expectedProtocolAvailableFunds.funds[0] = new Funds( + await mockToken.getAddress(), + "Foreign20", + protocolPayoff ); - expectedProtocolAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -2720,15 +2758,12 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // agentPayoff: agentFee - agentFee = BigInt(agentOffer.price)*agentFeePercentage/"10000".toString(); + agentFee = (BigInt(agentOffer.price) * agentFeePercentage) / "10000".toString(); agentPayoff = agentFee; // seller: sellerDeposit + price - protocolFee - agentFee - sellerPayoff = BigInt(agentOffer.sellerDeposit) - +agentOffer.price - -agentOfferProtocolFee - -agentFee - .toString(); + sellerPayoff = + BigInt(agentOffer.sellerDeposit) + agentOffer.price - agentOfferProtocolFee - agentFee.toString(); // protocol: 0 protocolPayoff = agentOfferProtocolFee; @@ -2794,7 +2829,11 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds.push( new Funds(await mockToken.getAddress(), "Foreign20", BigInt(sellerPayoff).toString()) ); - expectedProtocolAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff); + expectedProtocolAvailableFunds.funds[0] = new Funds( + await mockToken.getAddress(), + "Foreign20", + protocolPayoff + ); expectedAgentAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", agentPayoff)); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -2815,10 +2854,7 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // seller: sellerDeposit + price - protocolFee - sellerPayoff = BigInt(offerToken.sellerDeposit) - +offerToken.price - -offerTokenProtocolFee - .toString(); + sellerPayoff = BigInt(offerToken.sellerDeposit) + offerToken.price - offerTokenProtocolFee.toString(); // protocol: protocolFee protocolPayoff = offerTokenProtocolFee; @@ -2880,9 +2916,13 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit)+sellerPayoff.toString() + BigInt(sellerDeposit) + sellerPayoff.toString() + ); + expectedProtocolAvailableFunds.funds[0] = new Funds( + await mockToken.getAddress(), + "Foreign20", + protocolPayoff ); - expectedProtocolAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -2908,15 +2948,12 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // agentPayoff: agentFee - agentFee = BigInt(agentOffer.price)*agentFeePercentage/"10000".toString(); + agentFee = (BigInt(agentOffer.price) * agentFeePercentage) / "10000".toString(); agentPayoff = agentFee; // seller: sellerDeposit + price - protocolFee - agent fee - sellerPayoff = BigInt(agentOffer.sellerDeposit) - +agentOffer.price - -agentOfferProtocolFee - -agentFee - .toString(); + sellerPayoff = + BigInt(agentOffer.sellerDeposit) + agentOffer.price - agentOfferProtocolFee - agentFee.toString(); // protocol: protocolFee protocolPayoff = agentOfferProtocolFee; @@ -2934,7 +2971,7 @@ describe("IBosonFundsHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate)+resolutionPeriod.toString(); + timeout = BigInt(disputedDate) + resolutionPeriod.toString(); await setNextBlockTimestamp(Number(timeout)); }); @@ -2989,7 +3026,11 @@ describe("IBosonFundsHandler", function () { new Funds(await mockToken.getAddress(), "Foreign20", sellerPayoff), ]); - expectedProtocolAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff); + expectedProtocolAvailableFunds.funds[0] = new Funds( + await mockToken.getAddress(), + "Foreign20", + protocolPayoff + ); expectedAgentAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", agentPayoff); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -3009,17 +3050,12 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: (price + sellerDeposit)*buyerPercentage - buyerPayoff = BigInt(offerToken.price) - +offerToken.sellerDeposit - *buyerPercentBasisPoints - /"10000" - .toString(); + buyerPayoff = + BigInt(offerToken.price) + (BigInt(offerToken.sellerDeposit) * BigInt(buyerPercentBasisPoints)) / 10000n; // seller: (price + sellerDeposit)*(1-buyerPercentage) - sellerPayoff = BigInt(offerToken.price) - +offerToken.sellerDeposit - -buyerPayoff - .toString(); + sellerPayoff = BigInt(offerToken.price) + BigInt(offerToken.sellerDeposit) - buyerPayoff; + console.log(sellerPayoff); // protocol: 0 protocolPayoff = 0; @@ -3096,9 +3132,11 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit)+sellerPayoff.toString() + BigInt(sellerDeposit) + sellerPayoff.toString() ); - expectedBuyerAvailableFunds = new FundsList([new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff)]); + expectedBuyerAvailableFunds = new FundsList([ + new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff), + ]); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -3132,17 +3170,17 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: (price + sellerDeposit)*buyerPercentage - buyerPayoff = BigInt(agentOffer.price) - +agentOffer.sellerDeposit - *buyerPercentBasisPoints - /"10000" - .toString(); + buyerPayoff = ( + BigInt(agentOffer.price) + + (BigInt(agentOffer.sellerDeposit) * BigInt(buyerPercentBasisPoints)) / 10000n + ).toString(); // seller: (price + sellerDeposit)*(1-buyerPercentage) - sellerPayoff = BigInt(agentOffer.price) - +agentOffer.sellerDeposit - -buyerPayoff - .toString(); + sellerPayoff = ( + BigInt(agentOffer.price) + + BigInt(agentOffer.sellerDeposit) - + BigInt(buyerPayoff) + ).toString(); // protocol: 0 protocolPayoff = 0; @@ -3200,14 +3238,18 @@ describe("IBosonFundsHandler", function () { // protocol: 0 // agent: 0 expectedSellerAvailableFunds.funds.push( - new Funds(await mockToken.getAddress(), "Foreign20", BigInt(sellerPayoff).toString()) + new Funds(await mockToken.getAddress(), "Foreign20", sellerPayoff.toString()) ); - expectedBuyerAvailableFunds = new FundsList([new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff)]); + expectedBuyerAvailableFunds = new FundsList([ + new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff), + ]); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); agentAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(agentId)); + console.log(sellersAvailableFunds); + console.log(expectedSellerAvailableFunds); expect(sellersAvailableFunds).to.eql(expectedSellerAvailableFunds); expect(buyerAvailableFunds).to.eql(expectedBuyerAvailableFunds); expect(protocolAvailableFunds).to.eql(expectedProtocolAvailableFunds); @@ -3223,11 +3265,11 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // seller: sellerDeposit + price - protocolFee + buyerEscalationDeposit - sellerPayoff = BigInt(offerToken.sellerDeposit) - +offerToken.price - -offerTokenProtocolFee - +buyerEscalationDeposit - .toString(); + sellerPayoff = + BigInt(offerToken.sellerDeposit) + + offerToken.price - + offerTokenProtocolFee + + buyerEscalationDeposit.toString(); // protocol: 0 protocolPayoff = offerTokenProtocolFee; @@ -3291,9 +3333,13 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit)+sellerPayoff.toString() + BigInt(sellerDeposit) + sellerPayoff.toString() + ); + expectedProtocolAvailableFunds.funds[0] = new Funds( + await mockToken.getAddress(), + "Foreign20", + protocolPayoff ); - expectedProtocolAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -3311,16 +3357,16 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // agentPayoff: agentFee - agentFee = BigInt(agentOffer.price)*agentFeePercentage/"10000".toString(); + agentFee = (BigInt(agentOffer.price) * agentFeePercentage) / "10000".toString(); agentPayoff = agentFee; // seller: sellerDeposit + price - protocolFee - agentFee + buyerEscalationDeposit - sellerPayoff = BigInt(agentOffer.sellerDeposit) - +agentOffer.price - -agentOfferProtocolFee - -agentFee - +buyerEscalationDeposit - .toString(); + sellerPayoff = + BigInt(agentOffer.sellerDeposit) + + agentOffer.price - + agentOfferProtocolFee - + agentFee + + buyerEscalationDeposit.toString(); // protocol: 0 protocolPayoff = agentOfferProtocolFee; @@ -3378,7 +3424,11 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds.push( new Funds(await mockToken.getAddress(), "Foreign20", BigInt(sellerPayoff).toString()) ); - expectedProtocolAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", protocolPayoff); + expectedProtocolAvailableFunds.funds[0] = new Funds( + await mockToken.getAddress(), + "Foreign20", + protocolPayoff + ); expectedAgentAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", agentPayoff)); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -3398,19 +3448,14 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: (price + sellerDeposit + buyerEscalationDeposit)*buyerPercentage - buyerPayoff = BigInt(offerToken.price) - +offerToken.sellerDeposit - +buyerEscalationDeposit - *buyerPercentBasisPoints - /"10000" - .toString(); + buyerPayoff = + BigInt(offerToken.price) + + offerToken.sellerDeposit + + (buyerEscalationDeposit * buyerPercentBasisPoints) / "10000".toString(); // seller: (price + sellerDeposit + buyerEscalationDeposit)*(1-buyerPercentage) - sellerPayoff = BigInt(offerToken.price) - +offerToken.sellerDeposit - +buyerEscalationDeposit - -buyerPayoff - .toString(); + sellerPayoff = + BigInt(offerToken.price) + offerToken.sellerDeposit + buyerEscalationDeposit - buyerPayoff.toString(); // protocol: 0 protocolPayoff = 0; @@ -3491,7 +3536,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit)+sellerPayoff.toString() + BigInt(sellerDeposit) + sellerPayoff.toString() ); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -3529,19 +3574,14 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: (price + sellerDeposit + buyerEscalationDeposit)*buyerPercentage - buyerPayoff = BigInt(agentOffer.price) - +agentOffer.sellerDeposit - +buyerEscalationDeposit - *buyerPercentBasisPoints - /"10000" - .toString(); + buyerPayoff = + BigInt(agentOffer.price) + + agentOffer.sellerDeposit + + (buyerEscalationDeposit * buyerPercentBasisPoints) / "10000".toString(); // seller: (price + sellerDeposit + buyerEscalationDeposit)*(1-buyerPercentage) - sellerPayoff = BigInt(agentOffer.price) - +agentOffer.sellerDeposit - +buyerEscalationDeposit - -buyerPayoff - .toString(); + sellerPayoff = + BigInt(agentOffer.price) + agentOffer.sellerDeposit + buyerEscalationDeposit - buyerPayoff.toString(); // protocol: 0 protocolPayoff = 0; @@ -3606,7 +3646,9 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds.push( new Funds(await mockToken.getAddress(), "Foreign20", BigInt(sellerPayoff).toString()) ); - expectedBuyerAvailableFunds = new FundsList([new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff)]); + expectedBuyerAvailableFunds = new FundsList([ + new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff), + ]); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -3626,19 +3668,14 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: (price + sellerDeposit + buyerEscalationDeposit)*buyerPercentage - buyerPayoff = BigInt(offerToken.price) - +offerToken.sellerDeposit - +buyerEscalationDeposit - *buyerPercentBasisPoints - /"10000" - .toString(); + buyerPayoff = + BigInt(offerToken.price) + + offerToken.sellerDeposit + + (buyerEscalationDeposit * buyerPercentBasisPoints) / "10000".toString(); // seller: (price + sellerDeposit + buyerEscalationDeposit)*(1-buyerPercentage) - sellerPayoff = BigInt(offerToken.price) - +offerToken.sellerDeposit - +buyerEscalationDeposit - -buyerPayoff - .toString(); + sellerPayoff = + BigInt(offerToken.price) + offerToken.sellerDeposit + buyerEscalationDeposit - buyerPayoff.toString(); // protocol: 0 protocolPayoff = 0; @@ -3693,7 +3730,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit)+sellerPayoff.toString() + BigInt(sellerDeposit) + sellerPayoff.toString() ); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -3731,25 +3768,20 @@ describe("IBosonFundsHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate)+resolutionPeriod.toString(); + timeout = BigInt(disputedDate) + resolutionPeriod.toString(); buyerPercentBasisPoints = "5566"; // 55.66% // expected payoffs // buyer: (price + sellerDeposit + buyerEscalationDeposit)*buyerPercentage - buyerPayoff = BigInt(agentOffer.price) - +agentOffer.sellerDeposit - +buyerEscalationDeposit - *buyerPercentBasisPoints - /"10000" - .toString(); + buyerPayoff = + BigInt(agentOffer.price) + + agentOffer.sellerDeposit + + (buyerEscalationDeposit * buyerPercentBasisPoints) / "10000".toString(); // seller: (price + sellerDeposit + buyerEscalationDeposit)*(1-buyerPercentage) - sellerPayoff = BigInt(agentOffer.price) - +agentOffer.sellerDeposit - +buyerEscalationDeposit - -buyerPayoff - .toString(); + sellerPayoff = + BigInt(agentOffer.price) + agentOffer.sellerDeposit + buyerEscalationDeposit - buyerPayoff.toString(); // protocol: 0 protocolPayoff = 0; @@ -3790,7 +3822,9 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds.push( new Funds(await mockToken.getAddress(), "Foreign20", BigInt(sellerPayoff).toString()) ); - expectedBuyerAvailableFunds = new FundsList([new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff)]); + expectedBuyerAvailableFunds = new FundsList([ + new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff), + ]); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); @@ -3809,7 +3843,7 @@ describe("IBosonFundsHandler", function () { beforeEach(async function () { // expected payoffs // buyer: price + buyerEscalationDeposit - buyerPayoff = BigInt(offerToken.price)+buyerEscalationDeposit.toString(); + buyerPayoff = BigInt(offerToken.price) + buyerEscalationDeposit.toString(); // seller: sellerDeposit sellerPayoff = offerToken.sellerDeposit; @@ -3873,7 +3907,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit)+sellerPayoff.toString() + BigInt(sellerDeposit) + sellerPayoff.toString() ); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -3909,7 +3943,7 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: price + buyerEscalationDeposit - buyerPayoff = BigInt(offerToken.price)+buyerEscalationDeposit.toString(); + buyerPayoff = BigInt(offerToken.price) + buyerEscalationDeposit.toString(); // seller: sellerDeposit sellerPayoff = offerToken.sellerDeposit; @@ -3957,7 +3991,11 @@ describe("IBosonFundsHandler", function () { // seller: sellerDeposit; // protocol: 0 // agent: 0 - expectedBuyerAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff); + expectedBuyerAvailableFunds.funds[0] = new Funds( + await mockToken.getAddress(), + "Foreign20", + buyerPayoff + ); expectedSellerAvailableFunds.funds.push( new Funds(await mockToken.getAddress(), "Foreign20", BigInt(sellerPayoff).toString()) ); @@ -3980,7 +4018,7 @@ describe("IBosonFundsHandler", function () { beforeEach(async function () { // expected payoffs // buyer: price + buyerEscalationDeposit - buyerPayoff = BigInt(offerToken.price)+buyerEscalationDeposit.toString(); + buyerPayoff = BigInt(offerToken.price) + buyerEscalationDeposit.toString(); // seller: sellerDeposit sellerPayoff = offerToken.sellerDeposit; @@ -3998,7 +4036,13 @@ describe("IBosonFundsHandler", function () { await expect(tx) .to.emit(disputeHandler, "FundsReleased") - .withArgs(exchangeId, seller.id, offerToken.exchangeToken, sellerPayoff, await assistantDR.getAddress()); + .withArgs( + exchangeId, + seller.id, + offerToken.exchangeToken, + sellerPayoff, + await assistantDR.getAddress() + ); await expect(tx) .to.emit(disputeHandler, "FundsReleased") @@ -4050,7 +4094,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit)+sellerPayoff.toString() + BigInt(sellerDeposit) + sellerPayoff.toString() ); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -4086,7 +4130,7 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: price + buyerEscalationDeposit - buyerPayoff = BigInt(offerToken.price)+buyerEscalationDeposit.toString(); + buyerPayoff = BigInt(offerToken.price) + buyerEscalationDeposit.toString(); // seller: sellerDeposit sellerPayoff = offerToken.sellerDeposit; @@ -4127,7 +4171,11 @@ describe("IBosonFundsHandler", function () { // seller: sellerDeposit; // protocol: 0 // agent: 0 - expectedBuyerAvailableFunds.funds[0] = new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff); + expectedBuyerAvailableFunds.funds[0] = new Funds( + await mockToken.getAddress(), + "Foreign20", + buyerPayoff + ); expectedSellerAvailableFunds.funds.push( new Funds(await mockToken.getAddress(), "Foreign20", BigInt(sellerPayoff).toString()) ); @@ -4155,10 +4203,7 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // seller: sellerDeposit + price - protocolFee - sellerPayoff = BigInt(offerToken.sellerDeposit) - +offerToken.price - -offerTokenProtocolFee - .toString(); + sellerPayoff = BigInt(offerToken.sellerDeposit) + offerToken.price - offerTokenProtocolFee.toString(); }); it("Protocol fee for existing exchanges should be the same as at the offer creation", async function () { @@ -4225,15 +4270,12 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // agentPayoff: agentFee - agentFee = BigInt(agentOffer.price)*agentFeePercentage/"10000".toString(); + agentFee = ((BigInt(agentOffer.price) * BigInt(agentFeePercentage)) / 10000n).toString(); agentPayoff = agentFee; // seller: sellerDeposit + price - protocolFee - agentFee - sellerPayoff = BigInt(agentOffer.sellerDeposit) - +agentOffer.price - -agentOfferProtocolFee - -agentFee - .toString(); + sellerPayoff = + BigInt(agentOffer.sellerDeposit) + agentOffer.price - agentOfferProtocolFee - agentFee.toString(); // protocol: protocolFee protocolPayoff = agentOfferProtocolFee; @@ -4260,6 +4302,7 @@ describe("IBosonFundsHandler", function () { // Complete the exchange, expecting event const tx = await exchangeHandler.connect(buyer).completeExchange(exchangeId); + const result = await tx.wait(); await expect(tx) .to.emit(exchangeHandler, "FundsReleased") diff --git a/test/protocol/TwinHandlerTest.js b/test/protocol/TwinHandlerTest.js index 1f642a5be..741720cd2 100644 --- a/test/protocol/TwinHandlerTest.js +++ b/test/protocol/TwinHandlerTest.js @@ -1,4 +1,5 @@ const { ethers } = require("hardhat"); +const { ZeroAddress, MaxUint256 } = ethers; const { expect, assert } = require("chai"); const Twin = require("../../scripts/domain/Twin"); const Bundle = require("../../scripts/domain/Bundle"); @@ -98,7 +99,12 @@ describe("IBosonTwinHandler", function () { id = "1"; // argument sent to contract for createSeller will be ignored // Create a valid seller, then set fields in tests directly - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + clerk.address, + await treasury.getAddress() + ); expect(seller.isValid()).is.true; // VoucherInitValues @@ -489,7 +495,7 @@ describe("IBosonTwinHandler", function () { ); }); - it.only("token address has been used in another twin with unlimited supply", async function () { + it("token address has been used in another twin with unlimited supply", async function () { twin.supplyAvailable = MaxUint256; twin.tokenType = TokenType.NonFungibleToken; twin.tokenAddress = await foreign721.getAddress(); @@ -507,12 +513,12 @@ describe("IBosonTwinHandler", function () { ); }); - it.only("Supply range overflow", async function () { - twin.supplyAvailable = MaxUint256/10*8.toString(); + it("Supply range overflow", async function () { + twin.supplyAvailable = ((MaxUint256 / 10n) * 8n).toString(); twin.tokenType = TokenType.NonFungibleToken; twin.tokenAddress = await foreign721.getAddress(); twin.amount = "0"; - twin.tokenId = MaxUint256-twin.supplyAvailable+1.toString(); + twin.tokenId = MaxUint256 - BigInt(twin.supplyAvailable) + 1n.toString(); await foreign721.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); @@ -522,7 +528,7 @@ describe("IBosonTwinHandler", function () { ); }); - it.only("Token with unlimited supply with starting tokenId to high", async function () { + it("Token with unlimited supply with starting tokenId to high", async function () { twin.supplyAvailable = MaxUint256.toString(); twin.tokenType = TokenType.NonFungibleToken; twin.tokenAddress = await foreign721.getAddress(); diff --git a/test/util/utils.js b/test/util/utils.js index 58076d76a..8af0978ee 100644 --- a/test/util/utils.js +++ b/test/util/utils.js @@ -199,10 +199,6 @@ async function prepareDataSignatureParameters( }; metaTxTypes = Object.assign({}, metaTxTypes, customTransactionTypes); - console.log(metaTxTypes); - console.log(domainData); - console.log(primaryType); - console.log(message); // Prepare the data to sign let dataToSign = JSON.stringify({ types: metaTxTypes, From 7cfd04e8a1e757fea3fb258917c5ea23ab20fe03 Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Thu, 22 Jun 2023 11:13:22 -0300 Subject: [PATCH 13/32] Fixing ProtoclInitializationHandler --- package-lock.json | 15540 +--------------- package.json | 3 +- scripts/domain/Receipt.js | 1 - scripts/util/diamond-utils.js | 2 +- test/access/AccessControllerTest.js | 59 +- test/protocol/DisputeHandlerTest.js | 10 +- test/protocol/FundsHandlerTest.js | 3 - .../ProtocolInitializationHandlerTest.js | 65 +- 8 files changed, 99 insertions(+), 15584 deletions(-) diff --git a/package-lock.json b/package-lock.json index 909b8665c..afe761506 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,7 +1,7 @@ { "name": "@bosonprotocol/boson-protocol-contracts", "version": "2.2.1", - "lockfileVersion": 2, + "lockfileVersion": 3, "requires": true, "packages": { "": { @@ -10,7 +10,8 @@ "license": "GPL-3.0-or-later", "dependencies": { "@openzeppelin/contracts": "^4.9.0", - "@openzeppelin/contracts-upgradeable": "4.9.0" + "@openzeppelin/contracts-upgradeable": "4.9.0", + "ethers": "^6.6.0" }, "devDependencies": { "@bosonprotocol/solidoc": "3.0.3", @@ -44,9 +45,7 @@ "node_modules/@adraffy/ens-normalize": { "version": "1.9.2", "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.9.2.tgz", - "integrity": "sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg==", - "dev": true, - "peer": true + "integrity": "sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg==" }, "node_modules/@apollo/protobufjs": { "version": "1.2.7", @@ -1696,7 +1695,6 @@ "version": "1.7.1", "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==", - "dev": true, "funding": [ { "type": "individual", @@ -2100,7 +2098,7 @@ "@types/mocha": ">=9.1.0", "@types/node": ">=12.0.0", "chai": "^4.2.0", - "ethers": "^6.4.0", + "ethers": "^6.6.0", "hardhat": "^2.11.0", "hardhat-gas-reporter": "^1.0.8", "solidity-coverage": "^0.8.1", @@ -2167,150 +2165,6 @@ "node": ">= 10" } }, - "node_modules/@nomicfoundation/solidity-analyzer-darwin-x64": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-darwin-x64/-/solidity-analyzer-darwin-x64-0.1.1.tgz", - "integrity": "sha512-XhQG4BaJE6cIbjAVtzGOGbK3sn1BO9W29uhk9J8y8fZF1DYz0Doj8QDMfpMu+A6TjPDs61lbsmeYodIDnfveSA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@nomicfoundation/solidity-analyzer-freebsd-x64": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-freebsd-x64/-/solidity-analyzer-freebsd-x64-0.1.1.tgz", - "integrity": "sha512-GHF1VKRdHW3G8CndkwdaeLkVBi5A9u2jwtlS7SLhBc8b5U/GcoL39Q+1CSO3hYqePNP+eV5YI7Zgm0ea6kMHoA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@nomicfoundation/solidity-analyzer-linux-arm64-gnu": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-arm64-gnu/-/solidity-analyzer-linux-arm64-gnu-0.1.1.tgz", - "integrity": "sha512-g4Cv2fO37ZsUENQ2vwPnZc2zRenHyAxHcyBjKcjaSmmkKrFr64yvzeNO8S3GBFCo90rfochLs99wFVGT/0owpg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@nomicfoundation/solidity-analyzer-linux-arm64-musl": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-arm64-musl/-/solidity-analyzer-linux-arm64-musl-0.1.1.tgz", - "integrity": "sha512-WJ3CE5Oek25OGE3WwzK7oaopY8xMw9Lhb0mlYuJl/maZVo+WtP36XoQTb7bW/i8aAdHW5Z+BqrHMux23pvxG3w==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@nomicfoundation/solidity-analyzer-linux-x64-gnu": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-x64-gnu/-/solidity-analyzer-linux-x64-gnu-0.1.1.tgz", - "integrity": "sha512-5WN7leSr5fkUBBjE4f3wKENUy9HQStu7HmWqbtknfXkkil+eNWiBV275IOlpXku7v3uLsXTOKpnnGHJYI2qsdA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@nomicfoundation/solidity-analyzer-linux-x64-musl": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-x64-musl/-/solidity-analyzer-linux-x64-musl-0.1.1.tgz", - "integrity": "sha512-KdYMkJOq0SYPQMmErv/63CwGwMm5XHenEna9X9aB8mQmhDBrYrlAOSsIPgFCUSL0hjxE3xHP65/EPXR/InD2+w==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@nomicfoundation/solidity-analyzer-win32-arm64-msvc": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-win32-arm64-msvc/-/solidity-analyzer-win32-arm64-msvc-0.1.1.tgz", - "integrity": "sha512-VFZASBfl4qiBYwW5xeY20exWhmv6ww9sWu/krWSesv3q5hA0o1JuzmPHR4LPN6SUZj5vcqci0O6JOL8BPw+APg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@nomicfoundation/solidity-analyzer-win32-ia32-msvc": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-win32-ia32-msvc/-/solidity-analyzer-win32-ia32-msvc-0.1.1.tgz", - "integrity": "sha512-JnFkYuyCSA70j6Si6cS1A9Gh1aHTEb8kOTBApp/c7NRTFGNMH8eaInKlyuuiIbvYFhlXW4LicqyYuWNNq9hkpQ==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@nomicfoundation/solidity-analyzer-win32-x64-msvc": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-win32-x64-msvc/-/solidity-analyzer-win32-x64-msvc-0.1.1.tgz", - "integrity": "sha512-HrVJr6+WjIXGnw3Q9u6KQcbZCtk0caVWhCdFADySvRyUxJ8PnzlaP+MhwNE8oyT8OZ6ejHBRrrgjSqDCFXGirw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, "node_modules/@nomiclabs/hardhat-web3": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-web3/-/hardhat-web3-2.0.0.tgz", @@ -5117,7 +4971,7 @@ "version": "4.0.7", "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz", "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", - "dev": true, + "devOptional": true, "hasInstallScript": true, "dependencies": { "node-gyp-build": "^4.3.0" @@ -8390,10 +8244,9 @@ } }, "node_modules/ethers": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.5.1.tgz", - "integrity": "sha512-jDpCnUGcyn39hnRUEtrulDZOtJcIPEz4Whccl3N9qhwdLsn1ELuDM9TgGgGJq6ph0p8/Uri+Wezmo/r69E+xkA==", - "dev": true, + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.6.0.tgz", + "integrity": "sha512-7D2U+n8eZYmh592VZqap9vBu50jN7YUDHqAmwBYTMntmUKC9RVgcqcFbd+3DTCOQ1jMyK6QHv1usbcfgiGaHOA==", "funding": [ { "type": "individual", @@ -8404,7 +8257,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@adraffy/ens-normalize": "1.9.2", "@noble/hashes": "1.1.2", @@ -8422,42 +8274,32 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", "integrity": "sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==", - "dev": true, "funding": [ { "type": "individual", "url": "https://paulmillr.com/funding/" } - ], - "peer": true + ] }, "node_modules/ethers/node_modules/@types/node": { "version": "18.15.13", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", - "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==", - "dev": true, - "peer": true + "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==" }, "node_modules/ethers/node_modules/aes-js": { "version": "4.0.0-beta.5", "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", - "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==", - "dev": true, - "peer": true + "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" }, "node_modules/ethers/node_modules/tslib": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", - "dev": true, - "peer": true + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" }, "node_modules/ethers/node_modules/ws": { "version": "8.5.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", - "dev": true, - "peer": true, "engines": { "node": ">=10.0.0" }, @@ -13224,7 +13066,7 @@ "version": "4.6.0", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==", - "dev": true, + "devOptional": true, "bin": { "node-gyp-build": "bin.js", "node-gyp-build-optional": "optional.js", @@ -18444,7 +18286,7 @@ "version": "5.0.10", "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", - "dev": true, + "devOptional": true, "hasInstallScript": true, "dependencies": { "node-gyp-build": "^4.3.0" @@ -19544,15357 +19386,5 @@ "url": "https://github.com/sponsors/sindresorhus" } } - }, - "dependencies": { - "@adraffy/ens-normalize": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.9.2.tgz", - "integrity": "sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg==", - "dev": true, - "peer": true - }, - "@apollo/protobufjs": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/@apollo/protobufjs/-/protobufjs-1.2.7.tgz", - "integrity": "sha512-Lahx5zntHPZia35myYDBRuF58tlwPskwHc5CWBZC/4bMKB6siTBWwtMrkqXcsNwQiFSzSx5hKdRPUmemrEp3Gg==", - "dev": true, - "optional": true, - "requires": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/long": "^4.0.0", - "long": "^4.0.0" - } - }, - "@apollo/usage-reporting-protobuf": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@apollo/usage-reporting-protobuf/-/usage-reporting-protobuf-4.1.0.tgz", - "integrity": "sha512-hXouMuw5pQVkzi8dgMybmr6Y11+eRmMQVoB5TF0HyTwAg9SOq/v3OCuiYqcVUKdBcskU9Msp+XvjAk0GKpWCwQ==", - "dev": true, - "optional": true, - "requires": { - "@apollo/protobufjs": "1.2.7" - } - }, - "@apollo/utils.dropunuseddefinitions": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@apollo/utils.dropunuseddefinitions/-/utils.dropunuseddefinitions-1.1.0.tgz", - "integrity": "sha512-jU1XjMr6ec9pPoL+BFWzEPW7VHHulVdGKMkPAMiCigpVIT11VmCbnij0bWob8uS3ODJ65tZLYKAh/55vLw2rbg==", - "dev": true, - "optional": true, - "requires": {} - }, - "@apollo/utils.keyvaluecache": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@apollo/utils.keyvaluecache/-/utils.keyvaluecache-1.0.2.tgz", - "integrity": "sha512-p7PVdLPMnPzmXSQVEsy27cYEjVON+SH/Wb7COyW3rQN8+wJgT1nv9jZouYtztWW8ZgTkii5T6tC9qfoDREd4mg==", - "dev": true, - "optional": true, - "requires": { - "@apollo/utils.logger": "^1.0.0", - "lru-cache": "7.10.1 - 7.13.1" - }, - "dependencies": { - "lru-cache": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.13.1.tgz", - "integrity": "sha512-CHqbAq7NFlW3RSnoWXLJBxCWaZVBrfa9UEHId2M3AW8iEBurbqduNexEUCGc3SHc6iCYXNJCDi903LajSVAEPQ==", - "dev": true, - "optional": true - } - } - }, - "@apollo/utils.logger": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@apollo/utils.logger/-/utils.logger-1.0.1.tgz", - "integrity": "sha512-XdlzoY7fYNK4OIcvMD2G94RoFZbzTQaNP0jozmqqMudmaGo2I/2Jx71xlDJ801mWA/mbYRihyaw6KJii7k5RVA==", - "dev": true, - "optional": true - }, - "@apollo/utils.printwithreducedwhitespace": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@apollo/utils.printwithreducedwhitespace/-/utils.printwithreducedwhitespace-1.1.0.tgz", - "integrity": "sha512-GfFSkAv3n1toDZ4V6u2d7L4xMwLA+lv+6hqXicMN9KELSJ9yy9RzuEXaX73c/Ry+GzRsBy/fdSUGayGqdHfT2Q==", - "dev": true, - "optional": true, - "requires": {} - }, - "@apollo/utils.removealiases": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@apollo/utils.removealiases/-/utils.removealiases-1.0.0.tgz", - "integrity": "sha512-6cM8sEOJW2LaGjL/0vHV0GtRaSekrPQR4DiywaApQlL9EdROASZU5PsQibe2MWeZCOhNrPRuHh4wDMwPsWTn8A==", - "dev": true, - "optional": true, - "requires": {} - }, - "@apollo/utils.sortast": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@apollo/utils.sortast/-/utils.sortast-1.1.0.tgz", - "integrity": "sha512-VPlTsmUnOwzPK5yGZENN069y6uUHgeiSlpEhRnLFYwYNoJHsuJq2vXVwIaSmts015WTPa2fpz1inkLYByeuRQA==", - "dev": true, - "optional": true, - "requires": { - "lodash.sortby": "^4.7.0" - } - }, - "@apollo/utils.stripsensitiveliterals": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@apollo/utils.stripsensitiveliterals/-/utils.stripsensitiveliterals-1.2.0.tgz", - "integrity": "sha512-E41rDUzkz/cdikM5147d8nfCFVKovXxKBcjvLEQ7bjZm/cg9zEcXvS6vFY8ugTubI3fn6zoqo0CyU8zT+BGP9w==", - "dev": true, - "optional": true, - "requires": {} - }, - "@apollo/utils.usagereporting": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@apollo/utils.usagereporting/-/utils.usagereporting-1.0.1.tgz", - "integrity": "sha512-6dk+0hZlnDbahDBB2mP/PZ5ybrtCJdLMbeNJD+TJpKyZmSY6bA3SjI8Cr2EM9QA+AdziywuWg+SgbWUF3/zQqQ==", - "dev": true, - "optional": true, - "requires": { - "@apollo/usage-reporting-protobuf": "^4.0.0", - "@apollo/utils.dropunuseddefinitions": "^1.1.0", - "@apollo/utils.printwithreducedwhitespace": "^1.1.0", - "@apollo/utils.removealiases": "1.0.0", - "@apollo/utils.sortast": "^1.1.0", - "@apollo/utils.stripsensitiveliterals": "^1.2.0" - } - }, - "@apollographql/apollo-tools": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/@apollographql/apollo-tools/-/apollo-tools-0.5.4.tgz", - "integrity": "sha512-shM3q7rUbNyXVVRkQJQseXv6bnYM3BUma/eZhwXR4xsuM+bqWnJKvW7SAfRjP7LuSCocrexa5AXhjjawNHrIlw==", - "dev": true, - "optional": true, - "requires": {} - }, - "@apollographql/graphql-playground-html": { - "version": "1.6.29", - "resolved": "https://registry.npmjs.org/@apollographql/graphql-playground-html/-/graphql-playground-html-1.6.29.tgz", - "integrity": "sha512-xCcXpoz52rI4ksJSdOCxeOCn2DLocxwHf9dVT/Q90Pte1LX+LY+91SFtJF3KXVHH8kEin+g1KKCQPKBjZJfWNA==", - "dev": true, - "optional": true, - "requires": { - "xss": "^1.0.8" - } - }, - "@babel/code-frame": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", - "integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", - "dev": true, - "requires": { - "@babel/highlight": "^7.18.6" - } - }, - "@babel/helper-validator-identifier": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", - "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", - "dev": true - }, - "@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - } - }, - "@babel/runtime": { - "version": "7.22.3", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.3.tgz", - "integrity": "sha512-XsDuspWKLUsxwCp6r7EhsExHtYfbe5oAGQ19kqngTdCPUoPQzOPdUbD/pB9PJiwb2ptYKQDjSJT3R6dC+EPqfQ==", - "dev": true, - "requires": { - "regenerator-runtime": "^0.13.11" - } - }, - "@bosonprotocol/solidoc": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@bosonprotocol/solidoc/-/solidoc-3.0.3.tgz", - "integrity": "sha512-RNevHlnY4IO6npNONaGdQajJ4+vYkEtNTjibhOb4QMAocZVwKNWGFPrh+B3chEyNGAsTtsgWK0fnt2IgX7mBwQ==", - "dev": true, - "requires": { - "fs-extra": "^7.0.0", - "glob": "^7.1.3", - "linq": "^3.1.0", - "pino": "^5.8.0", - "pino-pretty": "^2.2.2", - "require-all": "^3.0.0" - }, - "dependencies": { - "glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - } - } - }, - "@chainsafe/as-sha256": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@chainsafe/as-sha256/-/as-sha256-0.3.1.tgz", - "integrity": "sha512-hldFFYuf49ed7DAakWVXSJODuq3pzJEguD8tQ7h+sGkM18vja+OFoJI9krnGmgzyuZC2ETX0NOIcCTy31v2Mtg==", - "dev": true - }, - "@chainsafe/persistent-merkle-tree": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/@chainsafe/persistent-merkle-tree/-/persistent-merkle-tree-0.4.2.tgz", - "integrity": "sha512-lLO3ihKPngXLTus/L7WHKaw9PnNJWizlOF1H9NNzHP6Xvh82vzg9F2bzkXhYIFshMZ2gTCEz8tq6STe7r5NDfQ==", - "dev": true, - "requires": { - "@chainsafe/as-sha256": "^0.3.1" - } - }, - "@chainsafe/ssz": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/@chainsafe/ssz/-/ssz-0.9.4.tgz", - "integrity": "sha512-77Qtg2N1ayqs4Bg/wvnWfg5Bta7iy7IRh8XqXh7oNMeP2HBbBwx8m6yTpA8p0EHItWPEBkgZd5S5/LSlp3GXuQ==", - "dev": true, - "requires": { - "@chainsafe/as-sha256": "^0.3.1", - "@chainsafe/persistent-merkle-tree": "^0.4.2", - "case": "^1.6.3" - } - }, - "@colors/colors": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", - "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", - "dev": true, - "optional": true - }, - "@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dev": true, - "peer": true, - "requires": { - "@jridgewell/trace-mapping": "0.3.9" - } - }, - "@ensdomains/address-encoder": { - "version": "0.1.9", - "resolved": "https://registry.npmjs.org/@ensdomains/address-encoder/-/address-encoder-0.1.9.tgz", - "integrity": "sha512-E2d2gP4uxJQnDu2Kfg1tHNspefzbLT8Tyjrm5sEuim32UkU2sm5xL4VXtgc2X33fmPEw9+jUMpGs4veMbf+PYg==", - "dev": true, - "requires": { - "bech32": "^1.1.3", - "blakejs": "^1.1.0", - "bn.js": "^4.11.8", - "bs58": "^4.0.1", - "crypto-addr-codec": "^0.1.7", - "nano-base32": "^1.0.1", - "ripemd160": "^2.0.2" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - } - } - }, - "@ensdomains/ens": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/@ensdomains/ens/-/ens-0.4.5.tgz", - "integrity": "sha512-JSvpj1iNMFjK6K+uVl4unqMoa9rf5jopb8cya5UGBWz23Nw8hSNT7efgUx4BTlAPAgpNlEioUfeTyQ6J9ZvTVw==", - "dev": true, - "requires": { - "bluebird": "^3.5.2", - "eth-ens-namehash": "^2.0.8", - "solc": "^0.4.20", - "testrpc": "0.0.1", - "web3-utils": "^1.0.0-beta.31" - } - }, - "@ensdomains/ensjs": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@ensdomains/ensjs/-/ensjs-2.1.0.tgz", - "integrity": "sha512-GRbGPT8Z/OJMDuxs75U/jUNEC0tbL0aj7/L/QQznGYKm/tiasp+ndLOaoULy9kKJFC0TBByqfFliEHDgoLhyog==", - "dev": true, - "requires": { - "@babel/runtime": "^7.4.4", - "@ensdomains/address-encoder": "^0.1.7", - "@ensdomains/ens": "0.4.5", - "@ensdomains/resolver": "0.2.4", - "content-hash": "^2.5.2", - "eth-ens-namehash": "^2.0.8", - "ethers": "^5.0.13", - "js-sha3": "^0.8.0" - }, - "dependencies": { - "ethers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", - "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", - "dev": true, - "requires": { - "@ethersproject/abi": "5.7.0", - "@ethersproject/abstract-provider": "5.7.0", - "@ethersproject/abstract-signer": "5.7.0", - "@ethersproject/address": "5.7.0", - "@ethersproject/base64": "5.7.0", - "@ethersproject/basex": "5.7.0", - "@ethersproject/bignumber": "5.7.0", - "@ethersproject/bytes": "5.7.0", - "@ethersproject/constants": "5.7.0", - "@ethersproject/contracts": "5.7.0", - "@ethersproject/hash": "5.7.0", - "@ethersproject/hdnode": "5.7.0", - "@ethersproject/json-wallets": "5.7.0", - "@ethersproject/keccak256": "5.7.0", - "@ethersproject/logger": "5.7.0", - "@ethersproject/networks": "5.7.1", - "@ethersproject/pbkdf2": "5.7.0", - "@ethersproject/properties": "5.7.0", - "@ethersproject/providers": "5.7.2", - "@ethersproject/random": "5.7.0", - "@ethersproject/rlp": "5.7.0", - "@ethersproject/sha2": "5.7.0", - "@ethersproject/signing-key": "5.7.0", - "@ethersproject/solidity": "5.7.0", - "@ethersproject/strings": "5.7.0", - "@ethersproject/transactions": "5.7.0", - "@ethersproject/units": "5.7.0", - "@ethersproject/wallet": "5.7.0", - "@ethersproject/web": "5.7.1", - "@ethersproject/wordlists": "5.7.0" - } - } - } - }, - "@ensdomains/resolver": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/@ensdomains/resolver/-/resolver-0.2.4.tgz", - "integrity": "sha512-bvaTH34PMCbv6anRa9I/0zjLJgY4EuznbEMgbV77JBCQ9KNC46rzi0avuxpOfu+xDjPEtSFGqVEOr5GlUSGudA==", - "dev": true - }, - "@eslint-community/eslint-utils": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", - "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^3.3.0" - } - }, - "@eslint-community/regexpp": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.1.tgz", - "integrity": "sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ==", - "dev": true - }, - "@eslint/eslintrc": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.3.tgz", - "integrity": "sha512-+5gy6OQfk+xx3q0d6jGZZC3f3KzAkXc/IanVxd1is/VIIziRqqt3ongQz0FiTUXqTk0c7aDB3OaFuKnuSoJicQ==", - "dev": true, - "requires": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.5.2", - "globals": "^13.19.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "dependencies": { - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - } - } - }, - "@eslint/js": { - "version": "8.42.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.42.0.tgz", - "integrity": "sha512-6SWlXpWU5AvId8Ac7zjzmIOqMOba/JWY8XZ4A7q7Gn1Vlfg/SFFIlrtHXt9nPn4op9ZPAkl91Jao+QQv3r/ukw==", - "dev": true - }, - "@ethereum-waffle/mock-contract": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/@ethereum-waffle/mock-contract/-/mock-contract-4.0.4.tgz", - "integrity": "sha512-LwEj5SIuEe9/gnrXgtqIkWbk2g15imM/qcJcxpLyAkOj981tQxXmtV4XmQMZsdedEsZ/D/rbUAOtZbgwqgUwQA==", - "dev": true, - "requires": {} - }, - "@ethereumjs/common": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.5.0.tgz", - "integrity": "sha512-DEHjW6e38o+JmB/NO3GZBpW4lpaiBpkFgXF6jLcJ6gETBYpEyaA5nTimsWBUJR3Vmtm/didUEbNjajskugZORg==", - "dev": true, - "requires": { - "crc-32": "^1.2.0", - "ethereumjs-util": "^7.1.1" - } - }, - "@ethereumjs/tx": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.3.2.tgz", - "integrity": "sha512-6AaJhwg4ucmwTvw/1qLaZUX5miWrwZ4nLOUsKyb/HtzS3BMw/CasKhdi1ims9mBKeK9sOJCH4qGKOBGyJCeeog==", - "dev": true, - "requires": { - "@ethereumjs/common": "^2.5.0", - "ethereumjs-util": "^7.1.2" - } - }, - "@ethersproject/abi": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", - "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", - "dev": true, - "requires": { - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "@ethersproject/abstract-provider": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", - "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", - "dev": true, - "requires": { - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/networks": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/web": "^5.7.0" - } - }, - "@ethersproject/abstract-signer": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", - "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", - "dev": true, - "requires": { - "@ethersproject/abstract-provider": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0" - } - }, - "@ethersproject/address": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz", - "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", - "dev": true, - "requires": { - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/rlp": "^5.7.0" - } - }, - "@ethersproject/base64": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz", - "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", - "dev": true, - "requires": { - "@ethersproject/bytes": "^5.7.0" - } - }, - "@ethersproject/basex": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.7.0.tgz", - "integrity": "sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw==", - "dev": true, - "requires": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/properties": "^5.7.0" - } - }, - "@ethersproject/bignumber": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", - "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", - "dev": true, - "requires": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "bn.js": "^5.2.1" - } - }, - "@ethersproject/bytes": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", - "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", - "dev": true, - "requires": { - "@ethersproject/logger": "^5.7.0" - } - }, - "@ethersproject/constants": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz", - "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", - "dev": true, - "requires": { - "@ethersproject/bignumber": "^5.7.0" - } - }, - "@ethersproject/contracts": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.7.0.tgz", - "integrity": "sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==", - "dev": true, - "requires": { - "@ethersproject/abi": "^5.7.0", - "@ethersproject/abstract-provider": "^5.7.0", - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/transactions": "^5.7.0" - } - }, - "@ethersproject/hash": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz", - "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", - "dev": true, - "requires": { - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/base64": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "@ethersproject/hdnode": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.7.0.tgz", - "integrity": "sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg==", - "dev": true, - "requires": { - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/basex": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/pbkdf2": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/sha2": "^5.7.0", - "@ethersproject/signing-key": "^5.7.0", - "@ethersproject/strings": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/wordlists": "^5.7.0" - } - }, - "@ethersproject/json-wallets": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz", - "integrity": "sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g==", - "dev": true, - "requires": { - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/hdnode": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/pbkdf2": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/random": "^5.7.0", - "@ethersproject/strings": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "aes-js": "3.0.0", - "scrypt-js": "3.0.1" - } - }, - "@ethersproject/keccak256": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", - "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", - "dev": true, - "requires": { - "@ethersproject/bytes": "^5.7.0", - "js-sha3": "0.8.0" - } - }, - "@ethersproject/logger": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", - "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==", - "dev": true - }, - "@ethersproject/networks": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz", - "integrity": "sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==", - "dev": true, - "requires": { - "@ethersproject/logger": "^5.7.0" - } - }, - "@ethersproject/pbkdf2": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz", - "integrity": "sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==", - "dev": true, - "requires": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/sha2": "^5.7.0" - } - }, - "@ethersproject/properties": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz", - "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", - "dev": true, - "requires": { - "@ethersproject/logger": "^5.7.0" - } - }, - "@ethersproject/providers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.7.2.tgz", - "integrity": "sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==", - "dev": true, - "requires": { - "@ethersproject/abstract-provider": "^5.7.0", - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/base64": "^5.7.0", - "@ethersproject/basex": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/networks": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/random": "^5.7.0", - "@ethersproject/rlp": "^5.7.0", - "@ethersproject/sha2": "^5.7.0", - "@ethersproject/strings": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/web": "^5.7.0", - "bech32": "1.1.4", - "ws": "7.4.6" - } - }, - "@ethersproject/random": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.7.0.tgz", - "integrity": "sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==", - "dev": true, - "requires": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, - "@ethersproject/rlp": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz", - "integrity": "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", - "dev": true, - "requires": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, - "@ethersproject/sha2": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.7.0.tgz", - "integrity": "sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==", - "dev": true, - "requires": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "hash.js": "1.1.7" - } - }, - "@ethersproject/signing-key": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", - "integrity": "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", - "dev": true, - "requires": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "bn.js": "^5.2.1", - "elliptic": "6.5.4", - "hash.js": "1.1.7" - } - }, - "@ethersproject/solidity": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.7.0.tgz", - "integrity": "sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==", - "dev": true, - "requires": { - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/sha2": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "@ethersproject/strings": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz", - "integrity": "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", - "dev": true, - "requires": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, - "@ethersproject/transactions": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz", - "integrity": "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", - "dev": true, - "requires": { - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/rlp": "^5.7.0", - "@ethersproject/signing-key": "^5.7.0" - } - }, - "@ethersproject/units": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.7.0.tgz", - "integrity": "sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==", - "dev": true, - "requires": { - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, - "@ethersproject/wallet": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.7.0.tgz", - "integrity": "sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==", - "dev": true, - "requires": { - "@ethersproject/abstract-provider": "^5.7.0", - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/hdnode": "^5.7.0", - "@ethersproject/json-wallets": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/random": "^5.7.0", - "@ethersproject/signing-key": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/wordlists": "^5.7.0" - } - }, - "@ethersproject/web": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz", - "integrity": "sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==", - "dev": true, - "requires": { - "@ethersproject/base64": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "@ethersproject/wordlists": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.7.0.tgz", - "integrity": "sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==", - "dev": true, - "requires": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "@graphql-tools/batch-execute": { - "version": "8.5.1", - "resolved": "https://registry.npmjs.org/@graphql-tools/batch-execute/-/batch-execute-8.5.1.tgz", - "integrity": "sha512-hRVDduX0UDEneVyEWtc2nu5H2PxpfSfM/riUlgZvo/a/nG475uyehxR5cFGvTEPEQUKY3vGIlqvtRigzqTfCew==", - "dev": true, - "optional": true, - "requires": { - "@graphql-tools/utils": "8.9.0", - "dataloader": "2.1.0", - "tslib": "^2.4.0", - "value-or-promise": "1.0.11" - }, - "dependencies": { - "tslib": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", - "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==", - "dev": true, - "optional": true - } - } - }, - "@graphql-tools/delegate": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/@graphql-tools/delegate/-/delegate-8.8.1.tgz", - "integrity": "sha512-NDcg3GEQmdEHlnF7QS8b4lM1PSF+DKeFcIlLEfZFBvVq84791UtJcDj8734sIHLukmyuAxXMfA1qLd2l4lZqzA==", - "dev": true, - "optional": true, - "requires": { - "@graphql-tools/batch-execute": "8.5.1", - "@graphql-tools/schema": "8.5.1", - "@graphql-tools/utils": "8.9.0", - "dataloader": "2.1.0", - "tslib": "~2.4.0", - "value-or-promise": "1.0.11" - }, - "dependencies": { - "tslib": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", - "dev": true, - "optional": true - } - } - }, - "@graphql-tools/merge": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/@graphql-tools/merge/-/merge-8.3.1.tgz", - "integrity": "sha512-BMm99mqdNZbEYeTPK3it9r9S6rsZsQKtlqJsSBknAclXq2pGEfOxjcIZi+kBSkHZKPKCRrYDd5vY0+rUmIHVLg==", - "dev": true, - "optional": true, - "requires": { - "@graphql-tools/utils": "8.9.0", - "tslib": "^2.4.0" - }, - "dependencies": { - "tslib": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", - "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==", - "dev": true, - "optional": true - } - } - }, - "@graphql-tools/mock": { - "version": "8.7.20", - "resolved": "https://registry.npmjs.org/@graphql-tools/mock/-/mock-8.7.20.tgz", - "integrity": "sha512-ljcHSJWjC/ZyzpXd5cfNhPI7YljRVvabKHPzKjEs5ElxWu2cdlLGvyNYepApXDsM/OJG/2xuhGM+9GWu5gEAPQ==", - "dev": true, - "optional": true, - "requires": { - "@graphql-tools/schema": "^9.0.18", - "@graphql-tools/utils": "^9.2.1", - "fast-json-stable-stringify": "^2.1.0", - "tslib": "^2.4.0" - }, - "dependencies": { - "@graphql-tools/merge": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/@graphql-tools/merge/-/merge-8.4.2.tgz", - "integrity": "sha512-XbrHAaj8yDuINph+sAfuq3QCZ/tKblrTLOpirK0+CAgNlZUCHs0Fa+xtMUURgwCVThLle1AF7svJCxFizygLsw==", - "dev": true, - "optional": true, - "requires": { - "@graphql-tools/utils": "^9.2.1", - "tslib": "^2.4.0" - } - }, - "@graphql-tools/schema": { - "version": "9.0.19", - "resolved": "https://registry.npmjs.org/@graphql-tools/schema/-/schema-9.0.19.tgz", - "integrity": "sha512-oBRPoNBtCkk0zbUsyP4GaIzCt8C0aCI4ycIRUL67KK5pOHljKLBBtGT+Jr6hkzA74C8Gco8bpZPe7aWFjiaK2w==", - "dev": true, - "optional": true, - "requires": { - "@graphql-tools/merge": "^8.4.1", - "@graphql-tools/utils": "^9.2.1", - "tslib": "^2.4.0", - "value-or-promise": "^1.0.12" - } - }, - "@graphql-tools/utils": { - "version": "9.2.1", - "resolved": "https://registry.npmjs.org/@graphql-tools/utils/-/utils-9.2.1.tgz", - "integrity": "sha512-WUw506Ql6xzmOORlriNrD6Ugx+HjVgYxt9KCXD9mHAak+eaXSwuGGPyE60hy9xaDEoXKBsG7SkG69ybitaVl6A==", - "dev": true, - "optional": true, - "requires": { - "@graphql-typed-document-node/core": "^3.1.1", - "tslib": "^2.4.0" - } - }, - "tslib": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", - "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==", - "dev": true, - "optional": true - }, - "value-or-promise": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/value-or-promise/-/value-or-promise-1.0.12.tgz", - "integrity": "sha512-Z6Uz+TYwEqE7ZN50gwn+1LCVo9ZVrpxRPOhOLnncYkY1ZzOYtrX8Fwf/rFktZ8R5mJms6EZf5TqNOMeZmnPq9Q==", - "dev": true, - "optional": true - } - } - }, - "@graphql-tools/schema": { - "version": "8.5.1", - "resolved": "https://registry.npmjs.org/@graphql-tools/schema/-/schema-8.5.1.tgz", - "integrity": "sha512-0Esilsh0P/qYcB5DKQpiKeQs/jevzIadNTaT0jeWklPMwNbT7yMX4EqZany7mbeRRlSRwMzNzL5olyFdffHBZg==", - "dev": true, - "optional": true, - "requires": { - "@graphql-tools/merge": "8.3.1", - "@graphql-tools/utils": "8.9.0", - "tslib": "^2.4.0", - "value-or-promise": "1.0.11" - }, - "dependencies": { - "tslib": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", - "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==", - "dev": true, - "optional": true - } - } - }, - "@graphql-tools/utils": { - "version": "8.9.0", - "resolved": "https://registry.npmjs.org/@graphql-tools/utils/-/utils-8.9.0.tgz", - "integrity": "sha512-pjJIWH0XOVnYGXCqej8g/u/tsfV4LvLlj0eATKQu5zwnxd/TiTHq7Cg313qUPTFFHZ3PP5wJ15chYVtLDwaymg==", - "dev": true, - "optional": true, - "requires": { - "tslib": "^2.4.0" - }, - "dependencies": { - "tslib": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", - "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==", - "dev": true, - "optional": true - } - } - }, - "@graphql-typed-document-node/core": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@graphql-typed-document-node/core/-/core-3.2.0.tgz", - "integrity": "sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==", - "dev": true, - "optional": true, - "requires": {} - }, - "@humanwhocodes/config-array": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", - "integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==", - "dev": true, - "requires": { - "@humanwhocodes/object-schema": "^1.2.1", - "debug": "^4.1.1", - "minimatch": "^3.0.5" - } - }, - "@humanwhocodes/module-importer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", - "dev": true - }, - "@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", - "dev": true - }, - "@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "dev": true, - "requires": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "dev": true - }, - "ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true - }, - "emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true - }, - "string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, - "requires": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - } - }, - "strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, - "requires": { - "ansi-regex": "^6.0.1" - } - }, - "wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, - "requires": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - } - } - } - }, - "@josephg/resolvable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@josephg/resolvable/-/resolvable-1.0.1.tgz", - "integrity": "sha512-CtzORUwWTTOTqfVtHaKRJ0I1kNQd1bpn3sUh8I3nJDVY+5/M/Oe1DnEWzPQvqq/xPIIkzzzIP7mfCoAjFRvDhg==", - "dev": true, - "optional": true - }, - "@jridgewell/resolve-uri": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", - "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", - "dev": true, - "peer": true - }, - "@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true, - "peer": true - }, - "@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, - "peer": true, - "requires": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, - "@metamask/eth-sig-util": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@metamask/eth-sig-util/-/eth-sig-util-4.0.1.tgz", - "integrity": "sha512-tghyZKLHZjcdlDqCA3gNZmLeR0XvOE9U1qoQO9ohyAZT6Pya+H9vkBPcsyXytmYLNgVoin7CKCmweo/R43V+tQ==", - "dev": true, - "requires": { - "ethereumjs-abi": "^0.6.8", - "ethereumjs-util": "^6.2.1", - "ethjs-util": "^0.1.6", - "tweetnacl": "^1.0.3", - "tweetnacl-util": "^0.15.1" - }, - "dependencies": { - "@types/bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - }, - "ethereumjs-util": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz", - "integrity": "sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw==", - "dev": true, - "requires": { - "@types/bn.js": "^4.11.3", - "bn.js": "^4.11.0", - "create-hash": "^1.1.2", - "elliptic": "^6.5.2", - "ethereum-cryptography": "^0.1.3", - "ethjs-util": "0.1.6", - "rlp": "^2.2.3" - } - } - } - }, - "@noble/hashes": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.2.0.tgz", - "integrity": "sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ==", - "dev": true - }, - "@noble/secp256k1": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", - "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==", - "dev": true - }, - "@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - } - }, - "@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true - }, - "@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "requires": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - } - }, - "@nomicfoundation/ethereumjs-block": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-block/-/ethereumjs-block-5.0.1.tgz", - "integrity": "sha512-u1Yioemi6Ckj3xspygu/SfFvm8vZEO8/Yx5a1QLzi6nVU0jz3Pg2OmHKJ5w+D9Ogk1vhwRiqEBAqcb0GVhCyHw==", - "dev": true, - "requires": { - "@nomicfoundation/ethereumjs-common": "4.0.1", - "@nomicfoundation/ethereumjs-rlp": "5.0.1", - "@nomicfoundation/ethereumjs-trie": "6.0.1", - "@nomicfoundation/ethereumjs-tx": "5.0.1", - "@nomicfoundation/ethereumjs-util": "9.0.1", - "ethereum-cryptography": "0.1.3", - "ethers": "^5.7.1" - }, - "dependencies": { - "ethers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", - "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", - "dev": true, - "requires": { - "@ethersproject/abi": "5.7.0", - "@ethersproject/abstract-provider": "5.7.0", - "@ethersproject/abstract-signer": "5.7.0", - "@ethersproject/address": "5.7.0", - "@ethersproject/base64": "5.7.0", - "@ethersproject/basex": "5.7.0", - "@ethersproject/bignumber": "5.7.0", - "@ethersproject/bytes": "5.7.0", - "@ethersproject/constants": "5.7.0", - "@ethersproject/contracts": "5.7.0", - "@ethersproject/hash": "5.7.0", - "@ethersproject/hdnode": "5.7.0", - "@ethersproject/json-wallets": "5.7.0", - "@ethersproject/keccak256": "5.7.0", - "@ethersproject/logger": "5.7.0", - "@ethersproject/networks": "5.7.1", - "@ethersproject/pbkdf2": "5.7.0", - "@ethersproject/properties": "5.7.0", - "@ethersproject/providers": "5.7.2", - "@ethersproject/random": "5.7.0", - "@ethersproject/rlp": "5.7.0", - "@ethersproject/sha2": "5.7.0", - "@ethersproject/signing-key": "5.7.0", - "@ethersproject/solidity": "5.7.0", - "@ethersproject/strings": "5.7.0", - "@ethersproject/transactions": "5.7.0", - "@ethersproject/units": "5.7.0", - "@ethersproject/wallet": "5.7.0", - "@ethersproject/web": "5.7.1", - "@ethersproject/wordlists": "5.7.0" - } - } - } - }, - "@nomicfoundation/ethereumjs-blockchain": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-blockchain/-/ethereumjs-blockchain-7.0.1.tgz", - "integrity": "sha512-NhzndlGg829XXbqJEYrF1VeZhAwSPgsK/OB7TVrdzft3y918hW5KNd7gIZ85sn6peDZOdjBsAXIpXZ38oBYE5A==", - "dev": true, - "requires": { - "@nomicfoundation/ethereumjs-block": "5.0.1", - "@nomicfoundation/ethereumjs-common": "4.0.1", - "@nomicfoundation/ethereumjs-ethash": "3.0.1", - "@nomicfoundation/ethereumjs-rlp": "5.0.1", - "@nomicfoundation/ethereumjs-trie": "6.0.1", - "@nomicfoundation/ethereumjs-tx": "5.0.1", - "@nomicfoundation/ethereumjs-util": "9.0.1", - "abstract-level": "^1.0.3", - "debug": "^4.3.3", - "ethereum-cryptography": "0.1.3", - "level": "^8.0.0", - "lru-cache": "^5.1.1", - "memory-level": "^1.0.0" - } - }, - "@nomicfoundation/ethereumjs-common": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-common/-/ethereumjs-common-4.0.1.tgz", - "integrity": "sha512-OBErlkfp54GpeiE06brBW/TTbtbuBJV5YI5Nz/aB2evTDo+KawyEzPjBlSr84z/8MFfj8wS2wxzQX1o32cev5g==", - "dev": true, - "requires": { - "@nomicfoundation/ethereumjs-util": "9.0.1", - "crc-32": "^1.2.0" - } - }, - "@nomicfoundation/ethereumjs-ethash": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-ethash/-/ethereumjs-ethash-3.0.1.tgz", - "integrity": "sha512-KDjGIB5igzWOp8Ik5I6QiRH5DH+XgILlplsHR7TEuWANZA759G6krQ6o8bvj+tRUz08YygMQu/sGd9mJ1DYT8w==", - "dev": true, - "requires": { - "@nomicfoundation/ethereumjs-block": "5.0.1", - "@nomicfoundation/ethereumjs-rlp": "5.0.1", - "@nomicfoundation/ethereumjs-util": "9.0.1", - "abstract-level": "^1.0.3", - "bigint-crypto-utils": "^3.0.23", - "ethereum-cryptography": "0.1.3" - } - }, - "@nomicfoundation/ethereumjs-evm": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-evm/-/ethereumjs-evm-2.0.1.tgz", - "integrity": "sha512-oL8vJcnk0Bx/onl+TgQOQ1t/534GKFaEG17fZmwtPFeH8S5soiBYPCLUrvANOl4sCp9elYxIMzIiTtMtNNN8EQ==", - "dev": true, - "requires": { - "@ethersproject/providers": "^5.7.1", - "@nomicfoundation/ethereumjs-common": "4.0.1", - "@nomicfoundation/ethereumjs-tx": "5.0.1", - "@nomicfoundation/ethereumjs-util": "9.0.1", - "debug": "^4.3.3", - "ethereum-cryptography": "0.1.3", - "mcl-wasm": "^0.7.1", - "rustbn.js": "~0.2.0" - } - }, - "@nomicfoundation/ethereumjs-rlp": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-rlp/-/ethereumjs-rlp-5.0.1.tgz", - "integrity": "sha512-xtxrMGa8kP4zF5ApBQBtjlSbN5E2HI8m8FYgVSYAnO6ssUoY5pVPGy2H8+xdf/bmMa22Ce8nWMH3aEW8CcqMeQ==", - "dev": true - }, - "@nomicfoundation/ethereumjs-statemanager": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-statemanager/-/ethereumjs-statemanager-2.0.1.tgz", - "integrity": "sha512-B5ApMOnlruVOR7gisBaYwFX+L/AP7i/2oAahatssjPIBVDF6wTX1K7Qpa39E/nzsH8iYuL3krkYeUFIdO3EMUQ==", - "dev": true, - "requires": { - "@nomicfoundation/ethereumjs-common": "4.0.1", - "@nomicfoundation/ethereumjs-rlp": "5.0.1", - "debug": "^4.3.3", - "ethereum-cryptography": "0.1.3", - "ethers": "^5.7.1", - "js-sdsl": "^4.1.4" - }, - "dependencies": { - "ethers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", - "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", - "dev": true, - "requires": { - "@ethersproject/abi": "5.7.0", - "@ethersproject/abstract-provider": "5.7.0", - "@ethersproject/abstract-signer": "5.7.0", - "@ethersproject/address": "5.7.0", - "@ethersproject/base64": "5.7.0", - "@ethersproject/basex": "5.7.0", - "@ethersproject/bignumber": "5.7.0", - "@ethersproject/bytes": "5.7.0", - "@ethersproject/constants": "5.7.0", - "@ethersproject/contracts": "5.7.0", - "@ethersproject/hash": "5.7.0", - "@ethersproject/hdnode": "5.7.0", - "@ethersproject/json-wallets": "5.7.0", - "@ethersproject/keccak256": "5.7.0", - "@ethersproject/logger": "5.7.0", - "@ethersproject/networks": "5.7.1", - "@ethersproject/pbkdf2": "5.7.0", - "@ethersproject/properties": "5.7.0", - "@ethersproject/providers": "5.7.2", - "@ethersproject/random": "5.7.0", - "@ethersproject/rlp": "5.7.0", - "@ethersproject/sha2": "5.7.0", - "@ethersproject/signing-key": "5.7.0", - "@ethersproject/solidity": "5.7.0", - "@ethersproject/strings": "5.7.0", - "@ethersproject/transactions": "5.7.0", - "@ethersproject/units": "5.7.0", - "@ethersproject/wallet": "5.7.0", - "@ethersproject/web": "5.7.1", - "@ethersproject/wordlists": "5.7.0" - } - } - } - }, - "@nomicfoundation/ethereumjs-trie": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-trie/-/ethereumjs-trie-6.0.1.tgz", - "integrity": "sha512-A64It/IMpDVODzCgxDgAAla8jNjNtsoQZIzZUfIV5AY6Coi4nvn7+VReBn5itlxMiL2yaTlQr9TRWp3CSI6VoA==", - "dev": true, - "requires": { - "@nomicfoundation/ethereumjs-rlp": "5.0.1", - "@nomicfoundation/ethereumjs-util": "9.0.1", - "@types/readable-stream": "^2.3.13", - "ethereum-cryptography": "0.1.3", - "readable-stream": "^3.6.0" - } - }, - "@nomicfoundation/ethereumjs-tx": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-tx/-/ethereumjs-tx-5.0.1.tgz", - "integrity": "sha512-0HwxUF2u2hrsIM1fsasjXvlbDOq1ZHFV2dd1yGq8CA+MEYhaxZr8OTScpVkkxqMwBcc5y83FyPl0J9MZn3kY0w==", - "dev": true, - "requires": { - "@chainsafe/ssz": "^0.9.2", - "@ethersproject/providers": "^5.7.2", - "@nomicfoundation/ethereumjs-common": "4.0.1", - "@nomicfoundation/ethereumjs-rlp": "5.0.1", - "@nomicfoundation/ethereumjs-util": "9.0.1", - "ethereum-cryptography": "0.1.3" - } - }, - "@nomicfoundation/ethereumjs-util": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-util/-/ethereumjs-util-9.0.1.tgz", - "integrity": "sha512-TwbhOWQ8QoSCFhV/DDfSmyfFIHjPjFBj957219+V3jTZYZ2rf9PmDtNOeZWAE3p3vlp8xb02XGpd0v6nTUPbsA==", - "dev": true, - "requires": { - "@chainsafe/ssz": "^0.10.0", - "@nomicfoundation/ethereumjs-rlp": "5.0.1", - "ethereum-cryptography": "0.1.3" - }, - "dependencies": { - "@chainsafe/persistent-merkle-tree": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@chainsafe/persistent-merkle-tree/-/persistent-merkle-tree-0.5.0.tgz", - "integrity": "sha512-l0V1b5clxA3iwQLXP40zYjyZYospQLZXzBVIhhr9kDg/1qHZfzzHw0jj4VPBijfYCArZDlPkRi1wZaV2POKeuw==", - "dev": true, - "requires": { - "@chainsafe/as-sha256": "^0.3.1" - } - }, - "@chainsafe/ssz": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/@chainsafe/ssz/-/ssz-0.10.2.tgz", - "integrity": "sha512-/NL3Lh8K+0q7A3LsiFq09YXS9fPE+ead2rr7vM2QK8PLzrNsw3uqrif9bpRX5UxgeRjM+vYi+boCM3+GM4ovXg==", - "dev": true, - "requires": { - "@chainsafe/as-sha256": "^0.3.1", - "@chainsafe/persistent-merkle-tree": "^0.5.0" - } - } - } - }, - "@nomicfoundation/ethereumjs-vm": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-vm/-/ethereumjs-vm-7.0.1.tgz", - "integrity": "sha512-rArhyn0jPsS/D+ApFsz3yVJMQ29+pVzNZ0VJgkzAZ+7FqXSRtThl1C1prhmlVr3YNUlfpZ69Ak+RUT4g7VoOuQ==", - "dev": true, - "requires": { - "@nomicfoundation/ethereumjs-block": "5.0.1", - "@nomicfoundation/ethereumjs-blockchain": "7.0.1", - "@nomicfoundation/ethereumjs-common": "4.0.1", - "@nomicfoundation/ethereumjs-evm": "2.0.1", - "@nomicfoundation/ethereumjs-rlp": "5.0.1", - "@nomicfoundation/ethereumjs-statemanager": "2.0.1", - "@nomicfoundation/ethereumjs-trie": "6.0.1", - "@nomicfoundation/ethereumjs-tx": "5.0.1", - "@nomicfoundation/ethereumjs-util": "9.0.1", - "debug": "^4.3.3", - "ethereum-cryptography": "0.1.3", - "mcl-wasm": "^0.7.1", - "rustbn.js": "~0.2.0" - } - }, - "@nomicfoundation/hardhat-chai-matchers": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-chai-matchers/-/hardhat-chai-matchers-2.0.1.tgz", - "integrity": "sha512-qWKndseO8IPt8HiVamgEAutcBOYtX7/O6NPfe7uMNWxY2ywWaiWjDcRFuYYqxrZOMyQZl6ZuiHxbaRNctTUgLw==", - "dev": true, - "peer": true, - "requires": { - "@types/chai-as-promised": "^7.1.3", - "chai-as-promised": "^7.1.1", - "deep-eql": "^4.0.1", - "ordinal": "^1.0.3" - } - }, - "@nomicfoundation/hardhat-ethers": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-ethers/-/hardhat-ethers-3.0.2.tgz", - "integrity": "sha512-4Pu3OwyEvnq/gvW2IZ1Lnbcz4yCC4xqzbHze34mXkqbCwV2kHOx6jX3prFDWQ1koxtin725lAazGh9CJtTaYjg==", - "dev": true, - "peer": true, - "requires": { - "debug": "^4.1.1" - } - }, - "@nomicfoundation/hardhat-network-helpers": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-network-helpers/-/hardhat-network-helpers-1.0.8.tgz", - "integrity": "sha512-MNqQbzUJZnCMIYvlniC3U+kcavz/PhhQSsY90tbEtUyMj/IQqsLwIRZa4ctjABh3Bz0KCh9OXUZ7Yk/d9hr45Q==", - "dev": true, - "requires": { - "ethereumjs-util": "^7.1.4" - } - }, - "@nomicfoundation/hardhat-toolbox": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-toolbox/-/hardhat-toolbox-3.0.0.tgz", - "integrity": "sha512-MsteDXd0UagMksqm9KvcFG6gNKYNa3GGNCy73iQ6bEasEgg2v8Qjl6XA5hjs8o5UD5A3153B6W2BIVJ8SxYUtA==", - "dev": true, - "requires": {} - }, - "@nomicfoundation/hardhat-verify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-verify/-/hardhat-verify-1.0.1.tgz", - "integrity": "sha512-Z++nYMcgbCU3nXkWMVzqAPrhrIyRhrKErWHOWxj0k/GzlhindQzm/D3282mdV4bG9D5qz3+tse9kzhbi1ILCJA==", - "dev": true, - "peer": true, - "requires": { - "@ethersproject/abi": "^5.1.2", - "@ethersproject/address": "^5.0.2", - "cbor": "^8.1.0", - "chalk": "^2.4.2", - "debug": "^4.1.1", - "lodash.clonedeep": "^4.5.0", - "semver": "^6.3.0", - "table": "^6.8.0", - "undici": "^5.14.0" - } - }, - "@nomicfoundation/solidity-analyzer": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer/-/solidity-analyzer-0.1.1.tgz", - "integrity": "sha512-1LMtXj1puAxyFusBgUIy5pZk3073cNXYnXUpuNKFghHbIit/xZgbk0AokpUADbNm3gyD6bFWl3LRFh3dhVdREg==", - "dev": true, - "requires": { - "@nomicfoundation/solidity-analyzer-darwin-arm64": "0.1.1", - "@nomicfoundation/solidity-analyzer-darwin-x64": "0.1.1", - "@nomicfoundation/solidity-analyzer-freebsd-x64": "0.1.1", - "@nomicfoundation/solidity-analyzer-linux-arm64-gnu": "0.1.1", - "@nomicfoundation/solidity-analyzer-linux-arm64-musl": "0.1.1", - "@nomicfoundation/solidity-analyzer-linux-x64-gnu": "0.1.1", - "@nomicfoundation/solidity-analyzer-linux-x64-musl": "0.1.1", - "@nomicfoundation/solidity-analyzer-win32-arm64-msvc": "0.1.1", - "@nomicfoundation/solidity-analyzer-win32-ia32-msvc": "0.1.1", - "@nomicfoundation/solidity-analyzer-win32-x64-msvc": "0.1.1" - } - }, - "@nomicfoundation/solidity-analyzer-darwin-arm64": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-darwin-arm64/-/solidity-analyzer-darwin-arm64-0.1.1.tgz", - "integrity": "sha512-KcTodaQw8ivDZyF+D76FokN/HdpgGpfjc/gFCImdLUyqB6eSWVaZPazMbeAjmfhx3R0zm/NYVzxwAokFKgrc0w==", - "dev": true, - "optional": true - }, - "@nomicfoundation/solidity-analyzer-darwin-x64": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-darwin-x64/-/solidity-analyzer-darwin-x64-0.1.1.tgz", - "integrity": "sha512-XhQG4BaJE6cIbjAVtzGOGbK3sn1BO9W29uhk9J8y8fZF1DYz0Doj8QDMfpMu+A6TjPDs61lbsmeYodIDnfveSA==", - "dev": true, - "optional": true - }, - "@nomicfoundation/solidity-analyzer-freebsd-x64": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-freebsd-x64/-/solidity-analyzer-freebsd-x64-0.1.1.tgz", - "integrity": "sha512-GHF1VKRdHW3G8CndkwdaeLkVBi5A9u2jwtlS7SLhBc8b5U/GcoL39Q+1CSO3hYqePNP+eV5YI7Zgm0ea6kMHoA==", - "dev": true, - "optional": true - }, - "@nomicfoundation/solidity-analyzer-linux-arm64-gnu": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-arm64-gnu/-/solidity-analyzer-linux-arm64-gnu-0.1.1.tgz", - "integrity": "sha512-g4Cv2fO37ZsUENQ2vwPnZc2zRenHyAxHcyBjKcjaSmmkKrFr64yvzeNO8S3GBFCo90rfochLs99wFVGT/0owpg==", - "dev": true, - "optional": true - }, - "@nomicfoundation/solidity-analyzer-linux-arm64-musl": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-arm64-musl/-/solidity-analyzer-linux-arm64-musl-0.1.1.tgz", - "integrity": "sha512-WJ3CE5Oek25OGE3WwzK7oaopY8xMw9Lhb0mlYuJl/maZVo+WtP36XoQTb7bW/i8aAdHW5Z+BqrHMux23pvxG3w==", - "dev": true, - "optional": true - }, - "@nomicfoundation/solidity-analyzer-linux-x64-gnu": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-x64-gnu/-/solidity-analyzer-linux-x64-gnu-0.1.1.tgz", - "integrity": "sha512-5WN7leSr5fkUBBjE4f3wKENUy9HQStu7HmWqbtknfXkkil+eNWiBV275IOlpXku7v3uLsXTOKpnnGHJYI2qsdA==", - "dev": true, - "optional": true - }, - "@nomicfoundation/solidity-analyzer-linux-x64-musl": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-x64-musl/-/solidity-analyzer-linux-x64-musl-0.1.1.tgz", - "integrity": "sha512-KdYMkJOq0SYPQMmErv/63CwGwMm5XHenEna9X9aB8mQmhDBrYrlAOSsIPgFCUSL0hjxE3xHP65/EPXR/InD2+w==", - "dev": true, - "optional": true - }, - "@nomicfoundation/solidity-analyzer-win32-arm64-msvc": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-win32-arm64-msvc/-/solidity-analyzer-win32-arm64-msvc-0.1.1.tgz", - "integrity": "sha512-VFZASBfl4qiBYwW5xeY20exWhmv6ww9sWu/krWSesv3q5hA0o1JuzmPHR4LPN6SUZj5vcqci0O6JOL8BPw+APg==", - "dev": true, - "optional": true - }, - "@nomicfoundation/solidity-analyzer-win32-ia32-msvc": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-win32-ia32-msvc/-/solidity-analyzer-win32-ia32-msvc-0.1.1.tgz", - "integrity": "sha512-JnFkYuyCSA70j6Si6cS1A9Gh1aHTEb8kOTBApp/c7NRTFGNMH8eaInKlyuuiIbvYFhlXW4LicqyYuWNNq9hkpQ==", - "dev": true, - "optional": true - }, - "@nomicfoundation/solidity-analyzer-win32-x64-msvc": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-win32-x64-msvc/-/solidity-analyzer-win32-x64-msvc-0.1.1.tgz", - "integrity": "sha512-HrVJr6+WjIXGnw3Q9u6KQcbZCtk0caVWhCdFADySvRyUxJ8PnzlaP+MhwNE8oyT8OZ6ejHBRrrgjSqDCFXGirw==", - "dev": true, - "optional": true - }, - "@nomiclabs/hardhat-web3": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-web3/-/hardhat-web3-2.0.0.tgz", - "integrity": "sha512-zt4xN+D+fKl3wW2YlTX3k9APR3XZgPkxJYf36AcliJn3oujnKEVRZaHu0PhgLjO+gR+F/kiYayo9fgd2L8970Q==", - "dev": true, - "requires": { - "@types/bignumber.js": "^5.0.0" - } - }, - "@openzeppelin/contract-loader": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/@openzeppelin/contract-loader/-/contract-loader-0.6.3.tgz", - "integrity": "sha512-cOFIjBjwbGgZhDZsitNgJl0Ye1rd5yu/Yx5LMgeq3u0ZYzldm4uObzHDFq4gjDdoypvyORjjJa3BlFA7eAnVIg==", - "dev": true, - "requires": { - "find-up": "^4.1.0", - "fs-extra": "^8.1.0" - }, - "dependencies": { - "fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - } - } - }, - "@openzeppelin/contracts": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.9.0.tgz", - "integrity": "sha512-DUP74AFGKlic2sQb/CmgrN2aUPMFGxRrmCTUxLHsiU2RzwWqVuMPZBxiAyvlff6Pea77uylAX6B5x9W6evEbhA==" - }, - "@openzeppelin/contracts-upgradeable": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-4.9.0.tgz", - "integrity": "sha512-+6i2j6vr2fdudTqkBvG+UOosankukxYzg3WN1nqU7ijjQ5A4osWaD3ip6CEz6YvDoSdZgcFVZoiGr7zRlUUoZw==" - }, - "@openzeppelin/test-helpers": { - "version": "0.5.16", - "resolved": "https://registry.npmjs.org/@openzeppelin/test-helpers/-/test-helpers-0.5.16.tgz", - "integrity": "sha512-T1EvspSfH1qQO/sgGlskLfYVBbqzJR23SZzYl/6B2JnT4EhThcI85UpvDk0BkLWKaDScQTabGHt4GzHW+3SfZg==", - "dev": true, - "requires": { - "@openzeppelin/contract-loader": "^0.6.2", - "@truffle/contract": "^4.0.35", - "ansi-colors": "^3.2.3", - "chai": "^4.2.0", - "chai-bn": "^0.2.1", - "ethjs-abi": "^0.2.1", - "lodash.flatten": "^4.4.0", - "semver": "^5.6.0", - "web3": "^1.2.5", - "web3-utils": "^1.2.5" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true, - "peer": true - }, - "chai-bn": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/chai-bn/-/chai-bn-0.2.2.tgz", - "integrity": "sha512-MzjelH0p8vWn65QKmEq/DLBG1Hle4WeyqT79ANhXZhn/UxRWO0OogkAxi5oGGtfzwU9bZR8mvbvYdoqNVWQwFg==", - "dev": true, - "requires": {} - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, - "@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "dev": true, - "optional": true - }, - "@protobufjs/aspromise": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", - "dev": true, - "optional": true - }, - "@protobufjs/base64": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", - "dev": true, - "optional": true - }, - "@protobufjs/codegen": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", - "dev": true, - "optional": true - }, - "@protobufjs/eventemitter": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==", - "dev": true, - "optional": true - }, - "@protobufjs/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", - "dev": true, - "optional": true, - "requires": { - "@protobufjs/aspromise": "^1.1.1", - "@protobufjs/inquire": "^1.1.0" - } - }, - "@protobufjs/float": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", - "dev": true, - "optional": true - }, - "@protobufjs/inquire": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==", - "dev": true, - "optional": true - }, - "@protobufjs/path": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", - "dev": true, - "optional": true - }, - "@protobufjs/pool": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", - "dev": true, - "optional": true - }, - "@protobufjs/utf8": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", - "dev": true, - "optional": true - }, - "@redux-saga/core": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@redux-saga/core/-/core-1.2.3.tgz", - "integrity": "sha512-U1JO6ncFBAklFTwoQ3mjAeQZ6QGutsJzwNBjgVLSWDpZTRhobUzuVDS1qH3SKGJD8fvqoaYOjp6XJ3gCmeZWgA==", - "dev": true, - "requires": { - "@babel/runtime": "^7.6.3", - "@redux-saga/deferred": "^1.2.1", - "@redux-saga/delay-p": "^1.2.1", - "@redux-saga/is": "^1.1.3", - "@redux-saga/symbols": "^1.1.3", - "@redux-saga/types": "^1.2.1", - "redux": "^4.0.4", - "typescript-tuple": "^2.2.1" - }, - "dependencies": { - "redux": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz", - "integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==", - "dev": true, - "requires": { - "@babel/runtime": "^7.9.2" - } - } - } - }, - "@redux-saga/deferred": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@redux-saga/deferred/-/deferred-1.2.1.tgz", - "integrity": "sha512-cmin3IuuzMdfQjA0lG4B+jX+9HdTgHZZ+6u3jRAOwGUxy77GSlTi4Qp2d6PM1PUoTmQUR5aijlA39scWWPF31g==", - "dev": true - }, - "@redux-saga/delay-p": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@redux-saga/delay-p/-/delay-p-1.2.1.tgz", - "integrity": "sha512-MdiDxZdvb1m+Y0s4/hgdcAXntpUytr9g0hpcOO1XFVyyzkrDu3SKPgBFOtHn7lhu7n24ZKIAT1qtKyQjHqRd+w==", - "dev": true, - "requires": { - "@redux-saga/symbols": "^1.1.3" - } - }, - "@redux-saga/is": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@redux-saga/is/-/is-1.1.3.tgz", - "integrity": "sha512-naXrkETG1jLRfVfhOx/ZdLj0EyAzHYbgJWkXbB3qFliPcHKiWbv/ULQryOAEKyjrhiclmr6AMdgsXFyx7/yE6Q==", - "dev": true, - "requires": { - "@redux-saga/symbols": "^1.1.3", - "@redux-saga/types": "^1.2.1" - } - }, - "@redux-saga/symbols": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@redux-saga/symbols/-/symbols-1.1.3.tgz", - "integrity": "sha512-hCx6ZvU4QAEUojETnX8EVg4ubNLBFl1Lps4j2tX7o45x/2qg37m3c6v+kSp8xjDJY+2tJw4QB3j8o8dsl1FDXg==", - "dev": true - }, - "@redux-saga/types": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@redux-saga/types/-/types-1.2.1.tgz", - "integrity": "sha512-1dgmkh+3so0+LlBWRhGA33ua4MYr7tUOj+a9Si28vUi0IUFNbff1T3sgpeDJI/LaC75bBYnQ0A3wXjn0OrRNBA==", - "dev": true - }, - "@scure/base": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", - "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==", - "dev": true - }, - "@scure/bip32": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.1.5.tgz", - "integrity": "sha512-XyNh1rB0SkEqd3tXcXMi+Xe1fvg+kUIcoRIEujP1Jgv7DqW2r9lg3Ah0NkFaCs9sTkQAQA8kw7xiRXzENi9Rtw==", - "dev": true, - "requires": { - "@noble/hashes": "~1.2.0", - "@noble/secp256k1": "~1.7.0", - "@scure/base": "~1.1.0" - } - }, - "@scure/bip39": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.1.1.tgz", - "integrity": "sha512-t+wDck2rVkh65Hmv280fYdVdY25J9YeEUIgn2LG1WM6gxFkGzcksoDiUkWVpVp3Oex9xGC68JU2dSbUfwZ2jPg==", - "dev": true, - "requires": { - "@noble/hashes": "~1.2.0", - "@scure/base": "~1.1.0" - } - }, - "@sentry/core": { - "version": "5.30.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-5.30.0.tgz", - "integrity": "sha512-TmfrII8w1PQZSZgPpUESqjB+jC6MvZJZdLtE/0hZ+SrnKhW3x5WlYLvTXZpcWePYBku7rl2wn1RZu6uT0qCTeg==", - "dev": true, - "requires": { - "@sentry/hub": "5.30.0", - "@sentry/minimal": "5.30.0", - "@sentry/types": "5.30.0", - "@sentry/utils": "5.30.0", - "tslib": "^1.9.3" - } - }, - "@sentry/hub": { - "version": "5.30.0", - "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-5.30.0.tgz", - "integrity": "sha512-2tYrGnzb1gKz2EkMDQcfLrDTvmGcQPuWxLnJKXJvYTQDGLlEvi2tWz1VIHjunmOvJrB5aIQLhm+dcMRwFZDCqQ==", - "dev": true, - "requires": { - "@sentry/types": "5.30.0", - "@sentry/utils": "5.30.0", - "tslib": "^1.9.3" - } - }, - "@sentry/minimal": { - "version": "5.30.0", - "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-5.30.0.tgz", - "integrity": "sha512-BwWb/owZKtkDX+Sc4zCSTNcvZUq7YcH3uAVlmh/gtR9rmUvbzAA3ewLuB3myi4wWRAMEtny6+J/FN/x+2wn9Xw==", - "dev": true, - "requires": { - "@sentry/hub": "5.30.0", - "@sentry/types": "5.30.0", - "tslib": "^1.9.3" - } - }, - "@sentry/node": { - "version": "5.30.0", - "resolved": "https://registry.npmjs.org/@sentry/node/-/node-5.30.0.tgz", - "integrity": "sha512-Br5oyVBF0fZo6ZS9bxbJZG4ApAjRqAnqFFurMVJJdunNb80brh7a5Qva2kjhm+U6r9NJAB5OmDyPkA1Qnt+QVg==", - "dev": true, - "requires": { - "@sentry/core": "5.30.0", - "@sentry/hub": "5.30.0", - "@sentry/tracing": "5.30.0", - "@sentry/types": "5.30.0", - "@sentry/utils": "5.30.0", - "cookie": "^0.4.1", - "https-proxy-agent": "^5.0.0", - "lru_map": "^0.3.3", - "tslib": "^1.9.3" - } - }, - "@sentry/tracing": { - "version": "5.30.0", - "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-5.30.0.tgz", - "integrity": "sha512-dUFowCr0AIMwiLD7Fs314Mdzcug+gBVo/+NCMyDw8tFxJkwWAKl7Qa2OZxLQ0ZHjakcj1hNKfCQJ9rhyfOl4Aw==", - "dev": true, - "requires": { - "@sentry/hub": "5.30.0", - "@sentry/minimal": "5.30.0", - "@sentry/types": "5.30.0", - "@sentry/utils": "5.30.0", - "tslib": "^1.9.3" - } - }, - "@sentry/types": { - "version": "5.30.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-5.30.0.tgz", - "integrity": "sha512-R8xOqlSTZ+htqrfteCWU5Nk0CDN5ApUTvrlvBuiH1DyP6czDZ4ktbZB0hAgBlVcK0U+qpD3ag3Tqqpa5Q67rPw==", - "dev": true - }, - "@sentry/utils": { - "version": "5.30.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-5.30.0.tgz", - "integrity": "sha512-zaYmoH0NWWtvnJjC9/CBseXMtKHm/tm40sz3YfJRxeQjyzRqNQPgivpd9R/oDJCYj999mzdW382p/qi2ypjLww==", - "dev": true, - "requires": { - "@sentry/types": "5.30.0", - "tslib": "^1.9.3" - } - }, - "@sindresorhus/is": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", - "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", - "dev": true - }, - "@solidity-parser/parser": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.14.5.tgz", - "integrity": "sha512-6dKnHZn7fg/iQATVEzqyUOyEidbn05q7YA2mQ9hC0MMXhhV3/JrsxmFSYZAcr7j1yUP700LLhTruvJ3MiQmjJg==", - "dev": true, - "peer": true, - "requires": { - "antlr4ts": "^0.5.0-alpha.4" - } - }, - "@szmarczak/http-timer": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-5.0.1.tgz", - "integrity": "sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==", - "dev": true, - "requires": { - "defer-to-connect": "^2.0.1" - } - }, - "@truffle/abi-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@truffle/abi-utils/-/abi-utils-1.0.1.tgz", - "integrity": "sha512-ZQUY3XUxEPdqxNaoXsOqF0spTtb6f5RNlnN4MUrVsJ64sOh0FJsY7rxZiUI3khfePmNh4i2qcJrQlKT36YcWUA==", - "dev": true, - "requires": { - "change-case": "3.0.2", - "fast-check": "3.1.1", - "web3-utils": "1.10.0" - } - }, - "@truffle/blockchain-utils": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/@truffle/blockchain-utils/-/blockchain-utils-0.1.7.tgz", - "integrity": "sha512-1nibqGjEHC7KAyDThEFvbm2+EO8zAHee/VjCtxkYBE3ySwP50joh0QCEBjy7K/9z+icpMoDucfxmgaKToBFUgQ==", - "dev": true - }, - "@truffle/code-utils": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@truffle/code-utils/-/code-utils-3.0.3.tgz", - "integrity": "sha512-VMQMXvt/nXxWvHo5K1t697se1NU7VNh3zmiFw41qaSE1DjFZ2FMsZuW1ZoLhO4NKc14uB8k8pX3NN7XoF3uP4w==", - "dev": true, - "requires": { - "cbor": "^5.2.0" - }, - "dependencies": { - "bignumber.js": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", - "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==", - "dev": true - }, - "cbor": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/cbor/-/cbor-5.2.0.tgz", - "integrity": "sha512-5IMhi9e1QU76ppa5/ajP1BmMWZ2FHkhAhjeVKQ/EFCgYSEaeVaoGtL7cxJskf9oCCk+XjzaIdc3IuU/dbA/o2A==", - "dev": true, - "requires": { - "bignumber.js": "^9.0.1", - "nofilter": "^1.0.4" - } - }, - "nofilter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/nofilter/-/nofilter-1.0.4.tgz", - "integrity": "sha512-N8lidFp+fCz+TD51+haYdbDGrcBWwuHX40F5+z0qkUjMJ5Tp+rdSuAkMJ9N9eoolDlEVTf6u5icM+cNKkKW2mA==", - "dev": true - } - } - }, - "@truffle/codec": { - "version": "0.15.2", - "resolved": "https://registry.npmjs.org/@truffle/codec/-/codec-0.15.2.tgz", - "integrity": "sha512-rLLy1RmDq3stE1Bd6cnPO9kGpoB5QE4caY665ghmAURqlqD0ik1Bhbfi4MIRwM7YVx2sYw485qsxfPzlewnT4g==", - "dev": true, - "requires": { - "@truffle/abi-utils": "^1.0.1", - "@truffle/compile-common": "^0.9.6", - "big.js": "^6.0.3", - "bn.js": "^5.1.3", - "cbor": "^5.2.0", - "debug": "^4.3.1", - "lodash": "^4.17.21", - "semver": "7.3.7", - "utf8": "^3.0.0", - "web3-utils": "1.10.0" - }, - "dependencies": { - "bignumber.js": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", - "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==", - "dev": true - }, - "cbor": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/cbor/-/cbor-5.2.0.tgz", - "integrity": "sha512-5IMhi9e1QU76ppa5/ajP1BmMWZ2FHkhAhjeVKQ/EFCgYSEaeVaoGtL7cxJskf9oCCk+XjzaIdc3IuU/dbA/o2A==", - "dev": true, - "requires": { - "bignumber.js": "^9.0.1", - "nofilter": "^1.0.4" - } - }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "nofilter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/nofilter/-/nofilter-1.0.4.tgz", - "integrity": "sha512-N8lidFp+fCz+TD51+haYdbDGrcBWwuHX40F5+z0qkUjMJ5Tp+rdSuAkMJ9N9eoolDlEVTf6u5icM+cNKkKW2mA==", - "dev": true - }, - "semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } - } - }, - "@truffle/compile-common": { - "version": "0.9.6", - "resolved": "https://registry.npmjs.org/@truffle/compile-common/-/compile-common-0.9.6.tgz", - "integrity": "sha512-TCcmr1E0GqMZJ2tOaCRNEllxTBJ/g7TuD6jDJpw5Gt9Bw0YO3Cmp6yPQRynRSO4xMJbHUgiEsSfRgIhswut5UA==", - "dev": true, - "requires": { - "@truffle/error": "^0.2.1", - "colors": "1.4.0" - } - }, - "@truffle/config": { - "version": "1.3.57", - "resolved": "https://registry.npmjs.org/@truffle/config/-/config-1.3.57.tgz", - "integrity": "sha512-Cfude7ZMT2pykvMoHZ/47MvlVoZDQLs+Y85ChRw/1RKWsHrzz1BOyjDmnPLnSTOc056OuNOcgID1IdUMorVOIQ==", - "dev": true, - "optional": true, - "requires": { - "@truffle/error": "^0.2.1", - "@truffle/events": "^0.1.24", - "@truffle/provider": "^0.3.10", - "conf": "^10.1.2", - "debug": "^4.3.1", - "find-up": "^2.1.0", - "lodash": "^4.17.21", - "original-require": "^1.0.1" - }, - "dependencies": { - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", - "dev": true, - "optional": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", - "dev": true, - "optional": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "optional": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", - "dev": true, - "optional": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", - "dev": true, - "optional": true - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", - "dev": true, - "optional": true - } - } - }, - "@truffle/contract": { - "version": "4.6.22", - "resolved": "https://registry.npmjs.org/@truffle/contract/-/contract-4.6.22.tgz", - "integrity": "sha512-081tM5CBBLgTQX0Fhzp0nlZHnfgojRXweV7/d6v7LHe6QGrGBmgvUy3EIbO+R3P1uaxeGVijMvB4Ok8md9IpYQ==", - "dev": true, - "requires": { - "@ensdomains/ensjs": "^2.1.0", - "@truffle/blockchain-utils": "^0.1.7", - "@truffle/contract-schema": "^3.4.14", - "@truffle/debug-utils": "^6.0.50", - "@truffle/error": "^0.2.0", - "@truffle/interface-adapter": "^0.5.33", - "bignumber.js": "^7.2.1", - "debug": "^4.3.1", - "ethers": "^4.0.32", - "web3": "1.10.0", - "web3-core-helpers": "1.10.0", - "web3-core-promievent": "1.10.0", - "web3-eth-abi": "1.10.0", - "web3-utils": "1.10.0" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - }, - "ethers": { - "version": "4.0.49", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.49.tgz", - "integrity": "sha512-kPltTvWiyu+OktYy1IStSO16i2e7cS9D9OxZ81q2UUaiNPVrm/RTcbxamCXF9VUSKzJIdJV68EAIhTEVBalRWg==", - "dev": true, - "requires": { - "aes-js": "3.0.0", - "bn.js": "^4.11.9", - "elliptic": "6.5.4", - "hash.js": "1.1.3", - "js-sha3": "0.5.7", - "scrypt-js": "2.0.4", - "setimmediate": "1.0.4", - "uuid": "2.0.1", - "xmlhttprequest": "1.8.0" - } - }, - "hash.js": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", - "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.0" - } - }, - "js-sha3": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", - "integrity": "sha512-GII20kjaPX0zJ8wzkTbNDYMY7msuZcTWk8S5UOh6806Jq/wz1J8/bnr8uGU0DAUmYDjj2Mr4X1cW8v/GLYnR+g==", - "dev": true - }, - "scrypt-js": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.4.tgz", - "integrity": "sha512-4KsaGcPnuhtCZQCxFxN3GVYIhKFPTdLd8PLC552XwbMndtD0cjRFAhDuuydXQ0h08ZfPgzqe6EKHozpuH74iDw==", - "dev": true - }, - "setimmediate": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.4.tgz", - "integrity": "sha512-/TjEmXQVEzdod/FFskf3o7oOAsGhHf2j1dZqRFbDzq4F3mvvxflIIi4Hd3bLQE9y/CpwqfSQam5JakI/mi3Pog==", - "dev": true - }, - "uuid": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", - "integrity": "sha512-nWg9+Oa3qD2CQzHIP4qKUqwNfzKn8P0LtFhotaCTFchsV7ZfDhAybeip/HZVeMIpZi9JgY1E3nUlwaCmZT1sEg==", - "dev": true - } - } - }, - "@truffle/contract-schema": { - "version": "3.4.14", - "resolved": "https://registry.npmjs.org/@truffle/contract-schema/-/contract-schema-3.4.14.tgz", - "integrity": "sha512-IwVQZG9RVNwTdn321+jbFIcky3/kZLkCtq8tqil4jZwivvmZQg8rIVC8GJ7Lkrmixl9/yTyQNL6GtIUUvkZxyA==", - "dev": true, - "requires": { - "ajv": "^6.10.0", - "debug": "^4.3.1" - } - }, - "@truffle/dashboard-message-bus-client": { - "version": "0.1.11", - "resolved": "https://registry.npmjs.org/@truffle/dashboard-message-bus-client/-/dashboard-message-bus-client-0.1.11.tgz", - "integrity": "sha512-ABoKtaogh5KjOw0UM5/6wYuhg4T5cMPVSSNF1rv4j3s2XGzExx3vUObvXqNO6I8gZ8xuvzClw4RmcEk8JkM8yA==", - "dev": true, - "optional": true, - "requires": { - "@truffle/dashboard-message-bus-common": "^0.1.6", - "@truffle/promise-tracker": "^0.1.6", - "axios": "1.2.4", - "debug": "^4.3.1", - "delay": "^5.0.0", - "isomorphic-ws": "^4.0.1", - "node-abort-controller": "^3.0.1", - "tiny-typed-emitter": "^2.1.0", - "ws": "^7.2.0" - } - }, - "@truffle/dashboard-message-bus-common": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/@truffle/dashboard-message-bus-common/-/dashboard-message-bus-common-0.1.6.tgz", - "integrity": "sha512-93HNXILKeKgmW1YaWPdsQ55MJ0MaLzOA8kRXPnM5jF2H3KRlRxOeEg77R4YWtGH+cVZP4VYGXdpvUap/lOAnvw==", - "dev": true, - "optional": true - }, - "@truffle/db": { - "version": "2.0.28", - "resolved": "https://registry.npmjs.org/@truffle/db/-/db-2.0.28.tgz", - "integrity": "sha512-R9FfBeVxd/SEIdw6IrMwg2vLMNXuiHMJ5XwW7ivCSyNMYXesJMA85fWYPe9bWyJ8eufLOAWlX8xr55vua4DwZQ==", - "dev": true, - "optional": true, - "requires": { - "@graphql-tools/delegate": "^8.4.3", - "@graphql-tools/schema": "^8.3.1", - "@truffle/abi-utils": "^1.0.1", - "@truffle/code-utils": "^3.0.3", - "@truffle/config": "^1.3.57", - "abstract-leveldown": "^7.2.0", - "apollo-server": "^3.11.0", - "debug": "^4.3.1", - "fs-extra": "^9.1.0", - "graphql": "^15.3.0", - "graphql-tag": "^2.12.6", - "json-stable-stringify": "^1.0.1", - "pascal-case": "^2.0.1", - "pluralize": "^8.0.0", - "pouchdb": "7.3.0", - "pouchdb-adapter-memory": "^7.1.1", - "pouchdb-debug": "^7.1.1", - "pouchdb-find": "^7.0.0", - "web3-utils": "1.10.0" - }, - "dependencies": { - "fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "dev": true, - "optional": true, - "requires": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - } - }, - "jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, - "optional": true, - "requires": { - "graceful-fs": "^4.1.6", - "universalify": "^2.0.0" - } - }, - "universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "dev": true, - "optional": true - } - } - }, - "@truffle/db-loader": { - "version": "0.2.28", - "resolved": "https://registry.npmjs.org/@truffle/db-loader/-/db-loader-0.2.28.tgz", - "integrity": "sha512-oVXQXtYhM3Mu/pnfLR5KoqqEdw6GO6FDAFM7zZm647mIAtXCqv+EYSNt3efyqsFgQZwv3UZY6KP8TMxnjeWWGA==", - "dev": true, - "requires": { - "@truffle/db": "^2.0.28" - } - }, - "@truffle/debug-utils": { - "version": "6.0.50", - "resolved": "https://registry.npmjs.org/@truffle/debug-utils/-/debug-utils-6.0.50.tgz", - "integrity": "sha512-OWdSoOsPW7/jvcO7ASBRzXDzXQNb7dg8UqwoBAI7j7UpdQoCAhz7JQsusSNiFN6g1qrxEpGzeh5iIMDq9WxO3w==", - "dev": true, - "requires": { - "@truffle/codec": "^0.15.1", - "@trufflesuite/chromafi": "^3.0.0", - "bn.js": "^5.1.3", - "chalk": "^2.4.2", - "debug": "^4.3.1", - "highlightjs-solidity": "^2.0.6" - } - }, - "@truffle/debugger": { - "version": "11.1.4", - "resolved": "https://registry.npmjs.org/@truffle/debugger/-/debugger-11.1.4.tgz", - "integrity": "sha512-dWpf89fHZYaW/18x1ZfQhZozg3hZqxz7Czd6vIWVQc3OiV59xpA0+YLm+aumrebj6vmjqzGWu+iHfCaLiYhwQA==", - "dev": true, - "requires": { - "@ensdomains/ensjs": "^2.1.0", - "@truffle/abi-utils": "^1.0.1", - "@truffle/codec": "^0.15.2", - "@truffle/source-map-utils": "^1.3.113", - "bn.js": "^5.1.3", - "debug": "^4.3.1", - "json-pointer": "^0.6.1", - "json-stable-stringify": "^1.0.1", - "lodash": "^4.17.21", - "redux": "^3.7.2", - "redux-saga": "1.0.0", - "reselect-tree": "^1.3.7", - "semver": "7.3.7", - "web3": "1.10.0", - "web3-eth-abi": "1.10.0" - }, - "dependencies": { - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } - } - }, - "@truffle/error": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/@truffle/error/-/error-0.2.1.tgz", - "integrity": "sha512-5Qy+z9dg9hP37WNdLnXH4b9MzemWrjTufRq7/DTKqimjyxCP/1zlL8gQEMdiSx1BBtAZz0xypkID/jb7AF/Osg==", - "dev": true - }, - "@truffle/events": { - "version": "0.1.24", - "resolved": "https://registry.npmjs.org/@truffle/events/-/events-0.1.24.tgz", - "integrity": "sha512-rS+jKDjmdM0g+14H/H8MzhohaTKsSS6plNNzO95MIcUs0Ytinu1DXfSkUovDpgv5h2NcRoU0BMTKCR21Y3JiNw==", - "dev": true, - "optional": true, - "requires": { - "@truffle/dashboard-message-bus-client": "^0.1.11", - "@truffle/spinners": "^0.2.4", - "debug": "^4.3.1", - "emittery": "^0.4.1", - "web3-utils": "1.10.0" - } - }, - "@truffle/interface-adapter": { - "version": "0.5.34", - "resolved": "https://registry.npmjs.org/@truffle/interface-adapter/-/interface-adapter-0.5.34.tgz", - "integrity": "sha512-gPxabfMi2TueE4VxnNuyeudOfvGJQ1ofVC02PFw14cnRQhzH327JikjjQbZ1bT6S7kWl9H6P3hQPFeYFMHdm1g==", - "dev": true, - "requires": { - "bn.js": "^5.1.3", - "ethers": "^4.0.32", - "web3": "1.10.0" - }, - "dependencies": { - "ethers": { - "version": "4.0.49", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.49.tgz", - "integrity": "sha512-kPltTvWiyu+OktYy1IStSO16i2e7cS9D9OxZ81q2UUaiNPVrm/RTcbxamCXF9VUSKzJIdJV68EAIhTEVBalRWg==", - "dev": true, - "requires": { - "aes-js": "3.0.0", - "bn.js": "^4.11.9", - "elliptic": "6.5.4", - "hash.js": "1.1.3", - "js-sha3": "0.5.7", - "scrypt-js": "2.0.4", - "setimmediate": "1.0.4", - "uuid": "2.0.1", - "xmlhttprequest": "1.8.0" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - } - } - }, - "hash.js": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", - "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.0" - } - }, - "js-sha3": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", - "integrity": "sha512-GII20kjaPX0zJ8wzkTbNDYMY7msuZcTWk8S5UOh6806Jq/wz1J8/bnr8uGU0DAUmYDjj2Mr4X1cW8v/GLYnR+g==", - "dev": true - }, - "scrypt-js": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.4.tgz", - "integrity": "sha512-4KsaGcPnuhtCZQCxFxN3GVYIhKFPTdLd8PLC552XwbMndtD0cjRFAhDuuydXQ0h08ZfPgzqe6EKHozpuH74iDw==", - "dev": true - }, - "setimmediate": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.4.tgz", - "integrity": "sha512-/TjEmXQVEzdod/FFskf3o7oOAsGhHf2j1dZqRFbDzq4F3mvvxflIIi4Hd3bLQE9y/CpwqfSQam5JakI/mi3Pog==", - "dev": true - }, - "uuid": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", - "integrity": "sha512-nWg9+Oa3qD2CQzHIP4qKUqwNfzKn8P0LtFhotaCTFchsV7ZfDhAybeip/HZVeMIpZi9JgY1E3nUlwaCmZT1sEg==", - "dev": true - } - } - }, - "@truffle/promise-tracker": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/@truffle/promise-tracker/-/promise-tracker-0.1.6.tgz", - "integrity": "sha512-oUZ4Mc6Yt/qTvFZ/yD4nnUIN8pXhrBN0h4/SZ4e8W1TcHNvQkV6gUkkYkn8fZRvFwTMYjvWot+eAHHNRsSl/eA==", - "dev": true, - "optional": true - }, - "@truffle/provider": { - "version": "0.3.10", - "resolved": "https://registry.npmjs.org/@truffle/provider/-/provider-0.3.10.tgz", - "integrity": "sha512-oT7WKlxj1BrZBnCh9Dd4ex623yPG5ASAW5wK9kscS81MSkPYpSjld2B3tEZH9F6Lyz6lluQO1TcssuzZUek5Qg==", - "dev": true, - "optional": true, - "requires": { - "@truffle/error": "^0.2.1", - "@truffle/interface-adapter": "^0.5.34", - "debug": "^4.3.1", - "web3": "1.10.0" - } - }, - "@truffle/source-map-utils": { - "version": "1.3.113", - "resolved": "https://registry.npmjs.org/@truffle/source-map-utils/-/source-map-utils-1.3.113.tgz", - "integrity": "sha512-lzsocqZC0HIJYrPe+V3mSi9Pv0gu9vh8ETZJKe+8lr3prbeWEXeqZYXF+HI8Qw70cPE7or6L5A9d+wGVei5KNA==", - "dev": true, - "requires": { - "@truffle/code-utils": "^3.0.3", - "@truffle/codec": "^0.15.2", - "debug": "^4.3.1", - "json-pointer": "^0.6.1", - "node-interval-tree": "^1.3.3", - "web3-utils": "1.10.0" - } - }, - "@truffle/spinners": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/@truffle/spinners/-/spinners-0.2.4.tgz", - "integrity": "sha512-8GsIX9GzO6wBDGoNF4yAmQEe95TiIuAJq9p+2szCKGArYbAD3kbn+mG3TMS3Gr/zAS5p7fTJxnCm60E2HghsUQ==", - "dev": true, - "optional": true, - "requires": { - "@trufflesuite/spinnies": "^0.1.1" - } - }, - "@trufflesuite/chromafi": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@trufflesuite/chromafi/-/chromafi-3.0.0.tgz", - "integrity": "sha512-oqWcOqn8nT1bwlPPfidfzS55vqcIDdpfzo3HbU9EnUmcSTX+I8z0UyUFI3tZQjByVJulbzxHxUGS3ZJPwK/GPQ==", - "dev": true, - "requires": { - "camelcase": "^4.1.0", - "chalk": "^2.3.2", - "cheerio": "^1.0.0-rc.2", - "detect-indent": "^5.0.0", - "highlight.js": "^10.4.1", - "lodash.merge": "^4.6.2", - "strip-ansi": "^4.0.0", - "strip-indent": "^2.0.0" - } - }, - "@trufflesuite/spinnies": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@trufflesuite/spinnies/-/spinnies-0.1.1.tgz", - "integrity": "sha512-jltEtmFJj6xmQqr85gP8OqBHCEiId+zw+uAsb3DyLLRD17O6sySW6Afa2Z/jpzSafj+32ssDfLJ+c0of1NLqcA==", - "dev": true, - "optional": true, - "requires": { - "chalk": "^4.1.2", - "cli-cursor": "^3.1.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "optional": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "optional": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "optional": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "optional": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "optional": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "optional": true - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "optional": true, - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "optional": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@tsconfig/node10": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", - "dev": true, - "peer": true - }, - "@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true, - "peer": true - }, - "@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true, - "peer": true - }, - "@tsconfig/node16": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", - "dev": true, - "peer": true - }, - "@typechain/ethers-v6": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@typechain/ethers-v6/-/ethers-v6-0.4.0.tgz", - "integrity": "sha512-vD3Agzz63Gf2XlU3ed2/y+8dLWQj+wf+4Eq+0JXsyOio/plyV5F6r0yYe+s3XdGI858U3Sr263pl8mliDrUqbw==", - "dev": true, - "peer": true, - "requires": { - "lodash": "^4.17.15", - "ts-essentials": "^7.0.1" - } - }, - "@typechain/hardhat": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@typechain/hardhat/-/hardhat-8.0.0.tgz", - "integrity": "sha512-XUVbqlMx8tJTOmzZCD/r196CidtNWAnTBZRcYxjLTKgcJMvc/kHQpWBnVMMB5QHxVKpYpCiz8g07FYCpG8rrjA==", - "dev": true, - "peer": true, - "requires": { - "fs-extra": "^9.1.0" - }, - "dependencies": { - "fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "dev": true, - "peer": true, - "requires": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - } - }, - "jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, - "peer": true, - "requires": { - "graceful-fs": "^4.1.6", - "universalify": "^2.0.0" - } - }, - "universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "dev": true, - "peer": true - } - } - }, - "@types/accepts": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/@types/accepts/-/accepts-1.3.5.tgz", - "integrity": "sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==", - "dev": true, - "optional": true, - "requires": { - "@types/node": "*" - } - }, - "@types/bignumber.js": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@types/bignumber.js/-/bignumber.js-5.0.0.tgz", - "integrity": "sha512-0DH7aPGCClywOFaxxjE6UwpN2kQYe9LwuDQMv+zYA97j5GkOMo8e66LYT+a8JYU7jfmUFRZLa9KycxHDsKXJCA==", - "dev": true, - "requires": { - "bignumber.js": "*" - } - }, - "@types/bn.js": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", - "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/body-parser": { - "version": "1.19.2", - "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", - "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", - "dev": true, - "optional": true, - "requires": { - "@types/connect": "*", - "@types/node": "*" - } - }, - "@types/cacheable-request": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", - "integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==", - "dev": true, - "requires": { - "@types/http-cache-semantics": "*", - "@types/keyv": "^3.1.4", - "@types/node": "*", - "@types/responselike": "^1.0.0" - } - }, - "@types/chai": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.5.tgz", - "integrity": "sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng==", - "dev": true, - "peer": true - }, - "@types/chai-as-promised": { - "version": "7.1.5", - "resolved": "https://registry.npmjs.org/@types/chai-as-promised/-/chai-as-promised-7.1.5.tgz", - "integrity": "sha512-jStwss93SITGBwt/niYrkf2C+/1KTeZCZl1LaeezTlqppAKeoQC7jxyqYuP72sxBGKCIbw7oHgbYssIRzT5FCQ==", - "dev": true, - "peer": true, - "requires": { - "@types/chai": "*" - } - }, - "@types/concat-stream": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/@types/concat-stream/-/concat-stream-1.6.1.tgz", - "integrity": "sha512-eHE4cQPoj6ngxBZMvVf6Hw7Mh4jMW4U9lpGmS5GBPB9RYxlFg+CHaVN7ErNY4W9XfLIEn20b4VDYaIrbq0q4uA==", - "dev": true, - "peer": true, - "requires": { - "@types/node": "*" - } - }, - "@types/connect": { - "version": "3.4.35", - "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", - "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", - "dev": true, - "optional": true, - "requires": { - "@types/node": "*" - } - }, - "@types/cors": { - "version": "2.8.12", - "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.12.tgz", - "integrity": "sha512-vt+kDhq/M2ayberEtJcIN/hxXy1Pk+59g2FV/ZQceeaTyCtCucjL2Q7FXlFjtWn4n15KCr1NE2lNNFhp0lEThw==", - "dev": true, - "optional": true - }, - "@types/express": { - "version": "4.17.14", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.14.tgz", - "integrity": "sha512-TEbt+vaPFQ+xpxFLFssxUDXj5cWCxZJjIcB7Yg0k0GMHGtgtQgpvx/MUQUeAkNbA9AAGrwkAsoeItdTgS7FMyg==", - "dev": true, - "optional": true, - "requires": { - "@types/body-parser": "*", - "@types/express-serve-static-core": "^4.17.18", - "@types/qs": "*", - "@types/serve-static": "*" - } - }, - "@types/express-serve-static-core": { - "version": "4.17.35", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.35.tgz", - "integrity": "sha512-wALWQwrgiB2AWTT91CB62b6Yt0sNHpznUXeZEcnPU3DRdlDIz74x8Qg1UUYKSVFi+va5vKOLYRBI1bRKiLLKIg==", - "dev": true, - "optional": true, - "requires": { - "@types/node": "*", - "@types/qs": "*", - "@types/range-parser": "*", - "@types/send": "*" - } - }, - "@types/form-data": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-0.0.33.tgz", - "integrity": "sha512-8BSvG1kGm83cyJITQMZSulnl6QV8jqAGreJsc5tPu1Jq0vTSOiY/k24Wx82JRpWwZSqrala6sd5rWi6aNXvqcw==", - "dev": true, - "peer": true, - "requires": { - "@types/node": "*" - } - }, - "@types/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==", - "dev": true, - "peer": true, - "requires": { - "@types/minimatch": "*", - "@types/node": "*" - } - }, - "@types/http-cache-semantics": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", - "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==", - "dev": true - }, - "@types/keyv": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", - "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/long": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz", - "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==", - "dev": true, - "optional": true - }, - "@types/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-ssE3Vlrys7sdIzs5LOxCzTVMsU7i9oa/IaW92wF32JFb3CVczqOkru2xspuKczHEbG3nvmPY7IFqVmGGHdNbYw==", - "dev": true - }, - "@types/mime": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz", - "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==", - "dev": true, - "optional": true - }, - "@types/minimatch": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", - "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", - "dev": true, - "peer": true - }, - "@types/minimist": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz", - "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", - "dev": true - }, - "@types/mocha": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz", - "integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==", - "dev": true, - "peer": true - }, - "@types/node": { - "version": "20.2.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.2.5.tgz", - "integrity": "sha512-JJulVEQXmiY9Px5axXHeYGLSjhkZEnD+MDPDGbCbIAbMslkKwmygtZFy1X6s/075Yo94sf8GuSlFfPzysQrWZQ==", - "dev": true - }, - "@types/normalize-package-data": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", - "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", - "dev": true - }, - "@types/pbkdf2": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@types/pbkdf2/-/pbkdf2-3.1.0.tgz", - "integrity": "sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/prettier": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.3.tgz", - "integrity": "sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==", - "dev": true, - "peer": true - }, - "@types/qs": { - "version": "6.9.7", - "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", - "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==", - "dev": true - }, - "@types/range-parser": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", - "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", - "dev": true, - "optional": true - }, - "@types/readable-stream": { - "version": "2.3.15", - "resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-2.3.15.tgz", - "integrity": "sha512-oM5JSKQCcICF1wvGgmecmHldZ48OZamtMxcGGVICOJA8o8cahXC1zEVAif8iwoc5j8etxFaRFnf095+CDsuoFQ==", - "dev": true, - "requires": { - "@types/node": "*", - "safe-buffer": "~5.1.1" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - } - } - }, - "@types/responselike": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", - "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/secp256k1": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.3.tgz", - "integrity": "sha512-Da66lEIFeIz9ltsdMZcpQvmrmmoqrfju8pm1BH8WbYjZSwUgCwXLb9C+9XYogwBITnbsSaMdVPb2ekf7TV+03w==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/send": { - "version": "0.17.1", - "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.1.tgz", - "integrity": "sha512-Cwo8LE/0rnvX7kIIa3QHCkcuF21c05Ayb0ZfxPiv0W8VRiZiNW/WuRupHKpqqGVGf7SUA44QSOUKaEd9lIrd/Q==", - "dev": true, - "optional": true, - "requires": { - "@types/mime": "^1", - "@types/node": "*" - } - }, - "@types/serve-static": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.1.tgz", - "integrity": "sha512-NUo5XNiAdULrJENtJXZZ3fHtfMolzZwczzBbnAeBbqBwG+LaG6YaJtuwzwGSQZ2wsCrxjEhNNjAkKigy3n8teQ==", - "dev": true, - "optional": true, - "requires": { - "@types/mime": "*", - "@types/node": "*" - } - }, - "abbrev": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", - "integrity": "sha512-LEyx4aLEC3x6T0UguF6YILf+ntvmOaWsVfENmIW0E9H09vKlLDGelMjjSm0jkDHALj8A8quZ/HapKNigzwge+Q==", - "dev": true, - "peer": true - }, - "abort-controller": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", - "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", - "dev": true, - "requires": { - "event-target-shim": "^5.0.0" - } - }, - "abortcontroller-polyfill": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz", - "integrity": "sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ==", - "dev": true - }, - "abstract-level": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/abstract-level/-/abstract-level-1.0.3.tgz", - "integrity": "sha512-t6jv+xHy+VYwc4xqZMn2Pa9DjcdzvzZmQGRjTFc8spIbRGHgBrEKbPq+rYXc7CCo0lxgYvSgKVg9qZAhpVQSjA==", - "dev": true, - "requires": { - "buffer": "^6.0.3", - "catering": "^2.1.0", - "is-buffer": "^2.0.5", - "level-supports": "^4.0.0", - "level-transcoder": "^1.0.1", - "module-error": "^1.0.1", - "queue-microtask": "^1.2.3" - }, - "dependencies": { - "buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "dev": true, - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - } - } - }, - "abstract-leveldown": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz", - "integrity": "sha512-DnhQwcFEaYsvYDnACLZhMmCWd3rkOeEvglpa4q5i/5Jlm3UIsWaxVzuXvDLFCSCWRO3yy2/+V/G7FusFgejnfQ==", - "dev": true, - "optional": true, - "requires": { - "buffer": "^6.0.3", - "catering": "^2.0.0", - "is-buffer": "^2.0.5", - "level-concat-iterator": "^3.0.0", - "level-supports": "^2.0.1", - "queue-microtask": "^1.2.3" - }, - "dependencies": { - "buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "dev": true, - "optional": true, - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "level-supports": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-2.1.0.tgz", - "integrity": "sha512-E486g1NCjW5cF78KGPrMDRBYzPuueMZ6VBXHT6gC7A8UYWGiM14fGgp+s/L1oFfDWSPV/+SFkYCmZ0SiESkRKA==", - "dev": true, - "optional": true - } - } - }, - "accepts": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", - "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", - "dev": true, - "requires": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" - } - }, - "acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", - "dev": true - }, - "acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "requires": {} - }, - "acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true, - "peer": true - }, - "address": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/address/-/address-1.2.2.tgz", - "integrity": "sha512-4B/qKCfeE/ODUaAUpSwfzazo5x29WD4r3vXiWsB7I2mSDAihwEqKO+g8GELZUQSSAo5e1XTYh3ZVfLyxBc12nA==", - "dev": true, - "peer": true - }, - "adm-zip": { - "version": "0.4.16", - "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.16.tgz", - "integrity": "sha512-TFi4HBKSGfIKsK5YCkKaaFG2m4PEDyViZmEwof3MTIgzimHLto6muaHVpbrljdIvIrFZzEq/p4nafOeLcYegrg==", - "dev": true - }, - "aes-js": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", - "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==", - "dev": true - }, - "agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, - "requires": { - "debug": "4" - } - }, - "aggregate-error": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", - "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", - "dev": true, - "requires": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" - } - }, - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ajv-formats": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", - "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", - "dev": true, - "optional": true, - "requires": { - "ajv": "^8.0.0" - }, - "dependencies": { - "ajv": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", - "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", - "dev": true, - "optional": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - } - }, - "json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, - "optional": true - }, - "require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true, - "optional": true - } - } - }, - "amdefine": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg==", - "dev": true, - "optional": true, - "peer": true - }, - "ansi-colors": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz", - "integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==", - "dev": true - }, - "ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "requires": { - "type-fest": "^0.21.3" - }, - "dependencies": { - "type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true - } - } - }, - "ansi-regex": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", - "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "antlr4": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/antlr4/-/antlr4-4.13.0.tgz", - "integrity": "sha512-zooUbt+UscjnWyOrsuY/tVFL4rwrAGwOivpQmvmUDE22hy/lUA467Rc1rcixyRwcRUIXFYBwv7+dClDSHdmmew==", - "dev": true - }, - "antlr4ts": { - "version": "0.5.0-alpha.4", - "resolved": "https://registry.npmjs.org/antlr4ts/-/antlr4ts-0.5.0-alpha.4.tgz", - "integrity": "sha512-WPQDt1B74OfPv/IMS2ekXAKkTZIHl88uMetg6q3OTqgFxZ/dxDXI0EWLyZid/1Pe6hTftyg5N7gel5wNAGxXyQ==", - "dev": true - }, - "anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "apollo-datasource": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/apollo-datasource/-/apollo-datasource-3.3.2.tgz", - "integrity": "sha512-L5TiS8E2Hn/Yz7SSnWIVbZw0ZfEIXZCa5VUiVxD9P53JvSrf4aStvsFDlGWPvpIdCR+aly2CfoB79B9/JjKFqg==", - "dev": true, - "optional": true, - "requires": { - "@apollo/utils.keyvaluecache": "^1.0.1", - "apollo-server-env": "^4.2.1" - } - }, - "apollo-reporting-protobuf": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/apollo-reporting-protobuf/-/apollo-reporting-protobuf-3.4.0.tgz", - "integrity": "sha512-h0u3EbC/9RpihWOmcSsvTW2O6RXVaD/mPEjfrPkxRPTEPWqncsgOoRJw+wih4OqfH3PvTJvoEIf4LwKrUaqWog==", - "dev": true, - "optional": true, - "requires": { - "@apollo/protobufjs": "1.2.6" - }, - "dependencies": { - "@apollo/protobufjs": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@apollo/protobufjs/-/protobufjs-1.2.6.tgz", - "integrity": "sha512-Wqo1oSHNUj/jxmsVp4iR3I480p6qdqHikn38lKrFhfzcDJ7lwd7Ck7cHRl4JE81tWNArl77xhnG/OkZhxKBYOw==", - "dev": true, - "optional": true, - "requires": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/long": "^4.0.0", - "@types/node": "^10.1.0", - "long": "^4.0.0" - } - }, - "@types/node": { - "version": "10.17.60", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.60.tgz", - "integrity": "sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==", - "dev": true, - "optional": true - } - } - }, - "apollo-server": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/apollo-server/-/apollo-server-3.12.0.tgz", - "integrity": "sha512-wZHLgBoIdGxr/YpPTG5RwNnS+B2y70T/nCegCnU6Yl+H3PXB92OIguLMhdJIZVjukIOhiQT12dNIehqLQ+1hMQ==", - "dev": true, - "optional": true, - "requires": { - "@types/express": "4.17.14", - "apollo-server-core": "^3.12.0", - "apollo-server-express": "^3.12.0", - "express": "^4.17.1" - } - }, - "apollo-server-core": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/apollo-server-core/-/apollo-server-core-3.12.0.tgz", - "integrity": "sha512-hq7iH6Cgldgmnjs9FVSZeKWRpi0/ZR+iJ1arzeD2VXGxxgk1mAm/cz1Tx0TYgegZI+FvvrRl0UhKEx7sLnIxIg==", - "dev": true, - "optional": true, - "requires": { - "@apollo/utils.keyvaluecache": "^1.0.1", - "@apollo/utils.logger": "^1.0.0", - "@apollo/utils.usagereporting": "^1.0.0", - "@apollographql/apollo-tools": "^0.5.3", - "@apollographql/graphql-playground-html": "1.6.29", - "@graphql-tools/mock": "^8.1.2", - "@graphql-tools/schema": "^8.0.0", - "@josephg/resolvable": "^1.0.0", - "apollo-datasource": "^3.3.2", - "apollo-reporting-protobuf": "^3.4.0", - "apollo-server-env": "^4.2.1", - "apollo-server-errors": "^3.3.1", - "apollo-server-plugin-base": "^3.7.2", - "apollo-server-types": "^3.8.0", - "async-retry": "^1.2.1", - "fast-json-stable-stringify": "^2.1.0", - "graphql-tag": "^2.11.0", - "loglevel": "^1.6.8", - "lru-cache": "^6.0.0", - "node-abort-controller": "^3.0.1", - "sha.js": "^2.4.11", - "uuid": "^9.0.0", - "whatwg-mimetype": "^3.0.0" - }, - "dependencies": { - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "optional": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "uuid": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", - "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", - "dev": true, - "optional": true - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true, - "optional": true - } - } - }, - "apollo-server-env": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/apollo-server-env/-/apollo-server-env-4.2.1.tgz", - "integrity": "sha512-vm/7c7ld+zFMxibzqZ7SSa5tBENc4B0uye9LTfjJwGoQFY5xsUPH5FpO5j0bMUDZ8YYNbrF9SNtzc5Cngcr90g==", - "dev": true, - "optional": true, - "requires": { - "node-fetch": "^2.6.7" - } - }, - "apollo-server-errors": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/apollo-server-errors/-/apollo-server-errors-3.3.1.tgz", - "integrity": "sha512-xnZJ5QWs6FixHICXHxUfm+ZWqqxrNuPlQ+kj5m6RtEgIpekOPssH/SD9gf2B4HuWV0QozorrygwZnux8POvyPA==", - "dev": true, - "optional": true, - "requires": {} - }, - "apollo-server-express": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/apollo-server-express/-/apollo-server-express-3.12.0.tgz", - "integrity": "sha512-m8FaGPUfDOEGSm7QRWRmUUGjG/vqvpQoorkId9/FXkC57fz/A59kEdrzkMt9538Xgsa5AV+X4MEWLJhTvlW3LQ==", - "dev": true, - "optional": true, - "requires": { - "@types/accepts": "^1.3.5", - "@types/body-parser": "1.19.2", - "@types/cors": "2.8.12", - "@types/express": "4.17.14", - "@types/express-serve-static-core": "4.17.31", - "accepts": "^1.3.5", - "apollo-server-core": "^3.12.0", - "apollo-server-types": "^3.8.0", - "body-parser": "^1.19.0", - "cors": "^2.8.5", - "parseurl": "^1.3.3" - }, - "dependencies": { - "@types/express-serve-static-core": { - "version": "4.17.31", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.31.tgz", - "integrity": "sha512-DxMhY+NAsTwMMFHBTtJFNp5qiHKJ7TeqOo23zVEM9alT1Ml27Q3xcTH0xwxn7Q0BbMcVEJOs/7aQtUWupUQN3Q==", - "dev": true, - "optional": true, - "requires": { - "@types/node": "*", - "@types/qs": "*", - "@types/range-parser": "*" - } - } - } - }, - "apollo-server-plugin-base": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/apollo-server-plugin-base/-/apollo-server-plugin-base-3.7.2.tgz", - "integrity": "sha512-wE8dwGDvBOGehSsPTRZ8P/33Jan6/PmL0y0aN/1Z5a5GcbFhDaaJCjK5cav6npbbGL2DPKK0r6MPXi3k3N45aw==", - "dev": true, - "optional": true, - "requires": { - "apollo-server-types": "^3.8.0" - } - }, - "apollo-server-types": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/apollo-server-types/-/apollo-server-types-3.8.0.tgz", - "integrity": "sha512-ZI/8rTE4ww8BHktsVpb91Sdq7Cb71rdSkXELSwdSR0eXu600/sY+1UXhTWdiJvk+Eq5ljqoHLwLbY2+Clq2b9A==", - "dev": true, - "optional": true, - "requires": { - "@apollo/utils.keyvaluecache": "^1.0.1", - "@apollo/utils.logger": "^1.0.0", - "apollo-reporting-protobuf": "^3.4.0", - "apollo-server-env": "^4.2.1" - } - }, - "app-module-path": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/app-module-path/-/app-module-path-2.2.0.tgz", - "integrity": "sha512-gkco+qxENJV+8vFcDiiFhuoSvRXb2a/QPqpSoWhVz829VNJfOTnELbBmPmNKFxf3xdNnw4DWCkzkDaavcX/1YQ==", - "dev": true - }, - "arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true, - "peer": true - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "args": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/args/-/args-5.0.3.tgz", - "integrity": "sha512-h6k/zfFgusnv3i5TU08KQkVKuCPBtL/PWQbWkHUxvJrZ2nAyeaUupneemcrgn1xmqxPQsPIzwkUhOpoqPDRZuA==", - "dev": true, - "requires": { - "camelcase": "5.0.0", - "chalk": "2.4.2", - "leven": "2.1.0", - "mri": "1.1.4" - }, - "dependencies": { - "camelcase": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.0.0.tgz", - "integrity": "sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==", - "dev": true - } - } - }, - "argsarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/argsarray/-/argsarray-0.0.1.tgz", - "integrity": "sha512-u96dg2GcAKtpTrBdDoFIM7PjcBA+6rSP0OR94MOReNRyUECL6MtQt5XXmRr4qrftYaef9+l5hcpO5te7sML1Cg==", - "dev": true, - "optional": true - }, - "array-back": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz", - "integrity": "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==", - "dev": true, - "peer": true - }, - "array-buffer-byte-length": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", - "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", - "dev": true, - "peer": true, - "requires": { - "call-bind": "^1.0.2", - "is-array-buffer": "^3.0.1" - } - }, - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", - "dev": true - }, - "array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "peer": true - }, - "array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q==", - "dev": true, - "peer": true - }, - "array.prototype.reduce": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/array.prototype.reduce/-/array.prototype.reduce-1.0.5.tgz", - "integrity": "sha512-kDdugMl7id9COE8R7MHF5jWk7Dqt/fs4Pv+JXoICnYwqpjjjbUurz6w5fT5IG6brLdJhv6/VoHB0H7oyIBXd+Q==", - "dev": true, - "peer": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4", - "es-array-method-boxes-properly": "^1.0.0", - "is-string": "^1.0.7" - } - }, - "arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", - "dev": true - }, - "asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", - "dev": true, - "peer": true - }, - "asn1": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", - "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", - "dev": true, - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", - "dev": true - }, - "assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true - }, - "ast-parents": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/ast-parents/-/ast-parents-0.0.1.tgz", - "integrity": "sha512-XHusKxKz3zoYk1ic8Un640joHbFMhbqneyoZfoKnEGtf2ey9Uh/IdpcQplODdO/kENaMIWsD0nJm4+wX3UNLHA==", - "dev": true - }, - "astral-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", - "dev": true - }, - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha512-nSVgobk4rv61R9PUSDtYt7mPVB2olxNR5RWJcAsH676/ef11bUZwvu7+RGYrYauVdDPcO519v68wRhXQtxsV9w==", - "dev": true, - "peer": true - }, - "async-limiter": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", - "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", - "dev": true - }, - "async-retry": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz", - "integrity": "sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==", - "dev": true, - "optional": true, - "requires": { - "retry": "0.13.1" - } - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true - }, - "at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "dev": true - }, - "atomic-sleep": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", - "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", - "dev": true - }, - "atomically": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/atomically/-/atomically-1.7.0.tgz", - "integrity": "sha512-Xcz9l0z7y9yQ9rdDaxlmaI4uJHf/T8g9hOEzJcsEqX2SjCj4J20uK7+ldkDHMbpJDK76wF7xEIgxc/vSlsfw5w==", - "dev": true, - "optional": true - }, - "available-typed-arrays": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", - "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", - "dev": true - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", - "dev": true - }, - "aws4": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz", - "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==", - "dev": true - }, - "axios": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.4.tgz", - "integrity": "sha512-lIQuCfBJvZB/Bv7+RWUqEJqNShGOVpk9v7P0ZWx5Ip0qY6u7JBAU6dzQPMLasU9vHL2uD8av/1FDJXj7n6c39w==", - "dev": true, - "optional": true, - "requires": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - }, - "dependencies": { - "form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dev": true, - "optional": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - } - } - }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "base-x": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", - "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", - "dev": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "dev": true - }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", - "dev": true, - "requires": { - "tweetnacl": "^0.14.3" - }, - "dependencies": { - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", - "dev": true - } - } - }, - "bech32": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", - "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==", - "dev": true - }, - "big-integer": { - "version": "1.6.36", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.36.tgz", - "integrity": "sha512-t70bfa7HYEA1D9idDbmuv7YbsbVkQ+Hp+8KFSul4aE5e/i1bjCNIRYJZlA8Q8p0r9T8cF/RVvwUgRA//FydEyg==", - "dev": true - }, - "big.js": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-6.2.1.tgz", - "integrity": "sha512-bCtHMwL9LeDIozFn+oNhhFoq+yQ3BNdnsLSASUxLciOb1vgvpHsIO1dsENiGMgbb4SkP5TrzWzRiLddn8ahVOQ==", - "dev": true - }, - "bigint-crypto-utils": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/bigint-crypto-utils/-/bigint-crypto-utils-3.2.2.tgz", - "integrity": "sha512-U1RbE3aX9ayCUVcIPHuPDPKcK3SFOXf93J1UK/iHlJuQB7bhagPIX06/CLpLEsDThJ7KA4Dhrnzynl+d2weTiw==", - "dev": true - }, - "bignumber.js": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-7.2.1.tgz", - "integrity": "sha512-S4XzBk5sMB+Rcb/LNcpzXr57VRTxgAvaAEDAl1AwRx27j00hT84O6OkteE7u8UB3NuaaygCRrEpqox4uDOrbdQ==", - "dev": true - }, - "binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true - }, - "blakejs": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", - "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==", - "dev": true - }, - "bluebird": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", - "dev": true - }, - "bn.js": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", - "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", - "dev": true - }, - "body-parser": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", - "dev": true, - "requires": { - "bytes": "3.1.2", - "content-type": "~1.0.5", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.2", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - }, - "qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", - "dev": true, - "requires": { - "side-channel": "^1.0.4" - } - } - } - }, - "boolbase": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", - "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==", - "dev": true - }, - "browser-level": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browser-level/-/browser-level-1.0.1.tgz", - "integrity": "sha512-XECYKJ+Dbzw0lbydyQuJzwNXtOpbMSq737qxJN11sIRTErOMShvDpbzTlgju7orJKvx4epULolZAuJGLzCmWRQ==", - "dev": true, - "requires": { - "abstract-level": "^1.0.2", - "catering": "^2.1.1", - "module-error": "^1.0.2", - "run-parallel-limit": "^1.1.0" - } - }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "browserify-aes": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", - "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", - "dev": true, - "requires": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "bs58": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", - "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", - "dev": true, - "requires": { - "base-x": "^3.0.2" - } - }, - "bs58check": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", - "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", - "dev": true, - "requires": { - "bs58": "^4.0.0", - "create-hash": "^1.1.0", - "safe-buffer": "^5.1.2" - } - }, - "buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "dev": true, - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true - }, - "buffer-to-arraybuffer": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", - "integrity": "sha512-3dthu5CYiVB1DEJp61FtApNnNndTckcqe4pFcLdvHtrpG+kcyekCJKg4MRiDcFW7A6AODnXB9U4dwQiCW5kzJQ==", - "dev": true - }, - "buffer-xor": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", - "integrity": "sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==", - "dev": true - }, - "bufferutil": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz", - "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", - "dev": true, - "requires": { - "node-gyp-build": "^4.3.0" - } - }, - "busboy": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", - "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", - "dev": true, - "requires": { - "streamsearch": "^1.1.0" - } - }, - "bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", - "dev": true - }, - "cacheable-lookup": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-6.1.0.tgz", - "integrity": "sha512-KJ/Dmo1lDDhmW2XDPMo+9oiy/CeqosPguPCrgcVzKyZrL6pM1gU2GmPY/xo6OQPTUaA/c0kwHuywB4E6nmT9ww==", - "dev": true - }, - "cacheable-request": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.2.tgz", - "integrity": "sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==", - "dev": true, - "requires": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^4.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^6.0.1", - "responselike": "^2.0.0" - }, - "dependencies": { - "get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", - "dev": true - } - } - }, - "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dev": true, - "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - } - }, - "callsite": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", - "integrity": "sha512-0vdNRFXn5q+dtOqjfFtmtlI9N2eVZ7LMyEV2iKC5mEEFvSg/69Ml6b/WU2qF8W1nLRa0wiSrDT3Y5jOHZCwKPQ==", - "dev": true - }, - "callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true - }, - "camel-case": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz", - "integrity": "sha512-+MbKztAYHXPr1jNTSKQF52VpcFjwY5RkR7fxksV8Doo4KAYc5Fl4UJRgthBbTmEx8C54DqahhbLJkDwjI3PI/w==", - "dev": true, - "requires": { - "no-case": "^2.2.0", - "upper-case": "^1.1.1" - } - }, - "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha512-FxAv7HpHrXbh3aPo4o2qxHay2lkLY3x5Mw3KeE4KQE8ysVfziWeRZDwcjauvwBSGEC/nXUPzZy8zeh4HokqOnw==", - "dev": true - }, - "camelcase-keys": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", - "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", - "dev": true, - "requires": { - "camelcase": "^5.3.1", - "map-obj": "^4.0.0", - "quick-lru": "^4.0.1" - }, - "dependencies": { - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - } - } - }, - "case": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/case/-/case-1.6.3.tgz", - "integrity": "sha512-mzDSXIPaFwVDvZAHqZ9VlbyF4yyXRuX6IvB06WvPYkqJVO24kX1PPhv9bfpKNFZyxYFmmgo03HUiD8iklmJYRQ==", - "dev": true - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", - "dev": true - }, - "catering": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/catering/-/catering-2.1.1.tgz", - "integrity": "sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w==", - "dev": true - }, - "cbor": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/cbor/-/cbor-8.1.0.tgz", - "integrity": "sha512-DwGjNW9omn6EwP70aXsn7FQJx5kO12tX0bZkaTjzdVFM6/7nhA4t0EENocKGx6D2Bch9PE2KzCUf5SceBdeijg==", - "dev": true, - "peer": true, - "requires": { - "nofilter": "^3.1.0" - } - }, - "chai": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", - "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", - "dev": true, - "requires": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^4.1.2", - "get-func-name": "^2.0.0", - "loupe": "^2.3.1", - "pathval": "^1.1.1", - "type-detect": "^4.0.5" - } - }, - "chai-as-promised": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz", - "integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==", - "dev": true, - "peer": true, - "requires": { - "check-error": "^1.0.2" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "change-case": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/change-case/-/change-case-3.0.2.tgz", - "integrity": "sha512-Mww+SLF6MZ0U6kdg11algyKd5BARbyM4TbFBepwowYSR5ClfQGCGtxNXgykpN0uF/bstWeaGDT4JWaDh8zWAHA==", - "dev": true, - "requires": { - "camel-case": "^3.0.0", - "constant-case": "^2.0.0", - "dot-case": "^2.1.0", - "header-case": "^1.0.0", - "is-lower-case": "^1.1.0", - "is-upper-case": "^1.1.0", - "lower-case": "^1.1.1", - "lower-case-first": "^1.0.0", - "no-case": "^2.3.2", - "param-case": "^2.1.0", - "pascal-case": "^2.0.0", - "path-case": "^2.1.0", - "sentence-case": "^2.1.0", - "snake-case": "^2.1.0", - "swap-case": "^1.1.0", - "title-case": "^2.1.0", - "upper-case": "^1.1.1", - "upper-case-first": "^1.1.0" - } - }, - "charenc": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", - "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", - "dev": true, - "peer": true - }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", - "dev": true - }, - "cheerio": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.12.tgz", - "integrity": "sha512-VqR8m68vM46BNnuZ5NtnGBKIE/DfN0cRIzg9n40EIq9NOv90ayxLBXA8fXC5gquFRGJSTRqBq25Jt2ECLR431Q==", - "dev": true, - "requires": { - "cheerio-select": "^2.1.0", - "dom-serializer": "^2.0.0", - "domhandler": "^5.0.3", - "domutils": "^3.0.1", - "htmlparser2": "^8.0.1", - "parse5": "^7.0.0", - "parse5-htmlparser2-tree-adapter": "^7.0.0" - } - }, - "cheerio-select": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz", - "integrity": "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==", - "dev": true, - "requires": { - "boolbase": "^1.0.0", - "css-select": "^5.1.0", - "css-what": "^6.1.0", - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3", - "domutils": "^3.0.1" - } - }, - "chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, - "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "dependencies": { - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - } - } - }, - "chownr": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", - "dev": true - }, - "ci-info": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", - "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", - "dev": true - }, - "cids": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/cids/-/cids-0.7.5.tgz", - "integrity": "sha512-zT7mPeghoWAu+ppn8+BS1tQ5qGmbMfB4AregnQjA/qHY3GC1m1ptI9GkWNlgeu38r7CuRdXB47uY2XgAYt6QVA==", - "dev": true, - "requires": { - "buffer": "^5.5.0", - "class-is": "^1.1.0", - "multibase": "~0.6.0", - "multicodec": "^1.0.0", - "multihashes": "~0.4.15" - }, - "dependencies": { - "multicodec": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz", - "integrity": "sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg==", - "dev": true, - "requires": { - "buffer": "^5.6.0", - "varint": "^5.0.0" - } - } - } - }, - "cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "class-is": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/class-is/-/class-is-1.1.0.tgz", - "integrity": "sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw==", - "dev": true - }, - "classic-level": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/classic-level/-/classic-level-1.3.0.tgz", - "integrity": "sha512-iwFAJQYtqRTRM0F6L8h4JCt00ZSGdOyqh7yVrhhjrOpFhmBjNlRUey64MCiyo6UmQHMJ+No3c81nujPv+n9yrg==", - "dev": true, - "requires": { - "abstract-level": "^1.0.2", - "catering": "^2.1.0", - "module-error": "^1.0.1", - "napi-macros": "^2.2.2", - "node-gyp-build": "^4.3.0" - } - }, - "clean-stack": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", - "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", - "dev": true - }, - "cli-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "dev": true, - "optional": true, - "requires": { - "restore-cursor": "^3.1.0" - } - }, - "cli-table3": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.3.tgz", - "integrity": "sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==", - "dev": true, - "requires": { - "@colors/colors": "1.5.0", - "string-width": "^4.2.0" - } - }, - "cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - } - } - }, - "clone-buffer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz", - "integrity": "sha512-KLLTJWrvwIP+OPfMn0x2PheDEP20RPUcGXj/ERegTgdmPEZylALQldygiqrPPu8P45uNuPs7ckmReLY6v/iA5g==", - "dev": true, - "optional": true - }, - "clone-response": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz", - "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", - "dev": true, - "requires": { - "mimic-response": "^1.0.0" - } - }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==", - "dev": true - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "colors": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", - "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", - "dev": true - }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "command-exists": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", - "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==", - "dev": true - }, - "command-line-args": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.1.tgz", - "integrity": "sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg==", - "dev": true, - "peer": true, - "requires": { - "array-back": "^3.1.0", - "find-replace": "^3.0.0", - "lodash.camelcase": "^4.3.0", - "typical": "^4.0.0" - } - }, - "command-line-usage": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-6.1.3.tgz", - "integrity": "sha512-sH5ZSPr+7UStsloltmDh7Ce5fb8XPlHyoPzTpyyMuYCtervL65+ubVZ6Q61cFtFl62UyJlc8/JwERRbAFPUqgw==", - "dev": true, - "peer": true, - "requires": { - "array-back": "^4.0.2", - "chalk": "^2.4.2", - "table-layout": "^1.0.2", - "typical": "^5.2.0" - }, - "dependencies": { - "array-back": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz", - "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==", - "dev": true, - "peer": true - }, - "typical": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", - "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", - "dev": true, - "peer": true - } - } - }, - "commander": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", - "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true - }, - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, - "peer": true, - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", - "dev": true, - "peer": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true, - "peer": true - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "peer": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "conf": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/conf/-/conf-10.2.0.tgz", - "integrity": "sha512-8fLl9F04EJqjSqH+QjITQfJF8BrOVaYr1jewVgSRAEWePfxT0sku4w2hrGQ60BC/TNLGQ2pgxNlTbWQmMPFvXg==", - "dev": true, - "optional": true, - "requires": { - "ajv": "^8.6.3", - "ajv-formats": "^2.1.1", - "atomically": "^1.7.0", - "debounce-fn": "^4.0.0", - "dot-prop": "^6.0.1", - "env-paths": "^2.2.1", - "json-schema-typed": "^7.0.3", - "onetime": "^5.1.2", - "pkg-up": "^3.1.0", - "semver": "^7.3.5" - }, - "dependencies": { - "ajv": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", - "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", - "dev": true, - "optional": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - } - }, - "json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, - "optional": true - }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "optional": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true, - "optional": true - }, - "semver": { - "version": "7.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", - "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", - "dev": true, - "optional": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true, - "optional": true - } - } - }, - "constant-case": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/constant-case/-/constant-case-2.0.0.tgz", - "integrity": "sha512-eS0N9WwmjTqrOmR3o83F5vW8Z+9R1HnVz3xmzT2PMFug9ly+Au/fxRWlEBSb6LcZwspSsEn9Xs1uw9YgzAg1EQ==", - "dev": true, - "requires": { - "snake-case": "^2.1.0", - "upper-case": "^1.1.1" - } - }, - "content-disposition": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", - "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", - "dev": true, - "requires": { - "safe-buffer": "5.2.1" - } - }, - "content-hash": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/content-hash/-/content-hash-2.5.2.tgz", - "integrity": "sha512-FvIQKy0S1JaWV10sMsA7TRx8bpU+pqPkhbsfvOJAdjRXvYxEckAwQWGwtRjiaJfh+E0DvcWUGqcdjwMGFjsSdw==", - "dev": true, - "requires": { - "cids": "^0.7.1", - "multicodec": "^0.5.5", - "multihashes": "^0.4.15" - } - }, - "content-type": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", - "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", - "dev": true - }, - "cookie": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", - "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", - "dev": true - }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", - "dev": true - }, - "cors": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", - "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", - "dev": true, - "requires": { - "object-assign": "^4", - "vary": "^1" - } - }, - "cosmiconfig": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.1.3.tgz", - "integrity": "sha512-/UkO2JKI18b5jVMJUp0lvKFMpa/Gye+ZgZjKD+DGEN9y7NRcf/nK1A0sp67ONmKtnDCNMS44E6jrk0Yc3bDuUw==", - "dev": true, - "requires": { - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "parse-json": "^5.0.0", - "path-type": "^4.0.0" - }, - "dependencies": { - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - } - } - }, - "coveralls": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.1.1.tgz", - "integrity": "sha512-+dxnG2NHncSD1NrqbSM3dn/lE57O6Qf/koe9+I7c+wzkqRmEvcp0kgJdxKInzYzkICKkFMZsX3Vct3++tsF9ww==", - "dev": true, - "requires": { - "js-yaml": "^3.13.1", - "lcov-parse": "^1.0.0", - "log-driver": "^1.2.7", - "minimist": "^1.2.5", - "request": "^2.88.2" - } - }, - "crc-32": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", - "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", - "dev": true - }, - "create-hash": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", - "dev": true, - "requires": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" - } - }, - "create-hmac": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", - "dev": true, - "requires": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true, - "peer": true - }, - "cross-fetch": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.6.tgz", - "integrity": "sha512-riRvo06crlE8HiqOwIpQhxwdOk4fOeR7FVM/wXoxchFEqMNUjvbs3bfo4OTgMEMHzppd4DxFBDbyySj8Cv781g==", - "dev": true, - "requires": { - "node-fetch": "^2.6.11" - } - }, - "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "crypt": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", - "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", - "dev": true, - "peer": true - }, - "crypto-addr-codec": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/crypto-addr-codec/-/crypto-addr-codec-0.1.7.tgz", - "integrity": "sha512-X4hzfBzNhy4mAc3UpiXEC/L0jo5E8wAa9unsnA8nNXYzXjCcGk83hfC5avJWCSGT8V91xMnAS9AKMHmjw5+XCg==", - "dev": true, - "requires": { - "base-x": "^3.0.8", - "big-integer": "1.6.36", - "blakejs": "^1.1.0", - "bs58": "^4.0.1", - "ripemd160-min": "0.0.6", - "safe-buffer": "^5.2.0", - "sha3": "^2.1.1" - } - }, - "css-select": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", - "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", - "dev": true, - "requires": { - "boolbase": "^1.0.0", - "css-what": "^6.1.0", - "domhandler": "^5.0.2", - "domutils": "^3.0.1", - "nth-check": "^2.0.1" - } - }, - "css-what": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", - "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", - "dev": true - }, - "cssfilter": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/cssfilter/-/cssfilter-0.0.10.tgz", - "integrity": "sha512-FAaLDaplstoRsDR8XGYH51znUN0UY7nMc6Z9/fvE8EXGwvJE9hu7W2vHwx1+bd6gCYnln9nLbzxFTrcO9YQDZw==", - "dev": true, - "optional": true - }, - "d": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", - "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", - "dev": true, - "requires": { - "es5-ext": "^0.10.50", - "type": "^1.0.1" - } - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "dataloader": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/dataloader/-/dataloader-2.1.0.tgz", - "integrity": "sha512-qTcEYLen3r7ojZNgVUaRggOI+KM7jrKxXeSHhogh/TWxYMeONEMqY+hmkobiYQozsGIyg9OYVzO4ZIfoB4I0pQ==", - "dev": true, - "optional": true - }, - "dateformat": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", - "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", - "dev": true - }, - "death": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/death/-/death-1.1.0.tgz", - "integrity": "sha512-vsV6S4KVHvTGxbEcij7hkWRv0It+sGGWVOM67dQde/o5Xjnr+KmLjxWJii2uEObIrt1CcM9w0Yaovx+iOlIL+w==", - "dev": true, - "peer": true - }, - "debounce-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/debounce-fn/-/debounce-fn-4.0.0.tgz", - "integrity": "sha512-8pYCQiL9Xdcg0UPSD3d+0KMlOjp+KGU5EPwYddgzQ7DATsg4fuUDjQtsYLmWjnk2obnNHgV3vE2Y4jejSOJVBQ==", - "dev": true, - "optional": true, - "requires": { - "mimic-fn": "^3.0.0" - } - }, - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "decache": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/decache/-/decache-4.6.1.tgz", - "integrity": "sha512-ohApBM8u9ygepJCjgBrEZSSxPjc0T/PJkD+uNyxXPkqudyUpdXpwJYp0VISm2WrPVzASU6DZyIi6BWdyw7uJ2Q==", - "dev": true, - "requires": { - "callsite": "^1.0.0" - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", - "dev": true - }, - "decamelize-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", - "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", - "dev": true, - "requires": { - "decamelize": "^1.1.0", - "map-obj": "^1.0.0" - }, - "dependencies": { - "map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==", - "dev": true - } - } - }, - "decode-uri-component": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", - "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", - "dev": true - }, - "decompress-response": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", - "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", - "dev": true, - "requires": { - "mimic-response": "^3.1.0" - }, - "dependencies": { - "mimic-response": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", - "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", - "dev": true - } - } - }, - "deep-eql": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", - "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", - "dev": true, - "requires": { - "type-detect": "^4.0.0" - } - }, - "deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "dev": true, - "peer": true - }, - "deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true - }, - "defer-to-connect": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", - "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", - "dev": true - }, - "deferred-leveldown": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-5.3.0.tgz", - "integrity": "sha512-a59VOT+oDy7vtAbLRCZwWgxu2BaCfd5Hk7wxJd48ei7I+nsg8Orlb9CLG0PMZienk9BSUKgeAqkO2+Lw+1+Ukw==", - "dev": true, - "optional": true, - "requires": { - "abstract-leveldown": "~6.2.1", - "inherits": "^2.0.3" - }, - "dependencies": { - "abstract-leveldown": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", - "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", - "dev": true, - "optional": true, - "requires": { - "buffer": "^5.5.0", - "immediate": "^3.2.3", - "level-concat-iterator": "~2.0.0", - "level-supports": "~1.0.0", - "xtend": "~4.0.0" - } - }, - "level-concat-iterator": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz", - "integrity": "sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==", - "dev": true, - "optional": true - }, - "level-supports": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-1.0.1.tgz", - "integrity": "sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg==", - "dev": true, - "optional": true, - "requires": { - "xtend": "^4.0.2" - } - } - } - }, - "define-properties": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", - "integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==", - "dev": true, - "peer": true, - "requires": { - "has-property-descriptors": "^1.0.0", - "object-keys": "^1.1.1" - } - }, - "delay": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", - "integrity": "sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==", - "dev": true, - "optional": true - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "dev": true - }, - "depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "dev": true - }, - "destroy": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", - "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", - "dev": true - }, - "detect-indent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-5.0.0.tgz", - "integrity": "sha512-rlpvsxUtM0PQvy9iZe640/IWwWYyBsTApREbA1pHOpmOUIl9MkP/U4z7vTtg4Oaojvqhxt7sdufnT0EzGaR31g==", - "dev": true - }, - "detect-port": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/detect-port/-/detect-port-1.5.1.tgz", - "integrity": "sha512-aBzdj76lueB6uUst5iAs7+0H/oOjqI5D16XUWxlWMIMROhcM0rfsNVk93zTngq1dDNpoXRr++Sus7ETAExppAQ==", - "dev": true, - "peer": true, - "requires": { - "address": "^1.0.1", - "debug": "4" - } - }, - "diff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", - "dev": true - }, - "difflib": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/difflib/-/difflib-0.2.4.tgz", - "integrity": "sha512-9YVwmMb0wQHQNr5J9m6BSj6fk4pfGITGQOOs+D9Fl+INODWFOfvhIU1hNv6GgR1RBoC/9NJcwu77zShxV0kT7w==", - "dev": true, - "peer": true, - "requires": { - "heap": ">= 0.2.0" - } - }, - "dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "peer": true, - "requires": { - "path-type": "^4.0.0" - } - }, - "doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "dom-serializer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", - "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", - "dev": true, - "requires": { - "domelementtype": "^2.3.0", - "domhandler": "^5.0.2", - "entities": "^4.2.0" - } - }, - "dom-walk": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz", - "integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==", - "dev": true - }, - "domelementtype": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", - "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", - "dev": true - }, - "domhandler": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", - "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", - "dev": true, - "requires": { - "domelementtype": "^2.3.0" - } - }, - "domutils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", - "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", - "dev": true, - "requires": { - "dom-serializer": "^2.0.0", - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3" - } - }, - "dot-case": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-2.1.1.tgz", - "integrity": "sha512-HnM6ZlFqcajLsyudHq7LeeLDr2rFAVYtDv/hV5qchQEidSck8j9OPUsXY9KwJv/lHMtYlX4DjRQqwFYa+0r8Ug==", - "dev": true, - "requires": { - "no-case": "^2.2.0" - } - }, - "dot-prop": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-6.0.1.tgz", - "integrity": "sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==", - "dev": true, - "optional": true, - "requires": { - "is-obj": "^2.0.0" - } - }, - "dotenv": { - "version": "16.1.4", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.1.4.tgz", - "integrity": "sha512-m55RtE8AsPeJBpOIFKihEmqUcoVncQIwo7x9U8ZwLEZw9ZpXboz2c+rvog+jUaJvVrZ5kBOeYQBX5+8Aa/OZQw==", - "dev": true - }, - "double-ended-queue": { - "version": "2.1.0-0", - "resolved": "https://registry.npmjs.org/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz", - "integrity": "sha512-+BNfZ+deCo8hMNpDqDnvT+c0XpJ5cUa6mqYq89bho2Ifze4URTqRkcwR399hWoTrTkbZ/XJYDgP6rc7pRgffEQ==", - "dev": true, - "optional": true - }, - "eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true - }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", - "dev": true, - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", - "dev": true - }, - "eip55": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/eip55/-/eip55-2.1.1.tgz", - "integrity": "sha512-WcagVAmNu2Ww2cDUfzuWVntYwFxbvZ5MvIyLZpMjTTkjD6sCvkGOiS86jTppzu9/gWsc8isLHAeMBWK02OnZmA==", - "dev": true, - "requires": { - "keccak": "^3.0.3" - } - }, - "elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "dev": true, - "requires": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - } - } - }, - "emittery": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.4.1.tgz", - "integrity": "sha512-r4eRSeStEGf6M5SKdrQhhLK5bOwOBxQhIE3YSTnZE3GpKiLfnnhE+tPtrJE79+eDJgm39BM6LSoI8SCx4HbwlQ==", - "dev": true, - "optional": true - }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "encode-utf8": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/encode-utf8/-/encode-utf8-1.0.3.tgz", - "integrity": "sha512-ucAnuBEhUK4boH2HjVYG5Q2mQyPorvv0u/ocS+zhdw0S8AlHYY+GOFhP1Gio5z4icpP2ivFSvhtFjQi8+T9ppw==", - "dev": true - }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", - "dev": true - }, - "encoding-down": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/encoding-down/-/encoding-down-6.3.0.tgz", - "integrity": "sha512-QKrV0iKR6MZVJV08QY0wp1e7vF6QbhnbQhb07bwpEyuz4uZiZgPlEGdkCROuFkUwdxlFaiPIhjyarH1ee/3vhw==", - "dev": true, - "optional": true, - "requires": { - "abstract-leveldown": "^6.2.1", - "inherits": "^2.0.3", - "level-codec": "^9.0.0", - "level-errors": "^2.0.0" - }, - "dependencies": { - "abstract-leveldown": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.3.0.tgz", - "integrity": "sha512-TU5nlYgta8YrBMNpc9FwQzRbiXsj49gsALsXadbGHt9CROPzX5fB0rWDR5mtdpOOKa5XqRFpbj1QroPAoPzVjQ==", - "dev": true, - "optional": true, - "requires": { - "buffer": "^5.5.0", - "immediate": "^3.2.3", - "level-concat-iterator": "~2.0.0", - "level-supports": "~1.0.0", - "xtend": "~4.0.0" - } - }, - "level-concat-iterator": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz", - "integrity": "sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==", - "dev": true, - "optional": true - }, - "level-supports": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-1.0.1.tgz", - "integrity": "sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg==", - "dev": true, - "optional": true, - "requires": { - "xtend": "^4.0.2" - } - } - } - }, - "end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, - "end-stream": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/end-stream/-/end-stream-0.1.0.tgz", - "integrity": "sha512-Brl10T8kYnc75IepKizW6Y9liyW8ikz1B7n/xoHrJxoVSSjoqPn30sb7XVFfQERK4QfUMYRGs9dhWwtt2eu6uA==", - "dev": true, - "optional": true, - "requires": { - "write-stream": "~0.4.3" - } - }, - "enquirer": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", - "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", - "dev": true, - "requires": { - "ansi-colors": "^4.1.1" - }, - "dependencies": { - "ansi-colors": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", - "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", - "dev": true - } - } - }, - "entities": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", - "dev": true - }, - "env-paths": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", - "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", - "dev": true - }, - "errno": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", - "integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==", - "dev": true, - "optional": true, - "requires": { - "prr": "~1.0.1" - } - }, - "error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "es-abstract": { - "version": "1.21.2", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.21.2.tgz", - "integrity": "sha512-y/B5POM2iBnIxCiernH1G7rC9qQoM77lLIMQLuob0zhp8C56Po81+2Nj0WFKnd0pNReDTnkYryc+zhOzpEIROg==", - "dev": true, - "peer": true, - "requires": { - "array-buffer-byte-length": "^1.0.0", - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "es-set-tostringtag": "^2.0.1", - "es-to-primitive": "^1.2.1", - "function.prototype.name": "^1.1.5", - "get-intrinsic": "^1.2.0", - "get-symbol-description": "^1.0.0", - "globalthis": "^1.0.3", - "gopd": "^1.0.1", - "has": "^1.0.3", - "has-property-descriptors": "^1.0.0", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "internal-slot": "^1.0.5", - "is-array-buffer": "^3.0.2", - "is-callable": "^1.2.7", - "is-negative-zero": "^2.0.2", - "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.2", - "is-string": "^1.0.7", - "is-typed-array": "^1.1.10", - "is-weakref": "^1.0.2", - "object-inspect": "^1.12.3", - "object-keys": "^1.1.1", - "object.assign": "^4.1.4", - "regexp.prototype.flags": "^1.4.3", - "safe-regex-test": "^1.0.0", - "string.prototype.trim": "^1.2.7", - "string.prototype.trimend": "^1.0.6", - "string.prototype.trimstart": "^1.0.6", - "typed-array-length": "^1.0.4", - "unbox-primitive": "^1.0.2", - "which-typed-array": "^1.1.9" - }, - "dependencies": { - "object.assign": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", - "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", - "dev": true, - "peer": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "has-symbols": "^1.0.3", - "object-keys": "^1.1.1" - } - } - } - }, - "es-array-method-boxes-properly": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", - "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==", - "dev": true, - "peer": true - }, - "es-set-tostringtag": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", - "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", - "dev": true, - "peer": true, - "requires": { - "get-intrinsic": "^1.1.3", - "has": "^1.0.3", - "has-tostringtag": "^1.0.0" - } - }, - "es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, - "peer": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "es5-ext": { - "version": "0.10.62", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz", - "integrity": "sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==", - "dev": true, - "requires": { - "es6-iterator": "^2.0.3", - "es6-symbol": "^3.1.3", - "next-tick": "^1.1.0" - } - }, - "es6-iterator": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", - "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", - "dev": true, - "requires": { - "d": "1", - "es5-ext": "^0.10.35", - "es6-symbol": "^3.1.1" - } - }, - "es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", - "dev": true - }, - "es6-symbol": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", - "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", - "dev": true, - "requires": { - "d": "^1.0.1", - "ext": "^1.1.2" - } - }, - "escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true - }, - "escodegen": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", - "integrity": "sha512-yhi5S+mNTOuRvyW4gWlg5W1byMaQGWWSYHXsuFZ7GBo7tpyOwi2EdzMP/QWxh9hwkD2m+wDVHJsxhRIj+v/b/A==", - "dev": true, - "peer": true, - "requires": { - "esprima": "^2.7.1", - "estraverse": "^1.9.1", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.2.0" - }, - "dependencies": { - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha512-OarPfz0lFCiW4/AV2Oy1Rp9qu0iusTKqykwTspGCZtPxmF81JR4MmIebvF1F9+UOKth2ZubLQ4XGGaU+hSn99A==", - "dev": true, - "peer": true - }, - "estraverse": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", - "integrity": "sha512-25w1fMXQrGdoquWnScXZGckOv+Wes+JDnuN/+7ex3SauFRS72r2lFDec0EKPt2YD1wUJ/IrfEex+9yp4hfSOJA==", - "dev": true, - "peer": true - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", - "dev": true, - "peer": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dev": true, - "peer": true, - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - } - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", - "dev": true, - "peer": true - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", - "dev": true, - "peer": true, - "requires": { - "prelude-ls": "~1.1.2" - } - } - } - }, - "eslint": { - "version": "8.42.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.42.0.tgz", - "integrity": "sha512-ulg9Ms6E1WPf67PHaEY4/6E2tEn5/f7FXGzr3t9cBMugOmf1INYvuUwwh1aXQN4MfJ6a5K2iNwP3w4AColvI9A==", - "dev": true, - "requires": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.4.0", - "@eslint/eslintrc": "^2.0.3", - "@eslint/js": "8.42.0", - "@humanwhocodes/config-array": "^0.11.10", - "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.0", - "eslint-visitor-keys": "^3.4.1", - "espree": "^9.5.2", - "esquery": "^1.4.2", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", - "ignore": "^5.2.0", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", - "text-table": "^0.2.0" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true - }, - "find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "requires": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, - "locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "requires": { - "p-locate": "^5.0.0" - } - }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "requires": { - "p-limit": "^3.0.2" - } - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "eslint-config-prettier": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.8.0.tgz", - "integrity": "sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA==", - "dev": true, - "requires": {} - }, - "eslint-plugin-no-only-tests": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-no-only-tests/-/eslint-plugin-no-only-tests-3.1.0.tgz", - "integrity": "sha512-Lf4YW/bL6Un1R6A76pRZyE1dl1vr31G/ev8UzIc/geCgFWyrKil8hVjYqWVKGB/UIGmb6Slzs9T0wNezdSVegw==", - "dev": true - }, - "eslint-scope": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz", - "integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - } - }, - "eslint-visitor-keys": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz", - "integrity": "sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==", - "dev": true - }, - "espree": { - "version": "9.5.2", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.2.tgz", - "integrity": "sha512-7OASN1Wma5fum5SrNhFMAMJxOUAbhyfQ8dQ//PJaJbNw0URTPWqIghHWt1MmAANKhHZIYOHruW4Kw4ruUWOdGw==", - "dev": true, - "requires": { - "acorn": "^8.8.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" - } - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, - "esquery": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", - "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", - "dev": true, - "requires": { - "estraverse": "^5.1.0" - } - }, - "esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "requires": { - "estraverse": "^5.2.0" - } - }, - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true - }, - "esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true - }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", - "dev": true - }, - "eth-ens-namehash": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz", - "integrity": "sha512-VWEI1+KJfz4Km//dadyvBBoBeSQ0MHTXPvr8UIXiLW6IanxvAV+DmlZAijZwAyggqGUfwQBeHf7tc9wzc1piSw==", - "dev": true, - "requires": { - "idna-uts46-hx": "^2.3.1", - "js-sha3": "^0.5.7" - }, - "dependencies": { - "js-sha3": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", - "integrity": "sha512-GII20kjaPX0zJ8wzkTbNDYMY7msuZcTWk8S5UOh6806Jq/wz1J8/bnr8uGU0DAUmYDjj2Mr4X1cW8v/GLYnR+g==", - "dev": true - } - } - }, - "eth-gas-reporter": { - "version": "0.2.25", - "resolved": "https://registry.npmjs.org/eth-gas-reporter/-/eth-gas-reporter-0.2.25.tgz", - "integrity": "sha512-1fRgyE4xUB8SoqLgN3eDfpDfwEfRxh2Sz1b7wzFbyQA+9TekMmvSjjoRu9SKcSVyK+vLkLIsVbJDsTWjw195OQ==", - "dev": true, - "peer": true, - "requires": { - "@ethersproject/abi": "^5.0.0-beta.146", - "@solidity-parser/parser": "^0.14.0", - "cli-table3": "^0.5.0", - "colors": "1.4.0", - "ethereum-cryptography": "^1.0.3", - "ethers": "^4.0.40", - "fs-readdir-recursive": "^1.1.0", - "lodash": "^4.17.14", - "markdown-table": "^1.1.3", - "mocha": "^7.1.1", - "req-cwd": "^2.0.0", - "request": "^2.88.0", - "request-promise-native": "^1.0.5", - "sha1": "^1.1.1", - "sync-request": "^6.0.0" - }, - "dependencies": { - "ansi-colors": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", - "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", - "dev": true, - "peer": true - }, - "ansi-regex": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", - "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", - "dev": true, - "peer": true - }, - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true, - "peer": true - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true, - "peer": true - }, - "chokidar": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz", - "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==", - "dev": true, - "peer": true, - "requires": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "fsevents": "~2.1.1", - "glob-parent": "~5.1.0", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.2.0" - } - }, - "cli-table3": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.5.1.tgz", - "integrity": "sha512-7Qg2Jrep1S/+Q3EceiZtQcDPWxhAvBw+ERf1162v4sikJrvojMHFqXt8QIVha8UlH9rgU0BeWPytZ9/TzYqlUw==", - "dev": true, - "peer": true, - "requires": { - "colors": "^1.1.2", - "object-assign": "^4.1.0", - "string-width": "^2.1.1" - } - }, - "cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", - "dev": true, - "peer": true, - "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - }, - "dependencies": { - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "peer": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "peer": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "dev": true, - "peer": true, - "requires": { - "ms": "^2.1.1" - } - }, - "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", - "dev": true, - "peer": true - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true, - "peer": true - }, - "ethereum-cryptography": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-1.2.0.tgz", - "integrity": "sha512-6yFQC9b5ug6/17CQpCyE3k9eKBMdhyVjzUy1WkiuY/E4vj/SXDBbCw8QEIaXqf0Mf2SnY6RmpDcwlUmBSS0EJw==", - "dev": true, - "peer": true, - "requires": { - "@noble/hashes": "1.2.0", - "@noble/secp256k1": "1.7.1", - "@scure/bip32": "1.1.5", - "@scure/bip39": "1.1.1" - } - }, - "ethers": { - "version": "4.0.49", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.49.tgz", - "integrity": "sha512-kPltTvWiyu+OktYy1IStSO16i2e7cS9D9OxZ81q2UUaiNPVrm/RTcbxamCXF9VUSKzJIdJV68EAIhTEVBalRWg==", - "dev": true, - "peer": true, - "requires": { - "aes-js": "3.0.0", - "bn.js": "^4.11.9", - "elliptic": "6.5.4", - "hash.js": "1.1.3", - "js-sha3": "0.5.7", - "scrypt-js": "2.0.4", - "setimmediate": "1.0.4", - "uuid": "2.0.1", - "xmlhttprequest": "1.8.0" - } - }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "peer": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "flat": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.1.tgz", - "integrity": "sha512-FmTtBsHskrU6FJ2VxCnsDb84wu9zhmO3cUX2kGFb5tuwhfXxGciiT0oRY+cck35QmG+NmGh5eLz6lLCpWTqwpA==", - "dev": true, - "peer": true, - "requires": { - "is-buffer": "~2.0.3" - } - }, - "fsevents": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", - "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", - "dev": true, - "optional": true, - "peer": true - }, - "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", - "dev": true, - "peer": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "peer": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "hash.js": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", - "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", - "dev": true, - "peer": true, - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.0" - } - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", - "dev": true, - "peer": true - }, - "js-sha3": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", - "integrity": "sha512-GII20kjaPX0zJ8wzkTbNDYMY7msuZcTWk8S5UOh6806Jq/wz1J8/bnr8uGU0DAUmYDjj2Mr4X1cW8v/GLYnR+g==", - "dev": true, - "peer": true - }, - "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "dev": true, - "peer": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "peer": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "log-symbols": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", - "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", - "dev": true, - "peer": true, - "requires": { - "chalk": "^2.4.2" - } - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "peer": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "dev": true, - "peer": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "mocha": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.2.0.tgz", - "integrity": "sha512-O9CIypScywTVpNaRrCAgoUnJgozpIofjKUYmJhiCIJMiuYnLI6otcb1/kpW9/n/tJODHGZ7i8aLQoDVsMtOKQQ==", - "dev": true, - "peer": true, - "requires": { - "ansi-colors": "3.2.3", - "browser-stdout": "1.3.1", - "chokidar": "3.3.0", - "debug": "3.2.6", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "find-up": "3.0.0", - "glob": "7.1.3", - "growl": "1.10.5", - "he": "1.2.0", - "js-yaml": "3.13.1", - "log-symbols": "3.0.0", - "minimatch": "3.0.4", - "mkdirp": "0.5.5", - "ms": "2.1.1", - "node-environment-flags": "1.0.6", - "object.assign": "4.1.0", - "strip-json-comments": "2.0.1", - "supports-color": "6.0.0", - "which": "1.3.1", - "wide-align": "1.1.3", - "yargs": "13.3.2", - "yargs-parser": "13.1.2", - "yargs-unparser": "1.6.0" - } - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true, - "peer": true - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "peer": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", - "dev": true, - "peer": true - }, - "readdirp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", - "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==", - "dev": true, - "peer": true, - "requires": { - "picomatch": "^2.0.4" - } - }, - "scrypt-js": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.4.tgz", - "integrity": "sha512-4KsaGcPnuhtCZQCxFxN3GVYIhKFPTdLd8PLC552XwbMndtD0cjRFAhDuuydXQ0h08ZfPgzqe6EKHozpuH74iDw==", - "dev": true, - "peer": true - }, - "setimmediate": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.4.tgz", - "integrity": "sha512-/TjEmXQVEzdod/FFskf3o7oOAsGhHf2j1dZqRFbDzq4F3mvvxflIIi4Hd3bLQE9y/CpwqfSQam5JakI/mi3Pog==", - "dev": true, - "peer": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "peer": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", - "dev": true, - "peer": true - }, - "supports-color": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", - "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", - "dev": true, - "peer": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "uuid": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", - "integrity": "sha512-nWg9+Oa3qD2CQzHIP4qKUqwNfzKn8P0LtFhotaCTFchsV7ZfDhAybeip/HZVeMIpZi9JgY1E3nUlwaCmZT1sEg==", - "dev": true, - "peer": true - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "peer": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "dev": true, - "peer": true, - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - }, - "dependencies": { - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "peer": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "peer": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "y18n": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", - "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", - "dev": true, - "peer": true - }, - "yargs": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", - "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", - "dev": true, - "peer": true, - "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - }, - "dependencies": { - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "peer": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "peer": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "yargs-parser": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", - "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", - "dev": true, - "peer": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "yargs-unparser": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", - "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", - "dev": true, - "peer": true, - "requires": { - "flat": "^4.1.0", - "lodash": "^4.17.15", - "yargs": "^13.3.0" - } - } - } - }, - "eth-lib": { - "version": "0.1.29", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.29.tgz", - "integrity": "sha512-bfttrr3/7gG4E02HoWTDUcDDslN003OlOoBxk9virpAZQ1ja/jDgwkWB8QfJF7ojuEowrqy+lzp9VcJG7/k5bQ==", - "dev": true, - "requires": { - "bn.js": "^4.11.6", - "elliptic": "^6.4.0", - "nano-json-stream-parser": "^0.1.2", - "servify": "^0.1.12", - "ws": "^3.0.0", - "xhr-request-promise": "^0.1.2" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "ws": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", - "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", - "dev": true, - "requires": { - "async-limiter": "~1.0.0", - "safe-buffer": "~5.1.0", - "ultron": "~1.1.0" - } - } - } - }, - "ethereum-bloom-filters": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.10.tgz", - "integrity": "sha512-rxJ5OFN3RwjQxDcFP2Z5+Q9ho4eIdEmSc2ht0fCu8Se9nbXjZ7/031uXoUYJ87KHCOdVeiUuwSnoS7hmYAGVHA==", - "dev": true, - "requires": { - "js-sha3": "^0.8.0" - } - }, - "ethereum-cryptography": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", - "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", - "dev": true, - "requires": { - "@types/pbkdf2": "^3.0.0", - "@types/secp256k1": "^4.0.1", - "blakejs": "^1.1.0", - "browserify-aes": "^1.2.0", - "bs58check": "^2.1.2", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "hash.js": "^1.1.7", - "keccak": "^3.0.0", - "pbkdf2": "^3.0.17", - "randombytes": "^2.1.0", - "safe-buffer": "^5.1.2", - "scrypt-js": "^3.0.0", - "secp256k1": "^4.0.1", - "setimmediate": "^1.0.5" - } - }, - "ethereum-input-data-decoder": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/ethereum-input-data-decoder/-/ethereum-input-data-decoder-0.4.2.tgz", - "integrity": "sha512-nzdb9YEZ/oMIywN6AxuZtwUxYoCss5/DDbHKIaDxVEll/zQLy/CxZkNCaZJGJ+QtP/8DTtrBPc46o7Y683ZZ2A==", - "dev": true, - "requires": { - "@types/node": "^16.7.13", - "bn.js": "^4.11.8", - "buffer": "^5.2.1", - "ethers": "^5.5.4", - "is-buffer": "^2.0.3", - "meow": "9.0.0" - }, - "dependencies": { - "@types/node": { - "version": "16.18.34", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.34.tgz", - "integrity": "sha512-VmVm7gXwhkUimRfBwVI1CHhwp86jDWR04B5FGebMMyxV90SlCmFujwUHrxTD4oO+SOYU86SoxvhgeRQJY7iXFg==", - "dev": true - }, - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - }, - "ethers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", - "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", - "dev": true, - "requires": { - "@ethersproject/abi": "5.7.0", - "@ethersproject/abstract-provider": "5.7.0", - "@ethersproject/abstract-signer": "5.7.0", - "@ethersproject/address": "5.7.0", - "@ethersproject/base64": "5.7.0", - "@ethersproject/basex": "5.7.0", - "@ethersproject/bignumber": "5.7.0", - "@ethersproject/bytes": "5.7.0", - "@ethersproject/constants": "5.7.0", - "@ethersproject/contracts": "5.7.0", - "@ethersproject/hash": "5.7.0", - "@ethersproject/hdnode": "5.7.0", - "@ethersproject/json-wallets": "5.7.0", - "@ethersproject/keccak256": "5.7.0", - "@ethersproject/logger": "5.7.0", - "@ethersproject/networks": "5.7.1", - "@ethersproject/pbkdf2": "5.7.0", - "@ethersproject/properties": "5.7.0", - "@ethersproject/providers": "5.7.2", - "@ethersproject/random": "5.7.0", - "@ethersproject/rlp": "5.7.0", - "@ethersproject/sha2": "5.7.0", - "@ethersproject/signing-key": "5.7.0", - "@ethersproject/solidity": "5.7.0", - "@ethersproject/strings": "5.7.0", - "@ethersproject/transactions": "5.7.0", - "@ethersproject/units": "5.7.0", - "@ethersproject/wallet": "5.7.0", - "@ethersproject/web": "5.7.1", - "@ethersproject/wordlists": "5.7.0" - } - } - } - }, - "ethereumjs-abi": { - "version": "0.6.8", - "resolved": "https://registry.npmjs.org/ethereumjs-abi/-/ethereumjs-abi-0.6.8.tgz", - "integrity": "sha512-Tx0r/iXI6r+lRsdvkFDlut0N08jWMnKRZ6Gkq+Nmw75lZe4e6o3EkSnkaBP5NF6+m5PTGAr9JP43N3LyeoglsA==", - "dev": true, - "requires": { - "bn.js": "^4.11.8", - "ethereumjs-util": "^6.0.0" - }, - "dependencies": { - "@types/bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - }, - "ethereumjs-util": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz", - "integrity": "sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw==", - "dev": true, - "requires": { - "@types/bn.js": "^4.11.3", - "bn.js": "^4.11.0", - "create-hash": "^1.1.2", - "elliptic": "^6.5.2", - "ethereum-cryptography": "^0.1.3", - "ethjs-util": "0.1.6", - "rlp": "^2.2.3" - } - } - } - }, - "ethereumjs-util": { - "version": "7.1.5", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz", - "integrity": "sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg==", - "dev": true, - "requires": { - "@types/bn.js": "^5.1.0", - "bn.js": "^5.1.2", - "create-hash": "^1.1.2", - "ethereum-cryptography": "^0.1.3", - "rlp": "^2.2.4" - } - }, - "ethers": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.5.1.tgz", - "integrity": "sha512-jDpCnUGcyn39hnRUEtrulDZOtJcIPEz4Whccl3N9qhwdLsn1ELuDM9TgGgGJq6ph0p8/Uri+Wezmo/r69E+xkA==", - "dev": true, - "peer": true, - "requires": { - "@adraffy/ens-normalize": "1.9.2", - "@noble/hashes": "1.1.2", - "@noble/secp256k1": "1.7.1", - "@types/node": "18.15.13", - "aes-js": "4.0.0-beta.5", - "tslib": "2.4.0", - "ws": "8.5.0" - }, - "dependencies": { - "@noble/hashes": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", - "integrity": "sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==", - "dev": true, - "peer": true - }, - "@types/node": { - "version": "18.15.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", - "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==", - "dev": true, - "peer": true - }, - "aes-js": { - "version": "4.0.0-beta.5", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", - "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==", - "dev": true, - "peer": true - }, - "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", - "dev": true, - "peer": true - }, - "ws": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", - "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", - "dev": true, - "peer": true, - "requires": {} - } - } - }, - "ethjs-abi": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/ethjs-abi/-/ethjs-abi-0.2.1.tgz", - "integrity": "sha512-g2AULSDYI6nEJyJaEVEXtTimRY2aPC2fi7ddSy0W+LXvEVL8Fe1y76o43ecbgdUKwZD+xsmEgX1yJr1Ia3r1IA==", - "dev": true, - "requires": { - "bn.js": "4.11.6", - "js-sha3": "0.5.5", - "number-to-bn": "1.7.0" - }, - "dependencies": { - "bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==", - "dev": true - }, - "js-sha3": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.5.tgz", - "integrity": "sha512-yLLwn44IVeunwjpDVTDZmQeVbB0h+dZpY2eO68B/Zik8hu6dH+rKeLxwua79GGIvW6xr8NBAcrtiUbYrTjEFTA==", - "dev": true - } - } - }, - "ethjs-unit": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", - "integrity": "sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw==", - "dev": true, - "requires": { - "bn.js": "4.11.6", - "number-to-bn": "1.7.0" - }, - "dependencies": { - "bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==", - "dev": true - } - } - }, - "ethjs-util": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz", - "integrity": "sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w==", - "dev": true, - "requires": { - "is-hex-prefixed": "1.0.0", - "strip-hex-prefix": "1.0.0" - } - }, - "event-target-shim": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", - "dev": true - }, - "eventemitter3": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.4.tgz", - "integrity": "sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ==", - "dev": true - }, - "evp_bytestokey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", - "dev": true, - "requires": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" - } - }, - "express": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", - "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", - "dev": true, - "requires": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.1", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.5.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.2.0", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.7", - "qs": "6.11.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "dependencies": { - "body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", - "dev": true, - "requires": { - "bytes": "3.1.2", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.1", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - } - }, - "cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", - "dev": true - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - }, - "qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", - "dev": true, - "requires": { - "side-channel": "^1.0.4" - } - }, - "raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", - "dev": true, - "requires": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - } - } - } - }, - "ext": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", - "integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==", - "dev": true, - "requires": { - "type": "^2.7.2" - }, - "dependencies": { - "type": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz", - "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==", - "dev": true - } - } - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", - "dev": true - }, - "fast-check": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-3.1.1.tgz", - "integrity": "sha512-3vtXinVyuUKCKFKYcwXhGE6NtGWkqF8Yh3rvMZNzmwz8EPrgoc/v4pDdLHyLnCyCI5MZpZZkDEwFyXyEONOxpA==", - "dev": true, - "requires": { - "pure-rand": "^5.0.1" - } - }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, - "fast-diff": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", - "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", - "dev": true - }, - "fast-glob": { - "version": "3.2.12", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", - "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", - "dev": true, - "peer": true, - "requires": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "dependencies": { - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "peer": true, - "requires": { - "is-glob": "^4.0.1" - } - } - } - }, - "fast-json-parse": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/fast-json-parse/-/fast-json-parse-1.0.3.tgz", - "integrity": "sha512-FRWsaZRWEJ1ESVNbDWmsAlqDk96gPQezzLghafp5J4GUKjbCz3OkAHuZs5TuPEtkbVQERysLp9xv6c24fBm8Aw==", - "dev": true - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true - }, - "fast-redact": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-2.1.0.tgz", - "integrity": "sha512-0LkHpTLyadJavq9sRzzyqIoMZemWli77K2/MGOkafrR64B9ItrvZ9aT+jluvNDsv0YEHjSNhlMBtbokuoqii4A==", - "dev": true - }, - "fast-safe-stringify": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", - "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", - "dev": true - }, - "fastq": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", - "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", - "dev": true, - "requires": { - "reusify": "^1.0.4" - } - }, - "fetch-cookie": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-0.11.0.tgz", - "integrity": "sha512-BQm7iZLFhMWFy5CZ/162sAGjBfdNWb7a8LEqqnzsHFhxT/X/SVj/z2t2nu3aJvjlbQkrAlTUApplPRjWyH4mhA==", - "dev": true, - "optional": true, - "requires": { - "tough-cookie": "^2.3.3 || ^3.0.1 || ^4.0.0" - } - }, - "file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", - "dev": true, - "requires": { - "flat-cache": "^3.0.4" - } - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", - "dev": true, - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "statuses": "2.0.1", - "unpipe": "~1.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - } - } - }, - "find-replace": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz", - "integrity": "sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==", - "dev": true, - "peer": true, - "requires": { - "array-back": "^3.0.1" - } - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true - }, - "flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", - "dev": true, - "requires": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" - } - }, - "flatstr": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/flatstr/-/flatstr-1.0.12.tgz", - "integrity": "sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw==", - "dev": true - }, - "flatted": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", - "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", - "dev": true - }, - "fmix": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/fmix/-/fmix-0.1.0.tgz", - "integrity": "sha512-Y6hyofImk9JdzU8k5INtTXX1cu8LDlePWDFU5sftm9H+zKCr5SGrVjdhkvsim646cw5zD0nADj8oHyXMZmCZ9w==", - "dev": true, - "requires": { - "imul": "^1.0.0" - } - }, - "follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", - "dev": true - }, - "for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "dev": true, - "requires": { - "is-callable": "^1.1.3" - } - }, - "foreach": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.6.tgz", - "integrity": "sha512-k6GAGDyqLe9JaebCsFCoudPPWfihKu8pylYXRlqP1J7ms39iPoTtk2fviNglIeQEwdh0bQeKJ01ZPyuyQvKzwg==", - "dev": true - }, - "foreground-child": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", - "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, - "dependencies": { - "signal-exit": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.0.2.tgz", - "integrity": "sha512-MY2/qGx4enyjprQnFaZsHib3Yadh3IXyV2C321GY0pjGfVBu4un0uDJkwgdxqO+Rdx8JMT8IfJIRwbYVz3Ob3Q==", - "dev": true - } - } - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", - "dev": true - }, - "form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, - "form-data-encoder": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.1.tgz", - "integrity": "sha512-EFRDrsMm/kyqbTQocNvRXMLjc7Es2Vk+IQFx/YW7hkUH1eBl4J1fqiP34l74Yt0pFLCNpc06fkbVk00008mzjg==", - "dev": true - }, - "forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", - "dev": true - }, - "fp-ts": { - "version": "1.19.3", - "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-1.19.3.tgz", - "integrity": "sha512-H5KQDspykdHuztLTg+ajGN0Z2qUjcEf3Ybxc6hLt0k7/zPkn29XnKnxlBPyW2XIddWrGaJBzBl4VLYOtk39yZg==", - "dev": true - }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", - "dev": true - }, - "fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "fs-minipass": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", - "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", - "dev": true, - "requires": { - "minipass": "^2.6.0" - }, - "dependencies": { - "minipass": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", - "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - } - } - } - }, - "fs-readdir-recursive": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz", - "integrity": "sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA==", - "dev": true, - "peer": true - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "optional": true - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "function.prototype.name": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", - "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", - "dev": true, - "peer": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.0", - "functions-have-names": "^1.2.2" - } - }, - "functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", - "dev": true - }, - "functions-have-names": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", - "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", - "dev": true, - "peer": true - }, - "ganache": { - "version": "7.8.0", - "resolved": "https://registry.npmjs.org/ganache/-/ganache-7.8.0.tgz", - "integrity": "sha512-IrUYvsaE/m2/NaVIZ7D/gCnsmyU/buechnH6MhUipzG1qJcZIwIp/DoP/LZUcHyhy0Bv0NKZD2pGOjpRhn7l7A==", - "dev": true, - "requires": { - "@trufflesuite/bigint-buffer": "1.1.10", - "@trufflesuite/uws-js-unofficial": "20.10.0-unofficial.2", - "@types/bn.js": "^5.1.0", - "@types/lru-cache": "5.1.1", - "@types/seedrandom": "3.0.1", - "abstract-level": "1.0.3", - "abstract-leveldown": "7.2.0", - "async-eventemitter": "0.2.4", - "bufferutil": "4.0.5", - "emittery": "0.10.0", - "keccak": "3.0.2", - "leveldown": "6.1.0", - "secp256k1": "4.0.3", - "utf-8-validate": "5.0.7" - }, - "dependencies": { - "@trufflesuite/bigint-buffer": { - "version": "1.1.10", - "resolved": "https://registry.npmjs.org/@trufflesuite/bigint-buffer/-/bigint-buffer-1.1.10.tgz", - "integrity": "sha512-pYIQC5EcMmID74t26GCC67946mgTJFiLXOT/BYozgrd4UEY2JHEGLhWi9cMiQCt5BSqFEvKkCHNnoj82SRjiEw==", - "bundled": true, - "dev": true, - "requires": { - "node-gyp-build": "4.4.0" - }, - "dependencies": { - "node-gyp-build": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.4.0.tgz", - "integrity": "sha512-amJnQCcgtRVw9SvoebO3BKGESClrfXGCUTX9hSn1OuGQTQBOZmVd0Z0OlecpuRksKvbsUqALE8jls/ErClAPuQ==", - "bundled": true, - "dev": true - } - } - }, - "@trufflesuite/uws-js-unofficial": { - "version": "20.10.0-unofficial.2", - "resolved": "https://registry.npmjs.org/@trufflesuite/uws-js-unofficial/-/uws-js-unofficial-20.10.0-unofficial.2.tgz", - "integrity": "sha512-oQQlnS3oNeGsgS4K3KCSSavJgSb0W9D5ktZs4FacX9VbM7b+NlhjH96d6/G4fMrz+bc5MXRyco419on0X0dvRA==", - "dev": true, - "requires": { - "bufferutil": "4.0.5", - "utf-8-validate": "5.0.7", - "ws": "8.2.3" - } - }, - "@types/bn.js": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", - "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-ssE3Vlrys7sdIzs5LOxCzTVMsU7i9oa/IaW92wF32JFb3CVczqOkru2xspuKczHEbG3nvmPY7IFqVmGGHdNbYw==", - "dev": true - }, - "@types/node": { - "version": "17.0.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.0.tgz", - "integrity": "sha512-eMhwJXc931Ihh4tkU+Y7GiLzT/y/DBNpNtr4yU9O2w3SYBsr9NaOPhQlLKRmoWtI54uNwuo0IOUFQjVOTZYRvw==", - "dev": true - }, - "@types/seedrandom": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@types/seedrandom/-/seedrandom-3.0.1.tgz", - "integrity": "sha512-giB9gzDeiCeloIXDgzFBCgjj1k4WxcDrZtGl6h1IqmUPlxF+Nx8Ve+96QCyDZ/HseB/uvDsKbpib9hU5cU53pw==", - "dev": true - }, - "abstract-level": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/abstract-level/-/abstract-level-1.0.3.tgz", - "integrity": "sha512-t6jv+xHy+VYwc4xqZMn2Pa9DjcdzvzZmQGRjTFc8spIbRGHgBrEKbPq+rYXc7CCo0lxgYvSgKVg9qZAhpVQSjA==", - "dev": true, - "requires": { - "buffer": "^6.0.3", - "catering": "^2.1.0", - "is-buffer": "^2.0.5", - "level-supports": "^4.0.0", - "level-transcoder": "^1.0.1", - "module-error": "^1.0.1", - "queue-microtask": "^1.2.3" - }, - "dependencies": { - "level-supports": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-4.0.1.tgz", - "integrity": "sha512-PbXpve8rKeNcZ9C1mUicC9auIYFyGpkV9/i6g76tLgANwWhtG2v7I4xNBUlkn3lE2/dZF3Pi0ygYGtLc4RXXdA==", - "dev": true - } - } - }, - "abstract-leveldown": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz", - "integrity": "sha512-DnhQwcFEaYsvYDnACLZhMmCWd3rkOeEvglpa4q5i/5Jlm3UIsWaxVzuXvDLFCSCWRO3yy2/+V/G7FusFgejnfQ==", - "bundled": true, - "dev": true, - "requires": { - "buffer": "^6.0.3", - "catering": "^2.0.0", - "is-buffer": "^2.0.5", - "level-concat-iterator": "^3.0.0", - "level-supports": "^2.0.1", - "queue-microtask": "^1.2.3" - } - }, - "async": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", - "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", - "dev": true, - "requires": { - "lodash": "^4.17.14" - } - }, - "async-eventemitter": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/async-eventemitter/-/async-eventemitter-0.2.4.tgz", - "integrity": "sha512-pd20BwL7Yt1zwDFy+8MX8F1+WCT8aQeKj0kQnTrH9WaeRETlRamVhD0JtRPmrV4GfOJ2F9CvdQkZeZhnh2TuHw==", - "dev": true, - "requires": { - "async": "^2.4.0" - } - }, - "base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "bundled": true, - "dev": true - }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", - "bundled": true, - "dev": true - }, - "buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "bundled": true, - "dev": true, - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "bufferutil": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz", - "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==", - "dev": true, - "optional": true, - "requires": { - "node-gyp-build": "^4.3.0" - } - }, - "catering": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/catering/-/catering-2.1.0.tgz", - "integrity": "sha512-M5imwzQn6y+ODBfgi+cfgZv2hIUI6oYU/0f35Mdb1ujGeqeoI5tOnl9Q13DTH7LW+7er+NYq8stNOKZD/Z3U/A==", - "bundled": true, - "dev": true, - "requires": { - "queue-tick": "^1.0.0" - } - }, - "elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "bundled": true, - "dev": true, - "requires": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "bundled": true, - "dev": true - } - } - }, - "emittery": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.10.0.tgz", - "integrity": "sha512-AGvFfs+d0JKCJQ4o01ASQLGPmSCxgfU9RFXvzPvZdjKK8oscynksuJhWrSTSw7j7Ep/sZct5b5ZhYCi8S/t0HQ==", - "dev": true - }, - "hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "bundled": true, - "dev": true, - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "bundled": true, - "dev": true, - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "bundled": true, - "dev": true - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "bundled": true, - "dev": true - }, - "is-buffer": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", - "bundled": true, - "dev": true - }, - "keccak": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.2.tgz", - "integrity": "sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ==", - "bundled": true, - "dev": true, - "requires": { - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0", - "readable-stream": "^3.6.0" - } - }, - "level-concat-iterator": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz", - "integrity": "sha512-BWRCMHBxbIqPxJ8vHOvKUsaO0v1sLYZtjN3K2iZJsRBYtp+ONsY6Jfi6hy9K3+zolgQRryhIn2NRZjZnWJ9NmQ==", - "bundled": true, - "dev": true, - "requires": { - "catering": "^2.1.0" - } - }, - "level-supports": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-2.1.0.tgz", - "integrity": "sha512-E486g1NCjW5cF78KGPrMDRBYzPuueMZ6VBXHT6gC7A8UYWGiM14fGgp+s/L1oFfDWSPV/+SFkYCmZ0SiESkRKA==", - "bundled": true, - "dev": true - }, - "level-transcoder": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/level-transcoder/-/level-transcoder-1.0.1.tgz", - "integrity": "sha512-t7bFwFtsQeD8cl8NIoQ2iwxA0CL/9IFw7/9gAjOonH0PWTTiRfY7Hq+Ejbsxh86tXobDQ6IOiddjNYIfOBs06w==", - "dev": true, - "requires": { - "buffer": "^6.0.3", - "module-error": "^1.0.1" - } - }, - "leveldown": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-6.1.0.tgz", - "integrity": "sha512-8C7oJDT44JXxh04aSSsfcMI8YiaGRhOFI9/pMEL7nWJLVsWajDPTRxsSHTM2WcTVY5nXM+SuRHzPPi0GbnDX+w==", - "bundled": true, - "dev": true, - "requires": { - "abstract-leveldown": "^7.2.0", - "napi-macros": "~2.0.0", - "node-gyp-build": "^4.3.0" - } - }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "bundled": true, - "dev": true - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", - "bundled": true, - "dev": true - }, - "module-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/module-error/-/module-error-1.0.2.tgz", - "integrity": "sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA==", - "dev": true - }, - "napi-macros": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz", - "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==", - "bundled": true, - "dev": true - }, - "node-addon-api": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", - "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", - "bundled": true, - "dev": true - }, - "node-gyp-build": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.3.0.tgz", - "integrity": "sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q==", - "bundled": true, - "dev": true - }, - "queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "bundled": true, - "dev": true - }, - "queue-tick": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.0.tgz", - "integrity": "sha512-ULWhjjE8BmiICGn3G8+1L9wFpERNxkf8ysxkAer4+TFdRefDaXOCV5m92aMB9FtBVmn/8sETXLXY6BfW7hyaWQ==", - "bundled": true, - "dev": true - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "bundled": true, - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "bundled": true, - "dev": true - }, - "secp256k1": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", - "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", - "bundled": true, - "dev": true, - "requires": { - "elliptic": "^6.5.4", - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0" - } - }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "bundled": true, - "dev": true, - "requires": { - "safe-buffer": "~5.2.0" - } - }, - "utf-8-validate": { - "version": "5.0.7", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz", - "integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==", - "dev": true, - "optional": true, - "requires": { - "node-gyp-build": "^4.3.0" - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "bundled": true, - "dev": true - }, - "ws": { - "version": "8.2.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz", - "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==", - "dev": true - } - } - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", - "dev": true - }, - "get-intrinsic": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", - "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3" - } - }, - "get-port": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/get-port/-/get-port-3.2.0.tgz", - "integrity": "sha512-x5UJKlgeUiNT8nyo/AcnwLnZuZNcSjSw0kogRB+Whd1fjjFq4B1hySFxSFWWSn4mIBzg3sRNUDFYc4g5gjPoLg==", - "dev": true, - "peer": true - }, - "get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true - }, - "get-symbol-description": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", - "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", - "dev": true, - "peer": true, - "requires": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.1" - } - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "ghost-testrpc": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/ghost-testrpc/-/ghost-testrpc-0.0.2.tgz", - "integrity": "sha512-i08dAEgJ2g8z5buJIrCTduwPIhih3DP+hOCTyyryikfV8T0bNvHnGXO67i0DD1H4GBDETTclPy9njZbfluQYrQ==", - "dev": true, - "peer": true, - "requires": { - "chalk": "^2.4.2", - "node-emoji": "^1.10.0" - } - }, - "glob": { - "version": "10.2.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.2.7.tgz", - "integrity": "sha512-jTKehsravOJo8IJxUGfZILnkvVJM/MOfHRs8QcXolVef2zNI9Tqyy5+SeuOAZd3upViEZQLyFpQhYiHLrMUNmA==", - "dev": true, - "requires": { - "foreground-child": "^3.1.0", - "jackspeak": "^2.0.3", - "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2", - "path-scurry": "^1.7.0" - }, - "dependencies": { - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" - } - }, - "minimatch": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.1.tgz", - "integrity": "sha512-0jWhJpD/MdhPXwPuiRkCbfYfSKp2qnn2eOc279qI7f+osl/l+prKSrvhg157zSYvx/1nmgn2NqdT6k2Z7zSH9w==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - } - } - } - }, - "glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "requires": { - "is-glob": "^4.0.3" - } - }, - "global": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", - "integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==", - "dev": true, - "requires": { - "min-document": "^2.19.0", - "process": "^0.11.10" - } - }, - "global-modules": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-2.0.0.tgz", - "integrity": "sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A==", - "dev": true, - "peer": true, - "requires": { - "global-prefix": "^3.0.0" - } - }, - "global-prefix": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz", - "integrity": "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==", - "dev": true, - "peer": true, - "requires": { - "ini": "^1.3.5", - "kind-of": "^6.0.2", - "which": "^1.3.1" - }, - "dependencies": { - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "peer": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "globals": { - "version": "13.20.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", - "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } - }, - "globalthis": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", - "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", - "dev": true, - "peer": true, - "requires": { - "define-properties": "^1.1.3" - } - }, - "globby": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.2.tgz", - "integrity": "sha512-7dUi7RvCoT/xast/o/dLN53oqND4yk0nsHkhRgn9w65C4PofCLOoJ39iSOg+qVDdWQPIEj+eszMHQ+aLVwwQSg==", - "dev": true, - "peer": true, - "requires": { - "@types/glob": "^7.1.1", - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.0.3", - "glob": "^7.1.3", - "ignore": "^5.1.1", - "merge2": "^1.2.3", - "slash": "^3.0.0" - }, - "dependencies": { - "glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "peer": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - } - } - }, - "gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dev": true, - "requires": { - "get-intrinsic": "^1.1.3" - } - }, - "got": { - "version": "12.1.0", - "resolved": "https://registry.npmjs.org/got/-/got-12.1.0.tgz", - "integrity": "sha512-hBv2ty9QN2RdbJJMK3hesmSkFTjVIHyIDDbssCKnSmq62edGgImJWD10Eb1k77TiV1bxloxqcFAVK8+9pkhOig==", - "dev": true, - "requires": { - "@sindresorhus/is": "^4.6.0", - "@szmarczak/http-timer": "^5.0.1", - "@types/cacheable-request": "^6.0.2", - "@types/responselike": "^1.0.0", - "cacheable-lookup": "^6.0.4", - "cacheable-request": "^7.0.2", - "decompress-response": "^6.0.0", - "form-data-encoder": "1.7.1", - "get-stream": "^6.0.1", - "http2-wrapper": "^2.1.10", - "lowercase-keys": "^3.0.0", - "p-cancelable": "^3.0.0", - "responselike": "^2.0.0" - } - }, - "graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true - }, - "graphemer": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true - }, - "graphql": { - "version": "15.8.0", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-15.8.0.tgz", - "integrity": "sha512-5gghUc24tP9HRznNpV2+FIoq3xKkj5dTQqf4v0CpdPbFVwFkWoxOM+o+2OC9ZSvjEMTjfmG9QT+gcvggTwW1zw==", - "dev": true, - "optional": true - }, - "graphql-tag": { - "version": "2.12.6", - "resolved": "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.12.6.tgz", - "integrity": "sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg==", - "dev": true, - "optional": true, - "requires": { - "tslib": "^2.1.0" - }, - "dependencies": { - "tslib": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", - "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==", - "dev": true, - "optional": true - } - } - }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true, - "peer": true - }, - "handlebars": { - "version": "4.7.7", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", - "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", - "dev": true, - "peer": true, - "requires": { - "minimist": "^1.2.5", - "neo-async": "^2.6.0", - "source-map": "^0.6.1", - "uglify-js": "^3.1.4", - "wordwrap": "^1.0.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "peer": true - } - } - }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", - "dev": true - }, - "har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "dev": true, - "requires": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - } - }, - "hard-rejection": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", - "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", - "dev": true - }, - "hardhat": { - "version": "2.14.1", - "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.14.1.tgz", - "integrity": "sha512-H3Qp/UKyQGmPDDBSfMoSyH18rRnac90rsb0LNer+sKe6at6rxLe4D5j+M+1icqZQF02iLPjNRwc/PA8OPf757A==", - "dev": true, - "requires": { - "@ethersproject/abi": "^5.1.2", - "@metamask/eth-sig-util": "^4.0.0", - "@nomicfoundation/ethereumjs-block": "5.0.1", - "@nomicfoundation/ethereumjs-blockchain": "7.0.1", - "@nomicfoundation/ethereumjs-common": "4.0.1", - "@nomicfoundation/ethereumjs-evm": "2.0.1", - "@nomicfoundation/ethereumjs-rlp": "5.0.1", - "@nomicfoundation/ethereumjs-statemanager": "2.0.1", - "@nomicfoundation/ethereumjs-trie": "6.0.1", - "@nomicfoundation/ethereumjs-tx": "5.0.1", - "@nomicfoundation/ethereumjs-util": "9.0.1", - "@nomicfoundation/ethereumjs-vm": "7.0.1", - "@nomicfoundation/solidity-analyzer": "^0.1.0", - "@sentry/node": "^5.18.1", - "@types/bn.js": "^5.1.0", - "@types/lru-cache": "^5.1.0", - "abort-controller": "^3.0.0", - "adm-zip": "^0.4.16", - "aggregate-error": "^3.0.0", - "ansi-escapes": "^4.3.0", - "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", - "qs": "^6.7.0", - "raw-body": "^2.4.1", - "resolve": "1.17.0", - "semver": "^6.3.0", - "solc": "0.7.3", - "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" - }, - "dependencies": { - "commander": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", - "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==", - "dev": true - }, - "ethereum-cryptography": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-1.2.0.tgz", - "integrity": "sha512-6yFQC9b5ug6/17CQpCyE3k9eKBMdhyVjzUy1WkiuY/E4vj/SXDBbCw8QEIaXqf0Mf2SnY6RmpDcwlUmBSS0EJw==", - "dev": true, - "requires": { - "@noble/hashes": "1.2.0", - "@noble/secp256k1": "1.7.1", - "@scure/bip32": "1.1.5", - "@scure/bip39": "1.1.1" - } - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "jsonfile": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha512-PKllAqbgLgxHaj8TElYymKCAgrASebJrWpTnEkOaTowt23VKXXN0sUeriJ+eh7y6ufb/CC5ap11pz71/cM0hUw==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", - "dev": true - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", - "dev": true - }, - "require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true - }, - "rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "solc": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/solc/-/solc-0.7.3.tgz", - "integrity": "sha512-GAsWNAjGzIDg7VxzP6mPjdurby3IkGCjQcM8GFYZT6RyaoUZKmMU6Y7YwG+tFGhv7dwZ8rmR4iwFDrrD99JwqA==", - "dev": true, - "requires": { - "command-exists": "^1.2.8", - "commander": "3.0.2", - "follow-redirects": "^1.12.1", - "fs-extra": "^0.30.0", - "js-sha3": "0.8.0", - "memorystream": "^0.3.1", - "require-from-string": "^2.0.0", - "semver": "^5.5.0", - "tmp": "0.0.33" - }, - "dependencies": { - "fs-extra": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", - "integrity": "sha512-UvSPKyhMn6LEd/WpUaV9C9t3zATuqoqfWc3QdPhPLb58prN9tqYPlPWi8Krxi44loBoUzlobqZ3+8tGpxxSzwA==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0", - "klaw": "^1.0.0", - "path-is-absolute": "^1.0.0", - "rimraf": "^2.2.8" - } - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - } - } - }, - "hardhat-contract-sizer": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/hardhat-contract-sizer/-/hardhat-contract-sizer-2.9.0.tgz", - "integrity": "sha512-0I5lJo0iVPfK3YQNRv+zF4KHcdPbXPp9VCCOTcpDK/mfjWHiPxQwZv7eVt9S1JjvegjAVRtJPe9U5zQtd8LJGA==", - "dev": true, - "requires": { - "chalk": "^4.0.0", - "cli-table3": "^0.6.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "hardhat-gas-reporter": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/hardhat-gas-reporter/-/hardhat-gas-reporter-1.0.9.tgz", - "integrity": "sha512-INN26G3EW43adGKBNzYWOlI3+rlLnasXTwW79YNnUhXPDa+yHESgt639dJEs37gCjhkbNKcRRJnomXEuMFBXJg==", - "dev": true, - "peer": true, - "requires": { - "array-uniq": "1.0.3", - "eth-gas-reporter": "^0.2.25", - "sha1": "^1.1.1" - } - }, - "hardhat-preprocessor": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/hardhat-preprocessor/-/hardhat-preprocessor-0.1.5.tgz", - "integrity": "sha512-j8m44mmPxpxAAd0G8fPHRHOas/INZdzptSur0TNJvMEGcFdLDhbHHxBcqZVQ/bmiW42q4gC60AP4CXn9EF018g==", - "dev": true, - "requires": { - "murmur-128": "^0.2.1" - } - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-bigints": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", - "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", - "dev": true, - "peer": true - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true - }, - "has-property-descriptors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", - "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", - "dev": true, - "peer": true, - "requires": { - "get-intrinsic": "^1.1.1" - } - }, - "has-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", - "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", - "dev": true - }, - "has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "dev": true - }, - "has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "dev": true, - "requires": { - "has-symbols": "^1.0.2" - } - }, - "hash-base": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", - "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", - "dev": true, - "requires": { - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - } - }, - "hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true - }, - "header-case": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/header-case/-/header-case-1.0.1.tgz", - "integrity": "sha512-i0q9mkOeSuhXw6bGgiQCCBgY/jlZuV/7dZXyZ9c6LcBrqwvT8eT719E9uxE5LiZftdl+z81Ugbg/VvXV4OJOeQ==", - "dev": true, - "requires": { - "no-case": "^2.2.0", - "upper-case": "^1.1.3" - } - }, - "heap": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/heap/-/heap-0.2.7.tgz", - "integrity": "sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg==", - "dev": true, - "peer": true - }, - "highlight.js": { - "version": "10.7.3", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz", - "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==", - "dev": true - }, - "highlightjs-solidity": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/highlightjs-solidity/-/highlightjs-solidity-2.0.6.tgz", - "integrity": "sha512-DySXWfQghjm2l6a/flF+cteroJqD4gI8GSdL4PtvxZSsAHie8m3yVe2JFoRg03ROKT6hp2Lc/BxXkqerNmtQYg==", - "dev": true - }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", - "dev": true, - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "hosted-git-info": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", - "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - }, - "dependencies": { - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } - } - }, - "htmlparser2": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz", - "integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==", - "dev": true, - "requires": { - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3", - "domutils": "^3.0.1", - "entities": "^4.4.0" - } - }, - "http-basic": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/http-basic/-/http-basic-8.1.3.tgz", - "integrity": "sha512-/EcDMwJZh3mABI2NhGfHOGOeOZITqfkEO4p/xK+l3NpyncIHUQBoMvCSF/b5GqvKtySC2srL/GGG3+EtlqlmCw==", - "dev": true, - "peer": true, - "requires": { - "caseless": "^0.12.0", - "concat-stream": "^1.6.2", - "http-response-object": "^3.0.1", - "parse-cache-control": "^1.0.1" - } - }, - "http-cache-semantics": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", - "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", - "dev": true - }, - "http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", - "dev": true, - "requires": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - } - }, - "http-https": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", - "integrity": "sha512-o0PWwVCSp3O0wS6FvNr6xfBCHgt0m1tvPLFOCc2iFDKTRAXhB7m8klDf7ErowFH8POa6dVdGatKU5I1YYwzUyg==", - "dev": true - }, - "http-response-object": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/http-response-object/-/http-response-object-3.0.2.tgz", - "integrity": "sha512-bqX0XTF6fnXSQcEJ2Iuyr75yVakyjIDCqroJQ/aHfSdlM743Cwqoi2nDYMzLGWUcuTWGWy8AAvOKXTfiv6q9RA==", - "dev": true, - "peer": true, - "requires": { - "@types/node": "^10.0.3" - }, - "dependencies": { - "@types/node": { - "version": "10.17.60", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.60.tgz", - "integrity": "sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==", - "dev": true, - "peer": true - } - } - }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "http2-wrapper": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-2.2.0.tgz", - "integrity": "sha512-kZB0wxMo0sh1PehyjJUWRFEd99KC5TLjZ2cULC4f9iqJBAmKQQXEICjxl5iPJRwP40dpeHFqqhm7tYCvODpqpQ==", - "dev": true, - "requires": { - "quick-lru": "^5.1.1", - "resolve-alpn": "^1.2.0" - }, - "dependencies": { - "quick-lru": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", - "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", - "dev": true - } - } - }, - "https-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", - "dev": true, - "requires": { - "agent-base": "6", - "debug": "4" - } - }, - "husky": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", - "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", - "dev": true - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "idna-uts46-hx": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz", - "integrity": "sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA==", - "dev": true, - "requires": { - "punycode": "2.1.0" - } - }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dev": true - }, - "ignore": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", - "dev": true - }, - "immediate": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.3.0.tgz", - "integrity": "sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q==", - "dev": true, - "optional": true - }, - "immutable": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.0.tgz", - "integrity": "sha512-0AOCmOip+xgJwEVTQj1EfiDDOkPmuyllDuTuEX+DDXUgapLAsBIfkg3sxCYyCEA8mQqZrrxPUGjcOQ2JS3WLkg==", - "dev": true - }, - "import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, - "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - } - }, - "imul": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/imul/-/imul-1.0.1.tgz", - "integrity": "sha512-WFAgfwPLAjU66EKt6vRdTlKj4nAgIDQzh29JonLa4Bqtl6D8JrIMvWjCnx7xEjVNmP3U0fM5o8ZObk7d0f62bA==", - "dev": true - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true - }, - "indent-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "ini": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "dev": true, - "peer": true - }, - "internal-slot": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", - "integrity": "sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==", - "dev": true, - "peer": true, - "requires": { - "get-intrinsic": "^1.2.0", - "has": "^1.0.3", - "side-channel": "^1.0.4" - } - }, - "interpret": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", - "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", - "dev": true, - "peer": true - }, - "invert-kv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha512-xgs2NH9AE66ucSq4cNG1nhSFghr5l6tdL15Pk+jl46bmmBapgoaY/AacXyaDznAqmGL99TiLSQgO/XazFSKYeQ==", - "dev": true - }, - "io-ts": { - "version": "1.10.4", - "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-1.10.4.tgz", - "integrity": "sha512-b23PteSnYXSONJ6JQXRAlvJhuw8KOtkqa87W4wDtvMrud/DTJd5X+NpOOI+O/zZwVq6v0VLAaJ+1EDViKEuN9g==", - "dev": true, - "requires": { - "fp-ts": "^1.0.0" - } - }, - "ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", - "dev": true - }, - "is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, - "is-array-buffer": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", - "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", - "dev": true, - "peer": true, - "requires": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.0", - "is-typed-array": "^1.1.10" - } - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "dev": true - }, - "is-bigint": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", - "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", - "dev": true, - "peer": true, - "requires": { - "has-bigints": "^1.0.1" - } - }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-boolean-object": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", - "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", - "dev": true, - "peer": true, - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, - "is-buffer": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", - "dev": true - }, - "is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "dev": true - }, - "is-core-module": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", - "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", - "dev": true, - "requires": { - "has": "^1.0.3" - } - }, - "is-date-object": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", - "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", - "dev": true, - "peer": true, - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "is-function": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", - "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==", - "dev": true - }, - "is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", - "dev": true, - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-hex-prefixed": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", - "integrity": "sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA==", - "dev": true - }, - "is-lower-case": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/is-lower-case/-/is-lower-case-1.1.3.tgz", - "integrity": "sha512-+5A1e/WJpLLXZEDlgz4G//WYSHyQBD32qa4Jd3Lw06qQlv3fJHnp3YIHjTQSGzHMgzmVKz2ZP3rBxTHkPw/lxA==", - "dev": true, - "requires": { - "lower-case": "^1.1.0" - } - }, - "is-negative-zero": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", - "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", - "dev": true, - "peer": true - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "is-number-object": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", - "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", - "dev": true, - "peer": true, - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-obj": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", - "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", - "dev": true, - "optional": true - }, - "is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true - }, - "is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", - "dev": true - }, - "is-regex": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", - "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", - "dev": true, - "peer": true, - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, - "is-shared-array-buffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", - "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", - "dev": true, - "peer": true, - "requires": { - "call-bind": "^1.0.2" - } - }, - "is-string": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", - "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", - "dev": true, - "peer": true, - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-symbol": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", - "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", - "dev": true, - "peer": true, - "requires": { - "has-symbols": "^1.0.2" - } - }, - "is-typed-array": { - "version": "1.1.10", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", - "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", - "dev": true, - "requires": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0" - } - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", - "dev": true - }, - "is-unicode-supported": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", - "dev": true - }, - "is-upper-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-upper-case/-/is-upper-case-1.1.2.tgz", - "integrity": "sha512-GQYSJMgfeAmVwh9ixyk888l7OIhNAGKtY6QA+IrWlu9MDTCaXmeozOZ2S9Knj7bQwBO/H6J2kb+pbyTUiMNbsw==", - "dev": true, - "requires": { - "upper-case": "^1.1.0" - } - }, - "is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q==", - "dev": true - }, - "is-weakref": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", - "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", - "dev": true, - "peer": true, - "requires": { - "call-bind": "^1.0.2" - } - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true, - "peer": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true - }, - "isomorphic-ws": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", - "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", - "dev": true, - "optional": true, - "requires": {} - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==", - "dev": true - }, - "jackspeak": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.2.1.tgz", - "integrity": "sha512-MXbxovZ/Pm42f6cDIDkl3xpwv1AGwObKwfmjs2nQePiy85tP3fatofl3FC1aBsOtP/6fq5SbtgHwWcMsLP+bDw==", - "dev": true, - "requires": { - "@isaacs/cliui": "^8.0.2", - "@pkgjs/parseargs": "^0.11.0" - } - }, - "jmespath": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz", - "integrity": "sha512-+kHj8HXArPfpPEKGLZ+kB5ONRTCiGQXo8RQYL0hH8t6pWXUBBK5KkkQmTNOwKK4LEsd0yTsgtjJVm4UBSZea4w==", - "dev": true - }, - "js-sdsl": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.4.0.tgz", - "integrity": "sha512-FfVSdx6pJ41Oa+CF7RDaFmTnCaFhua+SNYQX74riGOpl96x+2jQCqEfQ2bnXu/5DPCqlRuiqyvTJM0Qjz26IVg==", - "dev": true - }, - "js-sha3": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==", - "dev": true - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==", - "dev": true - }, - "json-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", - "dev": true - }, - "json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true - }, - "json-pointer": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/json-pointer/-/json-pointer-0.6.2.tgz", - "integrity": "sha512-vLWcKbOaXlO+jvRy4qNd+TI1QUPZzfJj1tpJ3vAXDych5XJf93ftpUKe5pKCrzyIIwgBJcOcCVRUfqQP25afBw==", - "dev": true, - "requires": { - "foreach": "^2.0.4" - } - }, - "json-schema": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", - "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "json-schema-typed": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/json-schema-typed/-/json-schema-typed-7.0.3.tgz", - "integrity": "sha512-7DE8mpG+/fVw+dTpjbxnx47TaMnDfOI1jwft9g1VybltZCduyRQPJPvc+zzKY9WPHxhPWczyFuYa6I8Mw4iU5A==", - "dev": true, - "optional": true - }, - "json-stable-stringify": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.2.tgz", - "integrity": "sha512-eunSSaEnxV12z+Z73y/j5N37/In40GK4GmsSy+tEHJMxknvqnA7/djeYtAgW0GsWHUfg+847WJjKaEylk2y09g==", - "dev": true, - "requires": { - "jsonify": "^0.0.1" - } - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", - "dev": true - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "jsonify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", - "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", - "dev": true - }, - "jsonschema": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.1.tgz", - "integrity": "sha512-S6cATIPVv1z0IlxdN+zUk5EPjkGCdnhN4wVSBlvoUO1tOLJootbo9CquNJmbIh4yikWHiUedhRYrNPn1arpEmQ==", - "dev": true, - "peer": true - }, - "jsprim": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", - "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", - "dev": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.4.0", - "verror": "1.10.0" - } - }, - "keccak": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.3.tgz", - "integrity": "sha512-JZrLIAJWuZxKbCilMpNz5Vj7Vtb4scDG3dMXLOsbzBmQGyjwE61BbW7bJkfKKCShXiQZt3T6sBgALRtmd+nZaQ==", - "dev": true, - "requires": { - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0", - "readable-stream": "^3.6.0" - } - }, - "keyv": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.2.tgz", - "integrity": "sha512-5MHbFaKn8cNSmVW7BYnijeAVlE4cYA/SVkifVgrh7yotnfhKmjuXpDKjrABLnT0SfHWV21P8ow07OGfRrNDg8g==", - "dev": true, - "requires": { - "json-buffer": "3.0.1" - } - }, - "kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true - }, - "klaw": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", - "integrity": "sha512-TED5xi9gGQjGpNnvRWknrwAB1eL5GciPfVFOt3Vk1OJCVDQbzuSfrF3hkUQKlsgKrG1F+0t5W0m+Fje1jIt8rw==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.9" - } - }, - "lcid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha512-YiGkH6EnGrDGqLMITnGjXtGmNtjoXw9SVUzcaos8RBi7Ps0VBylkq+vOcY9QE5poLasPCR849ucFUkl0UzUyOw==", - "dev": true, - "requires": { - "invert-kv": "^1.0.0" - } - }, - "lcov-parse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-1.0.0.tgz", - "integrity": "sha512-aprLII/vPzuQvYZnDRU78Fns9I2Ag3gi4Ipga/hxnVMCZC8DnR2nI7XBqrPoywGfxqIx/DgarGvDJZAD3YBTgQ==", - "dev": true - }, - "level": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/level/-/level-8.0.0.tgz", - "integrity": "sha512-ypf0jjAk2BWI33yzEaaotpq7fkOPALKAgDBxggO6Q9HGX2MRXn0wbP1Jn/tJv1gtL867+YOjOB49WaUF3UoJNQ==", - "dev": true, - "requires": { - "browser-level": "^1.0.1", - "classic-level": "^1.2.0" - } - }, - "level-codec": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/level-codec/-/level-codec-9.0.2.tgz", - "integrity": "sha512-UyIwNb1lJBChJnGfjmO0OR+ezh2iVu1Kas3nvBS/BzGnx79dv6g7unpKIDNPMhfdTEGoc7mC8uAu51XEtX+FHQ==", - "dev": true, - "optional": true, - "requires": { - "buffer": "^5.6.0" - } - }, - "level-concat-iterator": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz", - "integrity": "sha512-BWRCMHBxbIqPxJ8vHOvKUsaO0v1sLYZtjN3K2iZJsRBYtp+ONsY6Jfi6hy9K3+zolgQRryhIn2NRZjZnWJ9NmQ==", - "dev": true, - "optional": true, - "requires": { - "catering": "^2.1.0" - } - }, - "level-errors": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/level-errors/-/level-errors-2.0.1.tgz", - "integrity": "sha512-UVprBJXite4gPS+3VznfgDSU8PTRuVX0NXwoWW50KLxd2yw4Y1t2JUR5In1itQnudZqRMT9DlAM3Q//9NCjCFw==", - "dev": true, - "optional": true, - "requires": { - "errno": "~0.1.1" - } - }, - "level-iterator-stream": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/level-iterator-stream/-/level-iterator-stream-4.0.2.tgz", - "integrity": "sha512-ZSthfEqzGSOMWoUGhTXdX9jv26d32XJuHz/5YnuHZzH6wldfWMOVwI9TBtKcya4BKTyTt3XVA0A3cF3q5CY30Q==", - "dev": true, - "optional": true, - "requires": { - "inherits": "^2.0.4", - "readable-stream": "^3.4.0", - "xtend": "^4.0.2" - } - }, - "level-js": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/level-js/-/level-js-5.0.2.tgz", - "integrity": "sha512-SnBIDo2pdO5VXh02ZmtAyPP6/+6YTJg2ibLtl9C34pWvmtMEmRTWpra+qO/hifkUtBTOtfx6S9vLDjBsBK4gRg==", - "dev": true, - "optional": true, - "requires": { - "abstract-leveldown": "~6.2.3", - "buffer": "^5.5.0", - "inherits": "^2.0.3", - "ltgt": "^2.1.2" - }, - "dependencies": { - "abstract-leveldown": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", - "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", - "dev": true, - "optional": true, - "requires": { - "buffer": "^5.5.0", - "immediate": "^3.2.3", - "level-concat-iterator": "~2.0.0", - "level-supports": "~1.0.0", - "xtend": "~4.0.0" - } - }, - "level-concat-iterator": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz", - "integrity": "sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==", - "dev": true, - "optional": true - }, - "level-supports": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-1.0.1.tgz", - "integrity": "sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg==", - "dev": true, - "optional": true, - "requires": { - "xtend": "^4.0.2" - } - } - } - }, - "level-packager": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/level-packager/-/level-packager-5.1.1.tgz", - "integrity": "sha512-HMwMaQPlTC1IlcwT3+swhqf/NUO+ZhXVz6TY1zZIIZlIR0YSn8GtAAWmIvKjNY16ZkEg/JcpAuQskxsXqC0yOQ==", - "dev": true, - "optional": true, - "requires": { - "encoding-down": "^6.3.0", - "levelup": "^4.3.2" - } - }, - "level-supports": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-4.0.1.tgz", - "integrity": "sha512-PbXpve8rKeNcZ9C1mUicC9auIYFyGpkV9/i6g76tLgANwWhtG2v7I4xNBUlkn3lE2/dZF3Pi0ygYGtLc4RXXdA==", - "dev": true - }, - "level-transcoder": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/level-transcoder/-/level-transcoder-1.0.1.tgz", - "integrity": "sha512-t7bFwFtsQeD8cl8NIoQ2iwxA0CL/9IFw7/9gAjOonH0PWTTiRfY7Hq+Ejbsxh86tXobDQ6IOiddjNYIfOBs06w==", - "dev": true, - "requires": { - "buffer": "^6.0.3", - "module-error": "^1.0.1" - }, - "dependencies": { - "buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "dev": true, - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - } - } - }, - "level-write-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/level-write-stream/-/level-write-stream-1.0.0.tgz", - "integrity": "sha512-bBNKOEOMl8msO+uIM9YX/gUO6ckokZ/4pCwTm/lwvs46x6Xs8Zy0sn3Vh37eDqse4mhy4fOMIb/JsSM2nyQFtw==", - "dev": true, - "optional": true, - "requires": { - "end-stream": "~0.1.0" - } - }, - "leveldown": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-5.6.0.tgz", - "integrity": "sha512-iB8O/7Db9lPaITU1aA2txU/cBEXAt4vWwKQRrrWuS6XDgbP4QZGj9BL2aNbwb002atoQ/lIotJkfyzz+ygQnUQ==", - "dev": true, - "optional": true, - "requires": { - "abstract-leveldown": "~6.2.1", - "napi-macros": "~2.0.0", - "node-gyp-build": "~4.1.0" - }, - "dependencies": { - "abstract-leveldown": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", - "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", - "dev": true, - "optional": true, - "requires": { - "buffer": "^5.5.0", - "immediate": "^3.2.3", - "level-concat-iterator": "~2.0.0", - "level-supports": "~1.0.0", - "xtend": "~4.0.0" - } - }, - "level-concat-iterator": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz", - "integrity": "sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==", - "dev": true, - "optional": true - }, - "level-supports": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-1.0.1.tgz", - "integrity": "sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg==", - "dev": true, - "optional": true, - "requires": { - "xtend": "^4.0.2" - } - }, - "napi-macros": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz", - "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==", - "dev": true, - "optional": true - }, - "node-gyp-build": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.1.1.tgz", - "integrity": "sha512-dSq1xmcPDKPZ2EED2S6zw/b9NKsqzXRE6dVr8TVQnI3FJOTteUMuqF3Qqs6LZg+mLGYJWqQzMbIjMtJqTv87nQ==", - "dev": true, - "optional": true - } - } - }, - "levelup": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/levelup/-/levelup-4.4.0.tgz", - "integrity": "sha512-94++VFO3qN95cM/d6eBXvd894oJE0w3cInq9USsyQzzoJxmiYzPAocNcuGCPGGjoXqDVJcr3C1jzt1TSjyaiLQ==", - "dev": true, - "optional": true, - "requires": { - "deferred-leveldown": "~5.3.0", - "level-errors": "~2.0.0", - "level-iterator-stream": "~4.0.0", - "level-supports": "~1.0.0", - "xtend": "~4.0.0" - }, - "dependencies": { - "level-supports": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-1.0.1.tgz", - "integrity": "sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg==", - "dev": true, - "optional": true, - "requires": { - "xtend": "^4.0.2" - } - } - } - }, - "leven": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", - "integrity": "sha512-nvVPLpIHUxCUoRLrFqTgSxXJ614d8AgQoWl7zPe/2VadE8+1dpU3LBhowRuBAcuwruWtOdD8oYC9jDNJjXDPyA==", - "dev": true - }, - "levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - } - }, - "lines-and-columns": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true - }, - "linq": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/linq/-/linq-3.2.4.tgz", - "integrity": "sha512-WIgtcH1EHHTXI/Qt/V3JH8D8j46ZiMJu1fynCzhAXtPYDAtV208BRmzpE2EhDq8KhoBAMVRL7KPH1khvHFstlw==", - "dev": true - }, - "load-json-file": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", - "integrity": "sha512-cy7ZdNRXdablkXYNI049pthVeXFurRyb9+hA/dZzerZ0pGTx42z+y+ssxBaVV2l70t1muq5IdKhn4UtcoGUY9A==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - }, - "dependencies": { - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha512-QR/GGaKCkhwk1ePQNYDRKYZ3mwU9ypsKhB0XyFnLQdomyEqk3e8wpW3V5Jp88zbxK4n5ST1nqo+g9juTpownhQ==", - "dev": true, - "requires": { - "error-ex": "^1.2.0" - } - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", - "dev": true - } - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, - "lodash-es": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", - "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", - "dev": true - }, - "lodash.assign": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", - "integrity": "sha512-hFuH8TY+Yji7Eja3mGiuAxBqLagejScbG8GbG0j6o9vzn0YL14My+ktnqtZgFTosKymC9/44wP6s7xyuLfnClw==", - "dev": true - }, - "lodash.camelcase": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", - "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", - "dev": true, - "peer": true - }, - "lodash.clonedeep": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==", - "dev": true, - "peer": true - }, - "lodash.flatten": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", - "integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==", - "dev": true - }, - "lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true - }, - "lodash.sortby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", - "integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==", - "dev": true, - "optional": true - }, - "lodash.truncate": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", - "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", - "dev": true - }, - "log-driver": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz", - "integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==", - "dev": true - }, - "log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "dev": true, - "requires": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "loglevel": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.1.tgz", - "integrity": "sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg==", - "dev": true, - "optional": true - }, - "long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==", - "dev": true, - "optional": true - }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dev": true, - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "loupe": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", - "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", - "dev": true, - "requires": { - "get-func-name": "^2.0.0" - } - }, - "lower-case": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", - "integrity": "sha512-2Fgx1Ycm599x+WGpIYwJOvsjmXFzTSc34IwDWALRA/8AopUKAVPwfJ+h5+f85BCp0PWmmJcWzEpxOpoXycMpdA==", - "dev": true - }, - "lower-case-first": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/lower-case-first/-/lower-case-first-1.0.2.tgz", - "integrity": "sha512-UuxaYakO7XeONbKrZf5FEgkantPf5DUqDayzP5VXZrtRPdH86s4kN47I8B3TW10S4QKiE3ziHNf3kRN//okHjA==", - "dev": true, - "requires": { - "lower-case": "^1.1.2" - } - }, - "lowercase-keys": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-3.0.0.tgz", - "integrity": "sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==", - "dev": true - }, - "lru_map": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.3.3.tgz", - "integrity": "sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ==", - "dev": true - }, - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "requires": { - "yallist": "^3.0.2" - } - }, - "ltgt": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ltgt/-/ltgt-2.2.1.tgz", - "integrity": "sha512-AI2r85+4MquTw9ZYqabu4nMwy9Oftlfa/e/52t9IjtfG+mGBbTNdAoZ3RQKLHR6r0wQnwZnPIEh/Ya6XTWAKNA==", - "dev": true, - "optional": true - }, - "make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true, - "peer": true - }, - "map-obj": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", - "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", - "dev": true - }, - "markdown-table": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-1.1.3.tgz", - "integrity": "sha512-1RUZVgQlpJSPWYbFSpmudq5nHY1doEIv89gBtF0s4gW1GF2XorxcA/70M5vq7rLv0a6mhOUccRsqkwhwLCIQ2Q==", - "dev": true, - "peer": true - }, - "mcl-wasm": { - "version": "0.7.9", - "resolved": "https://registry.npmjs.org/mcl-wasm/-/mcl-wasm-0.7.9.tgz", - "integrity": "sha512-iJIUcQWA88IJB/5L15GnJVnSQJmf/YaxxV6zRavv83HILHaJQb6y0iFyDMdDO0gN8X37tdxmAOrH/P8B6RB8sQ==", - "dev": true - }, - "md5.js": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", - "dev": true, - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", - "dev": true - }, - "memdown": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/memdown/-/memdown-1.4.1.tgz", - "integrity": "sha512-iVrGHZB8i4OQfM155xx8akvG9FIj+ht14DX5CQkCTG4EHzZ3d3sgckIf/Lm9ivZalEsFuEVnWv2B2WZvbrro2w==", - "dev": true, - "optional": true, - "requires": { - "abstract-leveldown": "~2.7.1", - "functional-red-black-tree": "^1.0.1", - "immediate": "^3.2.3", - "inherits": "~2.0.1", - "ltgt": "~2.2.0", - "safe-buffer": "~5.1.1" - }, - "dependencies": { - "abstract-leveldown": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-2.7.2.tgz", - "integrity": "sha512-+OVvxH2rHVEhWLdbudP6p0+dNMXu8JA1CbhP19T8paTYAcX7oJ4OVjT+ZUVpv7mITxXHqDMej+GdqXBmXkw09w==", - "dev": true, - "optional": true, - "requires": { - "xtend": "~4.0.0" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true, - "optional": true - } - } - }, - "memory-level": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/memory-level/-/memory-level-1.0.0.tgz", - "integrity": "sha512-UXzwewuWeHBz5krr7EvehKcmLFNoXxGcvuYhC41tRnkrTbJohtS7kVn9akmgirtRygg+f7Yjsfi8Uu5SGSQ4Og==", - "dev": true, - "requires": { - "abstract-level": "^1.0.0", - "functional-red-black-tree": "^1.0.1", - "module-error": "^1.0.1" - } - }, - "memorystream": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", - "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==", - "dev": true - }, - "meow": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz", - "integrity": "sha512-+obSblOQmRhcyBt62furQqRAQpNyWXo8BuQ5bN7dG8wmwQ+vwHKp/rCFD4CrTP8CsDQD1sjoZ94K417XEUk8IQ==", - "dev": true, - "requires": { - "@types/minimist": "^1.2.0", - "camelcase-keys": "^6.2.2", - "decamelize": "^1.2.0", - "decamelize-keys": "^1.1.0", - "hard-rejection": "^2.1.0", - "minimist-options": "4.1.0", - "normalize-package-data": "^3.0.0", - "read-pkg-up": "^7.0.1", - "redent": "^3.0.0", - "trim-newlines": "^3.0.0", - "type-fest": "^0.18.0", - "yargs-parser": "^20.2.3" - }, - "dependencies": { - "type-fest": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", - "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", - "dev": true - } - } - }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==", - "dev": true - }, - "merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "peer": true - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", - "dev": true - }, - "micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dev": true, - "peer": true, - "requires": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - } - }, - "mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "dev": true - }, - "mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dev": true - }, - "mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dev": true, - "requires": { - "mime-db": "1.52.0" - } - }, - "mimic-fn": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-3.1.0.tgz", - "integrity": "sha512-Ysbi9uYW9hFyfrThdDEQuykN4Ey6BuwPD2kpI5ES/nFTDn/98yxYNLZJcgUAKPT/mcrLLKaGzJR9YVxJrIdASQ==", - "dev": true, - "optional": true - }, - "mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", - "dev": true - }, - "min-document": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", - "integrity": "sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ==", - "dev": true, - "requires": { - "dom-walk": "^0.1.0" - } - }, - "min-indent": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", - "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", - "dev": true - }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "dev": true - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==", - "dev": true - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true - }, - "minimist-options": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", - "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", - "dev": true, - "requires": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0", - "kind-of": "^6.0.3" - } - }, - "minipass": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-6.0.2.tgz", - "integrity": "sha512-MzWSV5nYVT7mVyWCwn2o7JH13w2TBRmmSqSRCKzTw+lmft9X4z+3wjvs06Tzijo5z4W/kahUCDpRXTF+ZrmF/w==", - "dev": true - }, - "minizlib": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", - "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", - "dev": true, - "requires": { - "minipass": "^2.9.0" - }, - "dependencies": { - "minipass": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", - "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - } - } - } - }, - "mkdirp": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", - "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", - "dev": true, - "requires": { - "minimist": "^1.2.6" - } - }, - "mkdirp-promise": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz", - "integrity": "sha512-Hepn5kb1lJPtVW84RFT40YG1OddBNTOVUZR2bzQUHc+Z03en8/3uX0+060JDhcEzyO08HmipsN9DcnFMxhIL9w==", - "dev": true, - "requires": { - "mkdirp": "*" - } - }, - "mnemonist": { - "version": "0.38.5", - "resolved": "https://registry.npmjs.org/mnemonist/-/mnemonist-0.38.5.tgz", - "integrity": "sha512-bZTFT5rrPKtPJxj8KSV0WkPyNxl72vQepqqVUAW2ARUpUSF2qXMB6jZj7hW5/k7C1rtpzqbD/IIbJwLXUjCHeg==", - "dev": true, - "requires": { - "obliterator": "^2.0.0" - } - }, - "mocha": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", - "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", - "dev": true, - "requires": { - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.5.3", - "debug": "4.3.4", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "7.2.0", - "he": "1.2.0", - "js-yaml": "4.1.0", - "log-symbols": "4.1.0", - "minimatch": "5.0.1", - "ms": "2.1.3", - "nanoid": "3.3.3", - "serialize-javascript": "6.0.0", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "workerpool": "6.2.1", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" - }, - "dependencies": { - "ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true - }, - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true - }, - "find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "requires": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - } - }, - "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "dependencies": { - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - } - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, - "locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "requires": { - "p-locate": "^5.0.0" - } - }, - "minimatch": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", - "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - }, - "dependencies": { - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" - } - } - } - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "requires": { - "p-limit": "^3.0.2" - } - }, - "supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true - } - } - }, - "mock-fs": { - "version": "4.14.0", - "resolved": "https://registry.npmjs.org/mock-fs/-/mock-fs-4.14.0.tgz", - "integrity": "sha512-qYvlv/exQ4+svI3UOvPUpLDF0OMX5euvUH0Ny4N5QyRyhNdgAgUrVH3iUINSzEPLvx0kbo/Bp28GJKIqvE7URw==", - "dev": true - }, - "module-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/module-error/-/module-error-1.0.2.tgz", - "integrity": "sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA==", - "dev": true - }, - "mri": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.4.tgz", - "integrity": "sha512-6y7IjGPm8AzlvoUrwAaw1tLnUBudaS3752vcd8JtrpGGQn+rXIe63LFVHm/YMwtqAuh+LJPCFdlLYPWM1nYn6w==", - "dev": true - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "multibase": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.6.1.tgz", - "integrity": "sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw==", - "dev": true, - "requires": { - "base-x": "^3.0.8", - "buffer": "^5.5.0" - } - }, - "multicodec": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-0.5.7.tgz", - "integrity": "sha512-PscoRxm3f+88fAtELwUnZxGDkduE2HD9Q6GHUOywQLjOGT/HAdhjLDYNZ1e7VR0s0TP0EwZ16LNUTFpoBGivOA==", - "dev": true, - "requires": { - "varint": "^5.0.0" - } - }, - "multihashes": { - "version": "0.4.21", - "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-0.4.21.tgz", - "integrity": "sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw==", - "dev": true, - "requires": { - "buffer": "^5.5.0", - "multibase": "^0.7.0", - "varint": "^5.0.0" - }, - "dependencies": { - "multibase": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.7.0.tgz", - "integrity": "sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg==", - "dev": true, - "requires": { - "base-x": "^3.0.8", - "buffer": "^5.5.0" - } - } - } - }, - "murmur-128": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/murmur-128/-/murmur-128-0.2.1.tgz", - "integrity": "sha512-WseEgiRkI6aMFBbj8Cg9yBj/y+OdipwVC7zUo3W2W1JAJITwouUOtpqsmGSg67EQmwwSyod7hsVsWY5LsrfQVg==", - "dev": true, - "requires": { - "encode-utf8": "^1.0.2", - "fmix": "^0.1.0", - "imul": "^1.0.0" - } - }, - "nano-base32": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/nano-base32/-/nano-base32-1.0.1.tgz", - "integrity": "sha512-sxEtoTqAPdjWVGv71Q17koMFGsOMSiHsIFEvzOM7cNp8BXB4AnEwmDabm5dorusJf/v1z7QxaZYxUorU9RKaAw==", - "dev": true - }, - "nano-json-stream-parser": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", - "integrity": "sha512-9MqxMH/BSJC7dnLsEMPyfN5Dvoo49IsPFYMcHw3Bcfc2kN0lpHRBSzlMSVx4HGyJ7s9B31CyBTVehWJoQ8Ctew==", - "dev": true - }, - "nanoid": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", - "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", - "dev": true - }, - "napi-macros": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.2.2.tgz", - "integrity": "sha512-hmEVtAGYzVQpCKdbQea4skABsdXW4RUh5t5mJ2zzqowJS2OyXZTU1KhDVFhx+NlWZ4ap9mqR9TcDO3LTTttd+g==", - "dev": true - }, - "natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true - }, - "negotiator": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", - "dev": true - }, - "neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true, - "peer": true - }, - "next-tick": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", - "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==", - "dev": true - }, - "no-case": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz", - "integrity": "sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==", - "dev": true, - "requires": { - "lower-case": "^1.1.1" - } - }, - "node-abort-controller": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/node-abort-controller/-/node-abort-controller-3.1.1.tgz", - "integrity": "sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ==", - "dev": true, - "optional": true - }, - "node-addon-api": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", - "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", - "dev": true - }, - "node-emoji": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.11.0.tgz", - "integrity": "sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==", - "dev": true, - "peer": true, - "requires": { - "lodash": "^4.17.21" - } - }, - "node-environment-flags": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", - "integrity": "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==", - "dev": true, - "peer": true, - "requires": { - "object.getownpropertydescriptors": "^2.0.3", - "semver": "^5.7.0" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true, - "peer": true - } - } - }, - "node-fetch": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", - "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", - "dev": true, - "requires": { - "whatwg-url": "^5.0.0" - } - }, - "node-gyp-build": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", - "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==", - "dev": true - }, - "node-interval-tree": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/node-interval-tree/-/node-interval-tree-1.3.3.tgz", - "integrity": "sha512-K9vk96HdTK5fEipJwxSvIIqwTqr4e3HRJeJrNxBSeVMNSC/JWARRaX7etOLOuTmrRMeOI/K5TCJu3aWIwZiNTw==", - "dev": true, - "requires": { - "shallowequal": "^1.0.2" - } - }, - "nofilter": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/nofilter/-/nofilter-3.1.0.tgz", - "integrity": "sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g==", - "dev": true, - "peer": true - }, - "nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha512-4GUt3kSEYmk4ITxzB/b9vaIDfUVWN/Ml1Fwl11IlnIG2iaJ9O6WXZ9SrYM9NLI8OCBieN2Y8SWC2oJV0RQ7qYg==", - "dev": true, - "peer": true, - "requires": { - "abbrev": "1" - } - }, - "normalize-package-data": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", - "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", - "dev": true, - "requires": { - "hosted-git-info": "^4.0.1", - "is-core-module": "^2.5.0", - "semver": "^7.3.4", - "validate-npm-package-license": "^3.0.1" - }, - "dependencies": { - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "semver": { - "version": "7.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", - "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } - } - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true - }, - "normalize-url": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", - "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", - "dev": true - }, - "nth-check": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", - "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", - "dev": true, - "requires": { - "boolbase": "^1.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==", - "dev": true - }, - "number-to-bn": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", - "integrity": "sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig==", - "dev": true, - "requires": { - "bn.js": "4.11.6", - "strip-hex-prefix": "1.0.0" - }, - "dependencies": { - "bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==", - "dev": true - } - } - }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "dev": true - }, - "object-inspect": { - "version": "1.12.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", - "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", - "dev": true - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true, - "peer": true - }, - "object.assign": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", - "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", - "dev": true, - "peer": true, - "requires": { - "define-properties": "^1.1.2", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.0", - "object-keys": "^1.0.11" - } - }, - "object.getownpropertydescriptors": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.6.tgz", - "integrity": "sha512-lq+61g26E/BgHv0ZTFgRvi7NMEPuAxLkFU7rukXjc/AlwH4Am5xXVnIXy3un1bg/JPbXHrixRkK1itUzzPiIjQ==", - "dev": true, - "peer": true, - "requires": { - "array.prototype.reduce": "^1.0.5", - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.21.2", - "safe-array-concat": "^1.0.0" - } - }, - "obliterator": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/obliterator/-/obliterator-2.0.4.tgz", - "integrity": "sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ==", - "dev": true - }, - "oboe": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.5.tgz", - "integrity": "sha512-zRFWiF+FoicxEs3jNI/WYUrVEgA7DeET/InK0XQuudGHRg8iIob3cNPrJTKaz4004uaA9Pbe+Dwa8iluhjLZWA==", - "dev": true, - "requires": { - "http-https": "^1.0.0" - } - }, - "on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", - "dev": true, - "requires": { - "ee-first": "1.1.1" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "optional": true, - "requires": { - "mimic-fn": "^2.1.0" - }, - "dependencies": { - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, - "optional": true - } - } - }, - "optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", - "dev": true, - "requires": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" - } - }, - "ordinal": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/ordinal/-/ordinal-1.0.3.tgz", - "integrity": "sha512-cMddMgb2QElm8G7vdaa02jhUNbTSrhsgAGUz1OokD83uJTwSUn+nKoNoKVVaRa08yF6sgfO7Maou1+bgLd9rdQ==", - "dev": true, - "peer": true - }, - "original-require": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/original-require/-/original-require-1.0.1.tgz", - "integrity": "sha512-5vdKMbE58WaE61uVD+PKyh8xdM398UnjPBLotW2sjG5MzHARwta/+NtMBCBA0t2WQblGYBvq5vsiZpWokwno+A==", - "dev": true - }, - "os-locale": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", - "integrity": "sha512-PRT7ZORmwu2MEFt4/fv3Q+mEfN4zetKxufQrkShY2oGvUms9r8otu5HfdyIFHkYXjO7laNsoVGmM2MANfuTA8g==", - "dev": true, - "requires": { - "lcid": "^1.0.0" - } - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", - "dev": true - }, - "p-cancelable": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-3.0.0.tgz", - "integrity": "sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw==", - "dev": true - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "p-map": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", - "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", - "dev": true, - "requires": { - "aggregate-error": "^3.0.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "param-case": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/param-case/-/param-case-2.1.1.tgz", - "integrity": "sha512-eQE845L6ot89sk2N8liD8HAuH4ca6Vvr7VWAWwt7+kvvG5aBcPmmphQ68JsEG2qa9n1TykS2DLeMt363AAH8/w==", - "dev": true, - "requires": { - "no-case": "^2.2.0" - } - }, - "parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "requires": { - "callsites": "^3.0.0" - } - }, - "parse-cache-control": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parse-cache-control/-/parse-cache-control-1.0.1.tgz", - "integrity": "sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg==", - "dev": true, - "peer": true - }, - "parse-headers": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz", - "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==", - "dev": true - }, - "parse-json": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", - "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - } - }, - "parse5": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", - "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", - "dev": true, - "requires": { - "entities": "^4.4.0" - } - }, - "parse5-htmlparser2-tree-adapter": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.0.0.tgz", - "integrity": "sha512-B77tOZrqqfUfnVcOrUvfdLbz4pu4RopLD/4vmu3HUPswwTA8OH0EMW9BlWR2B0RCoiZRAHEUu7IxeP1Pd1UU+g==", - "dev": true, - "requires": { - "domhandler": "^5.0.2", - "parse5": "^7.0.0" - } - }, - "parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "dev": true - }, - "pascal-case": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-2.0.1.tgz", - "integrity": "sha512-qjS4s8rBOJa2Xm0jmxXiyh1+OFf6ekCWOvUaRgAQSktzlTbMotS0nmG9gyYAybCWBcuP4fsBeRCKNwGBnMe2OQ==", - "dev": true, - "requires": { - "camel-case": "^3.0.0", - "upper-case-first": "^1.1.0" - } - }, - "path-case": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/path-case/-/path-case-2.1.1.tgz", - "integrity": "sha512-Ou0N05MioItesaLr9q8TtHVWmJ6fxWdqKB2RohFmNWVyJ+2zeKIeDNWAN6B/Pe7wpzWChhZX6nONYmOnMeJQ/Q==", - "dev": true, - "requires": { - "no-case": "^2.2.0" - } - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true - }, - "path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "path-scurry": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.9.2.tgz", - "integrity": "sha512-qSDLy2aGFPm8i4rsbHd4MNyTcrzHFsLQykrtbuGRknZZCBBVXSv2tSCDN2Cg6Rt/GFRw8GoW9y9Ecw5rIPG1sg==", - "dev": true, - "requires": { - "lru-cache": "^9.1.1", - "minipass": "^5.0.0 || ^6.0.2" - }, - "dependencies": { - "lru-cache": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-9.1.1.tgz", - "integrity": "sha512-65/Jky17UwSb0BuB9V+MyDpsOtXKmYwzhyl+cOa9XUiI4uV2Ouy/2voFP3+al0BjZbJgMBD8FojMpAf+Z+qn4A==", - "dev": true - } - } - }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==", - "dev": true - }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true - }, - "pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", - "dev": true - }, - "pbkdf2": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", - "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", - "dev": true, - "requires": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", - "dev": true - }, - "picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true - }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true, - "peer": true - }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==", - "dev": true - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", - "dev": true, - "requires": { - "pinkie": "^2.0.0" - } - }, - "pino": { - "version": "5.17.0", - "resolved": "https://registry.npmjs.org/pino/-/pino-5.17.0.tgz", - "integrity": "sha512-LqrqmRcJz8etUjyV0ddqB6OTUutCgQULPFg2b4dtijRHUsucaAdBgSUW58vY6RFSX+NT8963F+q0tM6lNwGShA==", - "dev": true, - "requires": { - "fast-redact": "^2.0.0", - "fast-safe-stringify": "^2.0.7", - "flatstr": "^1.0.12", - "pino-std-serializers": "^2.4.2", - "quick-format-unescaped": "^3.0.3", - "sonic-boom": "^0.7.5" - } - }, - "pino-pretty": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/pino-pretty/-/pino-pretty-2.6.1.tgz", - "integrity": "sha512-e/CWtKLidqkr7sinfIVVcsfcHgnFVlGvuEfKuuPFnxBo+9dZZsmgF8a9Rj7SYJ5LMZ8YBxNY9Ca46eam4ajKtQ==", - "dev": true, - "requires": { - "args": "^5.0.0", - "chalk": "^2.3.2", - "dateformat": "^3.0.3", - "fast-json-parse": "^1.0.3", - "fast-safe-stringify": "^2.0.6", - "jmespath": "^0.15.0", - "pump": "^3.0.0", - "readable-stream": "^3.0.6", - "split2": "^3.0.0" - } - }, - "pino-std-serializers": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-2.5.0.tgz", - "integrity": "sha512-wXqbqSrIhE58TdrxxlfLwU9eDhrzppQDvGhBEr1gYbzzM4KKo3Y63gSjiDXRKLVS2UOXdPNR2v+KnQgNrs+xUg==", - "dev": true - }, - "pkg-up": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz", - "integrity": "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==", - "dev": true, - "optional": true, - "requires": { - "find-up": "^3.0.0" - }, - "dependencies": { - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "optional": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "optional": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "optional": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", - "dev": true, - "optional": true - } - } - }, - "pluralize": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", - "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", - "dev": true - }, - "pouchdb": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/pouchdb/-/pouchdb-7.3.0.tgz", - "integrity": "sha512-OwsIQGXsfx3TrU1pLruj6PGSwFH+h5k4hGNxFkZ76Um7/ZI8F5TzUHFrpldVVIhfXYi2vP31q0q7ot1FSLFYOw==", - "dev": true, - "optional": true, - "requires": { - "abort-controller": "3.0.0", - "argsarray": "0.0.1", - "buffer-from": "1.1.2", - "clone-buffer": "1.0.0", - "double-ended-queue": "2.1.0-0", - "fetch-cookie": "0.11.0", - "immediate": "3.3.0", - "inherits": "2.0.4", - "level": "6.0.1", - "level-codec": "9.0.2", - "level-write-stream": "1.0.0", - "leveldown": "5.6.0", - "levelup": "4.4.0", - "ltgt": "2.2.1", - "node-fetch": "2.6.7", - "readable-stream": "1.1.14", - "spark-md5": "3.0.2", - "through2": "3.0.2", - "uuid": "8.3.2", - "vuvuzela": "1.0.3" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", - "dev": true, - "optional": true - }, - "level": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/level/-/level-6.0.1.tgz", - "integrity": "sha512-psRSqJZCsC/irNhfHzrVZbmPYXDcEYhA5TVNwr+V92jF44rbf86hqGp8fiT702FyiArScYIlPSBTDUASCVNSpw==", - "dev": true, - "optional": true, - "requires": { - "level-js": "^5.0.0", - "level-packager": "^5.1.0", - "leveldown": "^5.4.0" - } - }, - "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "dev": true, - "optional": true, - "requires": { - "whatwg-url": "^5.0.0" - } - }, - "readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==", - "dev": true, - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==", - "dev": true, - "optional": true - } - } - }, - "pouchdb-abstract-mapreduce": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/pouchdb-abstract-mapreduce/-/pouchdb-abstract-mapreduce-7.3.1.tgz", - "integrity": "sha512-0zKXVFBvrfc1KnN0ggrB762JDmZnUpePHywo9Bq3Jy+L1FnoG7fXM5luFfvv5/T0gEw+ZTIwoocZECMnESBI9w==", - "dev": true, - "optional": true, - "requires": { - "pouchdb-binary-utils": "7.3.1", - "pouchdb-collate": "7.3.1", - "pouchdb-collections": "7.3.1", - "pouchdb-errors": "7.3.1", - "pouchdb-fetch": "7.3.1", - "pouchdb-mapreduce-utils": "7.3.1", - "pouchdb-md5": "7.3.1", - "pouchdb-utils": "7.3.1" - } - }, - "pouchdb-adapter-leveldb-core": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/pouchdb-adapter-leveldb-core/-/pouchdb-adapter-leveldb-core-7.3.1.tgz", - "integrity": "sha512-mxShHlqLMPz2gChrgtA9okV1ogFmQrRAoM/O4EN0CrQWPLXqYtpL1f7sI2asIvFe7SmpnvbLx7kkZyFmLTfwjA==", - "dev": true, - "optional": true, - "requires": { - "argsarray": "0.0.1", - "buffer-from": "1.1.2", - "double-ended-queue": "2.1.0-0", - "levelup": "4.4.0", - "pouchdb-adapter-utils": "7.3.1", - "pouchdb-binary-utils": "7.3.1", - "pouchdb-collections": "7.3.1", - "pouchdb-errors": "7.3.1", - "pouchdb-json": "7.3.1", - "pouchdb-md5": "7.3.1", - "pouchdb-merge": "7.3.1", - "pouchdb-utils": "7.3.1", - "sublevel-pouchdb": "7.3.1", - "through2": "3.0.2" - } - }, - "pouchdb-adapter-memory": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/pouchdb-adapter-memory/-/pouchdb-adapter-memory-7.3.1.tgz", - "integrity": "sha512-iHdWGJAHONqQv0we3Oi1MYen69ZS8McLW9wUyaAYcWTJnAIIAr2ZM0/TeTDVSHfMUwYqEYk7X8jRtJZEMwLnwg==", - "dev": true, - "optional": true, - "requires": { - "memdown": "1.4.1", - "pouchdb-adapter-leveldb-core": "7.3.1", - "pouchdb-utils": "7.3.1" - } - }, - "pouchdb-adapter-utils": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/pouchdb-adapter-utils/-/pouchdb-adapter-utils-7.3.1.tgz", - "integrity": "sha512-uKLG6dClwTs/sLIJ4WkLAi9wlnDBpOnfyhpeAgOjlOGN/XLz5nKHrA4UJRnURDyc+uv79S9r/Unc4hVpmbSPUw==", - "dev": true, - "optional": true, - "requires": { - "pouchdb-binary-utils": "7.3.1", - "pouchdb-collections": "7.3.1", - "pouchdb-errors": "7.3.1", - "pouchdb-md5": "7.3.1", - "pouchdb-merge": "7.3.1", - "pouchdb-utils": "7.3.1" - } - }, - "pouchdb-binary-utils": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/pouchdb-binary-utils/-/pouchdb-binary-utils-7.3.1.tgz", - "integrity": "sha512-crZJNfAEOnUoRk977Qtmk4cxEv6sNKllQ6vDDKgQrQLFjMUXma35EHzNyIJr1s76J77Q4sqKQAmxz9Y40yHGtw==", - "dev": true, - "optional": true, - "requires": { - "buffer-from": "1.1.2" - } - }, - "pouchdb-collate": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/pouchdb-collate/-/pouchdb-collate-7.3.1.tgz", - "integrity": "sha512-o4gyGqDMLMSNzf6EDTr3eHaH/JRMoqRhdc+eV+oA8u00nTBtr9wD+jypVe2LbgKLJ4NWqx2qVkXiTiQdUFtsLQ==", - "dev": true, - "optional": true - }, - "pouchdb-collections": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/pouchdb-collections/-/pouchdb-collections-7.3.1.tgz", - "integrity": "sha512-yUyDqR+OJmtwgExOSJegpBJXDLAEC84TWnbAYycyh+DZoA51Yw0+XVQF5Vh8Ii90/Ut2xo88fmrmp0t6kqom8w==", - "dev": true, - "optional": true - }, - "pouchdb-debug": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/pouchdb-debug/-/pouchdb-debug-7.2.1.tgz", - "integrity": "sha512-eP3ht/AKavLF2RjTzBM6S9gaI2/apcW6xvaKRQhEdOfiANqerFuksFqHCal3aikVQuDO+cB/cw+a4RyJn/glBw==", - "dev": true, - "optional": true, - "requires": { - "debug": "3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "optional": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true, - "optional": true - } - } - }, - "pouchdb-errors": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/pouchdb-errors/-/pouchdb-errors-7.3.1.tgz", - "integrity": "sha512-Zktz4gnXEUcZcty8FmyvtYUYsHskoST05m6H5/E2gg/0mCfEXq/XeyyLkZHaZmqD0ZPS9yNmASB1VaFWEKEaDw==", - "dev": true, - "optional": true, - "requires": { - "inherits": "2.0.4" - } - }, - "pouchdb-fetch": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/pouchdb-fetch/-/pouchdb-fetch-7.3.1.tgz", - "integrity": "sha512-205xAtvdHRPQ4fp1h9+RmT9oQabo9gafuPmWsS9aEl3ER54WbY8Vaj1JHZGbU4KtMTYvW7H5088zLS7Nrusuag==", - "dev": true, - "optional": true, - "requires": { - "abort-controller": "3.0.0", - "fetch-cookie": "0.11.0", - "node-fetch": "2.6.7" - }, - "dependencies": { - "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "dev": true, - "optional": true, - "requires": { - "whatwg-url": "^5.0.0" - } - } - } - }, - "pouchdb-find": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/pouchdb-find/-/pouchdb-find-7.3.1.tgz", - "integrity": "sha512-AeqUfAVY1c7IFaY36BRT0vIz9r4VTKq/YOWTmiqndOZUQ/pDGxyO2fNFal6NN3PyYww0JijlD377cPvhnrhJVA==", - "dev": true, - "optional": true, - "requires": { - "pouchdb-abstract-mapreduce": "7.3.1", - "pouchdb-collate": "7.3.1", - "pouchdb-errors": "7.3.1", - "pouchdb-fetch": "7.3.1", - "pouchdb-md5": "7.3.1", - "pouchdb-selector-core": "7.3.1", - "pouchdb-utils": "7.3.1" - } - }, - "pouchdb-json": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/pouchdb-json/-/pouchdb-json-7.3.1.tgz", - "integrity": "sha512-AyOKsmc85/GtHjMZyEacqzja8qLVfycS1hh1oskR+Bm5PIITX52Fb8zyi0hEetV6VC0yuGbn0RqiLjJxQePeqQ==", - "dev": true, - "optional": true, - "requires": { - "vuvuzela": "1.0.3" - } - }, - "pouchdb-mapreduce-utils": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/pouchdb-mapreduce-utils/-/pouchdb-mapreduce-utils-7.3.1.tgz", - "integrity": "sha512-oUMcq82+4pTGQ6dtrhgORHOVHZSr6w/5tFIUGlv7RABIDvJarL4snMawADjlpiEwPdiQ/ESG8Fqt8cxqvqsIgg==", - "dev": true, - "optional": true, - "requires": { - "argsarray": "0.0.1", - "inherits": "2.0.4", - "pouchdb-collections": "7.3.1", - "pouchdb-utils": "7.3.1" - } - }, - "pouchdb-md5": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/pouchdb-md5/-/pouchdb-md5-7.3.1.tgz", - "integrity": "sha512-aDV8ui/mprnL3xmt0gT/81DFtTtJiKyn+OxIAbwKPMfz/rDFdPYvF0BmDC9QxMMzGfkV+JJUjU6at0PPs2mRLg==", - "dev": true, - "optional": true, - "requires": { - "pouchdb-binary-utils": "7.3.1", - "spark-md5": "3.0.2" - } - }, - "pouchdb-merge": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/pouchdb-merge/-/pouchdb-merge-7.3.1.tgz", - "integrity": "sha512-FeK3r35mKimokf2PQ2tUI523QWyZ4lYZ0Yd75FfSch/SPY6wIokz5XBZZ6PHdu5aOJsEKzoLUxr8CpSg9DhcAw==", - "dev": true, - "optional": true - }, - "pouchdb-selector-core": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/pouchdb-selector-core/-/pouchdb-selector-core-7.3.1.tgz", - "integrity": "sha512-HBX+nNGXcaL9z0uNpwSMRq2GNZd3EZXW+fe9rJHS0hvJohjZL7aRJLoaXfEdHPRTNW+CpjM3Rny60eGekQdI/w==", - "dev": true, - "optional": true, - "requires": { - "pouchdb-collate": "7.3.1", - "pouchdb-utils": "7.3.1" - } - }, - "pouchdb-utils": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/pouchdb-utils/-/pouchdb-utils-7.3.1.tgz", - "integrity": "sha512-R3hHBo1zTdTu/NFs3iqkcaQAPwhIH0gMIdfVKd5lbDYlmP26rCG5pdS+v7NuoSSFLJ4xxnaGV+Gjf4duYsJ8wQ==", - "dev": true, - "optional": true, - "requires": { - "argsarray": "0.0.1", - "clone-buffer": "1.0.0", - "immediate": "3.3.0", - "inherits": "2.0.4", - "pouchdb-collections": "7.3.1", - "pouchdb-errors": "7.3.1", - "pouchdb-md5": "7.3.1", - "uuid": "8.3.2" - } - }, - "prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true - }, - "prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", - "dev": true - }, - "prettier-plugin-solidity": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/prettier-plugin-solidity/-/prettier-plugin-solidity-1.1.3.tgz", - "integrity": "sha512-fQ9yucPi2sBbA2U2Xjh6m4isUTJ7S7QLc/XDDsktqqxYfTwdYKJ0EnnywXHwCGAaYbQNK+HIYPL1OemxuMsgeg==", - "dev": true, - "requires": { - "@solidity-parser/parser": "^0.16.0", - "semver": "^7.3.8", - "solidity-comments-extractor": "^0.0.7" - }, - "dependencies": { - "@solidity-parser/parser": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.16.0.tgz", - "integrity": "sha512-ESipEcHyRHg4Np4SqBCfcXwyxxna1DgFVz69bgpLV8vzl/NP1DtcKsJ4dJZXWQhY/Z4J2LeKBiOkOVZn9ct33Q==", - "dev": true, - "requires": { - "antlr4ts": "^0.5.0-alpha.4" - } - }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "semver": { - "version": "7.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", - "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } - } - }, - "process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", - "dev": true - }, - "process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true, - "peer": true - }, - "promise": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/promise/-/promise-8.3.0.tgz", - "integrity": "sha512-rZPNPKTOYVNEEKFaq1HqTgOwZD+4/YHS5ukLzQCypkj+OkYx7iv0mA91lJlpPPZ8vMau3IIGj5Qlwrx+8iiSmg==", - "dev": true, - "peer": true, - "requires": { - "asap": "~2.0.6" - } - }, - "proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", - "dev": true, - "requires": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - } - }, - "proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "dev": true, - "optional": true - }, - "prr": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", - "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==", - "dev": true, - "optional": true - }, - "psl": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", - "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==", - "dev": true - }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "punycode": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", - "integrity": "sha512-Yxz2kRwT90aPiWEMHVYnEf4+rhwF1tBmmZ4KepCP+Wkium9JxtWnUm1nqGwpiAHr/tnTSeHqr3wb++jgSkXjhA==", - "dev": true - }, - "pure-rand": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-5.0.5.tgz", - "integrity": "sha512-BwQpbqxSCBJVpamI6ydzcKqyFmnd5msMWUGvzXLm1aXvusbbgkbOto/EUPM00hjveJEaJtdbhUjKSzWRhQVkaw==", - "dev": true - }, - "qs": { - "version": "6.11.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz", - "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", - "dev": true, - "requires": { - "side-channel": "^1.0.4" - } - }, - "query-string": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", - "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", - "dev": true, - "requires": { - "decode-uri-component": "^0.2.0", - "object-assign": "^4.1.0", - "strict-uri-encode": "^1.0.0" - } - }, - "queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true - }, - "quick-format-unescaped": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-3.0.3.tgz", - "integrity": "sha512-dy1yjycmn9blucmJLXOfZDx1ikZJUi6E8bBZLnhPG5gBrVhHXx2xVyqqgKBubVNEXmx51dBACMHpoMQK/N/AXQ==", - "dev": true - }, - "quick-lru": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", - "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", - "dev": true - }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "dev": true - }, - "raw-body": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", - "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", - "dev": true, - "requires": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - } - }, - "read-pkg": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", - "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", - "dev": true, - "requires": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" - }, - "dependencies": { - "hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true - }, - "normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - }, - "type-fest": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", - "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", - "dev": true - } - } - }, - "read-pkg-up": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", - "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", - "dev": true, - "requires": { - "find-up": "^4.1.0", - "read-pkg": "^5.2.0", - "type-fest": "^0.8.1" - }, - "dependencies": { - "type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true - } - } - }, - "readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "requires": { - "picomatch": "^2.2.1" - } - }, - "rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", - "dev": true, - "peer": true, - "requires": { - "resolve": "^1.1.6" - } - }, - "recursive-readdir": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.3.tgz", - "integrity": "sha512-8HrF5ZsXk5FAH9dgsx3BlUer73nIhuj+9OrQwEbLTPOBzGkL1lsFCR01am+v+0m2Cmbs1nP12hLDl5FA7EszKA==", - "dev": true, - "peer": true, - "requires": { - "minimatch": "^3.0.5" - } - }, - "redent": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", - "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", - "dev": true, - "requires": { - "indent-string": "^4.0.0", - "strip-indent": "^3.0.0" - }, - "dependencies": { - "strip-indent": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", - "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", - "dev": true, - "requires": { - "min-indent": "^1.0.0" - } - } - } - }, - "reduce-flatten": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/reduce-flatten/-/reduce-flatten-2.0.0.tgz", - "integrity": "sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==", - "dev": true, - "peer": true - }, - "redux": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/redux/-/redux-3.7.2.tgz", - "integrity": "sha512-pNqnf9q1hI5HHZRBkj3bAngGZW/JMCmexDlOxw4XagXY2o1327nHH54LoTjiPJ0gizoqPDRqWyX/00g0hD6w+A==", - "dev": true, - "requires": { - "lodash": "^4.2.1", - "lodash-es": "^4.2.1", - "loose-envify": "^1.1.0", - "symbol-observable": "^1.0.3" - } - }, - "redux-saga": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/redux-saga/-/redux-saga-1.0.0.tgz", - "integrity": "sha512-GvJWs/SzMvEQgeaw6sRMXnS2FghlvEGsHiEtTLpJqc/FHF3I5EE/B+Hq5lyHZ8LSoT2r/X/46uWvkdCnK9WgHA==", - "dev": true, - "requires": { - "@redux-saga/core": "^1.0.0" - } - }, - "regenerator-runtime": { - "version": "0.13.11", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", - "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==", - "dev": true - }, - "regexp.prototype.flags": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.0.tgz", - "integrity": "sha512-0SutC3pNudRKgquxGoRGIz946MZVHqbNfPjBdxeOhBrdgDKlRoXmYLQN9xRbrR09ZXWeGAdPuif7egofn6v5LA==", - "dev": true, - "peer": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "functions-have-names": "^1.2.3" - } - }, - "req-cwd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/req-cwd/-/req-cwd-2.0.0.tgz", - "integrity": "sha512-ueoIoLo1OfB6b05COxAA9UpeoscNpYyM+BqYlA7H6LVF4hKGPXQQSSaD2YmvDVJMkk4UDpAHIeU1zG53IqjvlQ==", - "dev": true, - "peer": true, - "requires": { - "req-from": "^2.0.0" - } - }, - "req-from": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/req-from/-/req-from-2.0.0.tgz", - "integrity": "sha512-LzTfEVDVQHBRfjOUMgNBA+V6DWsSnoeKzf42J7l0xa/B4jyPOuuF5MlNSmomLNGemWTnV2TIdjSSLnEn95fOQA==", - "dev": true, - "peer": true, - "requires": { - "resolve-from": "^3.0.0" - }, - "dependencies": { - "resolve-from": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", - "integrity": "sha512-GnlH6vxLymXJNMBo7XP1fJIzBFbdYt49CuTwmB/6N53t+kMPRMFKz783LlQ4tv28XoQfMWinAJX6WCGf2IlaIw==", - "dev": true, - "peer": true - } - } - }, - "request": { - "version": "2.88.2", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", - "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", - "dev": true, - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "dependencies": { - "qs": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", - "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", - "dev": true - }, - "uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "dev": true - } - } - }, - "request-promise-core": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz", - "integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==", - "dev": true, - "peer": true, - "requires": { - "lodash": "^4.17.19" - } - }, - "request-promise-native": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.9.tgz", - "integrity": "sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g==", - "dev": true, - "peer": true, - "requires": { - "request-promise-core": "1.1.4", - "stealthy-require": "^1.1.1", - "tough-cookie": "^2.3.3" - } - }, - "require-all": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/require-all/-/require-all-3.0.0.tgz", - "integrity": "sha512-jPGN876lc5exWYrMcgZSd7U42P0PmVQzxnQB13fCSzmyGnqQWW4WUz5DosZ/qe24hz+5o9lSvW2epBNZ1xa6Fw==", - "dev": true - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true - }, - "require-from-string": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-1.2.1.tgz", - "integrity": "sha512-H7AkJWMobeskkttHyhTVtS0fxpFLjxhbfMa6Bk3wimP7sdPRGL3EyCg3sAQenFfAe+xQ+oAc85Nmtvq0ROM83Q==", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true, - "peer": true - }, - "reselect": { - "version": "4.1.8", - "resolved": "https://registry.npmjs.org/reselect/-/reselect-4.1.8.tgz", - "integrity": "sha512-ab9EmR80F/zQTMNeneUr4cv+jSwPJgIlvEmVwLerwrWVbpLlBuls9XHzIeTFy4cegU2NHBp3va0LKOzU5qFEYQ==", - "dev": true - }, - "reselect-tree": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/reselect-tree/-/reselect-tree-1.3.7.tgz", - "integrity": "sha512-kZN+C1cVJ6fFN2smSb0l4UvYZlRzttgnu183svH4NrU22cBY++ikgr2QT75Uuk4MYpv5gXSVijw4c5U6cx6GKg==", - "dev": true, - "requires": { - "debug": "^3.1.0", - "json-pointer": "^0.6.1", - "reselect": "^4.0.0" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - } - } - }, - "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - }, - "resolve-alpn": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", - "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==", - "dev": true - }, - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true - }, - "responselike": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", - "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", - "dev": true, - "requires": { - "lowercase-keys": "^2.0.0" - }, - "dependencies": { - "lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", - "dev": true - } - } - }, - "restore-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "dev": true, - "optional": true, - "requires": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - } - }, - "retry": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", - "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", - "dev": true, - "optional": true - }, - "reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true - }, - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - }, - "dependencies": { - "glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - } - } - }, - "ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "dev": true, - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, - "ripemd160-min": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/ripemd160-min/-/ripemd160-min-0.0.6.tgz", - "integrity": "sha512-+GcJgQivhs6S9qvLogusiTcS9kQUfgR75whKuy5jIhuiOfQuJ8fjqxV6EGD5duH1Y/FawFUMtMhyeq3Fbnib8A==", - "dev": true - }, - "rlp": { - "version": "2.2.7", - "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.7.tgz", - "integrity": "sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ==", - "dev": true, - "requires": { - "bn.js": "^5.2.0" - } - }, - "run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "requires": { - "queue-microtask": "^1.2.2" - } - }, - "run-parallel-limit": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/run-parallel-limit/-/run-parallel-limit-1.1.0.tgz", - "integrity": "sha512-jJA7irRNM91jaKc3Hcl1npHsFLOXOoTkPCUL1JEa1R82O2miplXXRaGdjW/KM/98YQWDhJLiSs793CnXfblJUw==", - "dev": true, - "requires": { - "queue-microtask": "^1.2.2" - } - }, - "rustbn.js": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/rustbn.js/-/rustbn.js-0.2.0.tgz", - "integrity": "sha512-4VlvkRUuCJvr2J6Y0ImW7NvTCriMi7ErOAqWk1y69vAdoNIzCF3yPmgeNzx+RQTLEDFq5sHfscn1MwHxP9hNfA==", - "dev": true - }, - "safe-array-concat": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.0.tgz", - "integrity": "sha512-9dVEFruWIsnie89yym+xWTAYASdpw3CJV7Li/6zBewGf9z2i1j31rP6jnY0pHEO4QZh6N0K11bFjWmdR8UGdPQ==", - "dev": true, - "peer": true, - "requires": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.0", - "has-symbols": "^1.0.3", - "isarray": "^2.0.5" - }, - "dependencies": { - "isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true, - "peer": true - } - } - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true - }, - "safe-regex-test": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", - "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", - "dev": true, - "peer": true, - "requires": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.3", - "is-regex": "^1.1.4" - } - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "sc-istanbul": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/sc-istanbul/-/sc-istanbul-0.4.6.tgz", - "integrity": "sha512-qJFF/8tW/zJsbyfh/iT/ZM5QNHE3CXxtLJbZsL+CzdJLBsPD7SedJZoUA4d8iAcN2IoMp/Dx80shOOd2x96X/g==", - "dev": true, - "peer": true, - "requires": { - "abbrev": "1.0.x", - "async": "1.x", - "escodegen": "1.8.x", - "esprima": "2.7.x", - "glob": "^5.0.15", - "handlebars": "^4.0.1", - "js-yaml": "3.x", - "mkdirp": "0.5.x", - "nopt": "3.x", - "once": "1.x", - "resolve": "1.1.x", - "supports-color": "^3.1.0", - "which": "^1.1.1", - "wordwrap": "^1.0.0" - }, - "dependencies": { - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha512-OarPfz0lFCiW4/AV2Oy1Rp9qu0iusTKqykwTspGCZtPxmF81JR4MmIebvF1F9+UOKth2ZubLQ4XGGaU+hSn99A==", - "dev": true, - "peer": true - }, - "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha512-c9IPMazfRITpmAAKi22dK1VKxGDX9ehhqfABDriL/lzO92xcUKEJPQHrVA/2YHSNFB4iFlykVmWvwo48nr3OxA==", - "dev": true, - "peer": true, - "requires": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha512-DyYHfIYwAJmjAjSSPKANxI8bFY9YtFrgkAfinBojQ8YJTOuOuav64tMUJv584SES4xl74PmuaevIyaLESHdTAA==", - "dev": true, - "peer": true - }, - "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha512-9znBF0vBcaSN3W2j7wKvdERPwqTxSpCq+if5C0WoTCyV9n24rua28jeuQ2pL/HOf+yUe/Mef+H/5p60K0Id3bg==", - "dev": true, - "peer": true - }, - "supports-color": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", - "integrity": "sha512-Jds2VIYDrlp5ui7t8abHN2bjAu4LV/q4N2KivFPpGH0lrka0BMq/33AmECUXlKPcHigkNaqfXRENFju+rlcy+A==", - "dev": true, - "peer": true, - "requires": { - "has-flag": "^1.0.0" - } - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "peer": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "scrypt-js": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", - "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==", - "dev": true - }, - "secp256k1": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", - "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", - "dev": true, - "requires": { - "elliptic": "^6.5.4", - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, - "send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", - "dev": true, - "requires": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - }, - "dependencies": { - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - } - } - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - } - } - }, - "sentence-case": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/sentence-case/-/sentence-case-2.1.1.tgz", - "integrity": "sha512-ENl7cYHaK/Ktwk5OTD+aDbQ3uC8IByu/6Bkg+HDv8Mm+XnBnppVNalcfJTNsp1ibstKh030/JKQQWglDvtKwEQ==", - "dev": true, - "requires": { - "no-case": "^2.2.0", - "upper-case-first": "^1.1.2" - } - }, - "serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", - "dev": true, - "requires": { - "randombytes": "^2.1.0" - } - }, - "serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", - "dev": true, - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.18.0" - } - }, - "servify": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", - "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", - "dev": true, - "requires": { - "body-parser": "^1.16.0", - "cors": "^2.8.1", - "express": "^4.14.0", - "request": "^2.79.0", - "xhr": "^2.3.3" - } - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", - "dev": true - }, - "setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", - "dev": true - }, - "setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", - "dev": true - }, - "sha.js": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "sha1": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/sha1/-/sha1-1.1.1.tgz", - "integrity": "sha512-dZBS6OrMjtgVkopB1Gmo4RQCDKiZsqcpAQpkV/aaj+FCrCg8r4I4qMkDPQjBgLIxlmu9k4nUbWq6ohXahOneYA==", - "dev": true, - "peer": true, - "requires": { - "charenc": ">= 0.0.1", - "crypt": ">= 0.0.1" - } - }, - "sha3": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/sha3/-/sha3-2.1.4.tgz", - "integrity": "sha512-S8cNxbyb0UGUM2VhRD4Poe5N58gJnJsLJ5vC7FYWGUmGhcsj4++WaIOBFVDxlG0W3To6xBuiRh+i0Qp2oNCOtg==", - "dev": true, - "requires": { - "buffer": "6.0.3" - }, - "dependencies": { - "buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "dev": true, - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - } - } - }, - "shallowequal": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz", - "integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==", - "dev": true - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true - }, - "shelljs": { - "version": "0.8.5", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", - "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", - "dev": true, - "peer": true, - "requires": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - }, - "dependencies": { - "glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "peer": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - } - } - }, - "side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "dev": true, - "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - } - }, - "signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true, - "optional": true - }, - "simple-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", - "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", - "dev": true - }, - "simple-get": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.2.tgz", - "integrity": "sha512-Ijd/rV5o+mSBBs4F/x9oDPtTx9Zb6X9brmnXvMW4J7IR15ngi9q5xxqWBKU744jTZiaXtxaPL7uHG6vtN8kUkw==", - "dev": true, - "requires": { - "decompress-response": "^3.3.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - }, - "dependencies": { - "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA==", - "dev": true, - "requires": { - "mimic-response": "^1.0.0" - } - } - } - }, - "simple-statistics": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/simple-statistics/-/simple-statistics-7.8.3.tgz", - "integrity": "sha512-JFvMY00t6SBGtwMuJ+nqgsx9ylkMiJ5JlK9bkj8AdvniIe5615wWQYkKHXe84XtSuc40G/tlrPu0A5/NlJvv8A==", - "dev": true - }, - "slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "peer": true - }, - "slice-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - } - } - }, - "snake-case": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-2.1.0.tgz", - "integrity": "sha512-FMR5YoPFwOLuh4rRz92dywJjyKYZNLpMn1R5ujVpIYkbA9p01fq8RMg0FkO4M+Yobt4MjHeLTJVm5xFFBHSV2Q==", - "dev": true, - "requires": { - "no-case": "^2.2.0" - } - }, - "solc": { - "version": "0.4.26", - "resolved": "https://registry.npmjs.org/solc/-/solc-0.4.26.tgz", - "integrity": "sha512-o+c6FpkiHd+HPjmjEVpQgH7fqZ14tJpXhho+/bQXlXbliLIS/xjXb42Vxh+qQY1WCSTMQ0+a5vR9vi0MfhU6mA==", - "dev": true, - "requires": { - "fs-extra": "^0.30.0", - "memorystream": "^0.3.1", - "require-from-string": "^1.1.0", - "semver": "^5.3.0", - "yargs": "^4.7.1" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", - "dev": true - }, - "camelcase": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha512-4nhGqUkc4BqbBBB4Q6zLuD7lzzrHYrjKGeYaEji/3tFR5VdJu9v+LilhGIVe8wxEJPPOeWo7eg8dwY13TZ1BNg==", - "dev": true - }, - "cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha512-0yayqDxWQbqk3ojkYqUKqaAQ6AfNKeKWRNA8kR0WXzAsdHpP4BIaOmMAG87JGuO6qcobyW4GjxHd9PmhEd+T9w==", - "dev": true, - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" - } - }, - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha512-jvElSjyuo4EMQGoTwo1uJU5pQMwTW5lS1x05zzfJuTIyLR3zwO27LYrxNg+dlvKpGOuGy/MzBdXh80g0ve5+HA==", - "dev": true, - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "fs-extra": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", - "integrity": "sha512-UvSPKyhMn6LEd/WpUaV9C9t3zATuqoqfWc3QdPhPLb58prN9tqYPlPWi8Krxi44loBoUzlobqZ3+8tGpxxSzwA==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0", - "klaw": "^1.0.0", - "path-is-absolute": "^1.0.0", - "rimraf": "^2.2.8" - } - }, - "get-caller-file": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", - "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", - "dev": true - }, - "glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "jsonfile": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha512-PKllAqbgLgxHaj8TElYymKCAgrASebJrWpTnEkOaTowt23VKXXN0sUeriJ+eh7y6ufb/CC5ap11pz71/cM0hUw==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha512-yTltuKuhtNeFJKa1PiRzfLAU5182q1y4Eb4XCJ3PBqyzEDkAZRzBrKKBct682ls9reBVHf9udYLN5Nd+K1B9BQ==", - "dev": true, - "requires": { - "pinkie-promise": "^2.0.0" - } - }, - "path-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha512-S4eENJz1pkiQn9Znv33Q+deTOKmbl+jj1Fl+qiP/vYezj+S8x+J3Uo0ISrx/QoEvIlOaDWJhPaRd1flJ9HXZqg==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", - "dev": true - }, - "read-pkg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha512-7BGwRHqt4s/uVbuyoeejRn4YmFnYZiFl4AuaeXHlgZf3sONF0SOGlxs2Pw8g6hCKupo08RafIO5YXFNOKTfwsQ==", - "dev": true, - "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - } - }, - "read-pkg-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", - "integrity": "sha512-WD9MTlNtI55IwYUS27iHh9tK3YoIVhxis8yKhLpTqWtml739uXc9NWTpxoHkfZf3+DkCCsXox94/VWZniuZm6A==", - "dev": true, - "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - } - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha512-IqSUtOVP4ksd1C/ej5zeEh/BIP2ajqpn8c5x+q99gvcIG/Qf0cud5raVnE/Dwd0ua9TXYDoDc0RE5hBSdz22Ug==", - "dev": true - }, - "rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "which-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", - "integrity": "sha512-F6+WgncZi/mJDrammbTuHe1q0R5hOXv/mBaiNA2TCNT/LTHusX0V+CJnj9XT8ki5ln2UZyyddDgHfCzyrOH7MQ==", - "dev": true - }, - "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha512-vAaEaDM946gbNpH5pLVNR+vX2ht6n0Bt3GXwVB1AuAqZosOvHNF3P7wDnh8KLkSqgUh0uh77le7Owgoz+Z9XBw==", - "dev": true, - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" - } - }, - "y18n": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.2.tgz", - "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==", - "dev": true - }, - "yargs": { - "version": "4.8.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", - "integrity": "sha512-LqodLrnIDM3IFT+Hf/5sxBnEGECrfdC1uIbgZeJmESCSo4HoCAaKEus8MylXHAkdacGc0ye+Qa+dpkuom8uVYA==", - "dev": true, - "requires": { - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "lodash.assign": "^4.0.3", - "os-locale": "^1.4.0", - "read-pkg-up": "^1.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^1.0.1", - "which-module": "^1.0.0", - "window-size": "^0.2.0", - "y18n": "^3.2.1", - "yargs-parser": "^2.4.1" - } - }, - "yargs-parser": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", - "integrity": "sha512-9pIKIJhnI5tonzG6OnCFlz/yln8xHYcGl+pn3xR0Vzff0vzN1PbNRaelgfgRUwZ3s4i3jvxT9WhmUGL4whnasA==", - "dev": true, - "requires": { - "camelcase": "^3.0.0", - "lodash.assign": "^4.0.6" - } - } - } - }, - "solhint": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/solhint/-/solhint-3.4.1.tgz", - "integrity": "sha512-pzZn2RlZhws1XwvLPVSsxfHrwsteFf5eySOhpAytzXwKQYbTCJV6z8EevYDiSVKMpWrvbKpEtJ055CuEmzp4Xg==", - "dev": true, - "requires": { - "@solidity-parser/parser": "^0.16.0", - "ajv": "^6.12.6", - "antlr4": "^4.11.0", - "ast-parents": "^0.0.1", - "chalk": "^4.1.2", - "commander": "^10.0.0", - "cosmiconfig": "^8.0.0", - "fast-diff": "^1.2.0", - "glob": "^8.0.3", - "ignore": "^5.2.4", - "js-yaml": "^4.1.0", - "lodash": "^4.17.21", - "pluralize": "^8.0.0", - "prettier": "^2.8.3", - "semver": "^6.3.0", - "strip-ansi": "^6.0.1", - "table": "^6.8.1", - "text-table": "^0.2.0" - }, - "dependencies": { - "@solidity-parser/parser": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.16.0.tgz", - "integrity": "sha512-ESipEcHyRHg4Np4SqBCfcXwyxxna1DgFVz69bgpLV8vzl/NP1DtcKsJ4dJZXWQhY/Z4J2LeKBiOkOVZn9ct33Q==", - "dev": true, - "requires": { - "antlr4ts": "^0.5.0-alpha.4" - } - }, - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, - "minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - } - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "solidity-comments-extractor": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/solidity-comments-extractor/-/solidity-comments-extractor-0.0.7.tgz", - "integrity": "sha512-wciNMLg/Irp8OKGrh3S2tfvZiZ0NEyILfcRCXCD4mp7SgK/i9gzLfhY2hY7VMCQJ3kH9UB9BzNdibIVMchzyYw==", - "dev": true - }, - "solidity-coverage": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/solidity-coverage/-/solidity-coverage-0.8.2.tgz", - "integrity": "sha512-cv2bWb7lOXPE9/SSleDO6czkFiMHgP4NXPj+iW9W7iEKLBk7Cj0AGBiNmGX3V1totl9wjPrT0gHmABZKZt65rQ==", - "dev": true, - "peer": true, - "requires": { - "@ethersproject/abi": "^5.0.9", - "@solidity-parser/parser": "^0.14.1", - "chalk": "^2.4.2", - "death": "^1.1.0", - "detect-port": "^1.3.0", - "difflib": "^0.2.4", - "fs-extra": "^8.1.0", - "ghost-testrpc": "^0.0.2", - "global-modules": "^2.0.0", - "globby": "^10.0.1", - "jsonschema": "^1.2.4", - "lodash": "^4.17.15", - "mocha": "7.1.2", - "node-emoji": "^1.10.0", - "pify": "^4.0.1", - "recursive-readdir": "^2.2.2", - "sc-istanbul": "^0.4.5", - "semver": "^7.3.4", - "shelljs": "^0.8.3", - "web3-utils": "^1.3.6" - }, - "dependencies": { - "ansi-colors": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", - "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", - "dev": true, - "peer": true - }, - "ansi-regex": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", - "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", - "dev": true, - "peer": true - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true, - "peer": true - }, - "chokidar": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz", - "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==", - "dev": true, - "peer": true, - "requires": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "fsevents": "~2.1.1", - "glob-parent": "~5.1.0", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.2.0" - } - }, - "cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", - "dev": true, - "peer": true, - "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - } - }, - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "dev": true, - "peer": true, - "requires": { - "ms": "^2.1.1" - } - }, - "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", - "dev": true, - "peer": true - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true, - "peer": true - }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "peer": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "flat": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.1.tgz", - "integrity": "sha512-FmTtBsHskrU6FJ2VxCnsDb84wu9zhmO3cUX2kGFb5tuwhfXxGciiT0oRY+cck35QmG+NmGh5eLz6lLCpWTqwpA==", - "dev": true, - "peer": true, - "requires": { - "is-buffer": "~2.0.3" - } - }, - "fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "dev": true, - "peer": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "fsevents": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", - "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", - "dev": true, - "optional": true, - "peer": true - }, - "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", - "dev": true, - "peer": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "peer": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", - "dev": true, - "peer": true - }, - "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "dev": true, - "peer": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "peer": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "log-symbols": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", - "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", - "dev": true, - "peer": true, - "requires": { - "chalk": "^2.4.2" - } - }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "peer": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "peer": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "dev": true, - "peer": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "mocha": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.2.tgz", - "integrity": "sha512-o96kdRKMKI3E8U0bjnfqW4QMk12MwZ4mhdBTf+B5a1q9+aq2HRnj+3ZdJu0B/ZhJeK78MgYuv6L8d/rA5AeBJA==", - "dev": true, - "peer": true, - "requires": { - "ansi-colors": "3.2.3", - "browser-stdout": "1.3.1", - "chokidar": "3.3.0", - "debug": "3.2.6", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "find-up": "3.0.0", - "glob": "7.1.3", - "growl": "1.10.5", - "he": "1.2.0", - "js-yaml": "3.13.1", - "log-symbols": "3.0.0", - "minimatch": "3.0.4", - "mkdirp": "0.5.5", - "ms": "2.1.1", - "node-environment-flags": "1.0.6", - "object.assign": "4.1.0", - "strip-json-comments": "2.0.1", - "supports-color": "6.0.0", - "which": "1.3.1", - "wide-align": "1.1.3", - "yargs": "13.3.2", - "yargs-parser": "13.1.2", - "yargs-unparser": "1.6.0" - } - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true, - "peer": true - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "peer": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", - "dev": true, - "peer": true - }, - "readdirp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", - "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==", - "dev": true, - "peer": true, - "requires": { - "picomatch": "^2.0.4" - } - }, - "semver": { - "version": "7.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", - "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", - "dev": true, - "peer": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "peer": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "peer": true, - "requires": { - "ansi-regex": "^4.1.0" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", - "dev": true, - "peer": true - }, - "supports-color": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", - "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", - "dev": true, - "peer": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "peer": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "dev": true, - "peer": true, - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - } - }, - "y18n": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", - "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", - "dev": true, - "peer": true - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true, - "peer": true - }, - "yargs": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", - "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", - "dev": true, - "peer": true, - "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - } - }, - "yargs-parser": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", - "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", - "dev": true, - "peer": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "yargs-unparser": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", - "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", - "dev": true, - "peer": true, - "requires": { - "flat": "^4.1.0", - "lodash": "^4.17.15", - "yargs": "^13.3.0" - } - } - } - }, - "sonic-boom": { - "version": "0.7.7", - "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-0.7.7.tgz", - "integrity": "sha512-Ei5YOo5J64GKClHIL/5evJPgASXFVpfVYbJV9PILZQytTK6/LCwHvsZJW2Ig4p9FMC2OrBrMnXKgRN/OEoAWfg==", - "dev": true, - "requires": { - "atomic-sleep": "^1.0.0", - "flatstr": "^1.0.12" - } - }, - "source-map": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", - "integrity": "sha512-CBdZ2oa/BHhS4xj5DlhjWNHcan57/5YuvfdLf17iVmIpd9KRm+DFLmC6nBNj+6Ua7Kt3TmOjDpQT1aTYOQtoUA==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "amdefine": ">=0.0.4" - } - }, - "source-map-support": { - "version": "0.5.21", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", - "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "spark-md5": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/spark-md5/-/spark-md5-3.0.2.tgz", - "integrity": "sha512-wcFzz9cDfbuqe0FZzfi2or1sgyIrsDwmPwfZC4hiNidPdPINjeUwNfv5kldczoEAcjl9Y1L3SM7Uz2PUEQzxQw==", - "dev": true, - "optional": true - }, - "spdx-correct": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", - "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", - "dev": true, - "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-exceptions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", - "dev": true - }, - "spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dev": true, - "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-license-ids": { - "version": "3.0.13", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.13.tgz", - "integrity": "sha512-XkD+zwiqXHikFZm4AX/7JSCXA98U5Db4AFd5XUg/+9UNtnH75+Z9KxtpYiJZx36mUDVOwH83pl7yvCer6ewM3w==", - "dev": true - }, - "split2": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", - "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", - "dev": true, - "requires": { - "readable-stream": "^3.0.0" - } - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "dev": true - }, - "sshpk": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", - "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", - "dev": true, - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - }, - "dependencies": { - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", - "dev": true - } - } - }, - "stacktrace-parser": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/stacktrace-parser/-/stacktrace-parser-0.1.10.tgz", - "integrity": "sha512-KJP1OCML99+8fhOHxwwzyWrlUuVX5GQ0ZpJTd1DFXhdkrvg1szxfHhawXUZ3g9TkXORQd4/WG68jMlQZ2p8wlg==", - "dev": true, - "requires": { - "type-fest": "^0.7.1" - }, - "dependencies": { - "type-fest": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.7.1.tgz", - "integrity": "sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==", - "dev": true - } - } - }, - "statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", - "dev": true - }, - "stealthy-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", - "integrity": "sha512-ZnWpYnYugiOVEY5GkcuJK1io5V8QmNYChG62gSit9pQVGErXtrKuPC55ITaVSukmMta5qpMU7vqLt2Lnni4f/g==", - "dev": true, - "peer": true - }, - "streamsearch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", - "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", - "dev": true - }, - "strict-uri-encode": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", - "integrity": "sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ==", - "dev": true - }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, - "requires": { - "safe-buffer": "~5.2.0" - } - }, - "string-format": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/string-format/-/string-format-2.0.0.tgz", - "integrity": "sha512-bbEs3scLeYNXLecRRuk6uJxdXUSj6le/8rNPHChIJTn2V79aXVTR1EH2OH5zLKKoz0V02fOUKZZcw01pLUShZA==", - "dev": true, - "peer": true - }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - } - } - }, - "string-width-cjs": { - "version": "npm:string-width@4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - } - } - }, - "string.prototype.trim": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz", - "integrity": "sha512-p6TmeT1T3411M8Cgg9wBTMRtY2q9+PNy9EV1i2lIXUN/btt763oIfxwN3RR8VU6wHX8j/1CFy0L+YuThm6bgOg==", - "dev": true, - "peer": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4" - } - }, - "string.prototype.trimend": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.6.tgz", - "integrity": "sha512-JySq+4mrPf9EsDBEDYMOb/lM7XQLulwg5R/m1r0PXEFqrV0qHvl58sdTilSXtKOflCsK2E8jxf+GKC0T07RWwQ==", - "dev": true, - "peer": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4" - } - }, - "string.prototype.trimstart": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.6.tgz", - "integrity": "sha512-omqjMDaY92pbn5HOX7f9IccLA+U1tA9GvtU4JrodiXFfYB7jPzzHpRzpglLAjtUV6bB557zwClJezTqnAiYnQA==", - "dev": true, - "peer": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "strip-ansi-cjs": { - "version": "npm:strip-ansi@6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - } - } - }, - "strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==", - "dev": true, - "requires": { - "is-utf8": "^0.2.0" - } - }, - "strip-hex-prefix": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", - "integrity": "sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A==", - "dev": true, - "requires": { - "is-hex-prefixed": "1.0.0" - } - }, - "strip-indent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", - "integrity": "sha512-RsSNPLpq6YUL7QYy44RnPVTn/lcVZtb48Uof3X5JLbF4zD/Gs7ZFDv2HWol+leoQN2mT86LAzSshGfkTlSOpsA==", - "dev": true - }, - "strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true - }, - "sublevel-pouchdb": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/sublevel-pouchdb/-/sublevel-pouchdb-7.3.1.tgz", - "integrity": "sha512-n+4fK72F/ORdqPwoGgMGYeOrW2HaPpW9o9k80bT1B3Cim5BSvkKkr9WbWOWynni/GHkbCEdvLVFJL1ktosAdhQ==", - "dev": true, - "optional": true, - "requires": { - "inherits": "2.0.4", - "level-codec": "9.0.2", - "ltgt": "2.2.1", - "readable-stream": "1.1.14" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", - "dev": true, - "optional": true - }, - "readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==", - "dev": true, - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==", - "dev": true, - "optional": true - } - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "swap-case": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/swap-case/-/swap-case-1.1.2.tgz", - "integrity": "sha512-BAmWG6/bx8syfc6qXPprof3Mn5vQgf5dwdUNJhsNqU9WdPt5P+ES/wQ5bxfijy8zwZgZZHslC3iAsxsuQMCzJQ==", - "dev": true, - "requires": { - "lower-case": "^1.1.1", - "upper-case": "^1.1.1" - } - }, - "swarm-js": { - "version": "0.1.42", - "resolved": "https://registry.npmjs.org/swarm-js/-/swarm-js-0.1.42.tgz", - "integrity": "sha512-BV7c/dVlA3R6ya1lMlSSNPLYrntt0LUq4YMgy3iwpCIc6rZnS5W2wUoctarZ5pXlpKtxDDf9hNziEkcfrxdhqQ==", - "dev": true, - "requires": { - "bluebird": "^3.5.0", - "buffer": "^5.0.5", - "eth-lib": "^0.1.26", - "fs-extra": "^4.0.2", - "got": "^11.8.5", - "mime-types": "^2.1.16", - "mkdirp-promise": "^5.0.1", - "mock-fs": "^4.1.0", - "setimmediate": "^1.0.5", - "tar": "^4.0.2", - "xhr-request": "^1.0.1" - }, - "dependencies": { - "@szmarczak/http-timer": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", - "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", - "dev": true, - "requires": { - "defer-to-connect": "^2.0.0" - } - }, - "cacheable-lookup": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", - "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==", - "dev": true - }, - "fs-extra": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", - "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "got": { - "version": "11.8.6", - "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", - "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", - "dev": true, - "requires": { - "@sindresorhus/is": "^4.0.0", - "@szmarczak/http-timer": "^4.0.5", - "@types/cacheable-request": "^6.0.1", - "@types/responselike": "^1.0.0", - "cacheable-lookup": "^5.0.3", - "cacheable-request": "^7.0.2", - "decompress-response": "^6.0.0", - "http2-wrapper": "^1.0.0-beta.5.2", - "lowercase-keys": "^2.0.0", - "p-cancelable": "^2.0.0", - "responselike": "^2.0.0" - } - }, - "http2-wrapper": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", - "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", - "dev": true, - "requires": { - "quick-lru": "^5.1.1", - "resolve-alpn": "^1.0.0" - } - }, - "lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", - "dev": true - }, - "p-cancelable": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", - "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==", - "dev": true - }, - "quick-lru": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", - "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", - "dev": true - } - } - }, - "symbol-observable": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", - "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==", - "dev": true - }, - "sync-request": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/sync-request/-/sync-request-6.1.0.tgz", - "integrity": "sha512-8fjNkrNlNCrVc/av+Jn+xxqfCjYaBoHqCsDz6mt030UMxJGr+GSfCV1dQt2gRtlL63+VPidwDVLr7V2OcTSdRw==", - "dev": true, - "peer": true, - "requires": { - "http-response-object": "^3.0.1", - "sync-rpc": "^1.2.1", - "then-request": "^6.0.0" - } - }, - "sync-rpc": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/sync-rpc/-/sync-rpc-1.3.6.tgz", - "integrity": "sha512-J8jTXuZzRlvU7HemDgHi3pGnh/rkoqR/OZSjhTyyZrEkkYQbk7Z33AXp37mkPfPpfdOuj7Ex3H/TJM1z48uPQw==", - "dev": true, - "peer": true, - "requires": { - "get-port": "^3.1.0" - } - }, - "table": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/table/-/table-6.8.1.tgz", - "integrity": "sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==", - "dev": true, - "requires": { - "ajv": "^8.0.1", - "lodash.truncate": "^4.4.2", - "slice-ansi": "^4.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1" - }, - "dependencies": { - "ajv": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", - "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - } - }, - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - }, - "require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - } - } - }, - "table-layout": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-1.0.2.tgz", - "integrity": "sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A==", - "dev": true, - "peer": true, - "requires": { - "array-back": "^4.0.1", - "deep-extend": "~0.6.0", - "typical": "^5.2.0", - "wordwrapjs": "^4.0.0" - }, - "dependencies": { - "array-back": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz", - "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==", - "dev": true, - "peer": true - }, - "typical": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", - "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", - "dev": true, - "peer": true - } - } - }, - "tar": { - "version": "4.4.19", - "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.19.tgz", - "integrity": "sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA==", - "dev": true, - "requires": { - "chownr": "^1.1.4", - "fs-minipass": "^1.2.7", - "minipass": "^2.9.0", - "minizlib": "^1.3.3", - "mkdirp": "^0.5.5", - "safe-buffer": "^5.2.1", - "yallist": "^3.1.1" - }, - "dependencies": { - "minipass": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", - "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - } - } - } - }, - "testrpc": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/testrpc/-/testrpc-0.0.1.tgz", - "integrity": "sha512-afH1hO+SQ/VPlmaLUFj2636QMeDvPCeQMc/9RBMW0IfjNe9gFD9Ra3ShqYkB7py0do1ZcCna/9acHyzTJ+GcNA==", - "dev": true - }, - "text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true - }, - "then-request": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/then-request/-/then-request-6.0.2.tgz", - "integrity": "sha512-3ZBiG7JvP3wbDzA9iNY5zJQcHL4jn/0BWtXIkagfz7QgOL/LqjCEOBQuJNZfu0XYnv5JhKh+cDxCPM4ILrqruA==", - "dev": true, - "peer": true, - "requires": { - "@types/concat-stream": "^1.6.0", - "@types/form-data": "0.0.33", - "@types/node": "^8.0.0", - "@types/qs": "^6.2.31", - "caseless": "~0.12.0", - "concat-stream": "^1.6.0", - "form-data": "^2.2.0", - "http-basic": "^8.1.1", - "http-response-object": "^3.0.1", - "promise": "^8.0.0", - "qs": "^6.4.0" - }, - "dependencies": { - "@types/node": { - "version": "8.10.66", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.66.tgz", - "integrity": "sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==", - "dev": true, - "peer": true - } - } - }, - "through2": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz", - "integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==", - "dev": true, - "optional": true, - "requires": { - "inherits": "^2.0.4", - "readable-stream": "2 || 3" - } - }, - "timed-out": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", - "integrity": "sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA==", - "dev": true - }, - "tiny-typed-emitter": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/tiny-typed-emitter/-/tiny-typed-emitter-2.1.0.tgz", - "integrity": "sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA==", - "dev": true, - "optional": true - }, - "title-case": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/title-case/-/title-case-2.1.1.tgz", - "integrity": "sha512-EkJoZ2O3zdCz3zJsYCsxyq2OC5hrxR9mfdd5I+w8h/tmFfeOxJ+vvkxsKxdmN0WtS9zLdHEgfgVOiMVgv+Po4Q==", - "dev": true, - "requires": { - "no-case": "^2.2.0", - "upper-case": "^1.0.3" - } - }, - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "requires": { - "os-tmpdir": "~1.0.2" - } - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", - "dev": true - }, - "tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "dev": true, - "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, - "dependencies": { - "punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", - "dev": true - } - } - }, - "tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dev": true - }, - "trim-newlines": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", - "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", - "dev": true - }, - "truffle": { - "version": "5.9.4", - "resolved": "https://registry.npmjs.org/truffle/-/truffle-5.9.4.tgz", - "integrity": "sha512-35UUp6Y+TAZ/ZTrUUtmIr6XSacKlq36QalC96tABsPdATKe5xBJkUKqbJBKuQcLtV1BL7nOLqgQs7fyecSXKaA==", - "dev": true, - "requires": { - "@truffle/db": "^2.0.28", - "@truffle/db-loader": "^0.2.28", - "@truffle/debugger": "^11.1.4", - "app-module-path": "^2.2.0", - "ganache": "7.8.0", - "mocha": "10.1.0", - "original-require": "^1.0.1" - }, - "dependencies": { - "ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true - }, - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" - } - }, - "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true - }, - "find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "requires": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - } - }, - "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, - "locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "requires": { - "p-locate": "^5.0.0" - } - }, - "mocha": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.1.0.tgz", - "integrity": "sha512-vUF7IYxEoN7XhQpFLxQAEMtE4W91acW4B6En9l97MwE9stL1A9gusXfoHZCLVHDUJ/7V5+lbCM6yMqzo5vNymg==", - "dev": true, - "requires": { - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.5.3", - "debug": "4.3.4", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "7.2.0", - "he": "1.2.0", - "js-yaml": "4.1.0", - "log-symbols": "4.1.0", - "minimatch": "5.0.1", - "ms": "2.1.3", - "nanoid": "3.3.3", - "serialize-javascript": "6.0.0", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "workerpool": "6.2.1", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" - }, - "dependencies": { - "minimatch": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", - "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - } - } - } - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "requires": { - "p-limit": "^3.0.2" - } - }, - "supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true - } - } - }, - "ts-command-line-args": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/ts-command-line-args/-/ts-command-line-args-2.5.1.tgz", - "integrity": "sha512-H69ZwTw3rFHb5WYpQya40YAX2/w7Ut75uUECbgBIsLmM+BNuYnxsltfyyLMxy6sEeKxgijLTnQtLd0nKd6+IYw==", - "dev": true, - "peer": true, - "requires": { - "chalk": "^4.1.0", - "command-line-args": "^5.1.1", - "command-line-usage": "^6.1.0", - "string-format": "^2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "peer": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "peer": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "peer": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "peer": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "peer": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "peer": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "ts-essentials": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-7.0.3.tgz", - "integrity": "sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ==", - "dev": true, - "peer": true, - "requires": {} - }, - "ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", - "dev": true, - "peer": true, - "requires": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "dependencies": { - "diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, - "peer": true - } - } - }, - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "tsort": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/tsort/-/tsort-0.0.1.tgz", - "integrity": "sha512-Tyrf5mxF8Ofs1tNoxA13lFeZ2Zrbd6cKbuH3V+MQ5sb6DtBj5FjrXVsRWT8YvNAQTqNoz66dz1WsbigI22aEnw==", - "dev": true - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", - "dev": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", - "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", - "dev": true - }, - "tweetnacl-util": { - "version": "0.15.1", - "resolved": "https://registry.npmjs.org/tweetnacl-util/-/tweetnacl-util-0.15.1.tgz", - "integrity": "sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw==", - "dev": true - }, - "type": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", - "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==", - "dev": true - }, - "type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1" - } - }, - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true - }, - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true - }, - "type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "dev": true, - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - } - }, - "typechain": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/typechain/-/typechain-8.2.0.tgz", - "integrity": "sha512-tZqhqjxJ9xAS/Lh32jccTjMkpx7sTdUVVHAy5Bf0TIer5QFNYXotiX74oCvoVYjyxUKDK3MXHtMFzMyD3kE+jg==", - "dev": true, - "peer": true, - "requires": { - "@types/prettier": "^2.1.1", - "debug": "^4.3.1", - "fs-extra": "^7.0.0", - "glob": "7.1.7", - "js-sha3": "^0.8.0", - "lodash": "^4.17.15", - "mkdirp": "^1.0.4", - "prettier": "^2.3.1", - "ts-command-line-args": "^2.2.0", - "ts-essentials": "^7.0.1" - }, - "dependencies": { - "glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", - "dev": true, - "peer": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "dev": true, - "peer": true - } - } - }, - "typed-array-length": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", - "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", - "dev": true, - "peer": true, - "requires": { - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "is-typed-array": "^1.1.9" - } - }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", - "dev": true, - "peer": true - }, - "typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "dev": true, - "requires": { - "is-typedarray": "^1.0.0" - } - }, - "typescript": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", - "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", - "dev": true, - "peer": true - }, - "typescript-compare": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/typescript-compare/-/typescript-compare-0.0.2.tgz", - "integrity": "sha512-8ja4j7pMHkfLJQO2/8tut7ub+J3Lw2S3061eJLFQcvs3tsmJKp8KG5NtpLn7KcY2w08edF74BSVN7qJS0U6oHA==", - "dev": true, - "requires": { - "typescript-logic": "^0.0.0" - } - }, - "typescript-logic": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/typescript-logic/-/typescript-logic-0.0.0.tgz", - "integrity": "sha512-zXFars5LUkI3zP492ls0VskH3TtdeHCqu0i7/duGt60i5IGPIpAHE/DWo5FqJ6EjQ15YKXrt+AETjv60Dat34Q==", - "dev": true - }, - "typescript-tuple": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/typescript-tuple/-/typescript-tuple-2.2.1.tgz", - "integrity": "sha512-Zcr0lbt8z5ZdEzERHAMAniTiIKerFCMgd7yjq1fPnDJ43et/k9twIFQMUYff9k5oXcsQ0WpvFcgzK2ZKASoW6Q==", - "dev": true, - "requires": { - "typescript-compare": "^0.0.2" - } - }, - "typical": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", - "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==", - "dev": true, - "peer": true - }, - "uglify-js": { - "version": "3.17.4", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", - "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", - "dev": true, - "optional": true, - "peer": true - }, - "ultron": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", - "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==", - "dev": true - }, - "unbox-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", - "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", - "dev": true, - "peer": true, - "requires": { - "call-bind": "^1.0.2", - "has-bigints": "^1.0.2", - "has-symbols": "^1.0.3", - "which-boxed-primitive": "^1.0.2" - } - }, - "undici": { - "version": "5.22.1", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.22.1.tgz", - "integrity": "sha512-Ji2IJhFXZY0x/0tVBXeQwgPlLWw13GVzpsWPQ3rV50IFMMof2I55PZZxtm4P6iNq+L5znYN9nSTAq0ZyE6lSJw==", - "dev": true, - "requires": { - "busboy": "^1.6.0" - } - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true - }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", - "dev": true - }, - "upper-case": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz", - "integrity": "sha512-WRbjgmYzgXkCV7zNVpy5YgrHgbBv126rMALQQMrmzOVC4GM2waQ9x7xtm8VU+1yF2kWyPzI9zbZ48n4vSxwfSA==", - "dev": true - }, - "upper-case-first": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/upper-case-first/-/upper-case-first-1.1.2.tgz", - "integrity": "sha512-wINKYvI3Db8dtjikdAqoBbZoP6Q+PZUyfMR7pmwHzjC2quzSkUq5DmPrTtPEqHaz8AGtmsB4TqwapMTM1QAQOQ==", - "dev": true, - "requires": { - "upper-case": "^1.1.1" - } - }, - "uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "requires": { - "punycode": "^2.1.0" - } - }, - "url-set-query": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", - "integrity": "sha512-3AChu4NiXquPfeckE5R5cGdiHCMWJx1dwCWOmWIL4KHAziJNOFIYJlpGFeKDvwLPHovZRCxK3cYlwzqI9Vp+Gg==", - "dev": true - }, - "utf-8-validate": { - "version": "5.0.10", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", - "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", - "dev": true, - "requires": { - "node-gyp-build": "^4.3.0" - } - }, - "utf8": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz", - "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==", - "dev": true - }, - "util": { - "version": "0.12.5", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", - "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "which-typed-array": "^1.1.2" - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dev": true - }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", - "dev": true - }, - "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "dev": true - }, - "v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true, - "peer": true - }, - "validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "value-or-promise": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/value-or-promise/-/value-or-promise-1.0.11.tgz", - "integrity": "sha512-41BrgH+dIbCFXClcSapVs5M6GkENd3gQOJpEfPDNa71LsUGMXDL0jMWpI/Rh7WhX+Aalfz2TTS3Zt5pUsbnhLg==", - "dev": true, - "optional": true - }, - "varint": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", - "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==", - "dev": true - }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", - "dev": true - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "vuvuzela": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/vuvuzela/-/vuvuzela-1.0.3.tgz", - "integrity": "sha512-Tm7jR1xTzBbPW+6y1tknKiEhz04Wf/1iZkcTJjSFcpNko43+dFW6+OOeQe9taJIug3NdfUAjFKgUSyQrIKaDvQ==", - "dev": true, - "optional": true - }, - "web3": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3/-/web3-1.10.0.tgz", - "integrity": "sha512-YfKY9wSkGcM8seO+daR89oVTcbu18NsVfvOngzqMYGUU0pPSQmE57qQDvQzUeoIOHAnXEBNzrhjQJmm8ER0rng==", - "dev": true, - "requires": { - "web3-bzz": "1.10.0", - "web3-core": "1.10.0", - "web3-eth": "1.10.0", - "web3-eth-personal": "1.10.0", - "web3-net": "1.10.0", - "web3-shh": "1.10.0", - "web3-utils": "1.10.0" - } - }, - "web3-bzz": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.10.0.tgz", - "integrity": "sha512-o9IR59io3pDUsXTsps5pO5hW1D5zBmg46iNc2t4j2DkaYHNdDLwk2IP9ukoM2wg47QILfPEJYzhTfkS/CcX0KA==", - "dev": true, - "requires": { - "@types/node": "^12.12.6", - "got": "12.1.0", - "swarm-js": "^0.1.40" - }, - "dependencies": { - "@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", - "dev": true - } - } - }, - "web3-core": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.10.0.tgz", - "integrity": "sha512-fWySwqy2hn3TL89w5TM8wXF1Z2Q6frQTKHWmP0ppRQorEK8NcHJRfeMiv/mQlSKoTS1F6n/nv2uyZsixFycjYQ==", - "dev": true, - "requires": { - "@types/bn.js": "^5.1.1", - "@types/node": "^12.12.6", - "bignumber.js": "^9.0.0", - "web3-core-helpers": "1.10.0", - "web3-core-method": "1.10.0", - "web3-core-requestmanager": "1.10.0", - "web3-utils": "1.10.0" - }, - "dependencies": { - "@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", - "dev": true - }, - "bignumber.js": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", - "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==", - "dev": true - } - } - }, - "web3-core-helpers": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.10.0.tgz", - "integrity": "sha512-pIxAzFDS5vnbXvfvLSpaA1tfRykAe9adw43YCKsEYQwH0gCLL0kMLkaCX3q+Q8EVmAh+e1jWL/nl9U0de1+++g==", - "dev": true, - "requires": { - "web3-eth-iban": "1.10.0", - "web3-utils": "1.10.0" - } - }, - "web3-core-method": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.10.0.tgz", - "integrity": "sha512-4R700jTLAMKDMhQ+nsVfIXvH6IGJlJzGisIfMKWAIswH31h5AZz7uDUW2YctI+HrYd+5uOAlS4OJeeT9bIpvkA==", - "dev": true, - "requires": { - "@ethersproject/transactions": "^5.6.2", - "web3-core-helpers": "1.10.0", - "web3-core-promievent": "1.10.0", - "web3-core-subscriptions": "1.10.0", - "web3-utils": "1.10.0" - } - }, - "web3-core-promievent": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.10.0.tgz", - "integrity": "sha512-68N7k5LWL5R38xRaKFrTFT2pm2jBNFaM4GioS00YjAKXRQ3KjmhijOMG3TICz6Aa5+6GDWYelDNx21YAeZ4YTg==", - "dev": true, - "requires": { - "eventemitter3": "4.0.4" - } - }, - "web3-core-requestmanager": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.10.0.tgz", - "integrity": "sha512-3z/JKE++Os62APml4dvBM+GAuId4h3L9ckUrj7ebEtS2AR0ixyQPbrBodgL91Sv7j7cQ3Y+hllaluqjguxvSaQ==", - "dev": true, - "requires": { - "util": "^0.12.5", - "web3-core-helpers": "1.10.0", - "web3-providers-http": "1.10.0", - "web3-providers-ipc": "1.10.0", - "web3-providers-ws": "1.10.0" - } - }, - "web3-core-subscriptions": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.10.0.tgz", - "integrity": "sha512-HGm1PbDqsxejI075gxBc5OSkwymilRWZufIy9zEpnWKNmfbuv5FfHgW1/chtJP6aP3Uq2vHkvTDl3smQBb8l+g==", - "dev": true, - "requires": { - "eventemitter3": "4.0.4", - "web3-core-helpers": "1.10.0" - } - }, - "web3-eth": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.10.0.tgz", - "integrity": "sha512-Z5vT6slNMLPKuwRyKGbqeGYC87OAy8bOblaqRTgg94CXcn/mmqU7iPIlG4506YdcdK3x6cfEDG7B6w+jRxypKA==", - "dev": true, - "requires": { - "web3-core": "1.10.0", - "web3-core-helpers": "1.10.0", - "web3-core-method": "1.10.0", - "web3-core-subscriptions": "1.10.0", - "web3-eth-abi": "1.10.0", - "web3-eth-accounts": "1.10.0", - "web3-eth-contract": "1.10.0", - "web3-eth-ens": "1.10.0", - "web3-eth-iban": "1.10.0", - "web3-eth-personal": "1.10.0", - "web3-net": "1.10.0", - "web3-utils": "1.10.0" - } - }, - "web3-eth-abi": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.10.0.tgz", - "integrity": "sha512-cwS+qRBWpJ43aI9L3JS88QYPfFcSJJ3XapxOQ4j40v6mk7ATpA8CVK1vGTzpihNlOfMVRBkR95oAj7oL6aiDOg==", - "dev": true, - "requires": { - "@ethersproject/abi": "^5.6.3", - "web3-utils": "1.10.0" - } - }, - "web3-eth-accounts": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.10.0.tgz", - "integrity": "sha512-wiq39Uc3mOI8rw24wE2n15hboLE0E9BsQLdlmsL4Zua9diDS6B5abXG0XhFcoNsXIGMWXVZz4TOq3u4EdpXF/Q==", - "dev": true, - "requires": { - "@ethereumjs/common": "2.5.0", - "@ethereumjs/tx": "3.3.2", - "eth-lib": "0.2.8", - "ethereumjs-util": "^7.1.5", - "scrypt-js": "^3.0.1", - "uuid": "^9.0.0", - "web3-core": "1.10.0", - "web3-core-helpers": "1.10.0", - "web3-core-method": "1.10.0", - "web3-utils": "1.10.0" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - }, - "eth-lib": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz", - "integrity": "sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw==", - "dev": true, - "requires": { - "bn.js": "^4.11.6", - "elliptic": "^6.4.0", - "xhr-request-promise": "^0.1.2" - } - }, - "uuid": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", - "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", - "dev": true - } - } - }, - "web3-eth-contract": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.10.0.tgz", - "integrity": "sha512-MIC5FOzP/+2evDksQQ/dpcXhSqa/2hFNytdl/x61IeWxhh6vlFeSjq0YVTAyIzdjwnL7nEmZpjfI6y6/Ufhy7w==", - "dev": true, - "requires": { - "@types/bn.js": "^5.1.1", - "web3-core": "1.10.0", - "web3-core-helpers": "1.10.0", - "web3-core-method": "1.10.0", - "web3-core-promievent": "1.10.0", - "web3-core-subscriptions": "1.10.0", - "web3-eth-abi": "1.10.0", - "web3-utils": "1.10.0" - } - }, - "web3-eth-ens": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.10.0.tgz", - "integrity": "sha512-3hpGgzX3qjgxNAmqdrC2YUQMTfnZbs4GeLEmy8aCWziVwogbuqQZ+Gzdfrym45eOZodk+lmXyLuAdqkNlvkc1g==", - "dev": true, - "requires": { - "content-hash": "^2.5.2", - "eth-ens-namehash": "2.0.8", - "web3-core": "1.10.0", - "web3-core-helpers": "1.10.0", - "web3-core-promievent": "1.10.0", - "web3-eth-abi": "1.10.0", - "web3-eth-contract": "1.10.0", - "web3-utils": "1.10.0" - } - }, - "web3-eth-iban": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.10.0.tgz", - "integrity": "sha512-0l+SP3IGhInw7Q20LY3IVafYEuufo4Dn75jAHT7c2aDJsIolvf2Lc6ugHkBajlwUneGfbRQs/ccYPQ9JeMUbrg==", - "dev": true, - "requires": { - "bn.js": "^5.2.1", - "web3-utils": "1.10.0" - } - }, - "web3-eth-personal": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.10.0.tgz", - "integrity": "sha512-anseKn98w/d703eWq52uNuZi7GhQeVjTC5/svrBWEKob0WZ5kPdo+EZoFN0sp5a5ubbrk/E0xSl1/M5yORMtpg==", - "dev": true, - "requires": { - "@types/node": "^12.12.6", - "web3-core": "1.10.0", - "web3-core-helpers": "1.10.0", - "web3-core-method": "1.10.0", - "web3-net": "1.10.0", - "web3-utils": "1.10.0" - }, - "dependencies": { - "@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", - "dev": true - } - } - }, - "web3-net": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.10.0.tgz", - "integrity": "sha512-NLH/N3IshYWASpxk4/18Ge6n60GEvWBVeM8inx2dmZJVmRI6SJIlUxbL8jySgiTn3MMZlhbdvrGo8fpUW7a1GA==", - "dev": true, - "requires": { - "web3-core": "1.10.0", - "web3-core-method": "1.10.0", - "web3-utils": "1.10.0" - } - }, - "web3-providers-http": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.10.0.tgz", - "integrity": "sha512-eNr965YB8a9mLiNrkjAWNAPXgmQWfpBfkkn7tpEFlghfww0u3I0tktMZiaToJVcL2+Xq+81cxbkpeWJ5XQDwOA==", - "dev": true, - "requires": { - "abortcontroller-polyfill": "^1.7.3", - "cross-fetch": "^3.1.4", - "es6-promise": "^4.2.8", - "web3-core-helpers": "1.10.0" - } - }, - "web3-providers-ipc": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.10.0.tgz", - "integrity": "sha512-OfXG1aWN8L1OUqppshzq8YISkWrYHaATW9H8eh0p89TlWMc1KZOL9vttBuaBEi96D/n0eYDn2trzt22bqHWfXA==", - "dev": true, - "requires": { - "oboe": "2.1.5", - "web3-core-helpers": "1.10.0" - } - }, - "web3-providers-ws": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.10.0.tgz", - "integrity": "sha512-sK0fNcglW36yD5xjnjtSGBnEtf59cbw4vZzJ+CmOWIKGIR96mP5l684g0WD0Eo+f4NQc2anWWXG74lRc9OVMCQ==", - "dev": true, - "requires": { - "eventemitter3": "4.0.4", - "web3-core-helpers": "1.10.0", - "websocket": "^1.0.32" - } - }, - "web3-shh": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.10.0.tgz", - "integrity": "sha512-uNUUuNsO2AjX41GJARV9zJibs11eq6HtOe6Wr0FtRUcj8SN6nHeYIzwstAvJ4fXA53gRqFMTxdntHEt9aXVjpg==", - "dev": true, - "requires": { - "web3-core": "1.10.0", - "web3-core-method": "1.10.0", - "web3-core-subscriptions": "1.10.0", - "web3-net": "1.10.0" - } - }, - "web3-utils": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", - "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", - "dev": true, - "requires": { - "bn.js": "^5.2.1", - "ethereum-bloom-filters": "^1.0.6", - "ethereumjs-util": "^7.1.0", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randombytes": "^2.1.0", - "utf8": "3.0.0" - } - }, - "webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dev": true - }, - "websocket": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz", - "integrity": "sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==", - "dev": true, - "requires": { - "bufferutil": "^4.0.1", - "debug": "^2.2.0", - "es5-ext": "^0.10.50", - "typedarray-to-buffer": "^3.1.5", - "utf-8-validate": "^5.0.2", - "yaeti": "^0.0.6" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - } - } - }, - "whatwg-mimetype": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", - "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", - "dev": true, - "optional": true - }, - "whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dev": true, - "requires": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "which-boxed-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", - "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", - "dev": true, - "peer": true, - "requires": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" - } - }, - "which-module": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", - "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==", - "dev": true, - "peer": true - }, - "which-typed-array": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", - "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", - "dev": true, - "requires": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.10" - } - }, - "wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "dev": true, - "peer": true, - "requires": { - "string-width": "^1.0.2 || 2" - }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", - "dev": true, - "peer": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "peer": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - } - } - }, - "window-size": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.2.0.tgz", - "integrity": "sha512-UD7d8HFA2+PZsbKyaOCEy8gMh1oDtHgJh1LfgjQ4zVXmYjAT/kvz3PueITKuqDiIXQe7yzpPnxX3lNc+AhQMyw==", - "dev": true - }, - "word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true - }, - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", - "dev": true, - "peer": true - }, - "wordwrapjs": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-4.0.1.tgz", - "integrity": "sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA==", - "dev": true, - "peer": true, - "requires": { - "reduce-flatten": "^2.0.0", - "typical": "^5.2.0" - }, - "dependencies": { - "typical": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", - "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", - "dev": true, - "peer": true - } - } - }, - "workerpool": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", - "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", - "dev": true - }, - "wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - } - } - }, - "wrap-ansi-cjs": { - "version": "npm:wrap-ansi@7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - } - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, - "write-stream": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/write-stream/-/write-stream-0.4.3.tgz", - "integrity": "sha512-IJrvkhbAnj89W/GAVdVgbnPiVw5Ntg/B4tc/MUCIEwj/g6JIww1DWJyB/yBMT3yw2/TkT6IUZ0+IYef3flEw8A==", - "dev": true, - "optional": true, - "requires": { - "readable-stream": "~0.0.2" - }, - "dependencies": { - "readable-stream": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-0.0.4.tgz", - "integrity": "sha512-azrivNydKRYt7zwLV5wWUK7YzKTWs3q87xSmY6DlHapPrCvaT6ZrukvM5erV+yCSSPmZT8zkSdttOHQpWWm9zw==", - "dev": true, - "optional": true - } - } - }, - "ws": { - "version": "7.4.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", - "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", - "dev": true, - "requires": {} - }, - "xhr": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz", - "integrity": "sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA==", - "dev": true, - "requires": { - "global": "~4.4.0", - "is-function": "^1.0.1", - "parse-headers": "^2.0.0", - "xtend": "^4.0.0" - } - }, - "xhr-request": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", - "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", - "dev": true, - "requires": { - "buffer-to-arraybuffer": "^0.0.5", - "object-assign": "^4.1.1", - "query-string": "^5.0.1", - "simple-get": "^2.7.0", - "timed-out": "^4.0.1", - "url-set-query": "^1.0.0", - "xhr": "^2.0.4" - } - }, - "xhr-request-promise": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.3.tgz", - "integrity": "sha512-YUBytBsuwgitWtdRzXDDkWAXzhdGB8bYm0sSzMPZT7Z2MBjMSTHFsyCT1yCRATY+XC69DUrQraRAEgcoCRaIPg==", - "dev": true, - "requires": { - "xhr-request": "^1.1.0" - } - }, - "xmlhttprequest": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", - "integrity": "sha512-58Im/U0mlVBLM38NdZjHyhuMtCqa61469k2YP/AaPbvCoV9aQGUpbJBj1QRm2ytRiVQBD/fsw7L2bJGDVQswBA==", - "dev": true - }, - "xss": { - "version": "1.0.14", - "resolved": "https://registry.npmjs.org/xss/-/xss-1.0.14.tgz", - "integrity": "sha512-og7TEJhXvn1a7kzZGQ7ETjdQVS2UfZyTlsEdDOqvQF7GoxNfY+0YLCzBy1kPdsDDx4QuNAonQPddpsn6Xl/7sw==", - "dev": true, - "optional": true, - "requires": { - "commander": "^2.20.3", - "cssfilter": "0.0.10" - }, - "dependencies": { - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true, - "optional": true - } - } - }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "dev": true - }, - "y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true - }, - "yaeti": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", - "integrity": "sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug==", - "dev": true - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true - }, - "yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "requires": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - } - }, - "yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "dev": true - }, - "yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", - "dev": true, - "requires": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" - }, - "dependencies": { - "camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true - }, - "decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", - "dev": true - }, - "is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", - "dev": true - } - } - }, - "yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "peer": true - }, - "yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true - } } } diff --git a/package.json b/package.json index dc660b82c..aa044f123 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,8 @@ }, "dependencies": { "@openzeppelin/contracts": "^4.9.0", - "@openzeppelin/contracts-upgradeable": "4.9.0" + "@openzeppelin/contracts-upgradeable": "4.9.0", + "ethers": "^6.6.0" }, "devDependencies": { "@bosonprotocol/solidoc": "3.0.3", diff --git a/scripts/domain/Receipt.js b/scripts/domain/Receipt.js index c3aa9b824..8b38eaa7d 100644 --- a/scripts/domain/Receipt.js +++ b/scripts/domain/Receipt.js @@ -121,7 +121,6 @@ class Receipt { twinReceipts, ] = struct; - console.log(twinReceipts); return Receipt.fromObject({ exchangeId: exchangeId.toString(), offerId: offerId.toString(), diff --git a/scripts/util/diamond-utils.js b/scripts/util/diamond-utils.js index b7cc58495..4971aa03b 100644 --- a/scripts/util/diamond-utils.js +++ b/scripts/util/diamond-utils.js @@ -186,7 +186,7 @@ async function getInitializeCalldata( version, isUpgrade, initializationData, - initializationFacet, + initializationFacet = "0x", interfacesToRemove = [], interfacesToAdd = [] ) { diff --git a/test/access/AccessControllerTest.js b/test/access/AccessControllerTest.js index e7e9b9d38..024f6e1ea 100644 --- a/test/access/AccessControllerTest.js +++ b/test/access/AccessControllerTest.js @@ -1,5 +1,5 @@ -const hre = require("hardhat"); -const ethers = hre.ethers; +const { ethers } = require("hardhat"); +const { getContractFactory, getSigners, keccak256, toUtf8Bytes } = ethers; const { expect } = require("chai"); const Role = require("../../scripts/domain/Role"); const { getInterfaceIds } = require("../../scripts/config/supported-interfaces.js"); @@ -26,7 +26,7 @@ describe("AccessController", function () { // Deploy the contract AccessController = await getContractFactory("AccessController"); accessController = await AccessController.deploy(); - await accessController.deployed(); + await accessController.waitForDeployment(); }); context("📋 Interfaces", async function () { @@ -44,27 +44,42 @@ describe("AccessController", function () { context("📋 Deployer is limited to initial ADMIN role", async function () { it("Deployer should have ADMIN role", async function () { // Check role - expect(await accessController.hasRole(Role.ADMIN, await deployer.getAddress()), "Deployer doesn't have ADMIN role").is.true; + expect( + await accessController.hasRole(Role.ADMIN, await deployer.getAddress()), + "Deployer doesn't have ADMIN role" + ).is.true; }); it("Deployer should not have PROTOCOL role", async function () { // Check role - expect(await accessController.hasRole(Role.PROTOCOL, await deployer.getAddress()), "Deployer has PROTOCOL role").is.false; + expect( + await accessController.hasRole(Role.PROTOCOL, await deployer.getAddress()), + "Deployer has PROTOCOL role" + ).is.false; }); it("Deployer should not have UPGRADER role", async function () { // Check role - expect(await accessController.hasRole(Role.UPGRADER, await deployer.getAddress()), "Deployer has UPGRADER role").is.false; + expect( + await accessController.hasRole(Role.UPGRADER, await deployer.getAddress()), + "Deployer has UPGRADER role" + ).is.false; }); it("Deployer should not have PAUSER role", async function () { // Check role - expect(await accessController.hasRole(Role.PAUSER, await deployer.getAddress()), "Deployer has PAUSER role").is.false; + expect( + await accessController.hasRole(Role.PAUSER, await deployer.getAddress()), + "Deployer has PAUSER role" + ).is.false; }); it("Deployer should not have CLIENT role", async function () { // Check role - expect(await accessController.hasRole(Role.CLIENT, await deployer.getAddress()), "Deployer has CLIENT role").is.false; + expect( + await accessController.hasRole(Role.CLIENT, await deployer.getAddress()), + "Deployer has CLIENT role" + ).is.false; }); it("Deployer should not have FEE_COLLECTOR role", async function () { @@ -187,7 +202,10 @@ describe("AccessController", function () { .withArgs(Role.PAUSER, await pauser.getAddress(), await admin.getAddress()); // Test - expect(await accessController.hasRole(Role.PAUSER, await pauser.getAddress()), "ADMIN role can't grant PAUSER role").is.true; + expect( + await accessController.hasRole(Role.PAUSER, await pauser.getAddress()), + "ADMIN role can't grant PAUSER role" + ).is.true; }); it("ADMIN role should be able to grant CLIENT role", async function () { @@ -197,7 +215,10 @@ describe("AccessController", function () { .withArgs(Role.CLIENT, await client.getAddress(), await admin.getAddress()); // Test - expect(await accessController.hasRole(Role.CLIENT, await client.getAddress()), "ADMIN role can't grant CLIENT role").is.true; + expect( + await accessController.hasRole(Role.CLIENT, await client.getAddress()), + "ADMIN role can't grant CLIENT role" + ).is.true; }); it("ADMIN role should be able to grant FEE_COLLECTOR role", async function () { @@ -393,7 +414,9 @@ describe("AccessController", function () { it("FEE_COLLECTOR role should be able to renounce FEE_COLLECTOR role", async function () { // Renounce Role, expecting the event - await expect(accessController.connect(feeCollector).renounceRole(Role.FEE_COLLECTOR, await feeCollector.getAddress())) + await expect( + accessController.connect(feeCollector).renounceRole(Role.FEE_COLLECTOR, await feeCollector.getAddress()) + ) .to.emit(accessController, "RoleRevoked") .withArgs(Role.FEE_COLLECTOR, await feeCollector.getAddress(), await feeCollector.getAddress()); @@ -446,15 +469,15 @@ describe("AccessController", function () { context("💔 Revert Reasons", async function () { it("Caller is different from account to be renounced", async function () { // Renounce Role, expecting revert - await expect(accessController.connect(admin).renounceRole(Role.ADMIN, await deployer.getAddress())).to.be.revertedWith( - RevertReasons.CAN_ONLY_REVOKE_SELF - ); + await expect( + accessController.connect(admin).renounceRole(Role.ADMIN, await deployer.getAddress()) + ).to.be.revertedWith(RevertReasons.CAN_ONLY_REVOKE_SELF); }); it("Should revert if caller tries to grantRole but doesn't have ADMIN role", async function () { // Grant Role, expecting revert await expect(accessController.connect(rando).grantRole(Role.ADMIN, await rando.getAddress())).to.be.revertedWith( - `AccessControl: account ${await rando.getAddress().toLowerCase()} is missing role ${Role.ADMIN}` + `AccessControl: account ${(await rando.getAddress()).toLowerCase()} is missing role ${Role.ADMIN}` ); }); @@ -463,8 +486,10 @@ describe("AccessController", function () { await accessController.connect(deployer).grantRole(Role.PAUSER, await pauser.getAddress()); // Revoke Role, expecting revert - await expect(accessController.connect(rando).revokeRole(Role.PAUSER, await pauser.getAddress())).to.be.revertedWith( - `AccessControl: account ${await rando.getAddress().toLowerCase()} is missing role ${Role.ADMIN}` + await expect( + accessController.connect(rando).revokeRole(Role.PAUSER, await pauser.getAddress()) + ).to.be.revertedWith( + `AccessControl: account ${(await rando.getAddress()).toLowerCase()} is missing role ${Role.ADMIN}` ); }); }); diff --git a/test/protocol/DisputeHandlerTest.js b/test/protocol/DisputeHandlerTest.js index 100febf90..7efadcc53 100644 --- a/test/protocol/DisputeHandlerTest.js +++ b/test/protocol/DisputeHandlerTest.js @@ -261,7 +261,6 @@ describe("IBosonDisputeHandler", function () { block = await provider.getBlock(blockNumber); disputedDate = block.timestamp; timeout = disputedDate + resolutionPeriod; - console.log(timeout); // expected values dispute = new Dispute(exchangeId, DisputeState.Resolving, buyerPercentBasisPoints); @@ -1194,9 +1193,7 @@ describe("IBosonDisputeHandler", function () { .resolveDispute(exchangeId, buyerPercentBasisPoints, hexZeroPad("0x", 32), s, v) ).to.revertedWith(RevertReasons.INVALID_SIGNATURE); await expect( - disputeHandler - .connect(assistant) - .resolveDispute(exchangeId, buyerPercentBasisPoints, r, MaxUint256, v) + disputeHandler.connect(assistant).resolveDispute(exchangeId, buyerPercentBasisPoints, r, MaxUint256, v) ).to.revertedWith(RevertReasons.INVALID_SIGNATURE); }); @@ -2395,7 +2392,6 @@ describe("IBosonDisputeHandler", function () { block = await provider.getBlock(blockNumber); disputedDate = block.timestamp; timeout = disputedDate + resolutionPeriod; - console.log("before each itmeout", timeout); dispute[exchangeId] = new Dispute(exchangeId, DisputeState.Retracted, buyerPercentBasisPoints); disputeDates[exchangeId] = new DisputeDates(disputedDate, "0", finalizedDate, timeout); @@ -2446,13 +2442,9 @@ describe("IBosonDisputeHandler", function () { // Returned values should match the expected dispute and dispute dates for (const [key, value] of Object.entries(dispute[exchangeId])) { - console.log(key, value); - console.log(returnedDisputeDates[key]); expect(JSON.stringify(returnedDispute[key]) === JSON.stringify(value)).is.true; } for (const [key, value] of Object.entries(disputeDates[exchangeId])) { - console.log(key, value); - console.log(returnedDisputeDates[key]); expect(JSON.stringify(returnedDisputeDates[key]) === JSON.stringify(value)).is.true; } diff --git a/test/protocol/FundsHandlerTest.js b/test/protocol/FundsHandlerTest.js index d1f40b27c..b2f29704e 100644 --- a/test/protocol/FundsHandlerTest.js +++ b/test/protocol/FundsHandlerTest.js @@ -3055,7 +3055,6 @@ describe("IBosonFundsHandler", function () { // seller: (price + sellerDeposit)*(1-buyerPercentage) sellerPayoff = BigInt(offerToken.price) + BigInt(offerToken.sellerDeposit) - buyerPayoff; - console.log(sellerPayoff); // protocol: 0 protocolPayoff = 0; @@ -3248,8 +3247,6 @@ describe("IBosonFundsHandler", function () { protocolAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(protocolId)); agentAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(agentId)); - console.log(sellersAvailableFunds); - console.log(expectedSellerAvailableFunds); expect(sellersAvailableFunds).to.eql(expectedSellerAvailableFunds); expect(buyerAvailableFunds).to.eql(expectedBuyerAvailableFunds); expect(protocolAvailableFunds).to.eql(expectedProtocolAvailableFunds); diff --git a/test/protocol/ProtocolInitializationHandlerTest.js b/test/protocol/ProtocolInitializationHandlerTest.js index 6324619b5..ea232b225 100644 --- a/test/protocol/ProtocolInitializationHandlerTest.js +++ b/test/protocol/ProtocolInitializationHandlerTest.js @@ -1,6 +1,6 @@ const { expect } = require("chai"); const hre = require("hardhat"); -const { getContractAt, getContractFactory, getSigners, formatBytes32String, defaultAbiCoder, ZeroHash } = hre.ethers; +const { getContractAt, getContractFactory, getSigners, encodeBytes32String, AbiCoder, ZeroHash } = hre.ethers; const Role = require("../../scripts/domain/Role"); const { deployProtocolDiamond } = require("../../scripts/util/deploy-protocol-diamond.js"); @@ -12,6 +12,7 @@ const { getFacetAddCut, getFacetReplaceCut } = require("../../scripts/util/diamo const { RevertReasons } = require("../../scripts/config/revert-reasons.js"); const { getFacetsWithArgs } = require("../util/utils.js"); const { getV2_2_0DeployConfig } = require("../upgrade/00_config.js"); +const { ZeroAddress } = require("ethers"); describe("ProtocolInitializationHandler", async function () { // Common vars @@ -22,6 +23,7 @@ describe("ProtocolInitializationHandler", async function () { let erc165; let version; let maxPremintedVouchers, initializationData; + let abiCoder; before(async function () { // get interface Ids @@ -55,9 +57,12 @@ describe("ProtocolInitializationHandler", async function () { version = "2.2.0"; + abiCoder = AbiCoder.defaultAbiCoder(); + // initialization data for v2.2.0 maxPremintedVouchers = "1000"; - initializationData = defaultAbiCoder.encode(["uint256"], [maxPremintedVouchers]); + + initializationData = abiCoder.encode(["uint256"], [maxPremintedVouchers]); }); describe("Deploy tests", async function () { @@ -85,7 +90,7 @@ describe("ProtocolInitializationHandler", async function () { }); it("Addresses and calldata length mismatch", async function () { - version = formatBytes32String("2.2.0"); + version = encodeBytes32String("2.2.0"); const callData = protocolInitializationFacetDeployed.interface.encodeFunctionData("initialize", [ version, @@ -97,7 +102,7 @@ describe("ProtocolInitializationHandler", async function () { [], ]); - let facetCut = getFacetAddCut(protocolInitializationFacetDeployed, [callData.slice(0, 10)]); + let facetCut = await getFacetAddCut(protocolInitializationFacetDeployed, [callData.slice(0, 10)]); const cutArgs = [ [facetCut], @@ -122,7 +127,7 @@ describe("ProtocolInitializationHandler", async function () { [], ]); - let facetCut = getFacetAddCut(protocolInitializationFacetDeployed, [callData.slice(0, 10)]); + let facetCut = await getFacetAddCut(protocolInitializationFacetDeployed, [callData.slice(0, 10)]); const cutArgs = [ [facetCut], @@ -137,7 +142,7 @@ describe("ProtocolInitializationHandler", async function () { }); it("Initialize same version twice", async function () { - version = formatBytes32String("2.2.0"); + version = encodeBytes32String("2.2.0"); const callData = protocolInitializationFacetDeployed.interface.encodeFunctionData("initialize", [ version, @@ -149,7 +154,7 @@ describe("ProtocolInitializationHandler", async function () { [], ]); - let facetCut = getFacetAddCut(protocolInitializationFacetDeployed, [callData.slice(0, 10)]); + let facetCut = await getFacetAddCut(protocolInitializationFacetDeployed, [callData.slice(0, 10)]); await diamondCutFacet.diamondCut( [facetCut], @@ -165,7 +170,7 @@ describe("ProtocolInitializationHandler", async function () { const calldataTestFacet = testFacet.interface.encodeFunctionData("initialize", [await rando.getAddress()]); - facetCut = getFacetAddCut(testFacet, [calldataTestFacet.slice(0, 10)]); + facetCut = await getFacetAddCut(testFacet, [calldataTestFacet.slice(0, 10)]); const calldataProtocolInitialization = protocolInitializationFacetDeployed.interface.encodeFunctionData( "initialize", @@ -195,7 +200,9 @@ describe("ProtocolInitializationHandler", async function () { // Get actual deployed protocolInitializationFacet const diamondLoupe = await getContractAt("DiamondLoupeFacet", await protocolDiamond.getAddress()); - const signature = protocolInitializationFacet.interface.getSighash("getVersion()"); + const signature = protocolInitializationFacet.interface.fragments.find( + (f) => f.name == "getVersion" + ).selector; const existingFacetAddress = await diamondLoupe.facetAddress(signature); const protocolInitializationFacet2 = await getContractAt( "ProtocolInitializationHandlerFacet", @@ -210,7 +217,7 @@ describe("ProtocolInitializationHandler", async function () { // call initialize await expect( protocolInitializationFacet2.initialize( - formatBytes32String("haha"), + encodeBytes32String("haha"), [await selfDestructor.getAddress()], [selfDestructorInitData], false, @@ -258,7 +265,7 @@ describe("ProtocolInitializationHandler", async function () { const configHandlerInterface = InterfaceIds[interfaceImplementers["ConfigHandlerFacet"]]; const accountInterface = InterfaceIds[interfaceImplementers["AccountHandlerFacet"]]; - version = formatBytes32String("2.3.0"); + version = encodeBytes32String("2.3.0"); const calldataProtocolInitialization = deployedProtocolInitializationHandlerFacet.contract.interface.encodeFunctionData("initialize", [ version, @@ -300,7 +307,7 @@ describe("ProtocolInitializationHandler", async function () { const calldataTestFacet = testFacet.interface.encodeFunctionData("initialize", [await rando.getAddress()]); - version = formatBytes32String("2.3.0"); + version = encodeBytes32String("2.3.0"); const calldataProtocolInitialization = deployedProtocolInitializationHandlerFacet.contract.interface.encodeFunctionData("initialize", [ version, @@ -312,7 +319,7 @@ describe("ProtocolInitializationHandler", async function () { [], ]); - const facetCuts = [getFacetAddCut(testFacet)]; + const facetCuts = [await getFacetAddCut(testFacet)]; await diamondCutFacet.diamondCut( facetCuts, @@ -334,7 +341,7 @@ describe("ProtocolInitializationHandler", async function () { testFacet = await FacetTestFactory.deploy(await getFees(maxPriorityFeePerGas)); await testFacet.waitForDeployment(); - version = formatBytes32String("2.3.0"); + version = encodeBytes32String("2.3.0"); }); it("Delegate call to initialize fails", async function () { @@ -351,7 +358,7 @@ describe("ProtocolInitializationHandler", async function () { [], ]); - const facetCuts = [getFacetAddCut(testFacet)]; + const facetCuts = [await getFacetAddCut(testFacet)]; await expect( diamondCutFacet.diamondCut( @@ -379,7 +386,7 @@ describe("ProtocolInitializationHandler", async function () { [], ]); - const facetCuts = [getFacetAddCut(testFacet)]; + const facetCuts = [await getFacetAddCut(testFacet)]; await expect( diamondCutFacet.diamondCut( @@ -440,10 +447,9 @@ describe("ProtocolInitializationHandler", async function () { await getFees(maxPriorityFeePerGas) ); - version = formatBytes32String("2.2.0"); - + version = encodeBytes32String("2.2.0"); // Prepare cut data - facetCut = getFacetAddCut(configHandler); + facetCut = await getFacetAddCut(configHandler); // Attach correct address to configHandler configHandler = configHandler.attach(await protocolDiamond.getAddress()); // Prepare calldata @@ -456,7 +462,7 @@ describe("ProtocolInitializationHandler", async function () { it("Should emit MaxPremintedVouchersChanged event", async function () { // Make the cut, check the event await expect( - diamondCutFacet.diamondCut( + await diamondCutFacet.diamondCut( [facetCut], await deployedProtocolInitializationHandlerFacet.getAddress(), calldataProtocolInitialization, @@ -484,7 +490,7 @@ describe("ProtocolInitializationHandler", async function () { it("Max preminted vouchers is zero", async function () { // set invalid maxPremintedVouchers maxPremintedVouchers = "0"; - initializationData = defaultAbiCoder.encode(["uint256"], [maxPremintedVouchers]); + initializationData = abiCoder.encode(["uint256"], [maxPremintedVouchers]); calldataProtocolInitialization = deployedProtocolInitializationHandlerFacet.interface.encodeFunctionData( "initialize", @@ -518,7 +524,7 @@ describe("ProtocolInitializationHandler", async function () { ); // Prepare 2.2.0 deployment - version = formatBytes32String("2.2.0"); + version = encodeBytes32String("2.2.0"); // make diamond cut, expect revert await expect( @@ -532,6 +538,7 @@ describe("ProtocolInitializationHandler", async function () { }); }); }); + describe("initV2_2_1", async function () { let deployedProtocolInitializationHandlerFacet; let facetCut; @@ -555,12 +562,14 @@ describe("ProtocolInitializationHandler", async function () { ); // Prepare cut data - facetCut = getFacetReplaceCut(deployedProtocolInitializationHandlerFacet, ["initialize"]); + facetCut = await getFacetReplaceCut(deployedProtocolInitializationHandlerFacet, [ + deployedProtocolInitializationHandlerFacet.interface.fragments.find((f) => f.name == "initialize").selector, + ]); // Prepare calldata calldataProtocolInitialization = deployedProtocolInitializationHandlerFacet.interface.encodeFunctionData( "initialize", - [formatBytes32String(version), [], [], true, [], [], []] + [encodeBytes32String(version), [], [], true, "0x", [], []] ); }); @@ -583,11 +592,11 @@ describe("ProtocolInitializationHandler", async function () { // Prepare calldata const calldataProtocolInitializationWrong = deployedProtocolInitializationHandlerFacet.interface.encodeFunctionData("initialize", [ - formatBytes32String(wrongVersion), + encodeBytes32String(wrongVersion), [], [], true, - [], + "0x", [], [], ]); @@ -606,7 +615,9 @@ describe("ProtocolInitializationHandler", async function () { ); // Prepare cut data - facetCut = getFacetReplaceCut(accountHandler, ["initialize"]); + facetCut = await getFacetReplaceCut(accountHandler, [ + accountHandler.interface.fragments.find((f) => f.name == "initialize").selector, + ]); // Make diamond cut, expect revert await expect( From f8a53e746da7f120bd458f45037110b4b3f0027f Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Thu, 22 Jun 2023 19:50:10 -0300 Subject: [PATCH 14/32] Fixing BosonVoucherTests --- scripts/util/create-dispute-resolver.js | 2 +- test/protocol/OfferHandlerTest.js | 3 - test/protocol/PauseHandlerTest.js | 2 +- test/protocol/clients/BeaconClientProxy.js | 2 +- test/protocol/clients/BosonVoucherTest.js | 414 +++++++++++++-------- 5 files changed, 264 insertions(+), 159 deletions(-) diff --git a/scripts/util/create-dispute-resolver.js b/scripts/util/create-dispute-resolver.js index 9a57bbd37..05ec8ed94 100644 --- a/scripts/util/create-dispute-resolver.js +++ b/scripts/util/create-dispute-resolver.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { ZeroAddress, getContractAt, getSigner, Wallet } = hre.ethers; const fs = require("fs").promises; const environments = require("../../environments"); const network = hre.network.name; diff --git a/test/protocol/OfferHandlerTest.js b/test/protocol/OfferHandlerTest.js index 9e642c9ba..c945a795c 100644 --- a/test/protocol/OfferHandlerTest.js +++ b/test/protocol/OfferHandlerTest.js @@ -2996,9 +2996,6 @@ describe("IBosonOfferHandler", function () { // Make the valid until date the same as the existing offer newValidUntilDate = (BigInt(offers[4].validUntilDate) - 10000n).toString(); // same as that validUntilDate of offer 5 - console.log(offers[4].validUntilDate); - console.log(newValidUntilDate); - await expect( offerHandler.connect(assistant).extendOfferBatch(offersToExtend, newValidUntilDate) ).to.revertedWith(RevertReasons.OFFER_PERIOD_INVALID); diff --git a/test/protocol/PauseHandlerTest.js b/test/protocol/PauseHandlerTest.js index 9bf47df35..404ddc91f 100644 --- a/test/protocol/PauseHandlerTest.js +++ b/test/protocol/PauseHandlerTest.js @@ -132,7 +132,7 @@ describe("IBosonPauseHandler", function () { await pauseHandler.connect(pauser).pause([PausableRegion.Exchanges]); // Attempt to unpause without PAUSER role, expecting revert - await expect(pauseHandler.connect(rando).unpause([])).to.revertedWith(RevertReasons.ACCESS_DENIED); + await expect(pauseHandler.connect(rando).unpause()).to.revertedWith(RevertReasons.ACCESS_DENIED); }); it("Protocol is not currently paused", async function () { diff --git a/test/protocol/clients/BeaconClientProxy.js b/test/protocol/clients/BeaconClientProxy.js index 63565e21a..7e9256020 100644 --- a/test/protocol/clients/BeaconClientProxy.js +++ b/test/protocol/clients/BeaconClientProxy.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getSigners } = hre.ethers; const { deployProtocolClients } = require("../../../scripts/util/deploy-protocol-clients"); const { expect } = require("chai"); diff --git a/test/protocol/clients/BosonVoucherTest.js b/test/protocol/clients/BosonVoucherTest.js index 5d7439341..cd04771cf 100644 --- a/test/protocol/clients/BosonVoucherTest.js +++ b/test/protocol/clients/BosonVoucherTest.js @@ -1,4 +1,5 @@ const { ethers } = require("hardhat"); +const { ZeroAddress, getSigners, getContractAt, getContractFactory, provider, parseUnits, MaxUint256 } = ethers; const DisputeResolutionTerms = require("../../../scripts/domain/DisputeResolutionTerms"); const { getInterfaceIds } = require("../../../scripts/config/supported-interfaces.js"); @@ -33,7 +34,6 @@ const { } = require("../../util/utils.js"); const { deployMockTokens } = require("../../../scripts/util/deploy-mock-tokens"); const { deployMockContract } = require("@ethereum-waffle/mock-contract"); -const FormatTypes = FormatTypes; describe("IBosonVoucher", function () { let interfaceIds; @@ -148,14 +148,14 @@ describe("IBosonVoucher", function () { await admin.sendTransaction({ to: await bosonVoucher.getAddress(), value: amount }); const balanceAfter = await provider.getBalance(await bosonVoucher.getAddress()); - expect(balanceAfter-balanceBefore).to.eq(amount); + expect(balanceAfter - balanceBefore).to.eq(amount); }); it("Cannot initialize voucher twice", async function () { const initalizableClone = await getContractAt("IInitializableVoucherClone", await bosonVoucher.getAddress()); - await expect(initalizableClone.initializeVoucher(2, await assistant.getAddress(), voucherInitValues)).to.be.revertedWith( - RevertReasons.INITIALIZABLE_ALREADY_INITIALIZED - ); + await expect( + initalizableClone.initializeVoucher(2, await assistant.getAddress(), voucherInitValues) + ).to.be.revertedWith(RevertReasons.INITIALIZABLE_ALREADY_INITIALIZED); }); }); @@ -163,7 +163,7 @@ describe("IBosonVoucher", function () { let buyerStruct; let buyerWallet; - beforeEach(function () { + beforeEach(async function () { buyerStruct = mockBuyer(await buyer.getAddress()).toStruct(); buyerWallet = buyerStruct[1]; }); @@ -179,7 +179,7 @@ describe("IBosonVoucher", function () { const balanceAfter = await bosonVoucher.balanceOf(await buyer.getAddress()); - expect(balanceAfter-balanceBefore).eq(1); + expect(balanceAfter - balanceBefore).eq(1); }); it("should issue a voucher if it does not overlap with range", async function () { @@ -195,13 +195,15 @@ describe("IBosonVoucher", function () { await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); // Token id just below the range - await expect(() => - bosonVoucher.connect(protocol).issueVoucher(tokenId-1, buyerWallet) - ).to.changeTokenBalance(bosonVoucher, buyer, 1); + await expect(() => bosonVoucher.connect(protocol).issueVoucher(tokenId - 1, buyerWallet)).to.changeTokenBalance( + bosonVoucher, + buyer, + 1 + ); // Token id just above the range await expect(() => - bosonVoucher.connect(protocol).issueVoucher(tokenId+length, buyerWallet) + bosonVoucher.connect(protocol).issueVoucher(tokenId + length, buyerWallet) ).to.changeTokenBalance(bosonVoucher, buyer, 1); }); @@ -220,7 +222,7 @@ describe("IBosonVoucher", function () { await bosonVoucher.connect(rando).issueVoucher(0, buyerWallet); const balanceAfter = await bosonVoucher.balanceOf(await buyer.getAddress()); - expect(balanceAfter-balanceBefore).eq(1); + expect(balanceAfter - balanceBefore).eq(1); }); it("issueVoucher should revert if exchange id falls within a pre-minted offer's range", async function () { @@ -297,7 +299,9 @@ describe("IBosonVoucher", function () { it("Should emit event RangeReserved", async function () { // Reserve range, test for event - await expect(bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await bosonVoucher.getAddress())) + await expect( + bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await bosonVoucher.getAddress()) + ) .to.emit(bosonVoucher, "RangeReserved") .withArgs(offerId, range.toStruct()); }); @@ -359,8 +363,8 @@ describe("IBosonVoucher", function () { it("Range length is too large, i.e., would cause an overflow", async function () { // Set such numbers that would cause an overflow - start = MaxUint256/2+2; - length = MaxUint256/2; + start = MaxUint256 / 2n + 2n; + length = MaxUint256 / 2n; // Try to reserve range, it should fail await expect( @@ -427,7 +431,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(ZeroAddress, await assistant.getAddress(), start+i); + .withArgs(ZeroAddress, await assistant.getAddress(), start + i); } }); @@ -437,7 +441,9 @@ describe("IBosonVoucher", function () { start = deriveTokenId(offerId, start); - await expect(tx).to.emit(bosonVoucher, "VouchersPreMinted").withArgs(offerId, start, start+amount-1); + await expect(tx) + .to.emit(bosonVoucher, "VouchersPreMinted") + .withArgs(offerId, start, start + amount - 1); }); context("Owner range is contract", async function () { @@ -467,7 +473,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(ZeroAddress, await bosonVoucher.getAddress(), start+i); + .withArgs(ZeroAddress, await bosonVoucher.getAddress(), start + i); } }); @@ -480,19 +486,17 @@ describe("IBosonVoucher", function () { // Expect a correct owner for all preminted tokens start = deriveTokenId(offerId, start); for (let i = 0; i < Number(amount); i++) { - let tokenId = start+i; + let tokenId = start + i; let tokenOwner = await bosonVoucher.ownerOf(tokenId); assert.equal(tokenOwner, await bosonVoucher.getAddress(), `Wrong token owner for token ${tokenId}`); } // Token that is inside a range, but wasn't preminted yet should not have an owner - await expect(bosonVoucher.ownerOf(start+amount+1)).to.be.revertedWith( - RevertReasons.ERC721_NON_EXISTENT - ); + await expect(bosonVoucher.ownerOf(start + amount + 1)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); // Contract's balance should be updated for the total mint amount let contractBalanceAfter = await bosonVoucher.balanceOf(await bosonVoucher.getAddress()); - assert.equal(contractBalanceAfter.toNumber(), contractBalanceBefore+amount.toNumber(), "Balance mismatch"); + assert.equal(contractBalanceAfter.toNumber(), contractBalanceBefore + amount.toNumber(), "Balance mismatch"); // Get available premints from contract const availablePremints = await bosonVoucher.getAvailablePreMints(offerId); @@ -509,19 +513,17 @@ describe("IBosonVoucher", function () { // Expect a correct owner for all preminted tokens start = deriveTokenId(offerId, start); for (let i = 0; i < Number(amount); i++) { - let tokenId = start+i; + let tokenId = start + i; let tokenOwner = await bosonVoucher.ownerOf(tokenId); assert.equal(tokenOwner, await assistant.getAddress(), `Wrong token owner for token ${tokenId}`); } // Token that is inside a range, but wasn't preminted yet should not have an owner - await expect(bosonVoucher.ownerOf(start+amount+1)).to.be.revertedWith( - RevertReasons.ERC721_NON_EXISTENT - ); + await expect(bosonVoucher.ownerOf(start + amount + 1)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); // Seller's balance should be updated for the total mint amount let sellerBalanceAfter = await bosonVoucher.balanceOf(await assistant.getAddress()); - assert.equal(sellerBalanceAfter.toNumber(), sellerBalanceBefore+amount.toNumber(), "Balance mismatch"); + assert.equal(sellerBalanceAfter.toNumber(), sellerBalanceBefore + amount.toNumber(), "Balance mismatch"); // Get available premints from contract const availablePremints = await bosonVoucher.getAvailablePreMints(offerId); @@ -567,7 +569,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(ZeroAddress, await assistant.getAddress(), start+i); + .withArgs(ZeroAddress, await assistant.getAddress(), start + i); } }); @@ -615,7 +617,7 @@ describe("IBosonVoucher", function () { it("Offer already expired", async function () { // Skip to after offer expiration - await setNextBlockTimestamp(BigInt(offerDates.validUntil)+1.toHexString()); + await setNextBlockTimestamp((BigInt(offerDates.validUntil) + 1n).toString()); // Try to premint, it should fail await expect(bosonVoucher.connect(assistant).preMint(offerId, amount)).to.be.revertedWith( @@ -689,7 +691,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(await assistant.getAddress(), ZeroAddress, start+i); + .withArgs(await assistant.getAddress(), ZeroAddress, start + i); } }); @@ -702,13 +704,13 @@ describe("IBosonVoucher", function () { // All burned tokens should not have an owner const startId = deriveTokenId(offerId, start); for (let i = 0; i < Number(amount); i++) { - let tokenId = startId+i; + let tokenId = startId + i; await expect(bosonVoucher.ownerOf(tokenId)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); } // Seller's balance should be decreased for the total burn amount let sellerBalanceAfter = await bosonVoucher.balanceOf(await assistant.getAddress()); - assert.equal(sellerBalanceAfter.toNumber(), sellerBalanceBefore-amount.toNumber(), "Balance mismatch"); + assert.equal(sellerBalanceAfter.toNumber(), sellerBalanceBefore - amount.toNumber(), "Balance mismatch"); // Get available premints from contract const availablePremints = await bosonVoucher.getAvailablePreMints(offerId); @@ -716,8 +718,14 @@ describe("IBosonVoucher", function () { // Last burned id should be updated const tokenIdStart = deriveTokenId(offerId, start); - const lastBurnedId = tokenIdStart+amount - 1; - const range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), await assistant.getAddress()); + const lastBurnedId = tokenIdStart + amount - 1; + const range = new Range( + tokenIdStart.toString(), + length, + amount, + lastBurnedId.toString(), + await assistant.getAddress() + ); const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); }); @@ -732,7 +740,7 @@ describe("IBosonVoucher", function () { await expect(() => { tx = bosonVoucher.connect(rando).burnPremintedVouchers(offerId); return tx; - }).to.changeTokenBalance(bosonVoucher, assistant, Number(amount) * -1); + }).to.changeTokenBalance(bosonVoucher, assistant, Number(amount) * -1n); // Number of events emitted should be equal to amount tx = await tx; @@ -743,7 +751,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(await assistant.getAddress(), ZeroAddress, tokenIdStart+i); + .withArgs(await assistant.getAddress(), ZeroAddress, tokenIdStart + i); } }); @@ -774,7 +782,7 @@ describe("IBosonVoucher", function () { await expect(() => { tx = bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); return tx; - }).to.changeTokenBalance(bosonVoucher, bosonVoucher, Number(amount) * -1); + }).to.changeTokenBalance(bosonVoucher, bosonVoucher, Number(amount) * -1n); // Number of events emitted should be equal to amount tx = await tx; @@ -785,7 +793,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(await bosonVoucher.getAddress(), ZeroAddress, tokenIdStart+i); + .withArgs(await bosonVoucher.getAddress(), ZeroAddress, tokenIdStart + i); } }); }); @@ -799,8 +807,14 @@ describe("IBosonVoucher", function () { // Last burned id should be updated const tokenIdStart = deriveTokenId(offerId, start); - const lastBurnedId = tokenIdStart+amount - 1; - const range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), await assistant.getAddress()); + const lastBurnedId = tokenIdStart + amount - 1; + const range = new Range( + tokenIdStart.toString(), + length, + amount, + lastBurnedId.toString(), + await assistant.getAddress() + ); const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); @@ -835,8 +849,14 @@ describe("IBosonVoucher", function () { // Last burned id should be updated const tokenIdStart = deriveTokenId(offerId, start); - let lastBurnedId = tokenIdStart+maxPremintedVouchers - 1; - let range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), await assistant.getAddress()); + let lastBurnedId = tokenIdStart + maxPremintedVouchers - 1; + let range = new Range( + tokenIdStart.toString(), + length, + amount, + lastBurnedId.toString(), + await assistant.getAddress() + ); let returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); @@ -851,14 +871,14 @@ describe("IBosonVoucher", function () { ); // Last burned id should be updated - lastBurnedId = tokenIdStart+amount - 1; + lastBurnedId = tokenIdStart + amount - 1; range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), await assistant.getAddress()); returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); // All burned tokens should not have an owner for (let i = 0; i < Number(amount); i++) { - let tokenId = tokenIdStart+i; + let tokenId = tokenIdStart + i; await expect(bosonVoucher.ownerOf(tokenId)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); } @@ -872,11 +892,11 @@ describe("IBosonVoucher", function () { let committedVouchers = [11, 14].map((tokenId) => deriveTokenId(offerId, tokenId).toString()); // Transfer some preminted vouchers + const assistant = await assistant.getAddress(); + const buyer = await buyer.getAddress(); await mockProtocol.mock.commitToPreMintedOffer.returns(); await Promise.all( - committedVouchers.map((tokenId) => - bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId) - ) + committedVouchers.map((tokenId) => bosonVoucher.connect(assistant).transferFrom(assistant, buyer, tokenId)) ); // Burn tokens, test for event @@ -893,7 +913,7 @@ describe("IBosonVoucher", function () { // All burned tokens should not have an owner, but commited ones should const startId = deriveTokenId(offerId, start); for (let i = 0; i < Number(amount); i++) { - let tokenId = startId+i.toString(); + let tokenId = startId + i.toString(); if (committedVouchers.includes(tokenId)) { // Check that owner is buyer. expect(await bosonVoucher.ownerOf(tokenId)).to.equal(await buyer.getAddress()); @@ -908,8 +928,14 @@ describe("IBosonVoucher", function () { // Last burned id should be updated const tokenIdStart = deriveTokenId(offerId, start); - const lastBurnedId = tokenIdStart+amount - 1; - const range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), await assistant.getAddress()); + const lastBurnedId = tokenIdStart + amount - 1; + const range = new Range( + tokenIdStart.toString(), + length, + amount, + lastBurnedId.toString(), + await assistant.getAddress() + ); const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); }); @@ -921,7 +947,7 @@ describe("IBosonVoucher", function () { .withArgs(offerId) .returns(true, offer, offerDates, offerDurations, disputeResolutionTerms, offerFees); // skip to after offer expiration - await setNextBlockTimestamp(BigInt(offerDates.validUntil)+1.toHexString()); + await setNextBlockTimestamp((BigInt(offerDates.validUntil) + 1n).toString()); // Burn tokens, test for event const tx = await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); @@ -934,7 +960,7 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(await assistant.getAddress(), ZeroAddress, start+i); + .withArgs(await assistant.getAddress(), ZeroAddress, start + i); } }); @@ -1072,7 +1098,7 @@ describe("IBosonVoucher", function () { it("Should be 0 if offer is expired", async function () { // Skip to after offer expiry - await setNextBlockTimestamp(BigInt(offerDates.validUntil)+1.toHexString()); + await setNextBlockTimestamp((BigInt(offerDates.validUntil) + 1n).toString()); // Get available premints from contract let availablePremints = await bosonVoucher.getAvailablePreMints(offerId); @@ -1207,7 +1233,9 @@ describe("IBosonVoucher", function () { await mockProtocol.mock.commitToPreMintedOffer.returns(); // Transfer preminted token - await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); + await bosonVoucher + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); // Token owner should be the buyer let tokenOwner = await bosonVoucher.ownerOf(tokenId); @@ -1217,8 +1245,8 @@ describe("IBosonVoucher", function () { it("Returns seller if token is preminted and not transferred yet", async function () { // Token owner should be the seller for all preminted tokens let startTokenId = deriveTokenId(offerId, start); - let endTokenId = startTokenId+amount; - for (let i = startTokenId; i.lt(endTokenId); i = i+1) { + let endTokenId = startTokenId + amount; + for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { let tokenOwner = await bosonVoucher.ownerOf(i); assert.equal(tokenOwner, await assistant.getAddress(), `Token owner mismatch ${i.toString()}`); } @@ -1300,15 +1328,17 @@ describe("IBosonVoucher", function () { let nextAmount = "5"; // reserve length - await bosonVoucher.connect(protocol).reserveRange(nextOfferId, nextStartId, nextLength, await assistant.getAddress()); + await bosonVoucher + .connect(protocol) + .reserveRange(nextOfferId, nextStartId, nextLength, await assistant.getAddress()); // amount to premint await bosonVoucher.connect(assistant).preMint(nextOfferId, nextAmount); // First range - preminted tokens let startTokenId = deriveTokenId(offerId, start); - let endTokenId = startTokenId+amount; - for (let i = startTokenId; i.lt(endTokenId); i = i+1) { + let endTokenId = startTokenId + amount; + for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { let tokenOwner = await bosonVoucher.ownerOf(i); assert.equal(tokenOwner, await assistant.getAddress(), `Token owner mismatch ${i.toString()}`); } @@ -1317,14 +1347,14 @@ describe("IBosonVoucher", function () { startTokenId = endTokenId; let endExchangeId = Number(start) + Number(length); endTokenId = deriveTokenId(offerId, endExchangeId); - for (let i = startTokenId; i.lt(endTokenId); i = i+1) { + for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { await expect(bosonVoucher.connect(rando).ownerOf(i)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); } // Second range - preminted tokens startTokenId = deriveTokenId(nextOfferId, endExchangeId); - endTokenId = startTokenId+nextAmount; - for (let i = startTokenId; i.lt(endTokenId); i = i+1) { + endTokenId = startTokenId + nextAmount; + for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { let tokenOwner = await bosonVoucher.ownerOf(i); assert.equal(tokenOwner, await assistant.getAddress(), `Token owner mismatch ${i.toString()}`); } @@ -1333,7 +1363,7 @@ describe("IBosonVoucher", function () { startTokenId = endTokenId; endExchangeId += Number(nextLength); endTokenId = deriveTokenId(nextOfferId, endExchangeId); - for (let i = startTokenId; i.lt(endTokenId); i = i+1) { + for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { await expect(bosonVoucher.connect(rando).ownerOf(i)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); } }); @@ -1351,7 +1381,7 @@ describe("IBosonVoucher", function () { let endTokenId = deriveTokenId(offerId, Number(start) + Number(length)); // None of reserved but not preminted tokens should have an owner - for (let i = startTokenId; i.lt(endTokenId); i = i+1) { + for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { await expect(bosonVoucher.connect(rando).ownerOf(i)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); } }); @@ -1371,7 +1401,9 @@ describe("IBosonVoucher", function () { assert.equal(tokenOwner, await assistant.getAddress(), "Token owner mismatch"); // Transfer preminted token - await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); + await bosonVoucher + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); // Token owner should be the buyer tokenOwner = await bosonVoucher.ownerOf(tokenId); @@ -1439,7 +1471,12 @@ describe("IBosonVoucher", function () { }; beforeEach(async function () { - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + clerk.address, + await treasury.getAddress() + ); // Prepare the AuthToken and VoucherInitValues emptyAuthToken = mockAuthToken(); @@ -1452,7 +1489,7 @@ describe("IBosonVoucher", function () { disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -1486,12 +1523,12 @@ describe("IBosonVoucher", function () { disputeResolverId, agentId ); - await fundsHandler - .connect(admin) - .depositFunds(seller.id, ZeroAddress, offer.sellerDeposit, { - value: offer.sellerDeposit, - }); - await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offer.id, { value: offer.price }); + await fundsHandler.connect(admin).depositFunds(seller.id, ZeroAddress, offer.sellerDeposit, { + value: offer.sellerDeposit, + }); + await exchangeHandler + .connect(buyer) + .commitToOffer(await buyer.getAddress(), offer.id, { value: offer.price }); exchangeId = offerId = "1"; tokenId = deriveTokenId(offerId, exchangeId); @@ -1504,7 +1541,9 @@ describe("IBosonVoucher", function () { it("Should emit a Transfer event", async function () { await expect( - bosonVoucher.connect(buyer)[selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + bosonVoucher + .connect(buyer) + [selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ) .to.emit(bosonVoucher, "Transfer") .withArgs(await buyer.getAddress(), await rando.getAddress(), tokenId); @@ -1515,7 +1554,9 @@ describe("IBosonVoucher", function () { let tokenOwner = await bosonVoucher.ownerOf(tokenId); assert.equal(tokenOwner, await buyer.getAddress(), "Buyer is not the owner"); - await bosonVoucher.connect(buyer)[selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); + await bosonVoucher + .connect(buyer) + [selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); // After transfer, rando should be the owner tokenOwner = await bosonVoucher.ownerOf(tokenId); @@ -1525,7 +1566,9 @@ describe("IBosonVoucher", function () { it("Should call onVoucherTransferred", async function () { const randoBuyer = mockBuyer(); await expect( - bosonVoucher.connect(buyer)[selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + bosonVoucher + .connect(buyer) + [selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ) .to.emit(exchangeHandler, "VoucherTransferred") .withArgs(offerId, exchangeId, randoBuyer.id, await bosonVoucher.getAddress()); @@ -1536,7 +1579,9 @@ describe("IBosonVoucher", function () { await bosonVoucher.connect(buyer).setApprovalForAll(await rando2.getAddress(), true); await expect( - bosonVoucher.connect(rando2)[selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + bosonVoucher + .connect(rando2) + [selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ) .to.emit(bosonVoucher, "Transfer") .withArgs(await buyer.getAddress(), await rando.getAddress(), tokenId); @@ -1544,13 +1589,17 @@ describe("IBosonVoucher", function () { it("If seller is the true owner of voucher, transfer should work same as for others", async function () { mockBuyer(); // Call to properly update nextAccountId - await bosonVoucher.connect(buyer)[selector](await buyer.getAddress(), await assistant.getAddress(), tokenId, ...additionalArgs); + await bosonVoucher + .connect(buyer) + [selector](await buyer.getAddress(), await assistant.getAddress(), tokenId, ...additionalArgs); const tx = await bosonVoucher .connect(assistant) [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); - await expect(tx).to.emit(bosonVoucher, "Transfer").withArgs(await assistant.getAddress(), await rando.getAddress(), tokenId); + await expect(tx) + .to.emit(bosonVoucher, "Transfer") + .withArgs(await assistant.getAddress(), await rando.getAddress(), tokenId); const randoBuyer = mockBuyer(); @@ -1562,7 +1611,9 @@ describe("IBosonVoucher", function () { context("💔 Revert Reasons", async function () { it("From does not own the voucher", async function () { await expect( - bosonVoucher.connect(rando)[selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + bosonVoucher + .connect(rando) + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ).to.be.revertedWith(RevertReasons.ERC721_CALLER_NOT_OWNER_OR_APPROVED); }); }); @@ -1585,9 +1636,11 @@ describe("IBosonVoucher", function () { ); // Reserve range to assistant - await offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, await assistant.getAddress()); + await offerHandler + .connect(assistant) + .reserveRange(offer.id, offer.quantityAvailable, await assistant.getAddress()); // Pool needs to cover both seller deposit and price - const pool = BigInt(offer.sellerDeposit)+offer.price; + const pool = BigInt(offer.sellerDeposit) + offer.price; await fundsHandler.connect(admin).depositFunds(seller.id, ZeroAddress, pool, { value: pool, }); @@ -1609,7 +1662,9 @@ describe("IBosonVoucher", function () { it("Should emit a Transfer event", async function () { await expect( - bosonVoucher.connect(assistant)[selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + bosonVoucher + .connect(assistant) + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ) .to.emit(bosonVoucher, "Transfer") .withArgs(await assistant.getAddress(), await rando.getAddress(), tokenId); @@ -1688,7 +1743,9 @@ describe("IBosonVoucher", function () { await bosonVoucher.connect(assistant).setApprovalForAll(await rando2.getAddress(), true); await expect( - bosonVoucher.connect(rando2)[selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + bosonVoucher + .connect(rando2) + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ) .to.emit(bosonVoucher, "Transfer") .withArgs(await assistant.getAddress(), await rando.getAddress(), tokenId); @@ -1703,7 +1760,9 @@ describe("IBosonVoucher", function () { // Second transfer should fail, since voucher has an owner await expect( - bosonVoucher.connect(assistant)[selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + bosonVoucher + .connect(assistant) + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ).to.be.revertedWith(RevertReasons.ERC721_CALLER_NOT_OWNER_OR_APPROVED); }); @@ -1713,12 +1772,14 @@ describe("IBosonVoucher", function () { [selector](await assistant.getAddress(), await buyer.getAddress(), tokenId, ...additionalArgs); // Redeem voucher, effectively burning it - await setNextBlockTimestamp(BigInt(voucherRedeemableFrom).toHexString()); + await setNextBlockTimestamp(BigInt(voucherRedeemableFrom).toString()); await exchangeHandler.connect(buyer).redeemVoucher(exchangeId); // Transfer should fail, since voucher has been burned await expect( - bosonVoucher.connect(assistant)[selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + bosonVoucher + .connect(assistant) + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); }); @@ -1731,7 +1792,9 @@ describe("IBosonVoucher", function () { // None of reserved but not preminted tokens should have an owner await expect( - bosonVoucher.connect(assistant)[selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + bosonVoucher + .connect(assistant) + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); }); @@ -1741,17 +1804,21 @@ describe("IBosonVoucher", function () { // Transfer should fail, since protocol reverts await expect( - bosonVoucher.connect(assistant)[selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + bosonVoucher + .connect(assistant) + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ).to.be.revertedWith(RevertReasons.OFFER_HAS_BEEN_VOIDED); }); it("Transfer preminted voucher, where offer has expired", async function () { // Skip past offer expiry - await setNextBlockTimestamp(BigInt(offerValid).toHexString()); + await setNextBlockTimestamp(BigInt(offerValid).toString()); // Transfer should fail, since protocol reverts await expect( - bosonVoucher.connect(assistant)[selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + bosonVoucher + .connect(assistant) + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ).to.be.revertedWith(RevertReasons.OFFER_HAS_EXPIRED); }); @@ -1761,13 +1828,15 @@ describe("IBosonVoucher", function () { [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); // next token id. Make sure that assistant is the owner - tokenId = tokenId+1; + tokenId = tokenId + 1; let tokenOwner = await bosonVoucher.ownerOf(tokenId.toString()); assert.equal(tokenOwner, await assistant.getAddress(), "Seller is not the owner"); // Following call should fail, since rando is not the owner of preminted voucher await expect( - bosonVoucher.connect(rando)[selector](await rando.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + bosonVoucher + .connect(rando) + [selector](await rando.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) ).to.be.revertedWith(RevertReasons.NO_SILENT_MINT_ALLOWED); }); }); @@ -1794,10 +1863,12 @@ describe("IBosonVoucher", function () { bosonVoucher = await getContractAt("BosonVoucher", voucherAddress); // Reserve range to contract - await offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, await bosonVoucher.getAddress()); + await offerHandler + .connect(assistant) + .reserveRange(offer.id, offer.quantityAvailable, await bosonVoucher.getAddress()); // Pool needs to cover both seller deposit and price - const pool = BigInt(offer.sellerDeposit)+offer.price; + const pool = BigInt(offer.sellerDeposit) + offer.price; await fundsHandler.connect(admin).depositFunds(seller.id, ZeroAddress, pool, { value: pool, }); @@ -1818,7 +1889,9 @@ describe("IBosonVoucher", function () { .connect(rando2) [selector](await bosonVoucher.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); - await expect(tx).to.emit(bosonVoucher, "Transfer").withArgs(await bosonVoucher.getAddress(), await rando.getAddress(), tokenId); + await expect(tx) + .to.emit(bosonVoucher, "Transfer") + .withArgs(await bosonVoucher.getAddress(), await rando.getAddress(), tokenId); }); }); }); @@ -1842,7 +1915,7 @@ describe("IBosonVoucher", function () { const balanceAfter = await bosonVoucher.balanceOf(await buyer.getAddress()); - expect(balanceBefore-balanceAfter).eq(1); + expect(balanceBefore - balanceAfter).eq(1); }); it("should revert if caller does not have PROTOCOL role", async function () { @@ -1862,7 +1935,7 @@ describe("IBosonVoucher", function () { await bosonVoucher.connect(protocol).burnVoucher(0); const balanceAfter = await bosonVoucher.balanceOf(await buyer.getAddress()); - expect(balanceBefore-balanceAfter).eq(1); + expect(balanceBefore - balanceAfter).eq(1); }); }); @@ -1871,7 +1944,12 @@ describe("IBosonVoucher", function () { let bosonVoucher; beforeEach(async function () { - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + clerk.address, + await treasury.getAddress() + ); // prepare the VoucherInitValues voucherInitValues = mockVoucherInitValues(); @@ -1889,7 +1967,7 @@ describe("IBosonVoucher", function () { disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -1914,7 +1992,7 @@ describe("IBosonVoucher", function () { .connect(assistant) .createOffer(offer.toStruct(), offerDates.toStruct(), offerDurations.toStruct(), disputeResolverId, agentId); - const pool = BigInt(offer.sellerDeposit)+offer.price; + const pool = BigInt(offer.sellerDeposit) + offer.price; await fundsHandler.connect(admin).depositFunds(seller.id, ZeroAddress, pool, { value: pool }); @@ -1931,7 +2009,8 @@ describe("IBosonVoucher", function () { }); it("should return the correct tokenURI", async function () { - await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: offerPrice }); + const buyer = await buyer.getAddress(); + await exchangeHandler.connect(buyer).commitToOffer(buyer, offerId, { value: offerPrice }); const tokenId = deriveTokenId(offerId, 1); const tokenURI = await bosonVoucher.tokenURI(tokenId); expect(tokenURI).eq(metadataUri); @@ -1962,7 +2041,9 @@ describe("IBosonVoucher", function () { }); it("should return correct tokenURI when token is preminted and transferred", async function () { - await bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); + await bosonVoucher + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); const tokenURI = await bosonVoucher.tokenURI(tokenId); expect(tokenURI).eq(metadataUri); @@ -2060,7 +2141,12 @@ describe("IBosonVoucher", function () { context("EIP2981 NFT Royalty fee", function () { beforeEach(async function () { - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + clerk.address, + await treasury.getAddress() + ); // prepare the VoucherInitValues voucherInitValues = mockVoucherInitValues(); @@ -2079,7 +2165,7 @@ describe("IBosonVoucher", function () { disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -2257,7 +2343,7 @@ describe("IBosonVoucher", function () { // Receiver and amount should be 0 assert.equal(receiver, ZeroAddress, "Recipient address is incorrect"); - assert.equal(royaltyAmount.toNumber(), 0, "Royalty amount is incorrect"); + assert.equal(royaltyAmount, 0n, "Royalty amount is incorrect"); }); }); @@ -2289,7 +2375,12 @@ describe("IBosonVoucher", function () { emptyAuthToken = mockAuthToken(); expect(emptyAuthToken.isValid()).is.true; - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + clerk.address, + await treasury.getAddress() + ); await accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues); @@ -2314,14 +2405,16 @@ describe("IBosonVoucher", function () { // Deploy a random contract const MockSimpleContract = await getContractFactory("MockSimpleContract"); mockSimpleContract = await MockSimpleContract.deploy(); - await mockSimpleContract.deployed(); + await mockSimpleContract.waitForDeployment(); // Generate calldata calldata = mockSimpleContract.interface.encodeFunctionData("testEvent"); }); it("Should call external contract and emit its events", async function () { - const tx = await bosonVoucher.connect(assistant).callExternalContract(await mockSimpleContract.getAddress(), calldata); + const tx = await bosonVoucher + .connect(assistant) + .callExternalContract(await mockSimpleContract.getAddress(), calldata); const receipt = await tx.wait(); const event = getEvent(receipt, mockSimpleContract, "TestEvent"); @@ -2331,9 +2424,9 @@ describe("IBosonVoucher", function () { context("💔 Revert Reasons", async function () { it("_to is the zero address", async function () { - await expect( - bosonVoucher.connect(assistant).callExternalContract(ZeroAddress, calldata) - ).to.be.revertedWith(RevertReasons.INVALID_ADDRESS); + await expect(bosonVoucher.connect(assistant).callExternalContract(ZeroAddress, calldata)).to.be.revertedWith( + RevertReasons.INVALID_ADDRESS + ); }); it("Caller is not the contract owner", async function () { @@ -2351,7 +2444,9 @@ describe("IBosonVoucher", function () { }); it("To address is not a contract", async function () { - await expect(bosonVoucher.connect(assistant).callExternalContract(await rando.getAddress(), calldata)).to.be.reverted; + await expect( + bosonVoucher.connect(assistant).callExternalContract(await rando.getAddress(), calldata) + ).to.be.reverted; }); it("Owner tries to invoke method to transfer funds", async function () { @@ -2359,36 +2454,44 @@ describe("IBosonVoucher", function () { // transfer calldata = erc20.interface.encodeFunctionData("transfer", [await assistant.getAddress(), 20]); - await expect(bosonVoucher.connect(assistant).callExternalContract(await rando.getAddress(), calldata)).to.be.revertedWith( - RevertReasons.FUNCTION_NOT_ALLOWLISTED - ); + await expect( + bosonVoucher.connect(assistant).callExternalContract(await rando.getAddress(), calldata) + ).to.be.revertedWith(RevertReasons.FUNCTION_NOT_ALLOWLISTED); // transferFrom - calldata = erc20.interface.encodeFunctionData("transferFrom", [await bosonVoucher.getAddress(), await assistant.getAddress(), 20]); - await expect(bosonVoucher.connect(assistant).callExternalContract(await rando.getAddress(), calldata)).to.be.revertedWith( - RevertReasons.FUNCTION_NOT_ALLOWLISTED - ); + calldata = erc20.interface.encodeFunctionData("transferFrom", [ + await bosonVoucher.getAddress(), + await assistant.getAddress(), + 20, + ]); + await expect( + bosonVoucher.connect(assistant).callExternalContract(await rando.getAddress(), calldata) + ).to.be.revertedWith(RevertReasons.FUNCTION_NOT_ALLOWLISTED); // approve calldata = erc20.interface.encodeFunctionData("approve", [await assistant.getAddress(), 20]); - await expect(bosonVoucher.connect(assistant).callExternalContract(await rando.getAddress(), calldata)).to.be.revertedWith( - RevertReasons.FUNCTION_NOT_ALLOWLISTED - ); + await expect( + bosonVoucher.connect(assistant).callExternalContract(await rando.getAddress(), calldata) + ).to.be.revertedWith(RevertReasons.FUNCTION_NOT_ALLOWLISTED); // DAI const dai = await getContractAt("DAIAliases", ZeroAddress); // push calldata = dai.interface.encodeFunctionData("push", [await assistant.getAddress(), 20]); - await expect(bosonVoucher.connect(assistant).callExternalContract(await rando.getAddress(), calldata)).to.be.revertedWith( - RevertReasons.FUNCTION_NOT_ALLOWLISTED - ); + await expect( + bosonVoucher.connect(assistant).callExternalContract(await rando.getAddress(), calldata) + ).to.be.revertedWith(RevertReasons.FUNCTION_NOT_ALLOWLISTED); // move - calldata = dai.interface.encodeFunctionData("move", [await bosonVoucher.getAddress(), await assistant.getAddress(), 20]); - await expect(bosonVoucher.connect(assistant).callExternalContract(await rando.getAddress(), calldata)).to.be.revertedWith( - RevertReasons.FUNCTION_NOT_ALLOWLISTED - ); + calldata = dai.interface.encodeFunctionData("move", [ + await bosonVoucher.getAddress(), + await assistant.getAddress(), + 20, + ]); + await expect( + bosonVoucher.connect(assistant).callExternalContract(await rando.getAddress(), calldata) + ).to.be.revertedWith(RevertReasons.FUNCTION_NOT_ALLOWLISTED); }); }); }); @@ -2403,23 +2506,28 @@ describe("IBosonVoucher", function () { context("💔 Revert Reasons", async function () { it("should revert if caller is not the owner", async function () { // Expect revert if random user attempts to set approval - await expect(bosonVoucher.connect(rando).setApprovalForAllToContract(await rando.getAddress(), true)).to.revertedWith( - RevertReasons.OWNABLE_NOT_OWNER - ); + await expect( + bosonVoucher.connect(rando).setApprovalForAllToContract(await rando.getAddress(), true) + ).to.revertedWith(RevertReasons.OWNABLE_NOT_OWNER); }); it("should revert if operator is zero address", async function () { // Expect revert if random user attempts to set approval - await expect( - bosonVoucher.connect(assistant).setApprovalForAllToContract(ZeroAddress, true) - ).to.revertedWith(RevertReasons.INVALID_ADDRESS); + await expect(bosonVoucher.connect(assistant).setApprovalForAllToContract(ZeroAddress, true)).to.revertedWith( + RevertReasons.INVALID_ADDRESS + ); }); }); }); context("withdrawToProtocol", function () { beforeEach(async function () { - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + clerk.address, + await treasury.getAddress() + ); // Prepare the AuthToken and VoucherInitValues emptyAuthToken = mockAuthToken(); @@ -2441,9 +2549,10 @@ describe("IBosonVoucher", function () { const amount = parseUnits("1", "ether"); await admin.sendTransaction({ to: await bosonVoucher.getAddress(), value: amount }); - await expect(() => - bosonVoucher.connect(rando).withdrawToProtocol([ZeroAddress]) - ).to.changeEtherBalances([bosonVoucher, fundsHandler], [amount*-1, amount]); + await expect(() => bosonVoucher.connect(rando).withdrawToProtocol([ZeroAddress])).to.changeEtherBalances( + [bosonVoucher, fundsHandler], + [amount * -1n, amount] + ); }); it("Can withdraw ERC20", async function () { @@ -2456,10 +2565,11 @@ describe("IBosonVoucher", function () { await foreign20.connect(deployer).mint(await deployer.getAddress(), amount); await foreign20.connect(deployer).transfer(await bosonVoucher.getAddress(), amount); - await expect(() => bosonVoucher.connect(rando).withdrawToProtocol([await foreign20.getAddress()])).to.changeTokenBalances( + const foreign20Address = await foreign20.getAddress(); + await expect(() => bosonVoucher.connect(rando).withdrawToProtocol([foreign20Address])).to.changeTokenBalances( foreign20, [bosonVoucher, fundsHandler], - [amount*-1, amount] + [amount * -1n, amount] ); // Seller's available balance should increase @@ -2479,18 +2589,19 @@ describe("IBosonVoucher", function () { await foreign20.connect(deployer).mint(await deployer.getAddress(), amount); await foreign20.connect(deployer).transfer(await bosonVoucher.getAddress(), amount); + const foreign20Address = await foreign20.getAddress(); let tx; await expect(() => { - tx = bosonVoucher.connect(rando).withdrawToProtocol([ZeroAddress, await foreign20.getAddress()]); + tx = bosonVoucher.connect(rando).withdrawToProtocol([ZeroAddress, foreign20Address]); return tx; - }).to.changeTokenBalances(foreign20, [bosonVoucher, fundsHandler], [amount*-1, amount]); - await expect(() => tx).to.changeEtherBalances([bosonVoucher, fundsHandler], [amount*-1, amount]); + }).to.changeTokenBalances(foreign20, [bosonVoucher, fundsHandler], [amount * -1n, amount]); + await expect(() => tx).to.changeEtherBalances([bosonVoucher, fundsHandler], [amount * -1n, amount]); }); }); context("onERC721Received", function () { it("Should return correct selector value", async function () { - const expectedSelector = bosonVoucher.interface.getSighash("onERC721Received(address,address,uint256,bytes)"); + const expectedSelector = bosonVoucher.interface.fragments.find((f) => f.name == "onERC721Received").selector; const returnedSelector = await bosonVoucher.callStatic.onERC721Received( await assistant.getAddress(), await rando.getAddress(), @@ -2502,13 +2613,10 @@ describe("IBosonVoucher", function () { }); async function deployMockProtocol() { - const exchangeHandlerABI = exchangeHandler.interface.format(FormatTypes.json); - const configHandlerABI = configHandler.interface.format(FormatTypes.json); - const offerHandlerABI = offerHandler.interface.format(FormatTypes.json); const mockProtocol = await deployMockContract(deployer, [ - ...JSON.parse(exchangeHandlerABI), - ...JSON.parse(configHandlerABI), - ...JSON.parse(offerHandlerABI), + ...exchangeHandler.interface.fragments, + ...offerHandler.interface.fragments, + ...configHandler.interface.fragments, ]); //deploys mock // Update protocol address on beacon From 9ddbf8a2f04ee23e642bae9ae43c3c360c303f07 Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Thu, 22 Jun 2023 21:01:27 -0300 Subject: [PATCH 15/32] Fixing FundsHandlerTest --- scripts/domain/Funds.js | 2 +- test/protocol/FundsHandlerTest.js | 59 ++++++++++++++++++------------- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/scripts/domain/Funds.js b/scripts/domain/Funds.js index 702abce69..2e3fffad3 100644 --- a/scripts/domain/Funds.js +++ b/scripts/domain/Funds.js @@ -17,7 +17,7 @@ class Funds { constructor(tokenAddress, tokenName, availableAmount) { this.tokenAddress = tokenAddress; this.tokenName = tokenName; - this.availableAmount = availableAmount; + this.availableAmount = availableAmount.toString(); } /** diff --git a/test/protocol/FundsHandlerTest.js b/test/protocol/FundsHandlerTest.js index b2f29704e..b92507770 100644 --- a/test/protocol/FundsHandlerTest.js +++ b/test/protocol/FundsHandlerTest.js @@ -232,7 +232,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds let expectedAvailableFunds = new FundsList([ - new Funds(await mockToken.getAddress(), "Foreign20", depositAmount), + new Funds(await mockToken.getAddress(), "Foreign20", depositAmount.toString()), ]); expect(returnedAvailableFunds).to.eql(expectedAvailableFunds); @@ -243,7 +243,7 @@ describe("IBosonFundsHandler", function () { returnedAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); // Chain state should match the expected available funds - expectedAvailableFunds.funds.push(new Funds(ZeroAddress, "Native currency", depositAmount)); + expectedAvailableFunds.funds.push(new Funds(ZeroAddress, "Native currency", depositAmount.toString())); expect(returnedAvailableFunds).to.eql(expectedAvailableFunds); }); @@ -256,7 +256,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds let expectedAvailableFunds = new FundsList([ - new Funds(await mockToken.getAddress(), "Foreign20", depositAmount), + new Funds(await mockToken.getAddress(), "Foreign20", depositAmount.toString()), ]); expect(returnedAvailableFunds).to.eql(expectedAvailableFunds); @@ -268,7 +268,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedAvailableFunds = new FundsList([ - new Funds(await mockToken.getAddress(), "Foreign20", 3n * depositAmount), + new Funds(await mockToken.getAddress(), "Foreign20", (3n * depositAmount).toString()), ]); expect(returnedAvailableFunds).to.eql(expectedAvailableFunds); }); @@ -1465,7 +1465,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds let expectedAvailableFunds = new FundsList([ - new Funds(await mockToken.getAddress(), "Token name unspecified", depositAmount), + new Funds(await mockToken.getAddress(), "Token name unspecified", depositAmount.toString()), ]); expect(returnedAvailableFunds).to.eql(expectedAvailableFunds); }); @@ -2116,7 +2116,11 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // seller: sellerDeposit + price - protocolFee - sellerPayoff = (BigInt(offerToken.sellerDeposit) + offerToken.price - offerTokenProtocolFee).toString(); + sellerPayoff = ( + BigInt(offerToken.sellerDeposit) + + BigInt(offerToken.price) - + BigInt(offerTokenProtocolFee) + ).toString(); // protocol: protocolFee protocolPayoff = offerTokenProtocolFee; @@ -2189,12 +2193,12 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[1] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerPayoff) * 2n.toString() + BigInt(sellerPayoff) * 2n ); expectedProtocolAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(protocolPayoff) * 2n.toString() + BigInt(protocolPayoff) * 2n ); expect(sellersAvailableFunds).to.eql(expectedSellerAvailableFunds); expect(buyerAvailableFunds).to.eql(expectedBuyerAvailableFunds); @@ -2225,8 +2229,12 @@ describe("IBosonFundsHandler", function () { agentPayoff = agentFee; // seller: sellerDeposit + price - protocolFee - agentFee - sellerPayoff = - BigInt(agentOffer.sellerDeposit) + agentOffer.price - agentOfferProtocolFee - agentFee.toString(); + sellerPayoff = ( + BigInt(agentOffer.sellerDeposit) + + BigInt(agentOffer.price) - + BigInt(agentOfferProtocolFee) - + BigInt(agentFee) + ).toString(); // protocol: protocolFee protocolPayoff = agentOfferProtocolFee; @@ -2298,7 +2306,7 @@ describe("IBosonFundsHandler", function () { beforeEach(async function () { // expected payoffs // buyer: sellerDeposit + price - buyerPayoff = BigInt(offerToken.sellerDeposit) + offerToken.price.toString(); + buyerPayoff = BigInt(offerToken.sellerDeposit) + BigInt(offerToken.price); // seller: 0 sellerPayoff = 0; @@ -2324,7 +2332,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ new Funds(await mockToken.getAddress(), "Foreign20", sellerDeposit), - new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", (2n * BigInt(sellerDeposit)).toString()), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -2367,7 +2375,7 @@ describe("IBosonFundsHandler", function () { expectedBuyerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(buyerPayoff) * 2n.toString() + BigInt(buyerPayoff) * 2n ); expectedSellerAvailableFunds = new FundsList([ new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), @@ -2407,7 +2415,7 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: sellerDeposit + price - buyerPayoff = BigInt(agentOffer.sellerDeposit) + agentOffer.price.toString(); + buyerPayoff = BigInt(agentOffer.sellerDeposit) + BigInt(agentOffer.price); // seller: 0 sellerPayoff = 0; @@ -2474,7 +2482,7 @@ describe("IBosonFundsHandler", function () { expectedBuyerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(buyerPayoff) * 2n.toString() + BigInt(buyerPayoff) * 2n ); expectedSellerAvailableFunds = new FundsList([ new Funds(await mockToken.getAddress(), "Foreign20", `${sellerDeposit}`), @@ -2550,7 +2558,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit) + sellerPayoff.toString() + BigInt(sellerDeposit) + BigInt(sellerPayoff) ); expectedBuyerAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff)); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -2588,10 +2596,10 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: price - buyerCancelPenalty - buyerPayoff = BigInt(agentOffer.price) - agentOffer.buyerCancelPenalty.toString(); + buyerPayoff = BigInt(agentOffer.price) - BigInt(agentOffer.buyerCancelPenalty); // seller: sellerDeposit + buyerCancelPenalty - sellerPayoff = BigInt(agentOffer.sellerDeposit) + agentOffer.buyerCancelPenalty.toString(); + sellerPayoff = BigInt(agentOffer.sellerDeposit) + BigInt(agentOffer.buyerCancelPenalty); // protocol: 0 protocolPayoff = 0; @@ -2633,7 +2641,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit) + sellerPayoff.toString() + BigInt(sellerDeposit) + BigInt(sellerPayoff) ); expectedBuyerAvailableFunds.funds.push(new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff)); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); @@ -2663,17 +2671,17 @@ describe("IBosonFundsHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate) + resolutionPeriod.toString(); + timeout = BigInt(disputedDate) + BigInt(resolutionPeriod); }); - context("Final state DISPUTED - RETRACTED", async function () { + contex.only("Final state DISPUTED - RETRACTED", async function () { beforeEach(async function () { // expected payoffs // buyer: 0 buyerPayoff = 0; // seller: sellerDeposit + price - protocolFee - sellerPayoff = BigInt(offerToken.sellerDeposit) + offerToken.price - offerTokenProtocolFee.toString(); + sellerPayoff = BigInt(offerToken.sellerDeposit) + BigInt(offerToken.price) - BigInt(offerTokenProtocolFee); // protocol: 0 protocolPayoff = offerTokenProtocolFee; @@ -4200,7 +4208,7 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // seller: sellerDeposit + price - protocolFee - sellerPayoff = BigInt(offerToken.sellerDeposit) + offerToken.price - offerTokenProtocolFee.toString(); + sellerPayoff = BigInt(offerToken.sellerDeposit) + BigInt(offerToken.price) - BigInt(offerTokenProtocolFee); }); it("Protocol fee for existing exchanges should be the same as at the offer creation", async function () { @@ -4272,7 +4280,10 @@ describe("IBosonFundsHandler", function () { // seller: sellerDeposit + price - protocolFee - agentFee sellerPayoff = - BigInt(agentOffer.sellerDeposit) + agentOffer.price - agentOfferProtocolFee - agentFee.toString(); + BigInt(agentOffer.sellerDeposit) + + BigInt(agentOffer.price) - + BigInt(agentOfferProtocolFee) - + BigInt(agentFee); // protocol: protocolFee protocolPayoff = agentOfferProtocolFee; From 67d04c637e955716c839896070ec5c1e0e89b3cf Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Fri, 23 Jun 2023 07:44:49 -0300 Subject: [PATCH 16/32] Fixing MetaTransactionHandler --- scripts/config/facet-deploy.js | 4 +-- scripts/util/diamond-utils.js | 23 ++++++++------- test/protocol/MetaTransactionsHandlerTest.js | 28 +++++++++---------- .../ProtocolInitializationHandlerTest.js | 1 - 4 files changed, 25 insertions(+), 31 deletions(-) diff --git a/scripts/config/facet-deploy.js b/scripts/config/facet-deploy.js index fcc292d16..c2d9f0edd 100644 --- a/scripts/config/facet-deploy.js +++ b/scripts/config/facet-deploy.js @@ -26,9 +26,7 @@ function getConfigHandlerInitArgs() { * @returns {Object} - array of function hashes */ async function getMetaTransactionsHandlerFacetInitArgs(facets) { - const getFunctionHashesClosure = getStateModifyingFunctionsHashes(facets, [ - "executeMetaTransaction(address,string,bytes,uint256,bytes32,bytes32,uint8)", - ]); + const getFunctionHashesClosure = getStateModifyingFunctionsHashes(facets, ["executeMetaTransaction"]); return await getFunctionHashesClosure(); } diff --git a/scripts/util/diamond-utils.js b/scripts/util/diamond-utils.js index 4971aa03b..bab1ccb3a 100644 --- a/scripts/util/diamond-utils.js +++ b/scripts/util/diamond-utils.js @@ -147,20 +147,19 @@ async function getStateModifyingFunctions(facetNames, omitFunctions = [], onlyFu for (const facetName of facetNames) { let FacetContractFactory = await getContractFactory(facetName); const functions = FacetContractFactory.interface.fragments; - const functionNames = Object.keys(functions); - const facetStateModifyingFunctions = functionNames.filter((fn) => { - if (functions[fn].stateMutability !== "view" && !omitFunctions.includes(fn)) { - if (onlyFunctions.length === 0) { - return true; - } - for (const func of onlyFunctions) { - if (fn.includes(func)) { + const facetStateModifyingFunctions = functions + .filter((fn) => { + if (fn.type == "function" && fn.stateMutability !== "view" && !omitFunctions.includes(fn.name)) { + if (onlyFunctions.length === 0) { + return true; + } + if (onlyFunctions.includes(fn.name)) { return true; } } - } - return false; - }); + return false; + }) + .map((fn) => fn.format("sighash")); stateModifyingFunctions = stateModifyingFunctions.concat(facetStateModifyingFunctions); } @@ -173,7 +172,7 @@ function getStateModifyingFunctionsHashes(facetNames, omitFunctions = [], onlyFu // Allowlist contract methods const stateModifyingFunctions = await getStateModifyingFunctions( facetNames, - [...omitFunctions, "initialize()"], + [...omitFunctions, "initialize"], onlyFunctions ); return stateModifyingFunctions.map((smf) => keccak256(toUtf8Bytes(smf))); diff --git a/test/protocol/MetaTransactionsHandlerTest.js b/test/protocol/MetaTransactionsHandlerTest.js index d42d26c6b..36cd6fdc9 100644 --- a/test/protocol/MetaTransactionsHandlerTest.js +++ b/test/protocol/MetaTransactionsHandlerTest.js @@ -188,7 +188,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Deploy MockMetaTransactionsHandlerFacet const MockMetaTransactionsHandlerFacet = await getContractFactory("MockMetaTransactionsHandlerFacet"); const mockMetaTransactionsHandlerFacet = await MockMetaTransactionsHandlerFacet.deploy(); - await mockMetaTransactionsHandlerFacet.deployed(); + await mockMetaTransactionsHandlerFacet.waitForDeployment(); // Define the facet cut const facetCuts = [ @@ -226,7 +226,7 @@ describe("IBosonMetaTransactionsHandler", function () { }); // All supported methods - context("📋 Meta Transactions Handler Methods", async function () { + context.only("📋 Meta Transactions Handler Methods", async function () { beforeEach(async function () { nonce = parseInt(randomBytes(8)); }); @@ -410,9 +410,7 @@ describe("IBosonMetaTransactionsHandler", function () { }); it("after initialization all state modifying functions should be allowlisted", async function () { - const stateModifyingFunctionsClosure = getStateModifyingFunctionsHashes(facetNames, [ - "executeMetaTransaction(address,string,bytes,uint256,bytes32,bytes32,uint8)", - ]); + const stateModifyingFunctionsClosure = getStateModifyingFunctionsHashes(facetNames, ["executeMetaTransaction"]); const stateModifyingFunctionsHashes = await stateModifyingFunctionsClosure(); // Functions should be enabled @@ -465,8 +463,8 @@ describe("IBosonMetaTransactionsHandler", function () { it("after initialization all state modifying functions should be allowlisted", async function () { // Get list of state modifying functions const stateModifyingFunctions = await getStateModifyingFunctions(facetNames, [ - "executeMetaTransaction(address,string,bytes,uint256,bytes32,bytes32,uint8)", - "initialize()", + "executeMetaTransaction", + "initialize", ]); for (const func of stateModifyingFunctions) { @@ -1083,7 +1081,7 @@ describe("IBosonMetaTransactionsHandler", function () { functionSignature, nonce, r, - MaxUint256, // invalid s signature component + "0x" + MaxUint256.toString(16), // invalid s signature component v ) ).to.revertedWith(RevertReasons.INVALID_SIGNATURE); @@ -1383,7 +1381,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Expected payoffs - they are the same for token and native currency // Buyer: price - buyerCancelPenalty - buyerPayoff = BigInt(offerToken.price) - offerToken.buyerCancelPenalty.toString(); + buyerPayoff = (BigInt(offerToken.price) - BigInt(offerToken.buyerCancelPenalty)).toString(); // Prepare validFundDetails tokenListBuyer = [await maliciousToken.getAddress()]; @@ -3235,7 +3233,7 @@ describe("IBosonMetaTransactionsHandler", function () { it("does not modify revert reasons", async function () { // Reverse the from and until dates - offerDates.validFrom = BigInt(Date.now() + oneMonth * 6).toString(); // 6 months from now + offerDates.validFrom = (BigInt(Date.now()) + oneMonth * 6n).toString(); // 6 months from now offerDates.validUntil = BigInt(Date.now()).toString(); // now // Prepare the function signature for the facet function. @@ -3438,11 +3436,11 @@ describe("IBosonMetaTransactionsHandler", function () { // expected payoffs - they are the same for token and native currency // buyer: price - buyerCancelPenalty - buyerPayoff = BigInt(offerToken.price) - BigInt(offerToken.buyerCancelPenalty); + buyerPayoff = (BigInt(offerToken.price) - BigInt(offerToken.buyerCancelPenalty)).toString(); // prepare validFundDetails tokenListBuyer = [await mockToken.getAddress(), ZeroAddress]; - tokenAmountsBuyer = [buyerPayoff, (BigInt(buyerPayoff) / 2n).toString()]; + tokenAmountsBuyer = [buyerPayoff.toString(), (BigInt(buyerPayoff) / 2n).toString()]; validFundDetails = { entityId: buyerId, tokenList: tokenListBuyer, @@ -3540,7 +3538,7 @@ describe("IBosonMetaTransactionsHandler", function () { // Chain state should match the expected available funds after the withdrawal // Since all tokens are withdrawn, token should be removed from the list expectedBuyerAvailableFunds = new FundsList([ - new Funds(ZeroAddress, "Native currency", BigInt(buyerPayoff) / "2".toString()), + new Funds(ZeroAddress, "Native currency", (BigInt(buyerPayoff) / 2n).toString()), ]); expect(buyerAvailableFunds).to.eql( expectedBuyerAvailableFunds, @@ -3548,7 +3546,7 @@ describe("IBosonMetaTransactionsHandler", function () { ); // Token balance is increased for the buyer payoff - expect(buyerBalanceAfter).to.eql(buyerBalanceBefore + buyerPayoff, "Buyer token balance mismatch"); + expect(buyerBalanceAfter).to.eql(buyerBalanceBefore + BigInt(buyerPayoff), "Buyer token balance mismatch"); // Verify that nonce is used. Expect true. let expectedResult = true; @@ -3610,7 +3608,7 @@ describe("IBosonMetaTransactionsHandler", function () { ); // Token balance is increased for the buyer payoff - expect(buyerBalanceAfter).to.eql(buyerBalanceBefore + buyerPayoff, "Buyer token balance mismatch"); + expect(buyerBalanceAfter).to.eql(buyerBalanceBefore + BigInt(buyerPayoff), "Buyer token balance mismatch"); // Verify that nonce is used. Expect true. let expectedResult = true; diff --git a/test/protocol/ProtocolInitializationHandlerTest.js b/test/protocol/ProtocolInitializationHandlerTest.js index ea232b225..416959ff8 100644 --- a/test/protocol/ProtocolInitializationHandlerTest.js +++ b/test/protocol/ProtocolInitializationHandlerTest.js @@ -12,7 +12,6 @@ const { getFacetAddCut, getFacetReplaceCut } = require("../../scripts/util/diamo const { RevertReasons } = require("../../scripts/config/revert-reasons.js"); const { getFacetsWithArgs } = require("../util/utils.js"); const { getV2_2_0DeployConfig } = require("../upgrade/00_config.js"); -const { ZeroAddress } = require("ethers"); describe("ProtocolInitializationHandler", async function () { // Common vars From 51ebe0271a289c92c7c13afc9db62782801819da Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Fri, 23 Jun 2023 10:15:19 -0300 Subject: [PATCH 17/32] Fixing DisputeHandlerTest --- scripts/domain/DisputeDates.js | 8 ++--- test/protocol/DisputeHandlerTest.js | 56 +++++++++++++++-------------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/scripts/domain/DisputeDates.js b/scripts/domain/DisputeDates.js index 3f50a1ab9..d69a50e9f 100644 --- a/scripts/domain/DisputeDates.js +++ b/scripts/domain/DisputeDates.js @@ -16,10 +16,10 @@ class DisputeDates { */ constructor(disputed, escalated, finalized, timeout) { - this.disputed = disputed; - this.escalated = escalated; - this.finalized = finalized; - this.timeout = timeout; + this.disputed = disputed && disputed.toString(); + this.escalated = escalated && escalated.toString(); + this.finalized = finalized && finalized.toString(); + this.timeout = timeout && timeout.toString(); } /** diff --git a/test/protocol/DisputeHandlerTest.js b/test/protocol/DisputeHandlerTest.js index 7efadcc53..fbfedee3b 100644 --- a/test/protocol/DisputeHandlerTest.js +++ b/test/protocol/DisputeHandlerTest.js @@ -1,5 +1,5 @@ const { ethers } = require("hardhat"); -const { ZeroAddress, provider } = ethers; +const { ZeroAddress, provider, zeroPadBytes, MaxUint256 } = ethers; const { expect, assert } = require("chai"); const Exchange = require("../../scripts/domain/Exchange"); const Dispute = require("../../scripts/domain/Dispute"); @@ -252,7 +252,7 @@ describe("IBosonDisputeHandler", function () { .withArgs(exchangeId, buyerId, seller.id, await buyer.getAddress()); }); - it.only("should update state", async function () { + it("should update state", async function () { // Raise a dispute tx = await disputeHandler.connect(buyer).raiseDispute(exchangeId); @@ -260,11 +260,11 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp; - timeout = disputedDate + resolutionPeriod; + timeout = BigInt(disputedDate) + BigInt(resolutionPeriod); // expected values dispute = new Dispute(exchangeId, DisputeState.Resolving, buyerPercentBasisPoints); - disputeDates = new DisputeDates(disputedDate, "0", "0", timeout); + disputeDates = new DisputeDates(disputedDate.toString(), "0", "0", timeout.toString()); // Get the dispute as a struct [, disputeStruct, disputeDatesStruct] = await disputeHandler.connect(rando).getDispute(exchangeId); @@ -349,7 +349,7 @@ describe("IBosonDisputeHandler", function () { const voucherRedeemedDate = voucherStruct.redeemedDate; // Set time forward past the dispute period - await setNextBlockTimestamp((voucherRedeemedDate + disputePeriod + 1).toNumber()); + await setNextBlockTimestamp(Number(voucherRedeemedDate + BigInt(disputePeriod) + 1n)); // Attempt to raise a dispute, expecting revert await expect(disputeHandler.connect(buyer).raiseDispute(exchangeId)).to.revertedWith( @@ -368,7 +368,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate) + resolutionPeriod.toString(); + timeout = BigInt(disputedDate) + BigInt(resolutionPeriod); }); it("should emit a DisputeRetracted event", async function () { @@ -510,10 +510,10 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate) + resolutionPeriod.toString(); + timeout = BigInt(disputedDate) + BigInt(resolutionPeriod); // extend timeout for a month - newDisputeTimeout = BigInt(timeout) + oneMonth.toString(); + newDisputeTimeout = BigInt(timeout) + oneMonth; }); it("should emit a DisputeTimeoutExtended event", async function () { @@ -560,7 +560,7 @@ describe("IBosonDisputeHandler", function () { await setNextBlockTimestamp(Number(timeout) + Number(oneWeek)); // extend for another week - newDisputeTimeout = BigInt(newDisputeTimeout) + oneWeek.toString(); + newDisputeTimeout = BigInt(newDisputeTimeout) + oneWeek; // Extend the dispute timeout, testing for the event await expect(disputeHandler.connect(assistant).extendDisputeTimeout(exchangeId, newDisputeTimeout)) @@ -619,7 +619,7 @@ describe("IBosonDisputeHandler", function () { }); it("new dispute timeout is before the current dispute timeout", async function () { - newDisputeTimeout = BigInt(timeout) - oneWeek.toString(); + newDisputeTimeout = BigInt(timeout) - oneWeek; // Attempt to extend the dispute timeout, expecting revert await expect( @@ -648,7 +648,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate) + resolutionPeriod.toString(); + timeout = BigInt(disputedDate) + BigInt(resolutionPeriod); }); it("should emit a DisputeExpired event", async function () { @@ -787,7 +787,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate) + resolutionPeriod.toString(); + timeout = BigInt(disputedDate) + BigInt(resolutionPeriod); buyerPercentBasisPoints = "1234"; @@ -900,7 +900,7 @@ describe("IBosonDisputeHandler", function () { it("Dispute can be mutually resolved even if it's in escalated state and past the resolution period", async function () { // Set time forward before the dispute original expiration date - await setNextBlockTimestamp(BigInt(disputedDate) + resolutionPeriod / (2).toNumber()); + await setNextBlockTimestamp(Number(BigInt(disputedDate) + BigInt(resolutionPeriod) / 2n)); // escalate dispute await disputeHandler.connect(buyer).escalateDispute(exchangeId, { value: buyerEscalationDepositNative }); @@ -1017,7 +1017,7 @@ describe("IBosonDisputeHandler", function () { it("Dispute can be mutually resolved even if it's in escalated state and past the resolution period", async function () { // Set time forward before the dispute original expiration date - await setNextBlockTimestamp(BigInt(disputedDate) + resolutionPeriod / (2).toNumber()); + await setNextBlockTimestamp(Number(BigInt(disputedDate) + BigInt(resolutionPeriod) / 2n)); // escalate dispute await disputeHandler.connect(buyer).escalateDispute(exchangeId, { value: buyerEscalationDepositNative }); @@ -1185,15 +1185,17 @@ describe("IBosonDisputeHandler", function () { await expect( disputeHandler .connect(assistant) - .resolveDispute(exchangeId, buyerPercentBasisPoints, r, hexZeroPad("0x", 32), v) + .resolveDispute(exchangeId, buyerPercentBasisPoints, r, zeroPadBytes("0x", 32), v) ).to.revertedWith(RevertReasons.INVALID_SIGNATURE); await expect( disputeHandler .connect(assistant) - .resolveDispute(exchangeId, buyerPercentBasisPoints, hexZeroPad("0x", 32), s, v) + .resolveDispute(exchangeId, buyerPercentBasisPoints, zeroPadBytes("0x", 32), s, v) ).to.revertedWith(RevertReasons.INVALID_SIGNATURE); await expect( - disputeHandler.connect(assistant).resolveDispute(exchangeId, buyerPercentBasisPoints, r, MaxUint256, v) + disputeHandler + .connect(assistant) + .resolveDispute(exchangeId, buyerPercentBasisPoints, r, "0x" + MaxUint256.toString(16), v) ).to.revertedWith(RevertReasons.INVALID_SIGNATURE); }); @@ -1277,7 +1279,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); escalatedDate = block.timestamp.toString(); - timeout = BigInt(escalatedDate) + escalationPeriod.toString(); + timeout = BigInt(escalatedDate) + BigInt(escalationPeriod); dispute = new Dispute(exchangeId, DisputeState.Escalated, "0"); disputeDates = new DisputeDates(disputedDate, escalatedDate, "0", timeout); @@ -1372,7 +1374,7 @@ describe("IBosonDisputeHandler", function () { it("Dispute has expired", async function () { // Set time forward past the dispute resolution period - await setNextBlockTimestamp(Number(timeout) + oneWeek); + await setNextBlockTimestamp(Number(timeout + oneWeek)); // Attempt to escalate the dispute, expecting revert await expect(disputeHandler.connect(buyer).escalateDispute(exchangeId), { @@ -1530,7 +1532,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); escalatedDate = block.timestamp.toString(); - timeout = BigInt(escalatedDate) + escalationPeriod.toString(); + timeout = BigInt(escalatedDate) + BigInt(escalationPeriod); // buyer percent used in tests buyerPercentBasisPoints = "4321"; @@ -1674,7 +1676,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); escalatedDate = block.timestamp.toString(); - timeout = BigInt(escalatedDate) + escalationPeriod.toString(); + timeout = BigInt(escalatedDate) + BigInt(escalationPeriod); }); it("should emit a EscalatedDisputeExpired event", async function () { @@ -1823,7 +1825,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); escalatedDate = block.timestamp.toString(); - timeout = BigInt(escalatedDate) + escalationPeriod.toString(); + timeout = BigInt(escalatedDate) + BigInt(escalationPeriod); }); it("should emit a EscalatedDisputeRefused event", async function () { @@ -1965,7 +1967,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate) + resolutionPeriod.toString(); + timeout = BigInt(disputedDate) + BigInt(resolutionPeriod); // Expected value for dispute dispute = new Dispute(exchangeId, DisputeState.Resolving, buyerPercentBasisPoints); @@ -2204,7 +2206,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate) + resolutionPeriod.toString(); + timeout = BigInt(disputedDate) + BigInt(resolutionPeriod); }); it("should return true for exists if exchange id is valid", async function () { @@ -2391,7 +2393,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp; - timeout = disputedDate + resolutionPeriod; + timeout = BigInt(disputedDate) + BigInt(resolutionPeriod); dispute[exchangeId] = new Dispute(exchangeId, DisputeState.Retracted, buyerPercentBasisPoints); disputeDates[exchangeId] = new DisputeDates(disputedDate, "0", finalizedDate, timeout); @@ -2417,9 +2419,9 @@ describe("IBosonDisputeHandler", function () { .withArgs("4", await rando.getAddress()); }); - it.only("should update state", async function () { + it("should update state", async function () { // Set time forward past the dispute resolution period - await setNextBlockTimestamp(timeout + oneWeek); + await setNextBlockTimestamp(Number(timeout) + Number(oneWeek)); // Expire the dispute tx = await disputeHandler.connect(rando).expireDisputeBatch(disputesToExpire); From bf28608e398024c3f4b37953e58c79b4969608ae Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Fri, 23 Jun 2023 10:47:32 -0300 Subject: [PATCH 18/32] Fixing tests left behind --- test/protocol/BuyerHandlerTest.js | 2 +- test/protocol/DisputeResolverHandlerTest.js | 22 +++++++++---------- test/protocol/ExchangeHandlerTest.js | 10 ++++----- test/protocol/MetaTransactionsHandlerTest.js | 2 +- test/protocol/TwinHandlerTest.js | 4 ++-- .../clients/ClientExternalAddressesTest.js | 13 +++++------ 6 files changed, 25 insertions(+), 28 deletions(-) diff --git a/test/protocol/BuyerHandlerTest.js b/test/protocol/BuyerHandlerTest.js index 8b9decf94..0f11f47ed 100644 --- a/test/protocol/BuyerHandlerTest.js +++ b/test/protocol/BuyerHandlerTest.js @@ -316,7 +316,7 @@ describe("BuyerHandler", function () { await expect(accountHandler.connect(other1).updateBuyer(buyer)).to.revertedWith(RevertReasons.NOT_BUYER_WALLET); }); - context.only("💔 Revert Reasons", async function () { + context("💔 Revert Reasons", async function () { beforeEach(async function () { // Initial ids for all the things id = await accountHandler.connect(rando).getNextAccountId(); diff --git a/test/protocol/DisputeResolverHandlerTest.js b/test/protocol/DisputeResolverHandlerTest.js index 98b1a2245..4fd81e164 100644 --- a/test/protocol/DisputeResolverHandlerTest.js +++ b/test/protocol/DisputeResolverHandlerTest.js @@ -130,7 +130,7 @@ describe("DisputeResolverHandler", function () { seller = mockSeller( await assistant.getAddress(), await admin.getAddress(), - await clerk.getAddress(), + clerk.address, await treasury.getAddress() ); seller2 = mockSeller( @@ -161,7 +161,7 @@ describe("DisputeResolverHandler", function () { disputeResolver = mockDisputeResolver( await assistant.getAddress(), await admin.getAddress(), - await clerk.getAddress(), + clerk.address, await treasury.getAddress() ); expect(disputeResolver.isValid()).is.true; @@ -680,7 +680,7 @@ describe("DisputeResolverHandler", function () { Array.isArray(returnedSellerAllowList) && returnedSellerAllowList.reduce( (previousAllowedSeller, currentAllowedSeller) => - previousAllowedSeller && typeof BigInt(currentAllowedSeller) === "object", + previousAllowedSeller && typeof BigInt(currentAllowedSeller) === "bigint", true ); expect(valid).to.be.true; @@ -755,8 +755,8 @@ describe("DisputeResolverHandler", function () { }); it("should emit a DisputeResolverUpdatePending event with correct values if values change", async function () { - disputeResolver.escalationResponsePeriod = Number( - Number(disputeResolver.escalationResponsePeriod) - oneWeek + disputeResolver.escalationResponsePeriod = ( + BigInt(disputeResolver.escalationResponsePeriod) - oneWeek ).toString(); disputeResolver.assistant = disputeResolverPendingUpdate.assistant = await other1.getAddress(); disputeResolver.admin = disputeResolverPendingUpdate.admin = await other2.getAddress(); @@ -795,8 +795,8 @@ describe("DisputeResolverHandler", function () { }); it("should update state of all fields except Id and active flag and fees", async function () { - disputeResolver.escalationResponsePeriod = Number( - Number(disputeResolver.escalationResponsePeriod) - oneWeek + disputeResolver.escalationResponsePeriod = ( + BigInt(disputeResolver.escalationResponsePeriod) - oneWeek ).toString(); disputeResolver.assistant = await other1.getAddress(); disputeResolver.admin = await other2.getAddress(); @@ -849,7 +849,7 @@ describe("DisputeResolverHandler", function () { [exists] = await accountHandler.connect(rando).getDisputeResolverByAddress(await admin.getAddress()); expect(exists).to.be.false; - [exists] = await accountHandler.connect(rando).getDisputeResolverByAddress(await clerk.getAddress()); + [exists] = await accountHandler.connect(rando).getDisputeResolverByAddress(clerk.address); expect(exists).to.be.false; //Check that new addresses are mapped. We don't map the treasury address. @@ -961,8 +961,8 @@ describe("DisputeResolverHandler", function () { expect(valid).is.true; //Update first dispute resolver values - disputeResolver.escalationResponsePeriod = Number( - Number(disputeResolver.escalationResponsePeriod) - oneWeek + disputeResolver.escalationResponsePeriod = ( + BigInt(disputeResolver.escalationResponsePeriod) - oneWeek ).toString(); disputeResolver.assistant = await rando.getAddress(); disputeResolver.admin = await rando.getAddress(); @@ -1356,7 +1356,7 @@ describe("DisputeResolverHandler", function () { await configHandler.setMaxEscalationResponsePeriod(oneWeek); // New escalation period has to be different from the current escalation period - disputeResolver.escalationResponsePeriod = oneWeek + 1; + disputeResolver.escalationResponsePeriod = oneWeek + 1n; // Attempt to update a DisputeResolver, expecting revert await expect(accountHandler.connect(admin).updateDisputeResolver(disputeResolver)).to.revertedWith( diff --git a/test/protocol/ExchangeHandlerTest.js b/test/protocol/ExchangeHandlerTest.js index e4223c8e7..b3da5d6b0 100644 --- a/test/protocol/ExchangeHandlerTest.js +++ b/test/protocol/ExchangeHandlerTest.js @@ -1412,7 +1412,7 @@ describe("IBosonExchangeHandler", function () { block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = BigInt(block.timestamp + disputePeriod + 1).toString(); + newTime = Number(BigInt(block.timestamp) + BigInt(disputePeriod) + 1n); await setNextBlockTimestamp(newTime); // Complete exchange @@ -1433,7 +1433,7 @@ describe("IBosonExchangeHandler", function () { block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = BigInt(block.timestamp + disputePeriod + 1).toString(); + newTime = Number(BigInt(block.timestamp) + BigInt(disputePeriod) + 1n); await setNextBlockTimestamp(newTime); // Complete exchange @@ -1454,7 +1454,7 @@ describe("IBosonExchangeHandler", function () { block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = BigInt(block.timestamp + disputePeriod + 1).toString(); + newTime = Number(BigInt(block.timestamp) + BigInt(disputePeriod) + 1n); await setNextBlockTimestamp(newTime); // Create a rando buyer account @@ -1613,7 +1613,7 @@ describe("IBosonExchangeHandler", function () { block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = BigInt(block.timestamp + disputePeriod + 1).toString(); + newTime = Number(BigInt(block.timestamp) + BigInt(disputePeriod) + 1n); await setNextBlockTimestamp(newTime); // Complete exchange @@ -1645,7 +1645,7 @@ describe("IBosonExchangeHandler", function () { block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = BigInt(block.timestamp + disputePeriod + 1).toString(); + newTime = Number(BigInt(block.timestamp) + BigInt(disputePeriod) + 1n); await setNextBlockTimestamp(newTime); // Complete exchange diff --git a/test/protocol/MetaTransactionsHandlerTest.js b/test/protocol/MetaTransactionsHandlerTest.js index 36cd6fdc9..80c0e4fe6 100644 --- a/test/protocol/MetaTransactionsHandlerTest.js +++ b/test/protocol/MetaTransactionsHandlerTest.js @@ -226,7 +226,7 @@ describe("IBosonMetaTransactionsHandler", function () { }); // All supported methods - context.only("📋 Meta Transactions Handler Methods", async function () { + context("📋 Meta Transactions Handler Methods", async function () { beforeEach(async function () { nonce = parseInt(randomBytes(8)); }); diff --git a/test/protocol/TwinHandlerTest.js b/test/protocol/TwinHandlerTest.js index 741720cd2..5d8b548ba 100644 --- a/test/protocol/TwinHandlerTest.js +++ b/test/protocol/TwinHandlerTest.js @@ -518,7 +518,7 @@ describe("IBosonTwinHandler", function () { twin.tokenType = TokenType.NonFungibleToken; twin.tokenAddress = await foreign721.getAddress(); twin.amount = "0"; - twin.tokenId = MaxUint256 - BigInt(twin.supplyAvailable) + 1n.toString(); + twin.tokenId = (MaxUint256 - BigInt(twin.supplyAvailable) + 1n).toString(); await foreign721.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); @@ -533,7 +533,7 @@ describe("IBosonTwinHandler", function () { twin.tokenType = TokenType.NonFungibleToken; twin.tokenAddress = await foreign721.getAddress(); twin.amount = "0"; - twin.tokenId = MaxUint256 + 1n / 2n + 1n.toString(); + twin.tokenId = ((MaxUint256 + 1n) / 2n + 1n).toString(); await foreign721.connect(assistant).setApprovalForAll(await twinHandler.getAddress(), true); diff --git a/test/protocol/clients/ClientExternalAddressesTest.js b/test/protocol/clients/ClientExternalAddressesTest.js index fded5ae1f..1ed60d0b1 100644 --- a/test/protocol/clients/ClientExternalAddressesTest.js +++ b/test/protocol/clients/ClientExternalAddressesTest.js @@ -1,5 +1,5 @@ const { ethers } = require("hardhat"); - +const { getSigners, ZeroAddress, getContractFactory } = ethers; const { gasLimit } = require("../../../environments"); const { deployProtocolClientImpls } = require("../../../scripts/util/deploy-protocol-client-impls.js"); const { deployProtocolClientBeacons } = require("../../../scripts/util/deploy-protocol-client-beacons.js"); @@ -118,10 +118,7 @@ describe("IClientExternalAddresses", function () { context("💔 Revert Reasons", async function () { it("_protocolAddress address is the zero address", async function () { // Deploy Protocol Client implementation contracts - const protocolClientImpls = await deployProtocolClientImpls( - [ZeroAddress], - maxPriorityFeePerGas - ); + const protocolClientImpls = await deployProtocolClientImpls([ZeroAddress], maxPriorityFeePerGas); // Deploy Protocol Client beacon contracts const protocolClientArgs = [ZeroAddress]; @@ -136,9 +133,9 @@ describe("IClientExternalAddresses", function () { // Deploy the ClientBeacon for BosonVoucher const ClientBeacon = await getContractFactory("BosonClientBeacon"); - await expect( - ClientBeacon.deploy(...protocolClientArgs, ZeroAddress, { gasLimit }) - ).to.revertedWith(RevertReasons.INVALID_ADDRESS); + await expect(ClientBeacon.deploy(...protocolClientArgs, ZeroAddress, { gasLimit })).to.revertedWith( + RevertReasons.INVALID_ADDRESS + ); }); }); }); From 89ccd43c207da0e1a316a906120528fa50dde468 Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Mon, 26 Jun 2023 14:50:21 -0300 Subject: [PATCH 19/32] Refactor BosonVoucher --- .eslintrc.json | 14 +- .../protocol/clients/voucher/BosonVoucher.sol | 4 +- .../protocol/facets/ExchangeHandlerFacet.sol | 1 + package.json | 1 - test/protocol/clients/BosonVoucherTest.js | 3276 +++++++---------- test/util/utils.js | 4 +- 6 files changed, 1422 insertions(+), 1878 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 62f31bd90..9ecbd8766 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,11 +1,8 @@ { - "extends": [ - "eslint:recommended", - "prettier" - ], + "extends": ["eslint:recommended", "prettier"], "env": { "node": true, - "es6": true, + "es2020": true, "commonjs": true, "mocha": true }, @@ -17,7 +14,8 @@ "no-empty": "off", "no-only-tests/no-only-tests": "error" }, - "plugins": [ - "no-only-tests" - ] + "plugins": ["no-only-tests"], + "globals": { + "BigInt": true + } } diff --git a/contracts/protocol/clients/voucher/BosonVoucher.sol b/contracts/protocol/clients/voucher/BosonVoucher.sol index 3ea7bab82..d1a8f721d 100644 --- a/contracts/protocol/clients/voucher/BosonVoucher.sol +++ b/contracts/protocol/clients/voucher/BosonVoucher.sol @@ -1,5 +1,7 @@ -// SPDX-License-Identifier: GPL-3.0-or-later +// SPDX-License-Identifier: GPL-3.0-or-latehr pragma solidity 0.8.18; + +import "hardhat/console.sol"; import "../../../domain/BosonConstants.sol"; import { ERC721Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import { IERC721Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol"; diff --git a/contracts/protocol/facets/ExchangeHandlerFacet.sol b/contracts/protocol/facets/ExchangeHandlerFacet.sol index 53c051fa0..c19fd83f3 100644 --- a/contracts/protocol/facets/ExchangeHandlerFacet.sol +++ b/contracts/protocol/facets/ExchangeHandlerFacet.sol @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.18; +import "hardhat/console.sol"; import { IBosonExchangeHandler } from "../../interfaces/handlers/IBosonExchangeHandler.sol"; import { IBosonAccountHandler } from "../../interfaces/handlers/IBosonAccountHandler.sol"; import { IBosonVoucher } from "../../interfaces/clients/IBosonVoucher.sol"; diff --git a/package.json b/package.json index aa044f123..2e17c991a 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,6 @@ }, "devDependencies": { "@bosonprotocol/solidoc": "3.0.3", - "@ethereum-waffle/mock-contract": "^4.0.4", "@nomicfoundation/hardhat-network-helpers": "^1.0.6", "@nomicfoundation/hardhat-toolbox": "^3.0.0", "@nomiclabs/hardhat-web3": "^2.0.0", diff --git a/test/protocol/clients/BosonVoucherTest.js b/test/protocol/clients/BosonVoucherTest.js index cd04771cf..6997bf2f8 100644 --- a/test/protocol/clients/BosonVoucherTest.js +++ b/test/protocol/clients/BosonVoucherTest.js @@ -1,7 +1,6 @@ const { ethers } = require("hardhat"); const { ZeroAddress, getSigners, getContractAt, getContractFactory, provider, parseUnits, MaxUint256 } = ethers; -const DisputeResolutionTerms = require("../../../scripts/domain/DisputeResolutionTerms"); const { getInterfaceIds } = require("../../../scripts/config/supported-interfaces.js"); const Role = require("../../../scripts/domain/Role"); const { DisputeResolverFee } = require("../../../scripts/domain/DisputeResolverFee"); @@ -33,7 +32,6 @@ const { deriveTokenId, } = require("../../util/utils.js"); const { deployMockTokens } = require("../../../scripts/util/deploy-mock-tokens"); -const { deployMockContract } = require("@ethereum-waffle/mock-contract"); describe("IBosonVoucher", function () { let interfaceIds; @@ -54,7 +52,6 @@ describe("IBosonVoucher", function () { treasuryDR, seller, foreign20; - let beacon; let disputeResolver, disputeResolverFees; let emptyAuthToken; let agentId; @@ -86,7 +83,7 @@ describe("IBosonVoucher", function () { ({ signers: [protocol, buyer, rando, rando2, admin, treasury, adminDR, treasuryDR], contractInstances: { accountHandler, offerHandler, exchangeHandler, fundsHandler, configHandler }, - extraReturnValues: { bosonVoucher, beacon, accessController }, + extraReturnValues: { bosonVoucher, accessController }, } = await setupTestEnvironment(contracts, { forwarderAddress: [await forwarder.getAddress()], })); @@ -118,6 +115,9 @@ describe("IBosonVoucher", function () { afterEach(async function () { await revertToSnapshot(snapshotId); snapshotId = await getSnapshot(); + + // Reset + accountId.next(true); }); // Interface support @@ -159,312 +159,278 @@ describe("IBosonVoucher", function () { }); }); - context("issueVoucher()", function () { - let buyerStruct; - let buyerWallet; + context("Offer must exist", async function () { + let offer, offerDates, offerDurations, disputeResolverId; - beforeEach(async function () { - buyerStruct = mockBuyer(await buyer.getAddress()).toStruct(); - buyerWallet = buyerStruct[1]; - }); + before(async function () { + const bosonVoucherCloneAddress = calculateContractAddress(await exchangeHandler.getAddress(), "1"); + bosonVoucher = await getContractAt("IBosonVoucher", bosonVoucherCloneAddress); - after(async function () { - // Reset the accountId iterator - accountId.next(true); - }); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + clerk.address, + await treasury.getAddress() + ); - it("should issue a voucher with success", async function () { - const balanceBefore = await bosonVoucher.balanceOf(await buyer.getAddress()); - await bosonVoucher.connect(protocol).issueVoucher(0, buyerWallet); + // Prepare the AuthToken and VoucherInitValues + emptyAuthToken = mockAuthToken(); + voucherInitValues = mockVoucherInitValues(); + await accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues); - const balanceAfter = await bosonVoucher.balanceOf(await buyer.getAddress()); + // Create a valid dispute resolver + disputeResolver = mockDisputeResolver( + await assistantDR.getAddress(), + await adminDR.getAddress(), + clerkDR.address, + await treasuryDR.getAddress(), + true + ); - expect(balanceAfter - balanceBefore).eq(1); - }); + // Create DisputeResolverFee array so offer creation will succeed + disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", "0")]; + const sellerAllowList = []; + + // Register the dispute resolver + await accountHandler + .connect(adminDR) + .createDisputeResolver(disputeResolver, disputeResolverFees, sellerAllowList); - it("should issue a voucher if it does not overlap with range", async function () { - const offerId = "5"; - const start = "10"; - const length = "123"; - const tokenId = deriveTokenId(offerId, start); // token within reserved range + ({ offer, offerDates, offerDurations, disputeResolverId } = await mockOffer()); + offer.quantityAvailable = "1000"; - // Deploy mock protocol - await deployMockProtocol(); + await offerHandler.connect(assistant).createOffer(offer, offerDates, offerDurations, disputeResolverId, "0"); - // Reserve a range - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); + const amount = BigInt(offer.sellerDeposit) * BigInt(offer.quantityAvailable); - // Token id just below the range - await expect(() => bosonVoucher.connect(protocol).issueVoucher(tokenId - 1, buyerWallet)).to.changeTokenBalance( - bosonVoucher, - buyer, - 1 - ); + await fundsHandler.connect(admin).depositFunds(seller.id, ZeroAddress, amount, { + value: amount, + }); - // Token id just above the range - await expect(() => - bosonVoucher.connect(protocol).issueVoucher(tokenId + length, buyerWallet) - ).to.changeTokenBalance(bosonVoucher, buyer, 1); + // Get snapshot id + snapshotId = await getSnapshot(); }); - context("💔 Revert Reasons", async function () { - it("should revert if caller does not have PROTOCOL role", async function () { - // Expect revert if random user attempts to issue voucher - await expect(bosonVoucher.connect(rando).issueVoucher(0, buyerWallet)).to.be.revertedWith( - RevertReasons.ACCESS_DENIED - ); + after; + + /// afterEach(async function () { + /// // Reset + /// accountId.next(true); + /// }); + + context("issueVoucher()", function () { + let buyerStruct; + let buyerWallet; + + before(async function () { + buyerStruct = mockBuyer(await buyer.getAddress()).toStruct(); + buyerWallet = buyerStruct[1]; + }); - // Grant PROTOCOL role to random user address - await accessController.grantRole(Role.PROTOCOL, await rando.getAddress()); + // after(async function () { + // // Reset the accountId iterator + // accountId.next(true); + // }); - // Attempt to issue voucher again as a random user + it("should issue a voucher with success", async function () { const balanceBefore = await bosonVoucher.balanceOf(await buyer.getAddress()); - await bosonVoucher.connect(rando).issueVoucher(0, buyerWallet); + await bosonVoucher.connect(protocol).issueVoucher(0, buyerWallet); + const balanceAfter = await bosonVoucher.balanceOf(await buyer.getAddress()); expect(balanceAfter - balanceBefore).eq(1); }); - it("issueVoucher should revert if exchange id falls within a pre-minted offer's range", async function () { - const offerId = "5"; + it("should issue a voucher if it does not overlap with range", async function () { + const offerId = "1"; const start = "10"; const length = "123"; - const tokenId = deriveTokenId(offerId, "15"); // token within reserved range - - // Deploy mock protocol - await deployMockProtocol(); + const tokenId = deriveTokenId(offerId, start); // token within reserved range // Reserve a range await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); - // Expect revert if random user attempts to issue voucher - await expect(bosonVoucher.connect(protocol).issueVoucher(tokenId, buyerWallet)).to.be.revertedWith( - RevertReasons.EXCHANGE_ID_IN_RESERVED_RANGE - ); + // Token id just below the range + await expect(() => + bosonVoucher.connect(protocol).issueVoucher(tokenId - 1n, buyerWallet) + ).to.changeTokenBalance(bosonVoucher, buyer, 1); + + // Token id just above the range + await expect(() => + bosonVoucher.connect(protocol).issueVoucher(tokenId + BigInt(length), buyerWallet) + ).to.changeTokenBalance(bosonVoucher, buyer, 1); }); - }); - }); - context("reserveRange()", function () { - let offerId, start, length; - let range; + context("💔 Revert Reasons", async function () { + it("should revert if caller does not have PROTOCOL role", async function () { + // Expect revert if random user attempts to issue voucher + await expect(bosonVoucher.connect(rando).issueVoucher(0, buyerWallet)).to.be.revertedWith( + RevertReasons.ACCESS_DENIED + ); - beforeEach(async function () { - offerId = "5"; - start = "10"; - length = "123"; - const tokenStartId = deriveTokenId(offerId, start); + // Grant PROTOCOL role to random user address + await accessController.grantRole(Role.PROTOCOL, await rando.getAddress()); - range = new Range(tokenStartId.toString(), length, "0", "0", await assistant.getAddress()); - }); + // Attempt to issue voucher again as a random user + const balanceBefore = await bosonVoucher.balanceOf(await buyer.getAddress()); + await bosonVoucher.connect(rando).issueVoucher(0, buyerWallet); + const balanceAfter = await bosonVoucher.balanceOf(await buyer.getAddress()); - it("Should emit event RangeReserved", async function () { - // Reserve range, test for event - await expect(bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress())) - .to.emit(bosonVoucher, "RangeReserved") - .withArgs(offerId, range.toStruct()); - }); + expect(balanceAfter - balanceBefore).eq(1); + }); - it("Should update state", async function () { - // Reserve range - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); - - // Get range object from contract - const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); - assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); - - // Mock getOffer call, otherwise getAvailablePreMints will return 0 - const mockProtocol = await deployMockProtocol(); - const { offer, offerDates, offerDurations, offerFees } = await mockOffer(); - const disputeResolutionTerms = new DisputeResolutionTerms("0", "0", "0", "0"); - await mockProtocol.mock.getMaxPremintedVouchers.returns("1000"); - await mockProtocol.mock.getOffer.returns( - true, - offer, - offerDates, - offerDurations, - disputeResolutionTerms, - offerFees - ); + it("issueVoucher should revert if exchange id falls within a pre-minted offer's range", async function () { + const offerId = "1"; + const start = "10"; + const length = "123"; + const tokenId = deriveTokenId(offerId, "15"); // token within reserved range + + // Reserve a range + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); - // Get available premints from contract - const availablePremints = await bosonVoucher.getAvailablePreMints(offerId); - assert.equal(availablePremints.toString(), length, "Available Premints mismatch"); + // Expect revert if random user attempts to issue voucher + await expect(bosonVoucher.connect(protocol).issueVoucher(tokenId, buyerWallet)).to.be.revertedWith( + RevertReasons.EXCHANGE_ID_IN_RESERVED_RANGE + ); + }); + }); }); - context("Owner range is contract", async function () { + context("reserveRange()", function () { + let offerId, start, length; + let range; + beforeEach(async function () { - range.owner = await bosonVoucher.getAddress(); + offerId = "1"; + start = "10"; + length = "123"; + + const tokenStartId = deriveTokenId(offerId, start); + range = new Range(tokenStartId.toString(), length, "0", "0", await assistant.getAddress()); }); it("Should emit event RangeReserved", async function () { // Reserve range, test for event - await expect( - bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await bosonVoucher.getAddress()) - ) + await expect(bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress())) .to.emit(bosonVoucher, "RangeReserved") .withArgs(offerId, range.toStruct()); }); it("Should update state", async function () { // Reserve range - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await bosonVoucher.getAddress()); + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); // Get range object from contract const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); - // Mock getOffer call, otherwise getAvailablePreMints will return 0 - const mockProtocol = await deployMockProtocol(); - const { offer, offerDates, offerDurations, offerFees } = await mockOffer(); - const disputeResolutionTerms = new DisputeResolutionTerms("0", "0", "0", "0"); - await mockProtocol.mock.getMaxPremintedVouchers.returns("1000"); - await mockProtocol.mock.getOffer.returns( - true, - offer, - offerDates, - offerDurations, - disputeResolutionTerms, - offerFees - ); - // Get available premints from contract const availablePremints = await bosonVoucher.getAvailablePreMints(offerId); assert.equal(availablePremints.toString(), length, "Available Premints mismatch"); }); - }); - context("💔 Revert Reasons", async function () { - it("caller does not have PROTOCOL role", async function () { - await expect( - bosonVoucher.connect(rando).reserveRange(offerId, start, length, await assistant.getAddress()) - ).to.be.revertedWith(RevertReasons.ACCESS_DENIED); - }); + context("Owner range is contract", async function () { + beforeEach(async function () { + range.owner = await bosonVoucher.getAddress(); + }); - it("Start id is not greater than zero for the first range", async function () { - // Set start id to 0 - start = 0; + it("Should emit event RangeReserved", async function () { + // Reserve range, test for event + await expect( + bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await bosonVoucher.getAddress()) + ) + .to.emit(bosonVoucher, "RangeReserved") + .withArgs(offerId, range.toStruct()); + }); - // Try to reserve range, it should fail - await expect( - bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()) - ).to.be.revertedWith(RevertReasons.INVALID_RANGE_START); - }); + it("Should update state", async function () { + // Reserve range + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await bosonVoucher.getAddress()); - it("Range length is zero", async function () { - // Set length to 0 - length = "0"; + // Get range object from contract + const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); + assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); - // Try to reserve range, it should fail - await expect( - bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()) - ).to.be.revertedWith(RevertReasons.INVALID_RANGE_LENGTH); + // Get available premints from contract + const availablePremints = await bosonVoucher.getAvailablePreMints(offerId); + assert.equal(availablePremints.toString(), length, "Available Premints mismatch"); + }); }); - it("Range length is too large, i.e., would cause an overflow", async function () { - // Set such numbers that would cause an overflow - start = MaxUint256 / 2n + 2n; - length = MaxUint256 / 2n; - - // Try to reserve range, it should fail - await expect( - bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()) - ).to.be.revertedWith(RevertReasons.INVALID_RANGE_LENGTH); - }); + context("💔 Revert Reasons", async function () { + it("caller does not have PROTOCOL role", async function () { + await expect( + bosonVoucher.connect(rando).reserveRange(offerId, start, length, await assistant.getAddress()) + ).to.be.revertedWith(RevertReasons.ACCESS_DENIED); + }); - it("Offer id is already associated with a range", async function () { - // Reserve range for an offer - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); + it("Start id is not greater than zero for the first range", async function () { + // Set start id to 0 + start = 0; - start = Number(start) + Number(length) + 1; + // Try to reserve range, it should fail + await expect( + bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()) + ).to.be.revertedWith(RevertReasons.INVALID_RANGE_START); + }); - // Try to reserve range for the same offer, it should fail - await expect( - bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()) - ).to.be.revertedWith(RevertReasons.OFFER_RANGE_ALREADY_RESERVED); - }); + it("Range length is zero", async function () { + // Set length to 0 + length = "0"; - it("_to address isn't contract address or contract owner address", async function () { - // Try to reserve range for rando address, it should fail - await expect( - bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await rando.getAddress()) - ).to.be.revertedWith(RevertReasons.INVALID_TO_ADDRESS); - }); - }); - }); + // Try to reserve range, it should fail + await expect( + bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()) + ).to.be.revertedWith(RevertReasons.INVALID_RANGE_LENGTH); + }); - context("preMint()", function () { - let offerId, start, length, amount; - let mockProtocol; - let offer, offerDates, offerDurations, offerFees, disputeResolutionTerms; + it("Range length is too large, i.e., would cause an overflow", async function () { + // Set such numbers that would cause an overflow + start = MaxUint256 / 2n + 2n; + length = MaxUint256 / 2n; - beforeEach(async function () { - mockProtocol = await deployMockProtocol(); - ({ offer, offerDates, offerDurations, offerFees } = await mockOffer()); - disputeResolutionTerms = new DisputeResolutionTerms("0", "0", "0", "0"); - await mockProtocol.mock.getMaxPremintedVouchers.returns("1000"); - await mockProtocol.mock.getOffer.returns( - true, - offer, - offerDates, - offerDurations, - disputeResolutionTerms, - offerFees - ); + // Try to reserve range, it should fail + await expect( + bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()) + ).to.be.revertedWith(RevertReasons.INVALID_RANGE_LENGTH); + }); - // reserve a range - offerId = "5"; - start = 10; - length = "1000"; - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); + it("Offer id is already associated with a range", async function () { + // Reserve range for an offer + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); - // amount to mint - amount = 50; - }); + start = Number(start) + Number(length) + 1; - it("Should emit Transfer events", async function () { - // Premint tokens, test for event - const tx = await bosonVoucher.connect(assistant).preMint(offerId, amount); + // Try to reserve range for the same offer, it should fail + await expect( + bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()) + ).to.be.revertedWith(RevertReasons.OFFER_RANGE_ALREADY_RESERVED); + }); - // Expect an event for every mint - start = deriveTokenId(offerId, start); - for (let i = 0; i < Number(amount); i++) { - await expect(tx) - .to.emit(bosonVoucher, "Transfer") - .withArgs(ZeroAddress, await assistant.getAddress(), start + i); - } + it("_to address isn't contract address or contract owner address", async function () { + // Try to reserve range for rando address, it should fail + await expect( + bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await rando.getAddress()) + ).to.be.revertedWith(RevertReasons.INVALID_TO_ADDRESS); + }); + }); }); - it("Should emit VouchersPreMinted event", async function () { - // Premint tokens, test for event - const tx = await bosonVoucher.connect(assistant).preMint(offerId, amount); - - start = deriveTokenId(offerId, start); + context("preMint()", function () { + let offerId, start, length, amount; - await expect(tx) - .to.emit(bosonVoucher, "VouchersPreMinted") - .withArgs(offerId, start, start + amount - 1); - }); - - context("Owner range is contract", async function () { beforeEach(async function () { - offer.id = offerId = ++offerId; - await mockProtocol.mock.getOffer.returns( - true, - offer, - offerDates, - offerDurations, - disputeResolutionTerms, - offerFees - ); - // reserve a range - start = "1010"; - length = "1000"; - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await bosonVoucher.getAddress()); + offerId = "1"; + start = 10; + length = "990"; + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); + + // amount to mint + amount = "50"; }); - it("Transfer event should emit contract address", async function () { + it("Should emit Transfer events", async function () { // Premint tokens, test for event const tx = await bosonVoucher.connect(assistant).preMint(offerId, amount); @@ -473,932 +439,616 @@ describe("IBosonVoucher", function () { for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(ZeroAddress, await bosonVoucher.getAddress(), start + i); + .withArgs(ZeroAddress, await assistant.getAddress(), start + BigInt(i)); } }); - it("Should update state", async function () { - let contractBalanceBefore = await bosonVoucher.balanceOf(await bosonVoucher.getAddress()); - - // Premint tokens - await bosonVoucher.connect(assistant).preMint(offerId, amount); + it("Should emit VouchersPreMinted event", async function () { + // Premint tokens, test for event + const tx = await bosonVoucher.connect(assistant).preMint(offerId, amount); - // Expect a correct owner for all preminted tokens start = deriveTokenId(offerId, start); - for (let i = 0; i < Number(amount); i++) { - let tokenId = start + i; - let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, await bosonVoucher.getAddress(), `Wrong token owner for token ${tokenId}`); - } - - // Token that is inside a range, but wasn't preminted yet should not have an owner - await expect(bosonVoucher.ownerOf(start + amount + 1)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); - - // Contract's balance should be updated for the total mint amount - let contractBalanceAfter = await bosonVoucher.balanceOf(await bosonVoucher.getAddress()); - assert.equal(contractBalanceAfter.toNumber(), contractBalanceBefore + amount.toNumber(), "Balance mismatch"); - // Get available premints from contract - const availablePremints = await bosonVoucher.getAvailablePreMints(offerId); - assert.equal(availablePremints.toNumber(), Number(length) - Number(amount), "Available Premints mismatch"); + await expect(tx) + .to.emit(bosonVoucher, "VouchersPreMinted") + .withArgs(offerId, start, start + BigInt(amount) - 1n); }); - }); - - it("Should update state", async function () { - let sellerBalanceBefore = await bosonVoucher.balanceOf(await assistant.getAddress()); - - // Premint tokens - await bosonVoucher.connect(assistant).preMint(offerId, amount); - // Expect a correct owner for all preminted tokens - start = deriveTokenId(offerId, start); - for (let i = 0; i < Number(amount); i++) { - let tokenId = start + i; - let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, await assistant.getAddress(), `Wrong token owner for token ${tokenId}`); - } + context("Owner range is contract", async function () { + beforeEach(async function () { + offer.id = offerId = ++offerId; - // Token that is inside a range, but wasn't preminted yet should not have an owner - await expect(bosonVoucher.ownerOf(start + amount + 1)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); + await offerHandler.connect(assistant).createOffer(offer, offerDates, offerDurations, disputeResolverId, "0"); - // Seller's balance should be updated for the total mint amount - let sellerBalanceAfter = await bosonVoucher.balanceOf(await assistant.getAddress()); - assert.equal(sellerBalanceAfter.toNumber(), sellerBalanceBefore + amount.toNumber(), "Balance mismatch"); - - // Get available premints from contract - const availablePremints = await bosonVoucher.getAvailablePreMints(offerId); - assert.equal(availablePremints.toNumber(), Number(length) - Number(amount), "Available Premints mismatch"); - }); + // reserve a range + start = "1010"; + length = "1000"; + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await bosonVoucher.getAddress()); + }); - it("MetaTx: forwarder can execute preMint on behalf of seller", async function () { - const nonce = Number(await forwarder.getNonce(await assistant.getAddress())); + it("Transfer event should emit contract address", async function () { + // Premint tokens, test for event + const tx = await bosonVoucher.connect(assistant).preMint(offerId, amount); - const types = { - ForwardRequest: [ - { name: "from", type: "address" }, - { name: "to", type: "address" }, - { name: "nonce", type: "uint256" }, - { name: "data", type: "bytes" }, - ], - }; + // Expect an event for every mint + start = deriveTokenId(offerId, start); + for (let i = 0; i < Number(amount); i++) { + await expect(tx) + .to.emit(bosonVoucher, "Transfer") + .withArgs(ZeroAddress, await bosonVoucher.getAddress(), start + BigInt(i)); + } + }); - const functionSignature = bosonVoucher.interface.encodeFunctionData("preMint", [offerId, amount]); + it("Should update state", async function () { + let contractBalanceBefore = await bosonVoucher.balanceOf(await bosonVoucher.getAddress()); - const message = { - from: await assistant.getAddress(), - to: await bosonVoucher.getAddress(), - nonce: nonce, - data: functionSignature, - }; + // Premint tokens + await bosonVoucher.connect(assistant).preMint(offerId, amount); - const { signature } = await prepareDataSignatureParameters( - assistant, - types, - "ForwardRequest", - message, - await forwarder.getAddress(), - "MockForwarder", - "0.0.1", - "0Z" - ); + // Expect a correct owner for all preminted tokens + start = deriveTokenId(offerId, start); + for (let i = 0; i < Number(amount); i++) { + let tokenId = start + BigInt(i); + let tokenOwner = await bosonVoucher.ownerOf(tokenId); + assert.equal(tokenOwner, await bosonVoucher.getAddress(), `Wrong token owner for token ${tokenId}`); + } - const tx = await forwarder.execute(message, signature); + // Token that is inside a range, but wasn't preminted yet should not have an owner + await expect(bosonVoucher.ownerOf(start + amount + 1)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); - // Expect an event for every mint - start = deriveTokenId(offerId, start); - for (let i = 0; i < Number(amount); i++) { - await expect(tx) - .to.emit(bosonVoucher, "Transfer") - .withArgs(ZeroAddress, await assistant.getAddress(), start + i); - } - }); + // Contract's balance should be updated for the total mint amount + let contractBalanceAfter = await bosonVoucher.balanceOf(await bosonVoucher.getAddress()); + assert.equal(contractBalanceAfter, contractBalanceBefore + BigInt(amount), "Balance mismatch"); - context("💔 Revert Reasons", async function () { - it("Caller is not the owner", async function () { - await expect(bosonVoucher.connect(rando).preMint(offerId, amount)).to.be.revertedWith( - RevertReasons.OWNABLE_NOT_OWNER - ); + // Get available premints from contract + const availablePremints = await bosonVoucher.getAvailablePreMints(offerId); + assert.equal(availablePremints, BigInt(length) - BigInt(amount), "Available Premints mismatch"); + }); }); - it("Offer id is not associated with a range", async function () { - // Set invalid offer id - offerId = 15; - - // Try to premint, it should fail - await expect(bosonVoucher.connect(assistant).preMint(offerId, amount)).to.be.revertedWith( - RevertReasons.NO_RESERVED_RANGE_FOR_OFFER - ); - }); + it("Should update state", async function () { + let sellerBalanceBefore = await bosonVoucher.balanceOf(await assistant.getAddress()); - it("Amount to mint is more than remaining un-minted in range", async function () { - // Mint 50 tokens + // Premint tokens await bosonVoucher.connect(assistant).preMint(offerId, amount); - // Set invalid amount - amount = "990"; // length is 1000, already minted 50 + // Expect a correct owner for all preminted tokens + start = deriveTokenId(offerId, start); + for (let i = 0; i < Number(amount); i++) { + let tokenId = start + BigInt(i); + let tokenOwner = await bosonVoucher.ownerOf(tokenId); + assert.equal(tokenOwner, await assistant.getAddress(), `Wrong token owner for token ${tokenId}`); + } - // Try to premint, it should fail - await expect(bosonVoucher.connect(assistant).preMint(offerId, amount)).to.be.revertedWith( - RevertReasons.INVALID_AMOUNT_TO_MINT + // Token that is inside a range, but wasn't preminted yet should not have an owner + await expect(bosonVoucher.ownerOf(start + BigInt(amount) + 1n)).to.be.revertedWith( + RevertReasons.ERC721_NON_EXISTENT ); - }); - - it("Too many to mint in a single transaction", async function () { - await mockProtocol.mock.getMaxPremintedVouchers.returns("100"); - // Set invalid amount - amount = "101"; + // Seller's balance should be updated for the total mint amount + let sellerBalanceAfter = await bosonVoucher.balanceOf(await assistant.getAddress()); + assert.equal(sellerBalanceAfter, sellerBalanceBefore + BigInt(amount), "Balance mismatch"); - // Try to premint, it should fail - await expect(bosonVoucher.connect(assistant).preMint(offerId, amount)).to.be.revertedWith( - RevertReasons.TOO_MANY_TO_MINT - ); + // Get available premints from contract + const availablePremints = await bosonVoucher.getAvailablePreMints(offerId); + assert.equal(availablePremints, BigInt(length) - BigInt(amount), "Available Premints mismatch"); }); - it("Offer already expired", async function () { - // Skip to after offer expiration - await setNextBlockTimestamp((BigInt(offerDates.validUntil) + 1n).toString()); - - // Try to premint, it should fail - await expect(bosonVoucher.connect(assistant).preMint(offerId, amount)).to.be.revertedWith( - RevertReasons.OFFER_EXPIRED_OR_VOIDED + it("MetaTx: forwarder can execute preMint on behalf of seller", async function () { + const nonce = Number(await forwarder.getNonce(await assistant.getAddress())); + + const types = { + ForwardRequest: [ + { name: "from", type: "address" }, + { name: "to", type: "address" }, + { name: "nonce", type: "uint256" }, + { name: "data", type: "bytes" }, + ], + }; + + const functionSignature = bosonVoucher.interface.encodeFunctionData("preMint", [offerId, amount]); + + const message = { + from: await assistant.getAddress(), + to: await bosonVoucher.getAddress(), + nonce: nonce, + data: functionSignature, + }; + + const { signature } = await prepareDataSignatureParameters( + assistant, + types, + "ForwardRequest", + message, + await forwarder.getAddress(), + "MockForwarder", + "0.0.1", + "0Z" ); - }); - it("Offer is voided", async function () { - // Make offer voided - offer.voided = true; - await mockProtocol.mock.getOffer.returns( - true, - offer, - offerDates, - offerDurations, - disputeResolutionTerms, - offerFees - ); + const tx = await forwarder.execute(message, signature); - // Try to premint, it should fail - await expect(bosonVoucher.connect(assistant).preMint(offerId, amount)).to.be.revertedWith( - RevertReasons.OFFER_EXPIRED_OR_VOIDED - ); + // Expect an event for every mint + start = deriveTokenId(offerId, start); + for (let i = 0; i < Number(amount); i++) { + await expect(tx) + .to.emit(bosonVoucher, "Transfer") + .withArgs(ZeroAddress, await assistant.getAddress(), start + BigInt(i)); + } }); - }); - }); - context("burnPremintedVouchers()", function () { - let offerId, start, length, amount; - let mockProtocol; - let offer, offerDates, offerDurations, offerFees, disputeResolutionTerms; - let maxPremintedVouchers; + context("💔 Revert Reasons", async function () { + it("Caller is not the owner", async function () { + await expect(bosonVoucher.connect(rando).preMint(offerId, amount)).to.be.revertedWith( + RevertReasons.OWNABLE_NOT_OWNER + ); + }); - beforeEach(async function () { - offerId = "5"; - maxPremintedVouchers = "10"; - - mockProtocol = await deployMockProtocol(); - ({ offer, offerDates, offerDurations, offerFees } = await mockOffer()); - disputeResolutionTerms = new DisputeResolutionTerms("0", "0", "0", "0"); - await mockProtocol.mock.getMaxPremintedVouchers.returns(maxPremintedVouchers); - await mockProtocol.mock.getOffer - .withArgs(offerId) - .returns(true, offer, offerDates, offerDurations, disputeResolutionTerms, offerFees); - - // reserve a range - start = "10"; - length = "1000"; - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); - - // amount to mint - amount = "5"; - await bosonVoucher.connect(assistant).preMint(offerId, amount); - - // "void" the offer - offer.voided = true; - await mockProtocol.mock.getOffer - .withArgs(offerId) - .returns(true, offer, offerDates, offerDurations, disputeResolutionTerms, offerFees); - }); + it("Offer id is not associated with a range", async function () { + // Set invalid offer id + offerId = 15; - it("Should emit Transfer events", async function () { - // Burn tokens, test for event - const tx = await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); + // Try to premint, it should fail + await expect(bosonVoucher.connect(assistant).preMint(offerId, amount)).to.be.revertedWith( + RevertReasons.NO_RESERVED_RANGE_FOR_OFFER + ); + }); - // Number of events emitted should be equal to amount - assert.equal((await tx.wait()).events.length, Number(amount), "Wrong number of events emitted"); + it("Amount to mint is more than remaining un-minted in range", async function () { + // Mint 50 tokens + await bosonVoucher.connect(assistant).preMint(offerId, amount); - // Expect an event for every burn - start = deriveTokenId(offerId, start); - for (let i = 0; i < Number(amount); i++) { - await expect(tx) - .to.emit(bosonVoucher, "Transfer") - .withArgs(await assistant.getAddress(), ZeroAddress, start + i); - } - }); + // Set invalid amount + amount = "990"; // length is 1000, already minted 50 - it("Should update state", async function () { - let sellerBalanceBefore = await bosonVoucher.balanceOf(await assistant.getAddress()); - - // Burn tokens - await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); - - // All burned tokens should not have an owner - const startId = deriveTokenId(offerId, start); - for (let i = 0; i < Number(amount); i++) { - let tokenId = startId + i; - await expect(bosonVoucher.ownerOf(tokenId)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); - } - - // Seller's balance should be decreased for the total burn amount - let sellerBalanceAfter = await bosonVoucher.balanceOf(await assistant.getAddress()); - assert.equal(sellerBalanceAfter.toNumber(), sellerBalanceBefore - amount.toNumber(), "Balance mismatch"); - - // Get available premints from contract - const availablePremints = await bosonVoucher.getAvailablePreMints(offerId); - assert.equal(availablePremints.toNumber(), 0, "Available Premints mismatch"); - - // Last burned id should be updated - const tokenIdStart = deriveTokenId(offerId, start); - const lastBurnedId = tokenIdStart + amount - 1; - const range = new Range( - tokenIdStart.toString(), - length, - amount, - lastBurnedId.toString(), - await assistant.getAddress() - ); - const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); - assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); - }); + // Try to premint, it should fail + await expect(bosonVoucher.connect(assistant).preMint(offerId, amount)).to.be.revertedWith( + RevertReasons.INVALID_AMOUNT_TO_MINT + ); + }); - context("Contract owner is not owner of preminted vouchers", function () { - it("Ownership is transferred", async function () { - // Transfer ownership to rando - await bosonVoucher.connect(protocol).transferOwnership(await rando.getAddress()); + it("Offer already expired", async function () { + // Skip to after offer expiration + await setNextBlockTimestamp(Number(BigInt(offerDates.validUntil) + 1n)); - // Burn tokens, test for event - let tx; - await expect(() => { - tx = bosonVoucher.connect(rando).burnPremintedVouchers(offerId); - return tx; - }).to.changeTokenBalance(bosonVoucher, assistant, Number(amount) * -1n); + // Try to premint, it should fail + await expect(bosonVoucher.connect(assistant).preMint(offerId, amount)).to.be.revertedWith( + RevertReasons.OFFER_EXPIRED_OR_VOIDED + ); + }); - // Number of events emitted should be equal to amount - tx = await tx; - assert.equal((await tx.wait()).events.length, Number(amount), "Wrong number of events emitted"); + it("Offer is voided", async function () { + await offerHandler.connect(assistant).voidOffer(offerId); - // Expect an event for every burn, where owner is the old owner (assistant) - const tokenIdStart = deriveTokenId(offerId, start); - for (let i = 0; i < Number(amount); i++) { - await expect(tx) - .to.emit(bosonVoucher, "Transfer") - .withArgs(await assistant.getAddress(), ZeroAddress, tokenIdStart + i); - } + // Try to premint, it should fail + await expect(bosonVoucher.connect(assistant).preMint(offerId, amount)).to.be.revertedWith( + RevertReasons.OFFER_EXPIRED_OR_VOIDED + ); + }); }); + }); - it("Contract itself is the owner", async function () { - // create a new offer, so new range owner can be set - offerId = "6"; - offer.voided = false; - await mockProtocol.mock.getOffer - .withArgs(offerId) - .returns(true, offer, offerDates, offerDurations, disputeResolutionTerms, offerFees); + context("burnPremintedVouchers()", function () { + let offerId, start, length, amount; + + beforeEach(async function () { + offerId = "1"; // reserve a range - start = "2000"; - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await bosonVoucher.getAddress()); + start = "1"; + length = "1000"; + + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); // amount to mint - amount = "10"; + amount = "5"; await bosonVoucher.connect(assistant).preMint(offerId, amount); - // "void" the offer - offer.voided = true; - await mockProtocol.mock.getOffer - .withArgs(offerId) - .returns(true, offer, offerDates, offerDurations, disputeResolutionTerms, offerFees); + // Void offer + await offerHandler.connect(assistant).voidOffer(offerId); + }); + it("Should emit Transfer events", async function () { // Burn tokens, test for event - let tx; - await expect(() => { - tx = bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); - return tx; - }).to.changeTokenBalance(bosonVoucher, bosonVoucher, Number(amount) * -1n); - - // Number of events emitted should be equal to amount - tx = await tx; - assert.equal((await tx.wait()).events.length, Number(amount), "Wrong number of events emitted"); + const tx = await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); // Expect an event for every burn - const tokenIdStart = deriveTokenId(offerId, start); + start = deriveTokenId(offerId, start); for (let i = 0; i < Number(amount); i++) { await expect(tx) .to.emit(bosonVoucher, "Transfer") - .withArgs(await bosonVoucher.getAddress(), ZeroAddress, tokenIdStart + i); + .withArgs(await assistant.getAddress(), ZeroAddress, start + BigInt(i)); } }); - }); - it("Should burn all vouchers if there is less than MaxPremintedVouchers to burn", async function () { - // Burn tokens, test for event - let tx = await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); - - // Number of events emitted should be equal to amount - assert.equal((await tx.wait()).events.length, Number(amount), "Wrong number of events emitted"); - - // Last burned id should be updated - const tokenIdStart = deriveTokenId(offerId, start); - const lastBurnedId = tokenIdStart + amount - 1; - const range = new Range( - tokenIdStart.toString(), - length, - amount, - lastBurnedId.toString(), - await assistant.getAddress() - ); - const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); - assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); + it("Should update state", async function () { + let sellerBalanceBefore = await bosonVoucher.balanceOf(await assistant.getAddress()); - // Second call should revert since there's nothing to burn - await expect(bosonVoucher.connect(assistant).burnPremintedVouchers(offerId)).to.be.revertedWith( - RevertReasons.NOTHING_TO_BURN - ); - }); + // Burn tokens + await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); - it("Should burn only first MaxPremintedVouchers vouchers if there is more than MaxPremintedVouchers to burn", async function () { - // make offer not voided so premint is possible - offer.voided = false; - await mockProtocol.mock.getOffer - .withArgs(offerId) - .returns(true, offer, offerDates, offerDurations, disputeResolutionTerms, offerFees); - - // Mint another 10 vouchers, so that there are 15 in total - await bosonVoucher.connect(assistant).preMint(offerId, 10); - amount = `${Number(amount) + 10}`; - - // "void" the offer - offer.voided = true; - await mockProtocol.mock.getOffer - .withArgs(offerId) - .returns(true, offer, offerDates, offerDurations, disputeResolutionTerms, offerFees); - - // Burn tokens, test for event - let tx = await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); - - // Number of events emitted should be equal to maxPremintedVouchers - assert.equal((await tx.wait()).events.length, Number(maxPremintedVouchers), "Wrong number of events emitted"); - - // Last burned id should be updated - const tokenIdStart = deriveTokenId(offerId, start); - let lastBurnedId = tokenIdStart + maxPremintedVouchers - 1; - let range = new Range( - tokenIdStart.toString(), - length, - amount, - lastBurnedId.toString(), - await assistant.getAddress() - ); - let returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); - assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); + // All burned tokens should not have an owner + const startId = deriveTokenId(offerId, start); + for (let i = 0; i < Number(amount); i++) { + let tokenId = startId + BigInt(i); + await expect(bosonVoucher.ownerOf(tokenId)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); + } - // Second call should burn the difference - tx = await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); + // Seller's balance should be decreased for the total burn amount + let sellerBalanceAfter = await bosonVoucher.balanceOf(await assistant.getAddress()); + assert.equal(sellerBalanceAfter, sellerBalanceBefore - BigInt(amount), "Balance mismatch"); - // Number of events emitted should be equal to amount - assert.equal( - (await tx.wait()).events.length, - Number(amount) - maxPremintedVouchers, - "Wrong number of events emitted" - ); + // Get available premints from contract + const availablePremints = await bosonVoucher.getAvailablePreMints(offerId); + assert.equal(availablePremints, 0n, "Available Premints mismatch"); - // Last burned id should be updated - lastBurnedId = tokenIdStart + amount - 1; - range = new Range(tokenIdStart.toString(), length, amount, lastBurnedId.toString(), await assistant.getAddress()); - returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); - assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); - - // All burned tokens should not have an owner - for (let i = 0; i < Number(amount); i++) { - let tokenId = tokenIdStart + i; - await expect(bosonVoucher.ownerOf(tokenId)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); - } - - // Second call should revert since there's nothing to burn - await expect(bosonVoucher.connect(assistant).burnPremintedVouchers(offerId)).to.be.revertedWith( - RevertReasons.NOTHING_TO_BURN - ); - }); + // Last burned id should be updated + const tokenIdStart = deriveTokenId(offerId, start); + const lastBurnedId = tokenIdStart + BigInt(amount) - 1n; + const range = new Range( + tokenIdStart.toString(), + length, + amount, + lastBurnedId.toString(), + await assistant.getAddress() + ); + const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); + assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); + }); - it("Should skip all vouchers were already committed", async function () { - let committedVouchers = [11, 14].map((tokenId) => deriveTokenId(offerId, tokenId).toString()); + context("Contract owner is not owner of preminted vouchers", function () { + it("Ownership is transferred", async function () { + // Transfer ownership to rando + await bosonVoucher.connect(protocol).transferOwnership(await rando.getAddress()); + + // Burn tokens, test for event + let tx; + await expect(() => { + tx = bosonVoucher.connect(rando).burnPremintedVouchers(offerId); + return tx; + }).to.changeTokenBalance(bosonVoucher, assistant, BigInt(amount) * -1n); + + // Expect an event for every burn, where owner is the old owner (assistant) + const tokenIdStart = deriveTokenId(offerId, start); + for (let i = 0; i < Number(amount); i++) { + await expect(tx) + .to.emit(bosonVoucher, "Transfer") + .withArgs(await assistant.getAddress(), ZeroAddress, tokenIdStart + BigInt(i)); + } + }); - // Transfer some preminted vouchers - const assistant = await assistant.getAddress(); - const buyer = await buyer.getAddress(); - await mockProtocol.mock.commitToPreMintedOffer.returns(); - await Promise.all( - committedVouchers.map((tokenId) => bosonVoucher.connect(assistant).transferFrom(assistant, buyer, tokenId)) - ); + it("Contract itself is the owner", async function () { + offer.id = offerId = ++offerId; + offer.quantityAvailable = "2000"; - // Burn tokens, test for event - let tx = await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); + await offerHandler.connect(assistant).createOffer(offer, offerDates, offerDurations, disputeResolverId, "0"); - // Number of events emitted should be equal to amount of preminted vouchers decreased by length of committed vouchers - // We test this to indirectly verify that no events were emitted for committed vouchers - assert.equal( - (await tx.wait()).events.length, - Number(amount) - committedVouchers.length, - "Wrong number of events emitted" - ); + // reserve a range + start = "2000"; + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await bosonVoucher.getAddress()); - // All burned tokens should not have an owner, but commited ones should - const startId = deriveTokenId(offerId, start); - for (let i = 0; i < Number(amount); i++) { - let tokenId = startId + i.toString(); - if (committedVouchers.includes(tokenId)) { - // Check that owner is buyer. - expect(await bosonVoucher.ownerOf(tokenId)).to.equal(await buyer.getAddress()); - } else { - // Check that Transfer event was emitted and owner does not exist anymore - await expect(tx) - .to.emit(bosonVoucher, "Transfer") - .withArgs(await assistant.getAddress(), ZeroAddress, tokenId); - await expect(bosonVoucher.ownerOf(tokenId)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); - } - } - - // Last burned id should be updated - const tokenIdStart = deriveTokenId(offerId, start); - const lastBurnedId = tokenIdStart + amount - 1; - const range = new Range( - tokenIdStart.toString(), - length, - amount, - lastBurnedId.toString(), - await assistant.getAddress() - ); - const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); - assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); - }); + // amount to mint + amount = "10"; + await bosonVoucher.connect(assistant).preMint(offerId, amount); - it("Burning is possible if offer not voided, but just expired", async function () { - // make offer not voided so premint is possible - offer.voided = false; - await mockProtocol.mock.getOffer - .withArgs(offerId) - .returns(true, offer, offerDates, offerDurations, disputeResolutionTerms, offerFees); - // skip to after offer expiration - await setNextBlockTimestamp((BigInt(offerDates.validUntil) + 1n).toString()); + await offerHandler.connect(assistant).voidOffer(offerId); - // Burn tokens, test for event - const tx = await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); + // Burn tokens, test for event + let tx; + await expect(() => { + tx = bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); + return tx; + }).to.changeTokenBalance(bosonVoucher, bosonVoucher, BigInt(amount) * -1n); - // Number of events emitted should be equal to amount - assert.equal((await tx.wait()).events.length, Number(amount), "Wrong number of events emitted"); - - // Expect an event for every burn - start = deriveTokenId(offerId, start); - for (let i = 0; i < Number(amount); i++) { - await expect(tx) - .to.emit(bosonVoucher, "Transfer") - .withArgs(await assistant.getAddress(), ZeroAddress, start + i); - } - }); - - context("💔 Revert Reasons", async function () { - it("Caller is not the owner", async function () { - await expect(bosonVoucher.connect(rando).burnPremintedVouchers(offerId)).to.be.revertedWith( - RevertReasons.OWNABLE_NOT_OWNER - ); - }); - - it("Offer id is not associated with a range", async function () { - // Set invalid offer id - offerId = 15; - - // Try to burn, it should fail - await expect(bosonVoucher.connect(assistant).burnPremintedVouchers(offerId)).to.be.revertedWith( - RevertReasons.NO_RESERVED_RANGE_FOR_OFFER - ); + // Expect an event for every burn + const tokenIdStart = deriveTokenId(offerId, start); + for (let i = 0; i < Number(amount); i++) { + await expect(tx) + .to.emit(bosonVoucher, "Transfer") + .withArgs(await bosonVoucher.getAddress(), ZeroAddress, tokenIdStart + BigInt(i)); + } + }); }); - it("Offer is still valid", async function () { - // make offer not voided + it("Should skip all vouchers were already committed", async function () { + // make offer not voided so premint is possible offer.voided = false; - await mockProtocol.mock.getOffer - .withArgs(offerId) - .returns(true, offer, offerDates, offerDurations, disputeResolutionTerms, offerFees); + // make offer not voided + offer.id = offerId = ++offerId; + length = amount = "10"; + start = "1"; - // Try to burn, it should fail - await expect(bosonVoucher.connect(assistant).burnPremintedVouchers(offerId)).to.be.revertedWith( - RevertReasons.OFFER_STILL_VALID - ); - }); + const assistantAddress = await assistant.getAddress(); - it("Nothing to burn", async function () { - // Burn tokens - await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); + await offerHandler.connect(assistant).createOffer(offer, offerDates, offerDurations, disputeResolverId, "0"); - // Try to burn, it should fail - await expect(bosonVoucher.connect(assistant).burnPremintedVouchers(offerId)).to.be.revertedWith( - RevertReasons.NOTHING_TO_BURN - ); - }); - }); - }); + await offerHandler.connect(assistant).reserveRange(offerId, length, assistantAddress); - context("getAvailablePreMints()", function () { - let offerId, start, length, amount; - let offer, offerDates, offerDurations, offerFees; - let disputeResolutionTerms; - let mockProtocol; + await bosonVoucher.connect(assistant).preMint(offerId, length); - beforeEach(async function () { - // reserve a range - offerId = "5"; - start = "10"; - length = "1000"; - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); - - // amount to mint - amount = 50; - - mockProtocol = await deployMockProtocol(); - ({ offer, offerDates, offerDurations, offerFees } = await mockOffer()); - disputeResolutionTerms = new DisputeResolutionTerms("0", "0", "0", "0"); - await mockProtocol.mock.getMaxPremintedVouchers.returns("1000"); - await mockProtocol.mock.getOffer.returns( - true, - offer, - offerDates, - offerDurations, - disputeResolutionTerms, - offerFees - ); - }); + let committedVouchers = [2, 4].map((tokenId) => deriveTokenId(offerId, tokenId)); - it("If nothing was preminted, return full range", async function () { - // Get available premints from contract - const availablePremints = await bosonVoucher.getAvailablePreMints(offerId); - assert.equal(availablePremints.toString(), length, "Available Premints mismatch"); - }); - - it("Part of range is preminted", async function () { - // Premint tokens - await bosonVoucher.connect(assistant).preMint(offerId, amount); - - // Get available premints from contract - let newAmount = Number(length) - Number(amount); - let availablePremints = await bosonVoucher.getAvailablePreMints(offerId); - assert.equal(availablePremints.toNumber(), newAmount, "Available Premints mismatch"); + // Transfer some preminted vouchers + const buyerAddress = await buyer.getAddress(); + await Promise.all( + committedVouchers.map((tokenId) => + bosonVoucher.connect(assistant).transferFrom(assistantAddress, buyerAddress, tokenId) + ) + ); - // Premint again - await bosonVoucher.connect(assistant).preMint(offerId, amount); - newAmount -= Number(amount); - availablePremints = await bosonVoucher.getAvailablePreMints(offerId); - assert.equal(availablePremints.toNumber(), newAmount, "Available Premints mismatch"); - }); + await offerHandler.connect(assistant).voidOffer(offerId); - it("Range is fully minted", async function () { - // Adjust config value - await configHandler.connect(deployer).setMaxPremintedVouchers(length); + // Burn tokens, test for event + let tx = await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); + + // All burned tokens should not have an owner, but commited ones should + const startId = deriveTokenId(offerId, start); + for (let i = 0; i < Number(length); i++) { + let tokenId = startId + BigInt(i); + if (committedVouchers.includes(tokenId)) { + // Check that owner is buyer. + expect(await bosonVoucher.ownerOf(tokenId)).to.equal(buyerAddress); + } else { + // Check that Transfer event was emitted and owner does not exist anymore + await expect(tx) + .to.emit(bosonVoucher, "Transfer") + .withArgs(await assistant.getAddress(), ZeroAddress, tokenId); + await expect(bosonVoucher.ownerOf(tokenId)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); + } + } - // Premint tokens - await bosonVoucher.connect(assistant).preMint(offerId, length); + // Last burned id should be updated + const tokenIdStart = deriveTokenId(offerId, start); + const lastBurnedId = tokenIdStart + BigInt(amount) - 1n; + const range = new Range( + tokenIdStart.toString(), + length, + amount, + lastBurnedId.toString(), + await assistant.getAddress() + ); + const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); + assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); + }); - // Get available premints from contract - let availablePremints = await bosonVoucher.getAvailablePreMints(offerId); - assert.equal(availablePremints.toNumber(), 0, "Available Premints mismatch"); - }); + it("Burning is possible if offer not voided, but just expired", async function () { + // make offer not voided so premint is possible + offer.voided = false; + // make offer not voided + offer.id = offerId = ++offerId; - it("Range for offer does not exist", async function () { - // Set invalid offer id - offerId = "20"; + await offerHandler.connect(assistant).createOffer(offer, offerDates, offerDurations, disputeResolverId, "0"); - // Get available premints from contract - let availablePremints = await bosonVoucher.getAvailablePreMints(offerId); - assert.equal(availablePremints.toNumber(), 0, "Available Premints mismatch"); - }); + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); - it("Should be 0 if offer is voided", async function () { - // void offer - offer.voided = true; - await mockProtocol.mock.getOffer.returns( - true, - offer, - offerDates, - offerDurations, - disputeResolutionTerms, - offerFees - ); + // Mint another 10 vouchers, so that there are 15 in total + await bosonVoucher.connect(assistant).preMint(offerId, 10); - // Get available premints from contract - let availablePremints = await bosonVoucher.getAvailablePreMints(offerId); - assert.equal(availablePremints.toNumber(), 0, "Available Premints mismatch"); - }); + // skip to after offer expiration + await setNextBlockTimestamp(Number(BigInt(offerDates.validUntil) + 1n)); - it("Should be 0 if offer is expired", async function () { - // Skip to after offer expiry - await setNextBlockTimestamp((BigInt(offerDates.validUntil) + 1n).toString()); + // Burn tokens, test for event + const tx = await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); - // Get available premints from contract - let availablePremints = await bosonVoucher.getAvailablePreMints(offerId); - assert.equal(availablePremints.toNumber(), 0, "Available Premints mismatch"); - }); - }); + // Expect an event for every burn + start = deriveTokenId(offerId, start); + for (let i = 0; i < Number(amount); i++) { + await expect(tx) + .to.emit(bosonVoucher, "Transfer") + .withArgs(await assistant.getAddress(), ZeroAddress, start + BigInt(i)); + } + }); - context("getRange()", function () { - let offerId, start, length, amount; - let range; + context("💔 Revert Reasons", async function () { + it("Caller is not the owner", async function () { + await expect(bosonVoucher.connect(rando).burnPremintedVouchers(offerId)).to.be.revertedWith( + RevertReasons.OWNABLE_NOT_OWNER + ); + }); - beforeEach(async function () { - // reserve a range - offerId = "5"; - start = "10"; - length = "1000"; - const tokenIdStart = deriveTokenId(offerId, start); - - range = new Range(tokenIdStart.toString(), length, "0", "0", await assistant.getAddress()); - - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); - - const mockProtocol = await deployMockProtocol(); - const { offer, offerDates, offerDurations, offerFees } = await mockOffer(); - const disputeResolutionTerms = new DisputeResolutionTerms("0", "0", "0", "0"); - await mockProtocol.mock.getMaxPremintedVouchers.returns("1000"); - await mockProtocol.mock.getOffer.returns( - true, - offer, - offerDates, - offerDurations, - disputeResolutionTerms, - offerFees - ); + it("Offer id is not associated with a range", async function () { + // Set invalid offer id + offerId = 15; - // amount to premint - amount = "50"; - range.minted = amount; - await bosonVoucher.connect(assistant).preMint(offerId, amount); - }); + // Try to burn, it should fail + await expect(bosonVoucher.connect(assistant).burnPremintedVouchers(offerId)).to.be.revertedWith( + RevertReasons.NO_RESERVED_RANGE_FOR_OFFER + ); + }); - it("Get range object for offer with reserved range", async function () { - // Get range object from contract - const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); - assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); - }); + it("Offer is still valid", async function () { + // make offer not voided + offer.id = offerId = ++offerId; - it("Get empty range if offer has no reserved ranges", async function () { - // Set invalid offer and empty range - offerId = "20"; - range = new Range("0", "0", "0", "0", ZeroAddress); + await offerHandler.connect(assistant).createOffer(offer, offerDates, offerDurations, disputeResolverId, "0"); - // Get range object from contract - const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); - assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); - }); - }); + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); - context("ownerOf()", function () { - let offerId, start, length, amount; - let offer, offerDates, offerDurations, offerFees, disputeResolutionTerms; - let mockProtocol; + // Mint another 10 vouchers, so that there are 15 in total + await bosonVoucher.connect(assistant).preMint(offerId, 10); - context("No preminted tokens", async function () { - it("Returns true owner if token exists", async function () { - let tokenId = "100000"; - // Issue ordinary voucher - await bosonVoucher.connect(protocol).issueVoucher(tokenId, await buyer.getAddress()); + // Try to burn, it should fail + await expect(bosonVoucher.connect(assistant).burnPremintedVouchers(offerId)).to.be.revertedWith( + RevertReasons.OFFER_STILL_VALID + ); + }); - // Token owner should be the buyer - let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, await buyer.getAddress(), "Token owner mismatch"); - }); + it("Nothing to burn", async function () { + // Burn tokens + await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); - context("💔 Revert Reasons", async function () { - it("Token does not exist", async function () { - let tokenId = "10"; - await expect(bosonVoucher.connect(rando).ownerOf(tokenId)).to.be.revertedWith( - RevertReasons.ERC721_NON_EXISTENT + // Try to burn, it should fail + await expect(bosonVoucher.connect(assistant).burnPremintedVouchers(offerId)).to.be.revertedWith( + RevertReasons.NOTHING_TO_BURN ); }); }); }); - context("With preminted tokens", async function () { + context("getAvailablePreMints()", function () { + let offerId, start, length, amount; + beforeEach(async function () { // reserve a range - offerId = "5"; + offerId = "1"; start = "10"; - length = "150"; + length = "990"; await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); - mockProtocol = await deployMockProtocol(); - ({ offer, offerDates, offerDurations, offerFees } = await mockOffer()); - disputeResolutionTerms = new DisputeResolutionTerms("0", "0", "0", "0"); - await mockProtocol.mock.getMaxPremintedVouchers.returns("1000"); - await mockProtocol.mock.getOffer.returns( - true, - offer, - offerDates, - offerDurations, - disputeResolutionTerms, - offerFees - ); - - // amount to premint + // amount to mint amount = 50; - await bosonVoucher.connect(assistant).preMint(offerId, amount); }); - it("Returns true owner if token exists - via issue voucher", async function () { - let tokenId = "100000"; + it("If nothing was preminted, return full range", async function () { + // Get available premints from contract + const availablePremints = await bosonVoucher.getAvailablePreMints(offerId); + assert.equal(availablePremints.toString(), length, "Available Premints mismatch"); + }); - // Define what should be returned when getExchange is called - await mockProtocol.mock.getExchange.withArgs(tokenId).returns(true, mockExchange({ offerId }), mockVoucher()); + it("Part of range is preminted", async function () { + // Premint tokens + await bosonVoucher.connect(assistant).preMint(offerId, amount); - // Issue ordinary voucher - await bosonVoucher.connect(protocol).issueVoucher(tokenId, await buyer.getAddress()); + // Get available premints from contract + let newAmount = BigInt(length) - BigInt(amount); + let availablePremints = await bosonVoucher.getAvailablePreMints(offerId); + assert.equal(availablePremints, newAmount, "Available Premints mismatch"); - // Token owner should be the buyer - let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, await buyer.getAddress(), "Token owner mismatch"); + // Premint again + await bosonVoucher.connect(assistant).preMint(offerId, amount); + newAmount -= BigInt(amount); + availablePremints = await bosonVoucher.getAvailablePreMints(offerId); + assert.equal(availablePremints, newAmount, "Available Premints mismatch"); }); - it("Returns true owner if token exists - via preminted voucher transfer.", async function () { - let exchangeId = "25"; // tokens between 10 and 60 are preminted - const tokenId = deriveTokenId(offerId, exchangeId); + it("Range is fully minted", async function () { + // Adjust config value + await configHandler.connect(deployer).setMaxPremintedVouchers(length); - const mockProtocol = await deployMockProtocol(); + // Premint tokens + await bosonVoucher.connect(assistant).preMint(offerId, length); - // Define what should be returned when commitToPreMintedOffer is called - await mockProtocol.mock.commitToPreMintedOffer.returns(); + // Get available premints from contract + let availablePremints = await bosonVoucher.getAvailablePreMints(offerId); + assert.equal(availablePremints, 0, "Available Premints mismatch"); + }); - // Transfer preminted token - await bosonVoucher - .connect(assistant) - .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); + it("Range for offer does not exist", async function () { + // Set invalid offer id + offerId = "20"; - // Token owner should be the buyer - let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, await buyer.getAddress(), "Token owner mismatch"); + // Get available premints from contract + let availablePremints = await bosonVoucher.getAvailablePreMints(offerId); + assert.equal(availablePremints, 0, "Available Premints mismatch"); }); - it("Returns seller if token is preminted and not transferred yet", async function () { - // Token owner should be the seller for all preminted tokens - let startTokenId = deriveTokenId(offerId, start); - let endTokenId = startTokenId + amount; - for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { - let tokenOwner = await bosonVoucher.ownerOf(i); - assert.equal(tokenOwner, await assistant.getAddress(), `Token owner mismatch ${i.toString()}`); - } + it("Should be 0 if offer is voided", async function () { + await offerHandler.connect(assistant).voidOffer(offerId); + + // Get available premints from contract + let availablePremints = await bosonVoucher.getAvailablePreMints(offerId); + assert.equal(availablePremints, 0, "Available Premints mismatch"); }); - it("Multiple ranges", async function () { - // Add five more ranges - // This tests more getPreMintStatus than ownerOf - // Might even be put into integration tests - // Adjust config value - await configHandler.connect(deployer).setMaxPremintedVouchers("10000"); - let previousOfferId = Number(offerId); - let previousStartId = Number(start); - let ranges = [new Range(Number(start), length, amount, "0")]; - length = Number(length); + it("Should be 0 if offer is expired", async function () { + // Skip to after offer expiry + await setNextBlockTimestamp(Number(BigInt(offerDates.validUntil) + 1n)); - for (let i = 0; i < 5; i++) { - offerId = previousOfferId + (i + 1) * 6; - start = previousStartId + length + 100; + // Get available premints from contract + let availablePremints = await bosonVoucher.getAvailablePreMints(offerId); + assert.equal(availablePremints, 0, "Available Premints mismatch"); + }); + }); - // reserve length - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); + context("getRange()", function () { + let offerId, start, length, amount; + let range; - // amount to premint - amount = length - i * 30; - await bosonVoucher.connect(assistant).preMint(offerId, amount); - ranges.push(new Range(start, length, amount, "0")); + beforeEach(async function () { + // reserve a range + offerId = "1"; + start = "10"; + length = "990"; + const tokenIdStart = deriveTokenId(offerId, start); - previousStartId = start; - previousOfferId = offerId; - } + range = new Range(tokenIdStart.toString(), length, "0", "0", await assistant.getAddress()); - let endTokenId = previousStartId + length; // last range end - let rangeIndex = 0; - let currentRange = ranges[rangeIndex]; - let currentRangeMintEndId = currentRange.start + currentRange.minted - 1; - let currentRangeEndId = currentRange.start + length - 1; - - offerId = "5"; - for (let i = 0; i < endTokenId; i++) { - const tokenId = deriveTokenId(offerId, i); - if (i < currentRange.start) { - // tokenId not in range - await expect(bosonVoucher.connect(rando).ownerOf(tokenId)).to.be.revertedWith( - RevertReasons.ERC721_NON_EXISTENT - ); - } else if (i <= currentRangeMintEndId) { - // tokenId in range and minted. Seller should be the owner - let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, await assistant.getAddress(), `Token owner mismatch ${tokenId.toString()}`); - } else if (i <= currentRangeEndId) { - // tokenId still in range, but not minted yet - await expect(bosonVoucher.connect(rando).ownerOf(tokenId)).to.be.revertedWith( - RevertReasons.ERC721_NON_EXISTENT - ); - } else { - // tokenId outside the current range - // Change current range - if (rangeIndex < ranges.length) { - currentRange = ranges[++rangeIndex]; - currentRangeMintEndId = currentRange.start + currentRange.minted - 1; - currentRangeEndId = currentRange.start + currentRange.length - 1; - offerId = Number(offerId) + rangeIndex * 6; - } - // Technically, next range could be consecutive and next call should return seller's address - // But range construction in this test ensures gaps between ranges - await expect(bosonVoucher.connect(rando).ownerOf(tokenId)).to.be.revertedWith( - RevertReasons.ERC721_NON_EXISTENT - ); - } - } + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); + + // amount to premint + amount = "50"; + range.minted = amount; + await bosonVoucher.connect(assistant).preMint(offerId, amount); }); - it("Consecutive ranges", async function () { - // Make two consecutive ranges - let nextOfferId = Number(offerId) + 1; - let nextStartId = Number(start) + Number(length); - let nextLength = "10"; - let nextAmount = "5"; + it("Get range object for offer with reserved range", async function () { + // Get range object from contract + const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); + assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); + }); - // reserve length - await bosonVoucher - .connect(protocol) - .reserveRange(nextOfferId, nextStartId, nextLength, await assistant.getAddress()); + it("Get empty range if offer has no reserved ranges", async function () { + // Set invalid offer and empty range + offerId = "20"; + range = new Range("0", "0", "0", "0", ZeroAddress); - // amount to premint - await bosonVoucher.connect(assistant).preMint(nextOfferId, nextAmount); - - // First range - preminted tokens - let startTokenId = deriveTokenId(offerId, start); - let endTokenId = startTokenId + amount; - for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { - let tokenOwner = await bosonVoucher.ownerOf(i); - assert.equal(tokenOwner, await assistant.getAddress(), `Token owner mismatch ${i.toString()}`); - } + // Get range object from contract + const returnedRange = Range.fromStruct(await bosonVoucher.getRangeByOfferId(offerId)); + assert.equal(returnedRange.toString(), range.toString(), "Range mismatch"); + }); + }); - // First range - not preminted tokens - startTokenId = endTokenId; - let endExchangeId = Number(start) + Number(length); - endTokenId = deriveTokenId(offerId, endExchangeId); - for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { - await expect(bosonVoucher.connect(rando).ownerOf(i)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); - } + context("ownerOf()", function () { + let offerId, start, length, amount; - // Second range - preminted tokens - startTokenId = deriveTokenId(nextOfferId, endExchangeId); - endTokenId = startTokenId + nextAmount; - for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { - let tokenOwner = await bosonVoucher.ownerOf(i); - assert.equal(tokenOwner, await assistant.getAddress(), `Token owner mismatch ${i.toString()}`); - } + context("No preminted tokens", async function () { + it("Returns true owner if token exists", async function () { + let tokenId = "100000"; + // Issue ordinary voucher + await bosonVoucher.connect(protocol).issueVoucher(tokenId, await buyer.getAddress()); - // Second range - not preminted tokens - startTokenId = endTokenId; - endExchangeId += Number(nextLength); - endTokenId = deriveTokenId(nextOfferId, endExchangeId); - for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { - await expect(bosonVoucher.connect(rando).ownerOf(i)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); - } - }); + // Token owner should be the buyer + let tokenOwner = await bosonVoucher.ownerOf(tokenId); + assert.equal(tokenOwner, await buyer.getAddress(), "Token owner mismatch"); + }); - context("💔 Revert Reasons", async function () { - it("Token is outside any range and not minted", async function () { - let tokenId = "200000"; - await expect(bosonVoucher.connect(rando).ownerOf(tokenId)).to.be.revertedWith( - RevertReasons.ERC721_NON_EXISTENT - ); + context("💔 Revert Reasons", async function () { + it("Token does not exist", async function () { + let tokenId = "10"; + await expect(bosonVoucher.connect(rando).ownerOf(tokenId)).to.be.revertedWith( + RevertReasons.ERC721_NON_EXISTENT + ); + }); }); + }); - it("Token is inside a range, but not minted yet", async function () { - let startTokenId = deriveTokenId(offerId, Number(start) + Number(amount)); - let endTokenId = deriveTokenId(offerId, Number(start) + Number(length)); + context("With preminted tokens", async function () { + beforeEach(async function () { + // reserve a range + offerId = "1"; + start = "10"; + length = "150"; + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); - // None of reserved but not preminted tokens should have an owner - for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { - await expect(bosonVoucher.connect(rando).ownerOf(i)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); - } + // amount to premint + amount = 50; + await bosonVoucher.connect(assistant).preMint(offerId, amount); }); - it("Token was preminted, transferred and burned", async function () { - let exchangeId = "26"; - const tokenId = deriveTokenId(offerId, exchangeId); - - // Mock exchange handler methods (easier and more efficient than creating a real offer) - const mockProtocol = await deployMockProtocol(); + it("Returns true owner if token exists - via issue voucher", async function () { + let tokenId = "100000"; - // Define what should be returned when commitToPreMintedOffer is called - await mockProtocol.mock.commitToPreMintedOffer.returns(); + // Issue ordinary voucher + await bosonVoucher.connect(protocol).issueVoucher(tokenId, await buyer.getAddress()); - // Token owner should be the seller + // Token owner should be the buyer let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, await assistant.getAddress(), "Token owner mismatch"); + assert.equal(tokenOwner, await buyer.getAddress(), "Token owner mismatch"); + }); + + it("Returns true owner if token exists - via preminted voucher transfer.", async function () { + let exchangeId = "25"; // tokens between 10 and 60 are preminted + const tokenId = deriveTokenId(offerId, exchangeId); // Transfer preminted token await bosonVoucher @@ -1406,507 +1056,866 @@ describe("IBosonVoucher", function () { .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); // Token owner should be the buyer - tokenOwner = await bosonVoucher.ownerOf(tokenId); + let tokenOwner = await bosonVoucher.ownerOf(tokenId); assert.equal(tokenOwner, await buyer.getAddress(), "Token owner mismatch"); + }); - // Simulate burn - await bosonVoucher.connect(protocol).burnVoucher(tokenId); - - // Token should have no owner - await expect(bosonVoucher.connect(rando).ownerOf(tokenId)).to.be.revertedWith( - RevertReasons.ERC721_NON_EXISTENT - ); + it("Returns seller if token is preminted and not transferred yet", async function () { + // Token owner should be the seller for all preminted tokens + let startTokenId = deriveTokenId(offerId, start); + let endTokenId = startTokenId + BigInt(amount); + for (let i = startTokenId; i < endTokenId; i = i + 1n) { + let tokenOwner = await bosonVoucher.ownerOf(i); + assert.equal(tokenOwner, await assistant.getAddress(), `Token owner mismatch ${i.toString()}`); + } }); - it("Token was preminted, not transferred and burned", async function () { - let exchangeId = "26"; - const tokenId = deriveTokenId(offerId, exchangeId); + it.skip("Multiple ranges", async function () { + // Add five more ranges + // This tests more getPreMintStatus than ownerOf + // Might even be put into integration tests + // Adjust config value + await configHandler.connect(deployer).setMaxPremintedVouchers("10000"); + let previousOfferId = Number(offerId); + let previousStartId = Number(start); + let ranges = [new Range(Number(start), length, amount, "0")]; + length = Number(length); - // Token owner should be the seller - let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, await assistant.getAddress(), "Token owner mismatch"); - - // Void the offer - offer.voided = true; - await mockProtocol.mock.getOffer.returns( - true, - offer, - offerDates, - offerDurations, - disputeResolutionTerms, - offerFees - ); + for (let i = 0; i < 5; i++) { + offerId = previousOfferId + (i + 1) * 6; + start = previousStartId + length + 100; - // Burn preminted voucher - await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); + // reserve length + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); - // Token should have no owner - await expect(bosonVoucher.connect(rando).ownerOf(tokenId)).to.be.revertedWith( - RevertReasons.ERC721_NON_EXISTENT - ); - }); - }); - }); - }); + // amount to premint + amount = length - i * 30; + await bosonVoucher.connect(assistant).preMint(offerId, amount); + ranges.push(new Range(start, length, amount, "0")); - context("Token transfers", function () { - let bosonVoucher; + previousStartId = start; + previousOfferId = offerId; + } - afterEach(async function () { - // Reset the accountId iterator - accountId.next(true); - }); + let endTokenId = previousStartId + length; // last range end + let rangeIndex = 0; + let currentRange = ranges[rangeIndex]; + let currentRangeMintEndId = currentRange.start + currentRange.minted - 1; + let currentRangeEndId = currentRange.start + length - 1; + + offerId = "5"; + for (let i = 0; i < endTokenId; i++) { + const tokenId = deriveTokenId(offerId, i); + if (i < currentRange.start) { + // tokenId not in range + await expect(bosonVoucher.connect(rando).ownerOf(tokenId)).to.be.revertedWith( + RevertReasons.ERC721_NON_EXISTENT + ); + } else if (i <= currentRangeMintEndId) { + // tokenId in range and minted. Seller should be the owner + let tokenOwner = await bosonVoucher.ownerOf(tokenId); + assert.equal(tokenOwner, await assistant.getAddress(), `Token owner mismatch ${tokenId.toString()}`); + } else if (i <= currentRangeEndId) { + // tokenId still in range, but not minted yet + await expect(bosonVoucher.connect(rando).ownerOf(tokenId)).to.be.revertedWith( + RevertReasons.ERC721_NON_EXISTENT + ); + } else { + // tokenId outside the current range + // Change current range + if (rangeIndex < ranges.length) { + currentRange = ranges[++rangeIndex]; + currentRangeMintEndId = currentRange.start + currentRange.minted - 1; + currentRangeEndId = currentRange.start + currentRange.length - 1; + offerId = Number(offerId) + rangeIndex * 6; + } + // Technically, next range could be consecutive and next call should return seller's address + // But range construction in this test ensures gaps between ranges + await expect(bosonVoucher.connect(rando).ownerOf(tokenId)).to.be.revertedWith( + RevertReasons.ERC721_NON_EXISTENT + ); + } + } + }); - const transferFunctions = { - "transferFrom()": { - selector: "transferFrom(address,address,uint256)", - }, - "safeTransferFrom()": { - selector: "safeTransferFrom(address,address,uint256)", - }, - "safeTransferFrom() with bytes": { - selector: "safeTransferFrom(address,address,uint256,bytes)", - additionalArgs: ["0x"], - }, - }; + it.skip("Consecutive ranges", async function () { + // Make two consecutive ranges + let nextOfferId = Number(offerId) + 1; + let nextStartId = Number(start) + Number(length); + let nextLength = "10"; + let nextAmount = "5"; - beforeEach(async function () { - seller = mockSeller( - await assistant.getAddress(), - await admin.getAddress(), - clerk.address, - await treasury.getAddress() - ); + // reserve length + await bosonVoucher + .connect(protocol) + .reserveRange(nextOfferId, nextStartId, nextLength, await assistant.getAddress()); - // Prepare the AuthToken and VoucherInitValues - emptyAuthToken = mockAuthToken(); - voucherInitValues = mockVoucherInitValues(); - await accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues); + // amount to premint + await bosonVoucher.connect(assistant).preMint(nextOfferId, nextAmount); - agentId = "0"; // agent id is optional while creating an offer + // First range - preminted tokens + let startTokenId = deriveTokenId(offerId, start); + let endTokenId = startTokenId + amount; + for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { + let tokenOwner = await bosonVoucher.ownerOf(i); + assert.equal(tokenOwner, await assistant.getAddress(), `Token owner mismatch ${i.toString()}`); + } - // Create a valid dispute resolver - disputeResolver = mockDisputeResolver( - await assistantDR.getAddress(), - await adminDR.getAddress(), - clerkDR.address, - await treasuryDR.getAddress(), - true - ); + // First range - not preminted tokens + startTokenId = endTokenId; + let endExchangeId = Number(start) + Number(length); + endTokenId = deriveTokenId(offerId, endExchangeId); + for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { + await expect(bosonVoucher.connect(rando).ownerOf(i)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); + } - // Create DisputeResolverFee array so offer creation will succeed - disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", "0")]; - const sellerAllowList = []; + // Second range - preminted tokens + startTokenId = deriveTokenId(nextOfferId, endExchangeId); + endTokenId = startTokenId + nextAmount; + for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { + let tokenOwner = await bosonVoucher.ownerOf(i); + assert.equal(tokenOwner, await assistant.getAddress(), `Token owner mismatch ${i.toString()}`); + } - // Register the dispute resolver - await accountHandler - .connect(adminDR) - .createDisputeResolver(disputeResolver, disputeResolverFees, sellerAllowList); - }); + // Second range - not preminted tokens + startTokenId = endTokenId; + endExchangeId += Number(nextLength); + endTokenId = deriveTokenId(nextOfferId, endExchangeId); + for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { + await expect(bosonVoucher.connect(rando).ownerOf(i)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); + } + }); - Object.keys(transferFunctions).forEach(function (transferFunction) { - context(transferFunction, function () { - let tokenId, offerId; - let selector = transferFunctions[transferFunction].selector; - let additionalArgs = transferFunctions[transferFunction].additionalArgs ?? []; - - context("Transfer of an actual voucher", async function () { - beforeEach(async function () { - // Create an offer - const { offer, offerDates, offerDurations, disputeResolverId } = await mockOffer(); - await offerHandler - .connect(assistant) - .createOffer( - offer.toStruct(), - offerDates.toStruct(), - offerDurations.toStruct(), - disputeResolverId, - agentId - ); - await fundsHandler.connect(admin).depositFunds(seller.id, ZeroAddress, offer.sellerDeposit, { - value: offer.sellerDeposit, - }); - await exchangeHandler - .connect(buyer) - .commitToOffer(await buyer.getAddress(), offer.id, { value: offer.price }); + context("💔 Revert Reasons", async function () { + it("Token is outside any range and not minted", async function () { + let tokenId = "200000"; + await expect(bosonVoucher.connect(rando).ownerOf(tokenId)).to.be.revertedWith( + RevertReasons.ERC721_NON_EXISTENT + ); + }); - exchangeId = offerId = "1"; - tokenId = deriveTokenId(offerId, exchangeId); - mockBuyer(); // call it just so accountId is correct + it("Token is inside a range, but not minted yet", async function () { + let startTokenId = deriveTokenId(offerId, Number(start) + Number(amount)); + let endTokenId = deriveTokenId(offerId, Number(start) + Number(length)); - // Update boson voucher address to actual seller's voucher - const voucherAddress = calculateContractAddress(await accountHandler.getAddress(), "1"); - bosonVoucher = await getContractAt("BosonVoucher", voucherAddress); + // None of reserved but not preminted tokens should have an owner + for (let i = startTokenId; i < endTokenId; i = i + 1n) { + await expect(bosonVoucher.connect(rando).ownerOf(i)).to.be.revertedWith( + RevertReasons.ERC721_NON_EXISTENT + ); + } }); - it("Should emit a Transfer event", async function () { - await expect( - bosonVoucher - .connect(buyer) - [selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) - ) - .to.emit(bosonVoucher, "Transfer") - .withArgs(await buyer.getAddress(), await rando.getAddress(), tokenId); - }); + it("Token was preminted, transferred and burned", async function () { + let exchangeId = "26"; + const tokenId = deriveTokenId(offerId, exchangeId); - it("Should update state", async function () { - // Before transfer, buyer should be the owner + // Token owner should be the seller let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, await buyer.getAddress(), "Buyer is not the owner"); + assert.equal(tokenOwner, await assistant.getAddress(), "Token owner mismatch"); + // Transfer preminted token await bosonVoucher - .connect(buyer) - [selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); - // After transfer, rando should be the owner + // Token owner should be the buyer tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, await rando.getAddress(), "Rando is not the owner"); - }); - - it("Should call onVoucherTransferred", async function () { - const randoBuyer = mockBuyer(); - await expect( - bosonVoucher - .connect(buyer) - [selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) - ) - .to.emit(exchangeHandler, "VoucherTransferred") - .withArgs(offerId, exchangeId, randoBuyer.id, await bosonVoucher.getAddress()); - }); + assert.equal(tokenOwner, await buyer.getAddress(), "Token owner mismatch"); - it("Transfer on behalf of should work normally", async function () { - // Approve another address to transfer the voucher - await bosonVoucher.connect(buyer).setApprovalForAll(await rando2.getAddress(), true); + // Simulate burn + await bosonVoucher.connect(protocol).burnVoucher(tokenId); - await expect( - bosonVoucher - .connect(rando2) - [selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) - ) - .to.emit(bosonVoucher, "Transfer") - .withArgs(await buyer.getAddress(), await rando.getAddress(), tokenId); + // Token should have no owner + await expect(bosonVoucher.connect(rando).ownerOf(tokenId)).to.be.revertedWith( + RevertReasons.ERC721_NON_EXISTENT + ); }); - it("If seller is the true owner of voucher, transfer should work same as for others", async function () { - mockBuyer(); // Call to properly update nextAccountId - await bosonVoucher - .connect(buyer) - [selector](await buyer.getAddress(), await assistant.getAddress(), tokenId, ...additionalArgs); + it("Token was preminted, not transferred and burned", async function () { + let exchangeId = "26"; + const tokenId = deriveTokenId(offerId, exchangeId); - const tx = await bosonVoucher - .connect(assistant) - [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); + // Token owner should be the seller + let tokenOwner = await bosonVoucher.ownerOf(tokenId); + assert.equal(tokenOwner, await assistant.getAddress(), "Token owner mismatch"); - await expect(tx) - .to.emit(bosonVoucher, "Transfer") - .withArgs(await assistant.getAddress(), await rando.getAddress(), tokenId); + await offerHandler.connect(assistant).voidOffer(offerId); - const randoBuyer = mockBuyer(); + // Burn preminted voucher + await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); - await expect(tx) - .to.emit(exchangeHandler, "VoucherTransferred") - .withArgs(offerId, exchangeId, randoBuyer.id, await bosonVoucher.getAddress()); + // Token should have no owner + await expect(bosonVoucher.connect(rando).ownerOf(tokenId)).to.be.revertedWith( + RevertReasons.ERC721_NON_EXISTENT + ); }); + }); + }); + }); + + context("Token transfers", function () { + const transferFunctions = { + "transferFrom()": { + selector: "transferFrom(address,address,uint256)", + }, + "safeTransferFrom()": { + selector: "safeTransferFrom(address,address,uint256)", + }, + "safeTransferFrom() with bytes": { + selector: "safeTransferFrom(address,address,uint256,bytes)", + additionalArgs: ["0x"], + }, + }; + + Object.keys(transferFunctions).forEach(function (transferFunction) { + context(transferFunction, function () { + let tokenId, offerId, buyerId; + let selector = transferFunctions[transferFunction].selector; + let additionalArgs = transferFunctions[transferFunction].additionalArgs ?? []; + + context("Transfer of an actual voucher", async function () { + beforeEach(async function () { + exchangeId = offerId = "1"; + tokenId = deriveTokenId(offerId, exchangeId); - context("💔 Revert Reasons", async function () { - it("From does not own the voucher", async function () { + // commit and create buyer account + await exchangeHandler.commitToOffer(await buyer.getAddress(), offerId, { value: offer.price }); + }); + + it("Should emit a Transfer event", async function () { await expect( bosonVoucher - .connect(rando) - [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) - ).to.be.revertedWith(RevertReasons.ERC721_CALLER_NOT_OWNER_OR_APPROVED); + .connect(buyer) + [selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + ) + .to.emit(bosonVoucher, "Transfer") + .withArgs(await buyer.getAddress(), await rando.getAddress(), tokenId); }); - }); - }); - context("Transfer of a preminted voucher when owner is assistant", async function () { - let voucherRedeemableFrom, voucherValid, offerValid; - beforeEach(async function () { - // Create preminted offer - const { offer, offerDates, offerDurations, disputeResolverId } = await mockOffer(); - offer.quantityAvailable = "2"; - await offerHandler - .connect(assistant) - .createOffer( - offer.toStruct(), - offerDates.toStruct(), - offerDurations.toStruct(), - disputeResolverId, - agentId - ); + it("Should update state", async function () { + // Before transfer, buyer should be the owner + let tokenOwner = await bosonVoucher.ownerOf(tokenId); + assert.equal(tokenOwner, await buyer.getAddress(), "Buyer is not the owner"); - // Reserve range to assistant - await offerHandler - .connect(assistant) - .reserveRange(offer.id, offer.quantityAvailable, await assistant.getAddress()); - // Pool needs to cover both seller deposit and price - const pool = BigInt(offer.sellerDeposit) + offer.price; - await fundsHandler.connect(admin).depositFunds(seller.id, ZeroAddress, pool, { - value: pool, + await bosonVoucher + .connect(buyer) + [selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); + + // After transfer, rando should be the owner + tokenOwner = await bosonVoucher.ownerOf(tokenId); + assert.equal(tokenOwner, await rando.getAddress(), "Rando is not the owner"); + }); + + it("Should call onVoucherTransferred", async function () { + buyerId = 4n; + await expect( + bosonVoucher + .connect(buyer) + [selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + ) + .to.emit(exchangeHandler, "VoucherTransferred") + .withArgs(offerId, exchangeId, buyerId, await bosonVoucher.getAddress()); }); - // Store correct values - voucherRedeemableFrom = offerDates.voucherRedeemableFrom; - voucherValid = offerDurations.voucherValid; - offerValid = offerDates.validUntil; - exchangeId = offerId = "1"; - tokenId = deriveTokenId(offerId, exchangeId); + it("Transfer on behalf of should work normally", async function () { + // Approve another address to transfer the voucher + await bosonVoucher.connect(buyer).setApprovalForAll(await rando2.getAddress(), true); - // Update boson voucher address to actual seller's voucher - const voucherAddress = calculateContractAddress(await accountHandler.getAddress(), "1"); - bosonVoucher = await getContractAt("BosonVoucher", voucherAddress); + await expect( + bosonVoucher + .connect(rando2) + [selector](await buyer.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + ) + .to.emit(bosonVoucher, "Transfer") + .withArgs(await buyer.getAddress(), await rando.getAddress(), tokenId); + }); - // amount to premint - await bosonVoucher.connect(assistant).preMint(offerId, offer.quantityAvailable); - }); + it("If seller is the true owner of voucher, transfer should work same as for others", async function () { + buyerId = 5n; + await bosonVoucher + .connect(buyer) + [selector](await buyer.getAddress(), await assistant.getAddress(), tokenId, ...additionalArgs); - it("Should emit a Transfer event", async function () { - await expect( - bosonVoucher + const tx = await bosonVoucher .connect(assistant) - [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) - ) - .to.emit(bosonVoucher, "Transfer") - .withArgs(await assistant.getAddress(), await rando.getAddress(), tokenId); - }); + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); - it("Should update state", async function () { - // Before transfer, seller should be the owner - let tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, await assistant.getAddress(), "Seller is not the owner"); + await expect(tx) + .to.emit(bosonVoucher, "Transfer") + .withArgs(await assistant.getAddress(), await rando.getAddress(), tokenId); - await bosonVoucher - .connect(assistant) - [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); + await expect(tx) + .to.emit(exchangeHandler, "VoucherTransferred") + .withArgs(offerId, exchangeId, buyerId, await bosonVoucher.getAddress()); + }); - // After transfer, rando should be the owner - tokenOwner = await bosonVoucher.ownerOf(tokenId); - assert.equal(tokenOwner, await rando.getAddress(), "Rando is not the owner"); + context("💔 Revert Reasons", async function () { + it("From does not own the voucher", async function () { + await expect( + bosonVoucher + .connect(rando) + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + ).to.be.revertedWith(RevertReasons.ERC721_CALLER_NOT_OWNER_OR_APPROVED); + }); + }); }); - it("Should call commitToPreMintedOffer", async function () { - const randoBuyer = mockBuyer(); - const tx = await bosonVoucher - .connect(assistant) - [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); - - // Get the block timestamp of the confirmed tx - const blockNumber = tx.blockNumber; - const block = await provider.getBlock(blockNumber); + context("Transfer of a preminted voucher when owner is assistant", async function () { + let voucherRedeemableFrom, voucherValid, offerValid; - // Prepare exchange and voucher for validation - const exchange = mockExchange({ id: exchangeId, offerId, buyerId: randoBuyer.id, finalizedDate: "0" }); - const voucher = mockVoucher({ redeemedDate: "0" }); - - // Update the committed date in the expected exchange struct with the block timestamp of the tx - voucher.committedDate = block.timestamp.toString(); - // Update the validUntilDate date in the expected exchange struct - voucher.validUntilDate = calculateVoucherExpiry(block, voucherRedeemableFrom, voucherValid); - // First transfer should call commitToPreMintedOffer - await expect(tx) - .to.emit(exchangeHandler, "BuyerCommitted") - .withArgs( - offerId, - randoBuyer.id, - exchangeId, - exchange.toStruct(), - voucher.toStruct(), - await bosonVoucher.getAddress() - ); - }); + beforeEach(async function () { + exchangeId = offerId = "1"; + const amount = "5"; - it("Second transfer should behave as normal voucher transfer", async function () { - // First transfer should call commitToPreMintedOffer, and not onVoucherTransferred - let tx = await bosonVoucher - .connect(assistant) - [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); - await expect(tx).to.emit(exchangeHandler, "BuyerCommitted"); - await expect(tx).to.not.emit(exchangeHandler, "VoucherTransferred"); - - // Second transfer should call onVoucherTransferred, and not commitToPreMintedOffer - tx = await bosonVoucher - .connect(rando) - [selector](await rando.getAddress(), await assistant.getAddress(), tokenId, ...additionalArgs); - await expect(tx).to.emit(exchangeHandler, "VoucherTransferred"); - await expect(tx).to.not.emit(exchangeHandler, "BuyerCommitted"); - - // Next transfer should call onVoucherTransferred, and not commitToPreMintedOffer, even if seller is the owner - tx = await bosonVoucher - .connect(assistant) - [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); - await expect(tx).to.emit(exchangeHandler, "VoucherTransferred"); - await expect(tx).to.not.emit(exchangeHandler, "BuyerCommitted"); - }); + buyerId = 3n; - it("Transfer on behalf of should work normally", async function () { - // Approve another address to transfer the voucher - await bosonVoucher.connect(assistant).setApprovalForAll(await rando2.getAddress(), true); + await offerHandler.connect(assistant).reserveRange(offerId, amount, await assistant.getAddress()); - await expect( - bosonVoucher - .connect(rando2) - [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) - ) - .to.emit(bosonVoucher, "Transfer") - .withArgs(await assistant.getAddress(), await rando.getAddress(), tokenId); - }); + // amount to premint + await bosonVoucher.connect(assistant).preMint(offerId, amount); + tokenId = deriveTokenId(offerId, exchangeId); - context("💔 Revert Reasons", async function () { - it("Cannot transfer preminted voucher twice", async function () { - // Make first transfer - await bosonVoucher - .connect(assistant) - [selector](await assistant.getAddress(), await buyer.getAddress(), tokenId, ...additionalArgs); + voucherRedeemableFrom = offerDates.voucherRedeemableFrom; + voucherValid = offerDurations.voucherValid; + offerValid = offerDates.validUntil; + }); - // Second transfer should fail, since voucher has an owner + it("Should emit a Transfer event", async function () { await expect( bosonVoucher .connect(assistant) [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) - ).to.be.revertedWith(RevertReasons.ERC721_CALLER_NOT_OWNER_OR_APPROVED); + ) + .to.emit(bosonVoucher, "Transfer") + .withArgs(await assistant.getAddress(), await rando.getAddress(), tokenId); }); - it("Transfer preminted voucher, which was committed and burned already", async function () { + it("Should update state", async function () { + // Before transfer, seller should be the owner + let tokenOwner = await bosonVoucher.ownerOf(tokenId); + assert.equal(tokenOwner, await assistant.getAddress(), "Seller is not the owner"); + await bosonVoucher .connect(assistant) - [selector](await assistant.getAddress(), await buyer.getAddress(), tokenId, ...additionalArgs); + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); - // Redeem voucher, effectively burning it - await setNextBlockTimestamp(BigInt(voucherRedeemableFrom).toString()); - await exchangeHandler.connect(buyer).redeemVoucher(exchangeId); + // After transfer, rando should be the owner + tokenOwner = await bosonVoucher.ownerOf(tokenId); + assert.equal(tokenOwner, await rando.getAddress(), "Rando is not the owner"); + }); - // Transfer should fail, since voucher has been burned - await expect( - bosonVoucher - .connect(assistant) - [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) - ).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); + it("Should call commitToPreMintedOffer", async function () { + const tx = await bosonVoucher + .connect(assistant) + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); + + // Get the block timestamp of the confirmed tx + const blockNumber = tx.blockNumber; + const block = await provider.getBlock(blockNumber); + + // Prepare exchange and voucher for validation + const exchange = mockExchange({ id: exchangeId, offerId, buyerId, finalizedDate: "0" }); + const voucher = mockVoucher({ redeemedDate: "0" }); + + // Update the committed date in the expected exchange struct with the block timestamp of the tx + voucher.committedDate = block.timestamp; + + // Update the validUntilDate date in the expected exchange struct + voucher.validUntilDate = calculateVoucherExpiry(block, voucherRedeemableFrom, voucherValid); + + // First transfer should call commitToPreMintedOffer + await expect(tx) + .to.emit(exchangeHandler, "BuyerCommitted") + .withArgs( + offerId, + buyerId, + exchangeId, + exchange.toStruct(), + voucher.toStruct(), + await bosonVoucher.getAddress() + ); }); - it("Transfer preminted voucher, which was not committed but burned already", async function () { - // Void offer - await offerHandler.connect(assistant).voidOffer(offerId); + it("Second transfer should behave as normal voucher transfer", async function () { + // First transfer should call commitToPreMintedOffer, and not onVoucherTransferred + let tx = await bosonVoucher + .connect(assistant) + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); + await expect(tx).to.emit(exchangeHandler, "BuyerCommitted"); + await expect(tx).to.not.emit(exchangeHandler, "VoucherTransferred"); + + // Second transfer should call onVoucherTransferred, and not commitToPreMintedOffer + tx = await bosonVoucher + .connect(rando) + [selector](await rando.getAddress(), await assistant.getAddress(), tokenId, ...additionalArgs); + await expect(tx).to.emit(exchangeHandler, "VoucherTransferred"); + await expect(tx).to.not.emit(exchangeHandler, "BuyerCommitted"); + + // Next transfer should call onVoucherTransferred, and not commitToPreMintedOffer, even if seller is the owner + tx = await bosonVoucher + .connect(assistant) + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); + await expect(tx).to.emit(exchangeHandler, "VoucherTransferred"); + await expect(tx).to.not.emit(exchangeHandler, "BuyerCommitted"); + }); - // Burn preminted vouchers - await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); + it("Transfer on behalf of should work normally", async function () { + // Approve another address to transfer the voucher + await bosonVoucher.connect(assistant).setApprovalForAll(await rando2.getAddress(), true); - // None of reserved but not preminted tokens should have an owner await expect( bosonVoucher - .connect(assistant) + .connect(rando2) [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) - ).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); + ) + .to.emit(bosonVoucher, "Transfer") + .withArgs(await assistant.getAddress(), await rando.getAddress(), tokenId); }); - it("Transfer preminted voucher, where offer was voided", async function () { - // Void offer - await offerHandler.connect(assistant).voidOffer(offerId); - - // Transfer should fail, since protocol reverts - await expect( - bosonVoucher + context("💔 Revert Reasons", async function () { + it("Cannot transfer preminted voucher twice", async function () { + // Make first transfer + await bosonVoucher .connect(assistant) - [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) - ).to.be.revertedWith(RevertReasons.OFFER_HAS_BEEN_VOIDED); + [selector](await assistant.getAddress(), await buyer.getAddress(), tokenId, ...additionalArgs); + + // Second transfer should fail, since voucher has an owner + await expect( + bosonVoucher + .connect(assistant) + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + ).to.be.revertedWith(RevertReasons.ERC721_CALLER_NOT_OWNER_OR_APPROVED); + }); + + it("Transfer preminted voucher, which was committed and burned already", async function () { + await bosonVoucher + .connect(assistant) + [selector](await assistant.getAddress(), await buyer.getAddress(), tokenId, ...additionalArgs); + + // Redeem voucher, effectively burning it + await setNextBlockTimestamp(Number(voucherRedeemableFrom)); + await exchangeHandler.connect(buyer).redeemVoucher(exchangeId); + + // Transfer should fail, since voucher has been burned + await expect( + bosonVoucher + .connect(assistant) + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + ).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); + }); + + it("Transfer preminted voucher, which was not committed but burned already", async function () { + // Void offer + await offerHandler.connect(assistant).voidOffer(offerId); + + // Burn preminted vouchers + await bosonVoucher.connect(assistant).burnPremintedVouchers(offerId); + + // None of reserved but not preminted tokens should have an owner + await expect( + bosonVoucher + .connect(assistant) + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + ).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); + }); + + it("Transfer preminted voucher, where offer was voided", async function () { + // Void offer + await offerHandler.connect(assistant).voidOffer(offerId); + + // Transfer should fail, since protocol reverts + await expect( + bosonVoucher + .connect(assistant) + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + ).to.be.revertedWith(RevertReasons.OFFER_HAS_BEEN_VOIDED); + }); + + it("Transfer preminted voucher, where offer has expired", async function () { + // Skip past offer expiry + await setNextBlockTimestamp(Number(offerValid)); + + // Transfer should fail, since protocol reverts + await expect( + bosonVoucher + .connect(assistant) + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + ).to.be.revertedWith(RevertReasons.OFFER_HAS_EXPIRED); + }); + + it("Transfer preminted voucher, but from is not the voucher owner", async function () { + await bosonVoucher + .connect(assistant) + [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); + + // next token id. Make sure that assistant is the owner + tokenId = tokenId + 1n; + let tokenOwner = await bosonVoucher.ownerOf(tokenId.toString()); + assert.equal(tokenOwner, await assistant.getAddress(), "Seller is not the owner"); + + // Following call should fail, since rando is not the owner of preminted voucher + await expect( + bosonVoucher + .connect(rando) + [selector](await rando.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) + ).to.be.revertedWith(RevertReasons.NO_SILENT_MINT_ALLOWED); + }); }); + }); - it("Transfer preminted voucher, where offer has expired", async function () { - // Skip past offer expiry - await setNextBlockTimestamp(BigInt(offerValid).toString()); + context("Transfer of a preminted voucher when owner is contract", async function () { + beforeEach(async function () { + exchangeId = offerId = "1"; - // Transfer should fail, since protocol reverts - await expect( - bosonVoucher - .connect(assistant) - [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) - ).to.be.revertedWith(RevertReasons.OFFER_HAS_EXPIRED); + tokenId = deriveTokenId(offerId, exchangeId); + const amount = "5"; + + buyerId = 3n; + + await offerHandler.connect(assistant).reserveRange(offerId, amount, await bosonVoucher.getAddress()); + + // amount to premint + await bosonVoucher.connect(assistant).preMint(offerId, amount); }); - it("Transfer preminted voucher, but from is not the voucher owner", async function () { - await bosonVoucher - .connect(assistant) - [selector](await assistant.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); + it("If voucher contract is the owner of voucher, transfer on behalf of should work normally", async function () { + // Approve another address to transfer the voucher + await bosonVoucher.connect(assistant).setApprovalForAllToContract(await rando2.getAddress(), true); - // next token id. Make sure that assistant is the owner - tokenId = tokenId + 1; - let tokenOwner = await bosonVoucher.ownerOf(tokenId.toString()); - assert.equal(tokenOwner, await assistant.getAddress(), "Seller is not the owner"); + const tx = await bosonVoucher + .connect(rando2) + [selector](await bosonVoucher.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); - // Following call should fail, since rando is not the owner of preminted voucher - await expect( - bosonVoucher - .connect(rando) - [selector](await rando.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs) - ).to.be.revertedWith(RevertReasons.NO_SILENT_MINT_ALLOWED); + await expect(tx) + .to.emit(bosonVoucher, "Transfer") + .withArgs(await bosonVoucher.getAddress(), await rando.getAddress(), tokenId); }); }); }); + }); + }); - context("Transfer of a preminted voucher when owner is contract", async function () { - beforeEach(async function () { - // Create preminted offer - const { offer, offerDates, offerDurations, disputeResolverId } = await mockOffer(); - offer.quantityAvailable = "2"; + context("tokenURI", function () { + let metadataUri, offerId; - await offerHandler - .connect(assistant) - .createOffer( - offer.toStruct(), - offerDates.toStruct(), - offerDurations.toStruct(), - disputeResolverId, - agentId - ); + beforeEach(async function () { + offerId = "1"; + metadataUri = offer.metadataUri; + }); + + it("should return the correct tokenURI", async function () { + const buyerAddress = await buyer.getAddress(); + + await exchangeHandler.connect(buyer).commitToOffer(buyerAddress, offerId, { value: offer.price }); + + const tokenId = deriveTokenId(offerId, 1); + console.log(tokenId); + const tokenURI = await bosonVoucher.tokenURI(tokenId); + expect(tokenURI).eq(metadataUri); + }); + + it("should return empty tokenURI if token does not exist", async function () { + const tokenURI = await bosonVoucher.tokenURI(10); + expect(tokenURI).eq(""); + }); + + context("pre-minted", async function () { + let start, tokenId; + beforeEach(async function () { + // reserve a range + start = "10"; + const length = "1"; + await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); + + // premint + await bosonVoucher.connect(assistant).preMint(offerId, 1); + + tokenId = deriveTokenId(offerId, start); + }); + + it("should return the correct tokenURI", async function () { + const tokenURI = await bosonVoucher.tokenURI(tokenId); + expect(tokenURI).eq(metadataUri); + }); + + it("should return correct tokenURI when token is preminted and transferred", async function () { + await bosonVoucher + .connect(assistant) + .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); + + const tokenURI = await bosonVoucher.tokenURI(tokenId); + expect(tokenURI).eq(metadataUri); + }); + }); + }); + + context("EIP2981 NFT Royalty fee", function () { + let offerId; + beforeEach(async function () { + offerId = "1"; + exchangeId = "1"; + offerPrice = offer.price; + + await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: offer.price }); + }); + + context("setRoyaltyPercentage()", function () { + beforeEach(async function () { + // give ownership to assistant + await bosonVoucher.connect(protocol).transferOwnership(await assistant.getAddress()); + }); + + it("should emit RoyaltyPercentageChanged event", async function () { + royaltyPercentage = "0"; //0% + await expect(bosonVoucher.connect(assistant).setRoyaltyPercentage(royaltyPercentage)) + .to.emit(bosonVoucher, "RoyaltyPercentageChanged") + .withArgs(royaltyPercentage); + }); + + it("should set a royalty fee percentage", async function () { + // First, set royalty fee as 0 + royaltyPercentage = "0"; //0% + await bosonVoucher.connect(assistant).setRoyaltyPercentage(royaltyPercentage); + + let receiver, royaltyAmount; + [receiver, royaltyAmount] = await bosonVoucher.connect(rando).royaltyInfo(exchangeId, offerPrice); + + // Expectations + let expectedRecipient = seller.treasury; + let expectedRoyaltyAmount = "0"; + + assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); + assert.equal(royaltyAmount.toString(), expectedRoyaltyAmount, "Royalty amount is incorrect"); + + // Now, set royalty fee as 10% + royaltyPercentage = "1000"; //10% + await bosonVoucher.connect(assistant).setRoyaltyPercentage(royaltyPercentage); + + [receiver, royaltyAmount] = await bosonVoucher.connect(rando).royaltyInfo(exchangeId, offerPrice); + + // Expectations + expectedRecipient = seller.treasury; + expectedRoyaltyAmount = applyPercentage(offerPrice, royaltyPercentage); + + assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); + assert.equal(royaltyAmount.toString(), expectedRoyaltyAmount, "Royalty amount is incorrect"); + }); + + context("💔 Revert Reasons", async function () { + it("should revert if caller is not the owner", async function () { + // random caller + await expect(bosonVoucher.connect(rando).setRoyaltyPercentage(royaltyPercentage)).to.be.revertedWith( + RevertReasons.OWNABLE_NOT_OWNER + ); + + // protocol as the caller + await expect(bosonVoucher.connect(protocol).setRoyaltyPercentage(royaltyPercentage)).to.be.revertedWith( + RevertReasons.OWNABLE_NOT_OWNER + ); + }); + + it("should revert if royaltyPercentage is greater than max royalty percentage defined in the protocol", async function () { + // Set royalty fee as 15% (protocol limit is 10%) + royaltyPercentage = "1500"; //15% + + // royalty percentage too high, expectig revert + await expect(bosonVoucher.connect(assistant).setRoyaltyPercentage(royaltyPercentage)).to.be.revertedWith( + RevertReasons.ROYALTY_FEE_INVALID + ); + }); + }); + }); + + context("getRoyaltyPercentage()", function () { + it("should return the royalty fee percentage", async function () { + // give ownership to assistant + await bosonVoucher.connect(protocol).transferOwnership(await assistant.getAddress()); + + royaltyPercentage = "1000"; //10% + await bosonVoucher.connect(assistant).setRoyaltyPercentage(royaltyPercentage); + + expect(await bosonVoucher.connect(rando).getRoyaltyPercentage()).to.equal( + royaltyPercentage, + "Invalid royalty percentage" + ); + }); + }); + + context("royaltyInfo()", function () { + beforeEach(async function () { + // give ownership to assistant + await bosonVoucher.connect(protocol).transferOwnership(await assistant.getAddress()); + }); + + it("should return a recipient and royalty fee", async function () { + // First, set royalty fee as 0 + royaltyPercentage = "0"; //0% + await bosonVoucher.connect(assistant).setRoyaltyPercentage(royaltyPercentage); + + let receiver, royaltyAmount; + [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(exchangeId, offerPrice); + + // Expectations + let expectedRecipient = seller.treasury; + let expectedRoyaltyAmount = "0"; + + assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); + assert.equal(royaltyAmount.toString(), expectedRoyaltyAmount, "Royalty amount is incorrect"); + + // Now, set royalty fee as 10% + royaltyPercentage = "1000"; //10% + await bosonVoucher.connect(assistant).setRoyaltyPercentage(royaltyPercentage); + + [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(exchangeId, offerPrice); + + // Expectations + expectedRecipient = seller.treasury; + expectedRoyaltyAmount = applyPercentage(offerPrice, royaltyPercentage); + + assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); + assert.equal(royaltyAmount.toString(), expectedRoyaltyAmount, "Royalty amount is incorrect"); + + // Any random address can check the royalty info + // Now, set royalty fee as 8% + royaltyPercentage = "800"; //8% + await bosonVoucher.connect(assistant).setRoyaltyPercentage(royaltyPercentage); + + [receiver, royaltyAmount] = await bosonVoucher.connect(rando).royaltyInfo(exchangeId, offerPrice); + + // Expectations + expectedRecipient = seller.treasury; + expectedRoyaltyAmount = applyPercentage(offerPrice, royaltyPercentage); + + assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); + assert.equal(royaltyAmount.toString(), expectedRoyaltyAmount, "Royalty amount is incorrect"); + }); + + it("if exchange doesn't exist it should return 0 values", async function () { + // Set royalty fee as 10% + royaltyPercentage = "1000"; //10% + await bosonVoucher.connect(assistant).setRoyaltyPercentage(royaltyPercentage); + + // Set inexistent exchangeId + exchangeId = "100000"; + const [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(exchangeId, offerPrice); + + // Receiver and amount should be 0 + assert.equal(receiver, ZeroAddress, "Recipient address is incorrect"); + assert.equal(royaltyAmount, 0n, "Royalty amount is incorrect"); + }); + }); + + context("💔 Revert Reasons", async function () { + it("should revert during create seller if royaltyPercentage is greater than max royalty percentage defined in the protocol", async function () { + // create invalid voucherInitValues + royaltyPercentage = "2000"; // 20% + voucherInitValues = new VoucherInitValues("ContractURI", royaltyPercentage); + + // create another seller + seller = mockSeller( + await rando.getAddress(), + await rando.getAddress(), + ZeroAddress, + await rando.getAddress() + ); + + // royalty percentage too high, expectig revert + await expect( + accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues) + ).to.be.revertedWith(RevertReasons.ROYALTY_FEE_INVALID); + }); + }); + }); + context("withdrawToProtocol", function () { + it("Can withdraw native token", async function () { + // Sellers available funds should be empty + const sellersFundsBefore = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); + + const amount = parseUnits("1", "ether"); + await admin.sendTransaction({ to: await bosonVoucher.getAddress(), value: amount }); + + await expect(() => bosonVoucher.connect(rando).withdrawToProtocol([ZeroAddress])).to.changeEtherBalances( + [bosonVoucher, fundsHandler], + [amount * -1n, amount] + ); + + console.log(sellersFundsBefore); + const { availableAmount } = sellersFundsBefore.funds.find((fund) => fund.tokenAddress == ZeroAddress); + + // Seller's available balance should increase + const expectedAvailableFunds = new FundsList([ + new Funds(ZeroAddress, "Native currency", (BigInt(availableAmount) + BigInt(amount)).toString()), + ]); + + const sellerFundsAfter = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); + + expect(sellerFundsAfter).to.eql(expectedAvailableFunds); + }); + + it("Can withdraw ERC20", async function () { + const amount = parseUnits("1", "ether"); + await foreign20.connect(deployer).mint(await deployer.getAddress(), amount); + await foreign20.connect(deployer).transfer(await bosonVoucher.getAddress(), amount); + + const foreign20Address = await foreign20.getAddress(); + await expect(() => bosonVoucher.connect(rando).withdrawToProtocol([foreign20Address])).to.changeTokenBalances( + foreign20, + [bosonVoucher, fundsHandler], + [amount * -1n, amount] + ); - // Update boson voucher address to actual seller's voucher - const voucherAddress = calculateContractAddress(await accountHandler.getAddress(), "1"); - bosonVoucher = await getContractAt("BosonVoucher", voucherAddress); + // Seller's available balance should increase + const expectedAvailableFunds = new Funds(await foreign20.getAddress(), "Foreign20", amount.toString()); - // Reserve range to contract - await offerHandler - .connect(assistant) - .reserveRange(offer.id, offer.quantityAvailable, await bosonVoucher.getAddress()); + // first item is AddressZero + const [, sellerFundsAfter] = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)).funds; + expect(sellerFundsAfter).to.eql(expectedAvailableFunds); + }); - // Pool needs to cover both seller deposit and price - const pool = BigInt(offer.sellerDeposit) + offer.price; - await fundsHandler.connect(admin).depositFunds(seller.id, ZeroAddress, pool, { - value: pool, - }); + it("Should withdraw all tokens when list length > 1", async function () { + // Sellers available funds should be empty + const sellersFundsBefore = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); + let expectedAvailableFunds = new FundsList([]); + expect(sellersFundsBefore).to.eql(expectedAvailableFunds); - // Store correct values - exchangeId = offerId = "1"; - tokenId = deriveTokenId(offerId, exchangeId); + const amount = parseUnits("1", "ether"); + await admin.sendTransaction({ to: await bosonVoucher.getAddress(), value: amount }); + await foreign20.connect(deployer).mint(await deployer.getAddress(), amount); + await foreign20.connect(deployer).transfer(await bosonVoucher.getAddress(), amount); - // amount to premint - await bosonVoucher.connect(assistant).preMint(offerId, offer.quantityAvailable); - }); + const foreign20Address = await foreign20.getAddress(); + let tx; + await expect(() => { + tx = bosonVoucher.connect(rando).withdrawToProtocol([ZeroAddress, foreign20Address]); + return tx; + }).to.changeTokenBalances(foreign20, [bosonVoucher, fundsHandler], [amount * -1n, amount]); + await expect(() => tx).to.changeEtherBalances([bosonVoucher, fundsHandler], [amount * -1n, amount]); + }); + }); - it("If voucher contract is the owner of voucher, transfer on behalf of should work normally", async function () { - // Approve another address to transfer the voucher - await bosonVoucher.connect(assistant).setApprovalForAllToContract(await rando2.getAddress(), true); + context("getSellerId()", function () { + it("should return the seller id", async function () { + await bosonVoucher.connect(protocol).transferOwnership(await assistant.getAddress()); - const tx = await bosonVoucher - .connect(rando2) - [selector](await bosonVoucher.getAddress(), await rando.getAddress(), tokenId, ...additionalArgs); + expect(await bosonVoucher.connect(rando).getSellerId()).to.equal(seller.id, "Invalid seller id returned"); - await expect(tx) - .to.emit(bosonVoucher, "Transfer") - .withArgs(await bosonVoucher.getAddress(), await rando.getAddress(), tokenId); - }); - }); + // Reset the accountId iterator + accountId.next(true); + }); + + it("should return 0 if the seller doesn't exist", async function () { + await bosonVoucher.connect(protocol).transferOwnership(await rando.getAddress()); + expect(await bosonVoucher.getSellerId()).to.equal(0, "Invalid seller id returned"); }); }); }); context("burnVoucher()", function () { - after(async function () { - // Reset the accountId iterator - accountId.next(true); - }); - it("should burn a voucher with success", async function () { const buyerStruct = mockBuyer(await buyer.getAddress()).toStruct(); const buyerWallet = buyerStruct[1]; + await bosonVoucher.connect(protocol).issueVoucher(0, buyerWallet); const balanceBefore = await bosonVoucher.balanceOf(await buyer.getAddress()); @@ -1939,118 +1948,6 @@ describe("IBosonVoucher", function () { }); }); - context("tokenURI", function () { - let metadataUri, offerId, offerPrice; - let bosonVoucher; - - beforeEach(async function () { - seller = mockSeller( - await assistant.getAddress(), - await admin.getAddress(), - clerk.address, - await treasury.getAddress() - ); - - // prepare the VoucherInitValues - voucherInitValues = mockVoucherInitValues(); - expect(voucherInitValues.isValid()).is.true; - - // AuthToken - emptyAuthToken = mockAuthToken(); - expect(emptyAuthToken.isValid()).is.true; - - await accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues); - - agentId = "0"; // agent id is optional while creating an offer - - // Create a valid dispute resolver - disputeResolver = mockDisputeResolver( - await assistantDR.getAddress(), - await adminDR.getAddress(), - clerkDR.address, - await treasuryDR.getAddress(), - true - ); - expect(disputeResolver.isValid()).is.true; - - //Create DisputeResolverFee array so offer creation will succeed - disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", "0")]; - - // Make empty seller list, so every seller is allowed - const sellerAllowList = []; - - // Register the dispute resolver - await accountHandler - .connect(adminDR) - .createDisputeResolver(disputeResolver, disputeResolverFees, sellerAllowList); - - const { offer, offerDates, offerDurations, disputeResolverId } = await mockOffer(); - offerId = offer.id; - offerPrice = offer.price; - - await offerHandler - .connect(assistant) - .createOffer(offer.toStruct(), offerDates.toStruct(), offerDurations.toStruct(), disputeResolverId, agentId); - - const pool = BigInt(offer.sellerDeposit) + offer.price; - - await fundsHandler.connect(admin).depositFunds(seller.id, ZeroAddress, pool, { value: pool }); - - metadataUri = offer.metadataUri; - - // Update boson voucher address to actual seller's voucher - const voucherAddress = calculateContractAddress(await accountHandler.getAddress(), "1"); - bosonVoucher = await getContractAt("BosonVoucher", voucherAddress); - }); - - afterEach(async function () { - // Reset the accountId iterator - accountId.next(true); - }); - - it("should return the correct tokenURI", async function () { - const buyer = await buyer.getAddress(); - await exchangeHandler.connect(buyer).commitToOffer(buyer, offerId, { value: offerPrice }); - const tokenId = deriveTokenId(offerId, 1); - const tokenURI = await bosonVoucher.tokenURI(tokenId); - expect(tokenURI).eq(metadataUri); - }); - - it("should return empty tokenURI if token does not exist", async function () { - const tokenURI = await bosonVoucher.tokenURI(10); - expect(tokenURI).eq(""); - }); - - context("pre-minted", async function () { - let start, tokenId; - beforeEach(async function () { - // reserve a range - start = "10"; - const length = "1"; - await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); - - // premint - await bosonVoucher.connect(assistant).preMint(offerId, 1); - - tokenId = deriveTokenId(offerId, start); - }); - - it("should return the correct tokenURI", async function () { - const tokenURI = await bosonVoucher.tokenURI(tokenId); - expect(tokenURI).eq(metadataUri); - }); - - it("should return correct tokenURI when token is preminted and transferred", async function () { - await bosonVoucher - .connect(assistant) - .transferFrom(await assistant.getAddress(), await buyer.getAddress(), tokenId); - - const tokenURI = await bosonVoucher.tokenURI(tokenId); - expect(tokenURI).eq(metadataUri); - }); - }); - }); - context("transferOwnership()", function () { it("should emit OwnershipTransferred", async function () { const ownable = await getContractAt("OwnableUpgradeable", await bosonVoucher.getAddress()); @@ -2139,265 +2036,6 @@ describe("IBosonVoucher", function () { }); }); - context("EIP2981 NFT Royalty fee", function () { - beforeEach(async function () { - seller = mockSeller( - await assistant.getAddress(), - await admin.getAddress(), - clerk.address, - await treasury.getAddress() - ); - - // prepare the VoucherInitValues - voucherInitValues = mockVoucherInitValues(); - voucherInitValues.royaltyPercentage = "1000"; // 10% - expect(voucherInitValues.isValid()).is.true; - - // AuthToken - emptyAuthToken = mockAuthToken(); - expect(emptyAuthToken.isValid()).is.true; - - await accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues); - - agentId = "0"; // agent id is optional while creating an offer - - // Create a valid dispute resolver - disputeResolver = mockDisputeResolver( - await assistantDR.getAddress(), - await adminDR.getAddress(), - clerkDR.address, - await treasuryDR.getAddress(), - true - ); - expect(disputeResolver.isValid()).is.true; - - //Create DisputeResolverFee array so offer creation will succeed - disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", "0")]; - - // Make empty seller list, so every seller is allowed - const sellerAllowList = []; - - // Register the dispute resolver - await accountHandler - .connect(adminDR) - .createDisputeResolver(disputeResolver, disputeResolverFees, sellerAllowList); - - const { offer, offerDates, offerDurations, disputeResolverId } = await mockOffer(); - await offerHandler - .connect(assistant) - .createOffer(offer.toStruct(), offerDates.toStruct(), offerDurations.toStruct(), disputeResolverId, agentId); - await fundsHandler - .connect(admin) - .depositFunds(seller.id, ZeroAddress, offer.sellerDeposit, { value: offer.sellerDeposit }); - await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offer.id, { value: offer.price }); - - exchangeId = "1"; - - offerPrice = offer.price; - }); - - afterEach(async function () { - // Reset the accountId iterator - accountId.next(true); - }); - - context("setRoyaltyPercentage()", function () { - beforeEach(async function () { - // give ownership to assistant - await bosonVoucher.connect(protocol).transferOwnership(await assistant.getAddress()); - }); - - it("should emit RoyaltyPercentageChanged event", async function () { - royaltyPercentage = "0"; //0% - await expect(bosonVoucher.connect(assistant).setRoyaltyPercentage(royaltyPercentage)) - .to.emit(bosonVoucher, "RoyaltyPercentageChanged") - .withArgs(royaltyPercentage); - }); - - it("should set a royalty fee percentage", async function () { - // First, set royalty fee as 0 - royaltyPercentage = "0"; //0% - await bosonVoucher.connect(assistant).setRoyaltyPercentage(royaltyPercentage); - - let receiver, royaltyAmount; - [receiver, royaltyAmount] = await bosonVoucher.connect(rando).royaltyInfo(exchangeId, offerPrice); - - // Expectations - let expectedRecipient = seller.treasury; - let expectedRoyaltyAmount = "0"; - - assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); - assert.equal(royaltyAmount.toString(), expectedRoyaltyAmount, "Royalty amount is incorrect"); - - // Now, set royalty fee as 10% - royaltyPercentage = "1000"; //10% - await bosonVoucher.connect(assistant).setRoyaltyPercentage(royaltyPercentage); - - [receiver, royaltyAmount] = await bosonVoucher.connect(rando).royaltyInfo(exchangeId, offerPrice); - - // Expectations - expectedRecipient = seller.treasury; - expectedRoyaltyAmount = applyPercentage(offerPrice, royaltyPercentage); - - assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); - assert.equal(royaltyAmount.toString(), expectedRoyaltyAmount, "Royalty amount is incorrect"); - }); - - context("💔 Revert Reasons", async function () { - it("should revert if caller is not the owner", async function () { - // random caller - await expect(bosonVoucher.connect(rando).setRoyaltyPercentage(royaltyPercentage)).to.be.revertedWith( - RevertReasons.OWNABLE_NOT_OWNER - ); - - // protocol as the caller - await expect(bosonVoucher.connect(protocol).setRoyaltyPercentage(royaltyPercentage)).to.be.revertedWith( - RevertReasons.OWNABLE_NOT_OWNER - ); - }); - - it("should revert if royaltyPercentage is greater than max royalty percentage defined in the protocol", async function () { - // Set royalty fee as 15% (protocol limit is 10%) - royaltyPercentage = "1500"; //15% - - // royalty percentage too high, expectig revert - await expect(bosonVoucher.connect(assistant).setRoyaltyPercentage(royaltyPercentage)).to.be.revertedWith( - RevertReasons.ROYALTY_FEE_INVALID - ); - }); - }); - }); - - context("getRoyaltyPercentage()", function () { - it("should return the royalty fee percentage", async function () { - // give ownership to assistant - await bosonVoucher.connect(protocol).transferOwnership(await assistant.getAddress()); - - royaltyPercentage = "1000"; //10% - await bosonVoucher.connect(assistant).setRoyaltyPercentage(royaltyPercentage); - - expect(await bosonVoucher.connect(rando).getRoyaltyPercentage()).to.equal( - royaltyPercentage, - "Invalid royalty percentage" - ); - }); - }); - - context("royaltyInfo()", function () { - beforeEach(async function () { - // give ownership to assistant - await bosonVoucher.connect(protocol).transferOwnership(await assistant.getAddress()); - }); - - it("should return a recipient and royalty fee", async function () { - // First, set royalty fee as 0 - royaltyPercentage = "0"; //0% - await bosonVoucher.connect(assistant).setRoyaltyPercentage(royaltyPercentage); - - let receiver, royaltyAmount; - [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(exchangeId, offerPrice); - - // Expectations - let expectedRecipient = seller.treasury; - let expectedRoyaltyAmount = "0"; - - assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); - assert.equal(royaltyAmount.toString(), expectedRoyaltyAmount, "Royalty amount is incorrect"); - - // Now, set royalty fee as 10% - royaltyPercentage = "1000"; //10% - await bosonVoucher.connect(assistant).setRoyaltyPercentage(royaltyPercentage); - - [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(exchangeId, offerPrice); - - // Expectations - expectedRecipient = seller.treasury; - expectedRoyaltyAmount = applyPercentage(offerPrice, royaltyPercentage); - - assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); - assert.equal(royaltyAmount.toString(), expectedRoyaltyAmount, "Royalty amount is incorrect"); - - // Any random address can check the royalty info - // Now, set royalty fee as 8% - royaltyPercentage = "800"; //8% - await bosonVoucher.connect(assistant).setRoyaltyPercentage(royaltyPercentage); - - [receiver, royaltyAmount] = await bosonVoucher.connect(rando).royaltyInfo(exchangeId, offerPrice); - - // Expectations - expectedRecipient = seller.treasury; - expectedRoyaltyAmount = applyPercentage(offerPrice, royaltyPercentage); - - assert.equal(receiver, expectedRecipient, "Recipient address is incorrect"); - assert.equal(royaltyAmount.toString(), expectedRoyaltyAmount, "Royalty amount is incorrect"); - }); - - it("if exchange doesn't exist it should return 0 values", async function () { - // Set royalty fee as 10% - royaltyPercentage = "1000"; //10% - await bosonVoucher.connect(assistant).setRoyaltyPercentage(royaltyPercentage); - - // Set inexistent exchangeId - exchangeId = "100000"; - const [receiver, royaltyAmount] = await bosonVoucher.connect(assistant).royaltyInfo(exchangeId, offerPrice); - - // Receiver and amount should be 0 - assert.equal(receiver, ZeroAddress, "Recipient address is incorrect"); - assert.equal(royaltyAmount, 0n, "Royalty amount is incorrect"); - }); - }); - - context("💔 Revert Reasons", async function () { - it("should revert during create seller if royaltyPercentage is greater than max royalty percentage defined in the protocol", async function () { - // create invalid voucherInitValues - royaltyPercentage = "2000"; // 20% - voucherInitValues = new VoucherInitValues("ContractURI", royaltyPercentage); - - // create another seller - seller = mockSeller(await rando.getAddress(), await rando.getAddress(), ZeroAddress, await rando.getAddress()); - seller.id = "2"; - - // royalty percentage too high, expectig revert - await expect( - accountHandler.connect(rando).createSeller(seller, emptyAuthToken, voucherInitValues) - ).to.be.revertedWith(RevertReasons.ROYALTY_FEE_INVALID); - }); - }); - }); - - context("getSellerId()", function () { - it("should return the seller id", async function () { - // prepare the VoucherInitValues - voucherInitValues = mockVoucherInitValues(); - expect(voucherInitValues.isValid()).is.true; - - // AuthToken - emptyAuthToken = mockAuthToken(); - expect(emptyAuthToken.isValid()).is.true; - - seller = mockSeller( - await assistant.getAddress(), - await admin.getAddress(), - clerk.address, - await treasury.getAddress() - ); - - await accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues); - - await bosonVoucher.connect(protocol).transferOwnership(await assistant.getAddress()); - - expect(await bosonVoucher.connect(rando).getSellerId()).to.equal(seller.id, "Invalid seller id returned"); - - // Reset the accountId iterator - accountId.next(true); - }); - - it("should return 0 if the seller doesn't exist", async function () { - await bosonVoucher.connect(protocol).transferOwnership(await rando.getAddress()); - expect(await bosonVoucher.getSellerId()).to.equal(0, "Invalid seller id returned"); - }); - }); - context("callExternalContract()", function () { let mockSimpleContract, calldata; @@ -2520,85 +2158,6 @@ describe("IBosonVoucher", function () { }); }); - context("withdrawToProtocol", function () { - beforeEach(async function () { - seller = mockSeller( - await assistant.getAddress(), - await admin.getAddress(), - clerk.address, - await treasury.getAddress() - ); - - // Prepare the AuthToken and VoucherInitValues - emptyAuthToken = mockAuthToken(); - voucherInitValues = mockVoucherInitValues(); - await accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues); - }); - - afterEach(async function () { - // Reset the accountId iterator - accountId.next(true); - }); - - it("Can withdraw native token", async function () { - // Sellers available funds should be empty - const sellersFundsBefore = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); - let expectedAvailableFunds = new FundsList([]); - expect(sellersFundsBefore).to.eql(expectedAvailableFunds); - - const amount = parseUnits("1", "ether"); - await admin.sendTransaction({ to: await bosonVoucher.getAddress(), value: amount }); - - await expect(() => bosonVoucher.connect(rando).withdrawToProtocol([ZeroAddress])).to.changeEtherBalances( - [bosonVoucher, fundsHandler], - [amount * -1n, amount] - ); - }); - - it("Can withdraw ERC20", async function () { - // Sellers available funds should be empty - const sellersFundsBefore = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); - let expectedAvailableFunds = new FundsList([]); - expect(sellersFundsBefore).to.eql(expectedAvailableFunds); - - const amount = parseUnits("1", "ether"); - await foreign20.connect(deployer).mint(await deployer.getAddress(), amount); - await foreign20.connect(deployer).transfer(await bosonVoucher.getAddress(), amount); - - const foreign20Address = await foreign20.getAddress(); - await expect(() => bosonVoucher.connect(rando).withdrawToProtocol([foreign20Address])).to.changeTokenBalances( - foreign20, - [bosonVoucher, fundsHandler], - [amount * -1n, amount] - ); - - // Seller's available balance should increase - expectedAvailableFunds = new FundsList([new Funds(await foreign20.getAddress(), "Foreign20", amount.toString())]); - const sellerFundsAfter = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); - expect(sellerFundsAfter).to.eql(expectedAvailableFunds); - }); - - it("Should withdraw all tokens when list length > 1", async function () { - // Sellers available funds should be empty - const sellersFundsBefore = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); - let expectedAvailableFunds = new FundsList([]); - expect(sellersFundsBefore).to.eql(expectedAvailableFunds); - - const amount = parseUnits("1", "ether"); - await admin.sendTransaction({ to: await bosonVoucher.getAddress(), value: amount }); - await foreign20.connect(deployer).mint(await deployer.getAddress(), amount); - await foreign20.connect(deployer).transfer(await bosonVoucher.getAddress(), amount); - - const foreign20Address = await foreign20.getAddress(); - let tx; - await expect(() => { - tx = bosonVoucher.connect(rando).withdrawToProtocol([ZeroAddress, foreign20Address]); - return tx; - }).to.changeTokenBalances(foreign20, [bosonVoucher, fundsHandler], [amount * -1n, amount]); - await expect(() => tx).to.changeEtherBalances([bosonVoucher, fundsHandler], [amount * -1n, amount]); - }); - }); - context("onERC721Received", function () { it("Should return correct selector value", async function () { const expectedSelector = bosonVoucher.interface.fragments.find((f) => f.name == "onERC721Received").selector; @@ -2611,19 +2170,4 @@ describe("IBosonVoucher", function () { expect(returnedSelector).to.equal(expectedSelector); }); }); - - async function deployMockProtocol() { - const mockProtocol = await deployMockContract(deployer, [ - ...exchangeHandler.interface.fragments, - ...offerHandler.interface.fragments, - ...configHandler.interface.fragments, - ]); //deploys mock - - // Update protocol address on beacon - await beacon.connect(deployer).setProtocolAddress(await mockProtocol.getAddress()); - - await mockProtocol.mock.getAccessControllerAddress.returns(await accessController.getAddress()); - - return mockProtocol; - } }); diff --git a/test/util/utils.js b/test/util/utils.js index 8af0978ee..1c4ce780b 100644 --- a/test/util/utils.js +++ b/test/util/utils.js @@ -190,7 +190,7 @@ async function prepareDataSignatureParameters( domainData.salt = zeroPadValue("0x" + 31337n.toString(16), 32); } else { const { chainId } = await provider.getNetwork(); - domainData.chainId = chainId; + domainData.chainId = chainId.toString(); } // Prepare the types @@ -425,7 +425,7 @@ async function revertToSnapshot(snapshotId) { } function deriveTokenId(offerId, exchangeId) { - return BigInt(offerId) * BigInt(2) ** BigInt(128) + BigInt(exchangeId); + return BigInt(offerId) * 2n ** 128n + BigInt(exchangeId); } exports.setNextBlockTimestamp = setNextBlockTimestamp; From 772338c0277f837f00c60aa28c2840b52b0b2aa7 Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Mon, 26 Jun 2023 20:53:31 -0300 Subject: [PATCH 20/32] Finalise refactor on BV --- test/protocol/clients/BosonVoucherTest.js | 75 ++++++++++++----------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/test/protocol/clients/BosonVoucherTest.js b/test/protocol/clients/BosonVoucherTest.js index 6997bf2f8..749c15d53 100644 --- a/test/protocol/clients/BosonVoucherTest.js +++ b/test/protocol/clients/BosonVoucherTest.js @@ -211,13 +211,6 @@ describe("IBosonVoucher", function () { snapshotId = await getSnapshot(); }); - after; - - /// afterEach(async function () { - /// // Reset - /// accountId.next(true); - /// }); - context("issueVoucher()", function () { let buyerStruct; let buyerWallet; @@ -227,11 +220,6 @@ describe("IBosonVoucher", function () { buyerWallet = buyerStruct[1]; }); - // after(async function () { - // // Reset the accountId iterator - // accountId.next(true); - // }); - it("should issue a voucher with success", async function () { const balanceBefore = await bosonVoucher.balanceOf(await buyer.getAddress()); await bosonVoucher.connect(protocol).issueVoucher(0, buyerWallet); @@ -1070,31 +1058,34 @@ describe("IBosonVoucher", function () { } }); - it.skip("Multiple ranges", async function () { + it("Multiple ranges", async function () { // Add five more ranges // This tests more getPreMintStatus than ownerOf // Might even be put into integration tests - // Adjust config value - await configHandler.connect(deployer).setMaxPremintedVouchers("10000"); let previousOfferId = Number(offerId); let previousStartId = Number(start); let ranges = [new Range(Number(start), length, amount, "0")]; length = Number(length); - for (let i = 0; i < 5; i++) { - offerId = previousOfferId + (i + 1) * 6; + offerId = ++previousOfferId; + + while (offerId <= 6) { start = previousStartId + length + 100; + await offerHandler + .connect(assistant) + .createOffer(offer, offerDates, offerDurations, disputeResolverId, "0"); + // reserve length await bosonVoucher.connect(protocol).reserveRange(offerId, start, length, await assistant.getAddress()); // amount to premint - amount = length - i * 30; + amount = length - (offerId - 2) * 30; await bosonVoucher.connect(assistant).preMint(offerId, amount); ranges.push(new Range(start, length, amount, "0")); previousStartId = start; - previousOfferId = offerId; + offerId++; } let endTokenId = previousStartId + length; // last range end @@ -1102,8 +1093,8 @@ describe("IBosonVoucher", function () { let currentRange = ranges[rangeIndex]; let currentRangeMintEndId = currentRange.start + currentRange.minted - 1; let currentRangeEndId = currentRange.start + length - 1; + offerId = 1; - offerId = "5"; for (let i = 0; i < endTokenId; i++) { const tokenId = deriveTokenId(offerId, i); if (i < currentRange.start) { @@ -1127,7 +1118,7 @@ describe("IBosonVoucher", function () { currentRange = ranges[++rangeIndex]; currentRangeMintEndId = currentRange.start + currentRange.minted - 1; currentRangeEndId = currentRange.start + currentRange.length - 1; - offerId = Number(offerId) + rangeIndex * 6; + offerId++; } // Technically, next range could be consecutive and next call should return seller's address // But range construction in this test ensures gaps between ranges @@ -1138,13 +1129,15 @@ describe("IBosonVoucher", function () { } }); - it.skip("Consecutive ranges", async function () { + it("Consecutive ranges", async function () { // Make two consecutive ranges let nextOfferId = Number(offerId) + 1; let nextStartId = Number(start) + Number(length); let nextLength = "10"; let nextAmount = "5"; + await offerHandler.connect(assistant).createOffer(offer, offerDates, offerDurations, disputeResolverId, "0"); + // reserve length await bosonVoucher .connect(protocol) @@ -1155,33 +1148,39 @@ describe("IBosonVoucher", function () { // First range - preminted tokens let startTokenId = deriveTokenId(offerId, start); - let endTokenId = startTokenId + amount; - for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { + let endTokenId = startTokenId + BigInt(amount); + + for (let i = startTokenId; i < endTokenId; i = i + 1n) { let tokenOwner = await bosonVoucher.ownerOf(i); assert.equal(tokenOwner, await assistant.getAddress(), `Token owner mismatch ${i.toString()}`); } // First range - not preminted tokens startTokenId = endTokenId; + let endExchangeId = Number(start) + Number(length); endTokenId = deriveTokenId(offerId, endExchangeId); - for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { + + for (let i = startTokenId; i < endTokenId; i = i + 1n) { await expect(bosonVoucher.connect(rando).ownerOf(i)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); } // Second range - preminted tokens startTokenId = deriveTokenId(nextOfferId, endExchangeId); - endTokenId = startTokenId + nextAmount; - for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { + + endTokenId = startTokenId + BigInt(nextAmount); + for (let i = startTokenId; i < endTokenId; i = i + 1n) { let tokenOwner = await bosonVoucher.ownerOf(i); assert.equal(tokenOwner, await assistant.getAddress(), `Token owner mismatch ${i.toString()}`); } // Second range - not preminted tokens startTokenId = endTokenId; + endExchangeId += Number(nextLength); endTokenId = deriveTokenId(nextOfferId, endExchangeId); - for (let i = startTokenId; i.lt(endTokenId); i = i + 1) { + + for (let i = startTokenId; i < endTokenId; i = i + 1n) { await expect(bosonVoucher.connect(rando).ownerOf(i)).to.be.revertedWith(RevertReasons.ERC721_NON_EXISTENT); } }); @@ -1610,7 +1609,6 @@ describe("IBosonVoucher", function () { await exchangeHandler.connect(buyer).commitToOffer(buyerAddress, offerId, { value: offer.price }); const tokenId = deriveTokenId(offerId, 1); - console.log(tokenId); const tokenURI = await bosonVoucher.tokenURI(tokenId); expect(tokenURI).eq(metadataUri); }); @@ -1829,7 +1827,6 @@ describe("IBosonVoucher", function () { }); context("withdrawToProtocol", function () { it("Can withdraw native token", async function () { - // Sellers available funds should be empty const sellersFundsBefore = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); const amount = parseUnits("1", "ether"); @@ -1840,7 +1837,6 @@ describe("IBosonVoucher", function () { [amount * -1n, amount] ); - console.log(sellersFundsBefore); const { availableAmount } = sellersFundsBefore.funds.find((fund) => fund.tokenAddress == ZeroAddress); // Seller's available balance should increase @@ -1874,10 +1870,9 @@ describe("IBosonVoucher", function () { }); it("Should withdraw all tokens when list length > 1", async function () { - // Sellers available funds should be empty - const sellersFundsBefore = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); - let expectedAvailableFunds = new FundsList([]); - expect(sellersFundsBefore).to.eql(expectedAvailableFunds); + const { funds: sellerFundsBefore } = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); + + sellerFundsBefore[1] = new Funds(await foreign20.getAddress(), "Foreign20", "0"); const amount = parseUnits("1", "ether"); await admin.sendTransaction({ to: await bosonVoucher.getAddress(), value: amount }); @@ -1891,6 +1886,14 @@ describe("IBosonVoucher", function () { return tx; }).to.changeTokenBalances(foreign20, [bosonVoucher, fundsHandler], [amount * -1n, amount]); await expect(() => tx).to.changeEtherBalances([bosonVoucher, fundsHandler], [amount * -1n, amount]); + + const { funds: sellerFundsAfter } = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); + + expect( + sellerFundsBefore.map((f) => { + return { ...f, availableAmount: (BigInt(f.availableAmount) + amount).toString() }; + }) + ).to.eql(sellerFundsAfter); }); }); @@ -2161,7 +2164,7 @@ describe("IBosonVoucher", function () { context("onERC721Received", function () { it("Should return correct selector value", async function () { const expectedSelector = bosonVoucher.interface.fragments.find((f) => f.name == "onERC721Received").selector; - const returnedSelector = await bosonVoucher.callStatic.onERC721Received( + const returnedSelector = await bosonVoucher.onERC721Received.staticCall( await assistant.getAddress(), await rando.getAddress(), "1", From 39475754c901756617ca1976c15d2df1ba86011b Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Mon, 26 Jun 2023 21:31:08 -0300 Subject: [PATCH 21/32] Tidy --- .../protocol/clients/voucher/BosonVoucher.sol | 3 +- .../protocol/facets/ExchangeHandlerFacet.sol | 1 - scripts/deploy-suite.js | 29 ++- scripts/domain/Role.js | 2 +- .../SnapshotGate/deploy-snapshot-gate.js | 2 +- scripts/manage-roles.js | 4 +- scripts/migrations/migrate_2.2.1.js | 2 +- scripts/upgrade-clients.js | 13 +- scripts/upgrade-facets.js | 15 +- scripts/upgrade-hooks/2.2.0.js | 1 + scripts/util/estimate-limits.js | 131 +++++++++--- scripts/util/validations.js | 2 - test/domain/OfferDatesTest.js | 1 - test/example/SnapshotGateTest.js | 43 +++- .../01-update-account-roles-addresses.js | 38 ++-- test/integration/02-Upgraded-facet.js | 75 ++++--- ...DR-removes-the-seller-from-allowed-list.js | 17 +- test/integration/04-DR-removes-fees.js | 58 +++--- test/integration/seaport/fixtures.js | 35 ++-- .../seaport/seaport-integration.js | 29 ++- test/protocol/DisputeHandlerTest.js | 2 +- test/protocol/FundsHandlerTest.js | 3 +- test/protocol/clients/BosonVoucherTest.js | 1 - test/upgrade/01_generic.js | 12 +- test/upgrade/2.0.0-2.1.0.js | 7 +- test/upgrade/2.1.0-2.2.0.js | 92 +++++++-- test/upgrade/2.2.0-2.2.1.js | 12 +- test/upgrade/clients/01_generic.js | 5 +- .../clients/BosonVoucher-2.1.0-2.2.0.js | 34 ++-- test/util/constants.js | 2 - test/util/upgrade.js | 188 ++++++++++-------- test/util/utils.js | 8 +- 32 files changed, 548 insertions(+), 319 deletions(-) diff --git a/contracts/protocol/clients/voucher/BosonVoucher.sol b/contracts/protocol/clients/voucher/BosonVoucher.sol index d1a8f721d..c129b08a9 100644 --- a/contracts/protocol/clients/voucher/BosonVoucher.sol +++ b/contracts/protocol/clients/voucher/BosonVoucher.sol @@ -1,7 +1,6 @@ -// SPDX-License-Identifier: GPL-3.0-or-latehr +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.18; -import "hardhat/console.sol"; import "../../../domain/BosonConstants.sol"; import { ERC721Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import { IERC721Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol"; diff --git a/contracts/protocol/facets/ExchangeHandlerFacet.sol b/contracts/protocol/facets/ExchangeHandlerFacet.sol index c19fd83f3..53c051fa0 100644 --- a/contracts/protocol/facets/ExchangeHandlerFacet.sol +++ b/contracts/protocol/facets/ExchangeHandlerFacet.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.18; -import "hardhat/console.sol"; import { IBosonExchangeHandler } from "../../interfaces/handlers/IBosonExchangeHandler.sol"; import { IBosonAccountHandler } from "../../interfaces/handlers/IBosonAccountHandler.sol"; import { IBosonVoucher } from "../../interfaces/clients/IBosonVoucher.sol"; diff --git a/scripts/deploy-suite.js b/scripts/deploy-suite.js index 3eb2e67b2..8be1f35aa 100644 --- a/scripts/deploy-suite.js +++ b/scripts/deploy-suite.js @@ -1,6 +1,6 @@ const environments = require("../environments"); const hre = require("hardhat"); -const ethers = hre.ethers; +const { ZeroAddress, getContractAt, getSigners } = hre.ethers; const network = hre.network.name; const confirmations = network == "hardhat" ? 1 : environments.confirmations; const tipMultiplier = BigInt(environments.tipMultiplier); @@ -83,8 +83,20 @@ async function main(env, facetConfig) { maxPriorityFeePerGas ); deploymentComplete("AccessController", await accessController.getAddress(), [], "", contracts); - deploymentComplete("DiamondLoupeFacet", await dlf.getAddress(), [], interfaceIdFromFacetName("DiamondLoupeFacet"), contracts); - deploymentComplete("DiamondCutFacet", await dcf.getAddress(), [], interfaceIdFromFacetName("DiamondCutFacet"), contracts); + deploymentComplete( + "DiamondLoupeFacet", + await dlf.getAddress(), + [], + interfaceIdFromFacetName("DiamondLoupeFacet"), + contracts + ); + deploymentComplete( + "DiamondCutFacet", + await dcf.getAddress(), + [], + interfaceIdFromFacetName("DiamondCutFacet"), + contracts + ); deploymentComplete("ERC165Facet", await erc165f.getAddress(), [], interfaceIdFromFacetName("ERC165Facet"), contracts); deploymentComplete("ProtocolDiamond", await protocolDiamond.getAddress(), diamondArgs, "", contracts); @@ -113,12 +125,17 @@ async function main(env, facetConfig) { } const { version } = packageFile; - let { deployedFacets } = await deployAndCutFacets(await protocolDiamond.getAddress(), facetData, maxPriorityFeePerGas, version); + let { deployedFacets } = await deployAndCutFacets( + await protocolDiamond.getAddress(), + facetData, + maxPriorityFeePerGas, + version + ); for (const deployedFacet of deployedFacets) { deploymentComplete( deployedFacet.name, - deployedFacet.await contract.getAddress(), + deployedFacet.contract, deployedFacet.constructorArgs, interfaceIdFromFacetName(deployedFacet.name), contracts @@ -205,7 +222,7 @@ async function main(env, facetConfig) { ); await transactionResponse.wait(confirmations); - if (adminAddress.toLowerCase() != await deployer.getAddress().toLowerCase()) { + if (adminAddress.toLowerCase() != (await deployer.getAddress().toLowerCase())) { // Grant ADMIN role to the specified admin address // Skip this step if adminAddress is the deployer transactionResponse = await accessController.grantRole( diff --git a/scripts/domain/Role.js b/scripts/domain/Role.js index bde64b6c8..92e185337 100644 --- a/scripts/domain/Role.js +++ b/scripts/domain/Role.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const { keccak256, toUtf8Bytes } = hre.ethers; +const { keccak256, toUtf8Bytes } = hre.ethers; /** * Boson Protocol Domain Enum: Role diff --git a/scripts/example/SnapshotGate/deploy-snapshot-gate.js b/scripts/example/SnapshotGate/deploy-snapshot-gate.js index 16670413f..9361157a3 100644 --- a/scripts/example/SnapshotGate/deploy-snapshot-gate.js +++ b/scripts/example/SnapshotGate/deploy-snapshot-gate.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getContractFactory } = hre.ethers; const environments = require("../../../environments"); const confirmations = hre.network.name == "hardhat" ? 1 : environments.confirmations; const { getFees } = require("../../util/utils"); diff --git a/scripts/manage-roles.js b/scripts/manage-roles.js index 42b57c912..e1799efcc 100644 --- a/scripts/manage-roles.js +++ b/scripts/manage-roles.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getContractAt, provider } = hre.ethers; const network = hre.network.name; const { RoleAssignments } = require("./config/role-assignments"); const { readContracts } = require("./util/utils"); @@ -63,7 +63,7 @@ async function main(env) { let contractInfo; contractInfo = contractsFile.contracts.find((i) => i.name === name); - await config.getAddress() = name === "AdminAddress" ? environments[network].adminAddress : await contractInfo.getAddress(); + config.address = name === "AdminAddress" ? environments[network].adminAddress : await contractInfo.getAddress(); console.log(` 👉 ${await config.getAddress()}`); diff --git a/scripts/migrations/migrate_2.2.1.js b/scripts/migrations/migrate_2.2.1.js index e8eaff506..a11a5f543 100644 --- a/scripts/migrations/migrate_2.2.1.js +++ b/scripts/migrations/migrate_2.2.1.js @@ -1,7 +1,7 @@ const shell = require("shelljs"); const { readContracts } = require("../util/utils.js"); const hre = require("hardhat"); -const ethers = hre.ethers; +const { provider, getContractAt } = hre.ethers; const network = hre.network.name; const { getStateModifyingFunctionsHashes } = require("../../scripts/util/diamond-utils.js"); const tag = "v2.2.1"; diff --git a/scripts/upgrade-clients.js b/scripts/upgrade-clients.js index 86a93359b..df0549401 100644 --- a/scripts/upgrade-clients.js +++ b/scripts/upgrade-clients.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { provider, ZeroAddress, getSigners, getSigner, getContractAt } = hre.ethers; const network = hre.network.name; const environments = require("../environments"); const tipMultiplier = BigInt(environments.tipMultiplier); @@ -37,8 +37,7 @@ async function main(env, clientConfig, version) { console.log(`⛓ Network: ${network}\n📅 ${new Date()}`); // If hardhat, get an address generated by the mnemonic - const adminAddress = - network === "hardhat" ? (await getSigners())[0].address : environments[network].adminAddress; + const adminAddress = network === "hardhat" ? (await getSigners())[0].address : environments[network].adminAddress; // If admin address is unspecified, exit the process if (adminAddress == ZeroAddress || !adminAddress) { @@ -88,7 +87,13 @@ async function main(env, clientConfig, version) { // Remove old entry from contracts contracts = contracts.filter((i) => i.name !== "BosonVoucher Logic"); - deploymentComplete("BosonVoucher Logic", await bosonVoucherImplementation.getAddress(), clientImplementationArgs, "", contracts); + deploymentComplete( + "BosonVoucher Logic", + await bosonVoucherImplementation.getAddress(), + clientImplementationArgs, + "", + contracts + ); const contractsPath = await writeContracts(contracts, env, version); console.log(divider); diff --git a/scripts/upgrade-facets.js b/scripts/upgrade-facets.js index 6e1d882ae..81bcd3a42 100644 --- a/scripts/upgrade-facets.js +++ b/scripts/upgrade-facets.js @@ -1,6 +1,6 @@ const fs = require("fs"); const hre = require("hardhat"); -const ethers = hre.ethers; +const { ZeroAddress, getContractAt, provider, getSigners, getContractFactory } = hre.ethers; const network = hre.network.name; const { getFacets } = require("./config/facet-upgrade"); const environments = require("../environments"); @@ -81,8 +81,7 @@ async function main(env, facetConfig, version) { } // If hardhat, get an address generated by the mnemonic - const adminAddress = - network === "hardhat" ? (await getSigners())[0].address : environments[network].adminAddress; + const adminAddress = network === "hardhat" ? (await getSigners())[0].address : environments[network].adminAddress; // If admin address is unspecified, exit the process if (adminAddress == ZeroAddress || !adminAddress) { @@ -201,13 +200,7 @@ async function main(env, facetConfig, version) { contracts = contracts.filter((i) => i.name !== newFacet.name); const newFacetInterfaceId = interfaceIdFromFacetName(newFacet.name); - deploymentComplete( - newFacet.name, - newFacet.await contract.getAddress(), - newFacet.constructorArgs, - newFacetInterfaceId, - contracts - ); + deploymentComplete(newFacet.name, newFacet.contract, newFacet.constructorArgs, newFacetInterfaceId, contracts); // Get new selectors from compiled contract const selectors = getSelectors(newFacet.contract, true); @@ -262,7 +255,7 @@ async function main(env, facetConfig, version) { } } - const newFacetAddress = newFacet.await contract.getAddress(); + const newFacetAddress = newFacet.contract; if (selectorsToAdd.length > 0) { deployedFacets[index].cut.push([newFacetAddress, FacetCutAction.Add, selectorsToAdd]); } diff --git a/scripts/upgrade-hooks/2.2.0.js b/scripts/upgrade-hooks/2.2.0.js index 8401ac54a..b439d59bb 100644 --- a/scripts/upgrade-hooks/2.2.0.js +++ b/scripts/upgrade-hooks/2.2.0.js @@ -1,4 +1,5 @@ const { ethers } = require("hardhat"); +const { getContractAt } = ethers; const environments = require("../../environments"); const tipMultiplier = BigInt(environments.tipMultiplier); const tipSuggestion = "1500000000"; // js always returns this constant, it does not vary per block diff --git a/scripts/util/estimate-limits.js b/scripts/util/estimate-limits.js index c31a581e5..4a2bbe0af 100644 --- a/scripts/util/estimate-limits.js +++ b/scripts/util/estimate-limits.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { Wallet, provider, ZeroAddress, parseEther, MaxUint256, getContractAt, getSigners, parseUnits } = hre.ethers; const simpleStatistic = require("simple-statistics"); const fs = require("fs"); @@ -98,7 +98,12 @@ setupEnvironment["maxAllowedSellers"] = async function (sellerCount = 10) { }; await other1.sendTransaction(tx); - const seller = mockSeller(await wallet.getAddress(), await wallet.getAddress(), await wallet.getAddress(), await wallet.getAddress()); + const seller = mockSeller( + await wallet.getAddress(), + await wallet.getAddress(), + await wallet.getAddress(), + await wallet.getAddress() + ); await accountHandler.connect(connectedWallet).createSeller(seller, emptyAuthToken, voucherInitValues); } @@ -112,18 +117,33 @@ setupEnvironment["maxAllowedSellers"] = async function (sellerCount = 10) { const sellerAllowList = [...Array(sellerCount + 1).keys()].slice(1); // Dispute resolver 2 - used in "addSellersToAllowList" - const disputeResolver2 = mockDisputeResolver(await dr2.getAddress(), await dr2.getAddress(), await dr2.getAddress(), await dr2.getAddress()); + const disputeResolver2 = mockDisputeResolver( + await dr2.getAddress(), + await dr2.getAddress(), + await dr2.getAddress(), + await dr2.getAddress() + ); await accountHandler.connect(dr2).createDisputeResolver(disputeResolver2, disputeResolverFees, []); const args_2 = [disputeResolver2.id, sellerAllowList]; const arrayIndex_2 = 1; // Dispute resolver 3 - used in "removeSellersFromAllowList" - const disputeResolver3 = mockDisputeResolver(await dr3.getAddress(), await dr3.getAddress(), await dr3.getAddress(), await dr3.getAddress()); + const disputeResolver3 = mockDisputeResolver( + await dr3.getAddress(), + await dr3.getAddress(), + await dr3.getAddress(), + await dr3.getAddress() + ); await accountHandler.connect(dr3).createDisputeResolver(disputeResolver3, disputeResolverFees, sellerAllowList); const args_3 = [disputeResolver3.id, sellerAllowList]; const arrayIndex_3 = 1; - const disputeResolver1 = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress()); + const disputeResolver1 = mockDisputeResolver( + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress() + ); const args_1 = [disputeResolver1, disputeResolverFees, sellerAllowList]; const arrayIndex_1 = 2; @@ -149,19 +169,34 @@ setupEnvironment["maxFeesPerDisputeResolver"] = async function (feesCount = 10) } // Dispute resolver 2 - used in "addFeesToDisputeResolver" - const disputeResolver2 = mockDisputeResolver(await dr2.getAddress(), await dr2.getAddress(), await dr2.getAddress(), await dr2.getAddress()); + const disputeResolver2 = mockDisputeResolver( + await dr2.getAddress(), + await dr2.getAddress(), + await dr2.getAddress(), + await dr2.getAddress() + ); await accountHandler.connect(dr2).createDisputeResolver(disputeResolver2, [], []); const args_2 = [disputeResolver2.id, disputeResolverFees]; const arrayIndex_2 = 1; // Dispute resolver 3 - used in "removeFeesFromDisputeResolver" - const disputeResolver3 = mockDisputeResolver(await dr3.getAddress(), await dr3.getAddress(), await dr3.getAddress(), await dr3.getAddress()); + const disputeResolver3 = mockDisputeResolver( + await dr3.getAddress(), + await dr3.getAddress(), + await dr3.getAddress(), + await dr3.getAddress() + ); await accountHandler.connect(dr3).createDisputeResolver(disputeResolver3, disputeResolverFees, [], { gasLimit }); const feeTokenAddressesToRemove = disputeResolverFees.map((DRfee) => DRfee.tokenAddress); const args_3 = [disputeResolver3.id, feeTokenAddressesToRemove]; const arrayIndex_3 = 1; - const disputeResolver1 = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress()); + const disputeResolver1 = mockDisputeResolver( + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress() + ); const args_1 = [disputeResolver1, disputeResolverFees, []]; const arrayIndex_1 = 1; @@ -212,7 +247,13 @@ setupEnvironment["maxOffersPerBatch"] = async function (offerCount = 10) { ); await accountHandler.connect(sellerWallet3).createSeller(seller3, emptyAuthToken, voucherInitValues); - const disputeResolver = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), true); + const disputeResolver = mockDisputeResolver( + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress(), + true + ); await accountHandler .connect(dr1) .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); @@ -296,7 +337,13 @@ setupEnvironment["maxOffersPerGroup"] = async function (offerCount = 10) { ); await accountHandler.connect(sellerWallet3).createSeller(seller3, emptyAuthToken, voucherInitValues); - const disputeResolver = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), true); + const disputeResolver = mockDisputeResolver( + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress(), + true + ); await accountHandler .connect(dr1) .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); @@ -367,7 +414,13 @@ setupEnvironment["maxOffersPerBundle"] = async function (offerCount = 10) { await accountHandler.connect(sellerWallet1).createSeller(seller1, emptyAuthToken, voucherInitValues); - const disputeResolver = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), true); + const disputeResolver = mockDisputeResolver( + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress(), + true + ); await accountHandler .connect(dr1) .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); @@ -427,7 +480,13 @@ setupEnvironment["maxTwinsPerBundle"] = async function (twinCount = 10) { await accountHandler.connect(sellerWallet1).createSeller(seller1, emptyAuthToken, voucherInitValues); - const disputeResolver = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), true); + const disputeResolver = mockDisputeResolver( + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress(), + true + ); await accountHandler .connect(dr1) .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); @@ -484,7 +543,13 @@ setupEnvironment["maxExchangesPerBatch"] = async function (exchangesCount = 10) await accountHandler.connect(sellerWallet1).createSeller(seller1, emptyAuthToken, voucherInitValues); - const disputeResolver = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), true); + const disputeResolver = mockDisputeResolver( + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress(), + true + ); await accountHandler .connect(dr1) .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); @@ -497,9 +562,7 @@ setupEnvironment["maxExchangesPerBatch"] = async function (exchangesCount = 10) // Deposit seller funds so the commit will succeed const sellerPool = BigInt(offer.price).mul(exchangesCount); - await fundsHandler - .connect(sellerWallet1) - .depositFunds(seller1.id, ZeroAddress, sellerPool, { value: sellerPool }); + await fundsHandler.connect(sellerWallet1).depositFunds(seller1.id, ZeroAddress, sellerPool, { value: sellerPool }); await setNextBlockTimestamp(Number(offerDates.voucherRedeemableFrom)); for (let i = 1; i < exchangesCount + 1; i++) { @@ -546,7 +609,13 @@ setupEnvironment["maxDisputesPerBatch"] = async function (exchangesCount = 10) { await accountHandler.connect(sellerWallet1).createSeller(seller1, emptyAuthToken, voucherInitValues); - const disputeResolver = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), true); + const disputeResolver = mockDisputeResolver( + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress(), + true + ); await accountHandler .connect(dr1) .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); @@ -559,9 +628,7 @@ setupEnvironment["maxDisputesPerBatch"] = async function (exchangesCount = 10) { // Deposit seller funds so the commit will succeed const sellerPool = BigInt(offer.price).mul(exchangesCount); - await fundsHandler - .connect(sellerWallet1) - .depositFunds(seller1.id, ZeroAddress, sellerPool, { value: sellerPool }); + await fundsHandler.connect(sellerWallet1).depositFunds(seller1.id, ZeroAddress, sellerPool, { value: sellerPool }); await setNextBlockTimestamp(Number(offerDates.voucherRedeemableFrom)); for (let i = 1; i < exchangesCount + 1; i++) { @@ -612,7 +679,13 @@ setupEnvironment["maxTokensPerWithdrawal"] = async function (tokenCount = 10) { await accountHandler.connect(sellerWallet1).createSeller(seller1, emptyAuthToken, voucherInitValues); - const disputeResolver = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), true); + const disputeResolver = mockDisputeResolver( + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress(), + true + ); await accountHandler .connect(dr1) .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); @@ -630,12 +703,16 @@ setupEnvironment["maxTokensPerWithdrawal"] = async function (tokenCount = 10) { await tokenContract.mint(await buyer.getAddress(), offer.price); await tokenContract.connect(sellerWallet1).approve(await protocolDiamond.getAddress(), offer.sellerDeposit); await tokenContract.connect(buyer).approve(await protocolDiamond.getAddress(), offer.price); - await fundsHandler.connect(sellerWallet1).depositFunds(seller1.id, await tokenContract.getAddress(), offer.sellerDeposit); + await fundsHandler + .connect(sellerWallet1) + .depositFunds(seller1.id, await tokenContract.getAddress(), offer.sellerDeposit); // add token to DR accepted tokens await accountHandler .connect(dr1) - .addFeesToDisputeResolver(disputeResolver.id, [new DisputeResolverFee(await tokenContract.getAddress(), `Token${i}`, "0")]); + .addFeesToDisputeResolver(disputeResolver.id, [ + new DisputeResolverFee(await tokenContract.getAddress(), `Token${i}`, "0"), + ]); // create the offer await offerHandler @@ -690,7 +767,13 @@ setupEnvironment["maxPremintedVouchers"] = async function (tokenCount = 10) { await accountHandler.connect(sellerWallet1).createSeller(seller1, emptyAuthToken, voucherInitValues); - const disputeResolver = mockDisputeResolver(await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), await dr1.getAddress(), true); + const disputeResolver = mockDisputeResolver( + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress(), + await dr1.getAddress(), + true + ); await accountHandler .connect(dr1) .createDisputeResolver(disputeResolver, [new DisputeResolverFee(ZeroAddress, "Native", "0")], []); diff --git a/scripts/util/validations.js b/scripts/util/validations.js index 8bf15e294..27179f2c2 100644 --- a/scripts/util/validations.js +++ b/scripts/util/validations.js @@ -1,5 +1,3 @@ -const hre = require("hardhat"); -const ethers = hre.ethers; const eip55 = require("eip55"); /** diff --git a/test/domain/OfferDatesTest.js b/test/domain/OfferDatesTest.js index 9f90f2c54..0f32c9023 100644 --- a/test/domain/OfferDatesTest.js +++ b/test/domain/OfferDatesTest.js @@ -1,4 +1,3 @@ -const hre = require("hardhat"); const { expect } = require("chai"); const OfferDates = require("../../scripts/domain/OfferDates"); const { oneWeek, oneMonth } = require("../util/constants"); diff --git a/test/example/SnapshotGateTest.js b/test/example/SnapshotGateTest.js index f8ad69bdf..1784b6439 100644 --- a/test/example/SnapshotGateTest.js +++ b/test/example/SnapshotGateTest.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { getContractAt, parseUnits, ZeroAddress, getSigners } = hre.ethers; const { expect } = require("chai"); const Role = require("../../scripts/domain/Role"); @@ -175,7 +175,12 @@ describe("SnapshotGate", function () { // Deploy the SnapshotGate example sellerId = "1"; - [snapshotGate] = await deploySnapshotGateExample(["SnapshotGateToken", "SGT", await protocolDiamond.getAddress(), sellerId]); + [snapshotGate] = await deploySnapshotGateExample([ + "SnapshotGateToken", + "SGT", + await protocolDiamond.getAddress(), + sellerId, + ]); // Deploy the mock tokens [foreign20] = await deployMockTokens(["Foreign20"]); @@ -186,11 +191,21 @@ describe("SnapshotGate", function () { agentId = "0"; // agent id is optional while creating an offer // Create a valid seller - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + await clerk.getAddress(), + await treasury.getAddress() + ); expect(seller.isValid()).is.true; // Create a second seller - seller2 = mockSeller(await assistant2.getAddress(), await assistant2.getAddress(), ZeroAddress, await assistant2.getAddress()); + seller2 = mockSeller( + await assistant2.getAddress(), + await assistant2.getAddress(), + ZeroAddress, + await assistant2.getAddress() + ); expect(seller2.isValid()).is.true; // AuthToken @@ -592,7 +607,9 @@ describe("SnapshotGate", function () { // Commit to the offer await expect( - snapshotGate.connect(caller).commitToGatedOffer(await caller.getAddress(), offerId, entry.tokenId, { value: price }) + snapshotGate + .connect(caller) + .commitToGatedOffer(await caller.getAddress(), offerId, entry.tokenId, { value: price }) ).to.revertedWith("Invalid offer id"); }); @@ -611,7 +628,9 @@ describe("SnapshotGate", function () { // Commit to the offer await expect( - snapshotGate.connect(caller).commitToGatedOffer(await caller.getAddress(), offerId, entry.tokenId, { value: price }) + snapshotGate + .connect(caller) + .commitToGatedOffer(await caller.getAddress(), offerId, entry.tokenId, { value: price }) ).to.revertedWith("Snapshot is not frozen"); }); @@ -633,7 +652,9 @@ describe("SnapshotGate", function () { // Commit to the offer await expect( - snapshotGate.connect(caller).commitToGatedOffer(await caller.getAddress(), offerId, entry.tokenId, { value: price }) + snapshotGate + .connect(caller) + .commitToGatedOffer(await caller.getAddress(), offerId, entry.tokenId, { value: price }) ).to.revertedWith("Buyer held no balance of the given token id at time of snapshot"); }); @@ -732,7 +753,7 @@ describe("SnapshotGate", function () { let holder = holderByAddress[entry.owner]; // Wrong price - const halfPrice = BigInt(price)/BigInt(2).toString(); + const halfPrice = BigInt(price) / BigInt(2).toString(); // Commit to the offer await expect( @@ -890,9 +911,9 @@ describe("SnapshotGate", function () { let holder = holderByAddress[entry.owner]; // Check that holder cannot commit directly to the offer on the protocol itself - await expect(exchangeHandler.connect(holder).commitToOffer(await holder.getAddress(), offerId)).to.revertedWith( - "Caller cannot commit" - ); + await expect( + exchangeHandler.connect(holder).commitToOffer(await holder.getAddress(), offerId) + ).to.revertedWith("Caller cannot commit"); }); }); }); diff --git a/test/integration/01-update-account-roles-addresses.js b/test/integration/01-update-account-roles-addresses.js index 582f7b506..5bce253c7 100644 --- a/test/integration/01-update-account-roles-addresses.js +++ b/test/integration/01-update-account-roles-addresses.js @@ -1,4 +1,5 @@ const { ethers } = require("hardhat"); +const { ZeroAddress, provider } = ethers; const { expect } = require("chai"); const { @@ -82,10 +83,21 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { expect(voucherInitValues.isValid()).is.true; // Create a seller account - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + await clerk.getAddress(), + await treasury.getAddress() + ); await expect(accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues)) .to.emit(accountHandler, "SellerCreated") - .withArgs(seller.id, seller.toStruct(), expectedCloneAddress, emptyAuthToken.toStruct(), await admin.getAddress()); + .withArgs( + seller.id, + seller.toStruct(), + expectedCloneAddress, + emptyAuthToken.toStruct(), + await admin.getAddress() + ); // Create a dispute resolver disputeResolver = mockDisputeResolver( @@ -99,9 +111,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { //Create DisputeResolverFee array so offer creation will succeed disputeResolverFeeNative = "0"; - const disputeResolverFees = [ - new DisputeResolverFee(ZeroAddress, "Native", disputeResolverFeeNative), - ]; + const disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", disputeResolverFeeNative)]; // Make empty seller list, so every seller is allowed const sellerAllowList = []; @@ -231,9 +241,9 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { await exchangeHandler.connect(buyer).cancelVoucher(exchangeId); // Expected buyer payoff: price - buyerCancelPenalty - buyerPayoff = BigInt(offer.price)-offer.buyerCancelPenalty.toString(); + buyerPayoff = BigInt(offer.price) - offer.buyerCancelPenalty.toString(); // Expected seller payoff: sellerDeposit + buyerCancelPenalty - sellerPayoff = BigInt(offer.sellerDeposit)+offer.buyerCancelPenalty.toString(); + sellerPayoff = BigInt(offer.sellerDeposit) + offer.buyerCancelPenalty.toString(); }); it("Buyer should be able to withdraw funds after updating wallet address", async function () { @@ -251,9 +261,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { ).to.revertedWith(RevertReasons.NOT_AUTHORIZED); // Attempt to withdraw funds with new buyer wallet, should succeed - await expect( - fundsHandler.connect(rando).withdrawFunds(buyerAccount.id, [ZeroAddress], [buyerPayoff]) - ) + await expect(fundsHandler.connect(rando).withdrawFunds(buyerAccount.id, [ZeroAddress], [buyerPayoff])) .to.emit(fundsHandler, "FundsWithdrawn") .withArgs(buyerAccount.id, await rando.getAddress(), ZeroAddress, buyerPayoff, await rando.getAddress()); }); @@ -288,9 +296,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { ).to.revertedWith(RevertReasons.NOT_AUTHORIZED); // Attempt to withdraw funds with new seller assistant, should succeed - await expect( - fundsHandler.connect(rando).withdrawFunds(seller.id, [ZeroAddress], [sellerPayoff]) - ) + await expect(fundsHandler.connect(rando).withdrawFunds(seller.id, [ZeroAddress], [sellerPayoff])) .to.emit(fundsHandler, "FundsWithdrawn") .withArgs(seller.id, await treasury.getAddress(), ZeroAddress, sellerPayoff, await rando.getAddress()); }); @@ -324,9 +330,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { ).to.revertedWith(RevertReasons.NOT_AUTHORIZED); // Attempt to withdraw funds with new agent wallet, should fail - await expect( - fundsHandler.connect(rando).withdrawFunds(agentAccount.id, [ZeroAddress], [agentPayoff]) - ) + await expect(fundsHandler.connect(rando).withdrawFunds(agentAccount.id, [ZeroAddress], [agentPayoff])) .to.emit(fundsHandler, "FundsWithdrawn") .withArgs(agentAccount.id, await rando.getAddress(), ZeroAddress, agentPayoff, await rando.getAddress()); }); @@ -367,7 +371,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { .withArgs(offer.id, buyerAccount.id, exchangeId, await rando.getAddress()); const block = await provider.getBlock(tx.blockNumber); - const disputePeriodEnd = redeemedDate+BigInt(offerDurations.disputePeriod); + const disputePeriodEnd = redeemedDate + BigInt(offerDurations.disputePeriod); // Expect the dispute period to not be over expect(block.timestamp).to.be.at.most(disputePeriodEnd); diff --git a/test/integration/02-Upgraded-facet.js b/test/integration/02-Upgraded-facet.js index 77cbcb113..73a32f9a5 100644 --- a/test/integration/02-Upgraded-facet.js +++ b/test/integration/02-Upgraded-facet.js @@ -1,4 +1,5 @@ const { ethers } = require("hardhat"); +const { ZeroAddress, getContractAt, getContractFactory, provider, parseUnits, getSigners } = ethers; const { expect, assert } = require("chai"); const { DisputeResolverFee } = require("../../scripts/domain/DisputeResolverFee"); const { deployMockTokens } = require("../../scripts/util/deploy-mock-tokens"); @@ -85,7 +86,12 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation beforeEach(async function () { // Create a valid seller, then set fields in tests directly - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + await clerk.getAddress(), + await treasury.getAddress() + ); expect(seller.isValid()).is.true; // VoucherInitValues @@ -201,9 +207,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation exchange.finalizedDate = "0"; // Deposit seller funds so the commit will succeed - await fundsHandler - .connect(assistant) - .depositFunds(seller.id, ZeroAddress, sellerPool, { value: sellerPool }); + await fundsHandler.connect(assistant).depositFunds(seller.id, ZeroAddress, sellerPool, { value: sellerPool }); }); afterEach(async function () { @@ -347,7 +351,9 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation context("👉 extendVoucher()", async function () { it("should emit an VoucherExtended2 event when seller's assistant calls", async function () { // Commit to offer - const tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerId, { value: price }); + const tx = await exchangeHandler + .connect(buyer) + .commitToOffer(await buyer.getAddress(), offerId, { value: price }); // Get the block timestamp of the confirmed tx const blockNumber = tx.blockNumber; @@ -360,7 +366,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation voucher.validUntilDate = calculateVoucherExpiry(block, voucherRedeemableFrom, voucherValid); // New expiry date for extensions - const validUntilDate = BigInt(voucher.validUntilDate)+oneMonth.toString(); + const validUntilDate = BigInt(voucher.validUntilDate) + oneMonth.toString(); // Upgrade Exchange handler facet await upgradeExchangeHandlerFacet("MockExchangeHandlerFacet"); @@ -422,7 +428,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation escalationPeriod = disputeResolver.escalationResponsePeriod; // Deposit seller funds so the commit will succeed - const fundsToDeposit = BigInt(sellerDeposit)*quantityAvailable; + const fundsToDeposit = BigInt(sellerDeposit) * quantityAvailable; await fundsHandler .connect(assistant) .depositFunds(seller.id, ZeroAddress, fundsToDeposit, { value: fundsToDeposit }); @@ -485,10 +491,10 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation const blockNumber = tx.blockNumber; const block = await provider.getBlock(blockNumber); const disputedDate = block.timestamp.toString(); - const timeout = BigInt(disputedDate)+resolutionPeriod.toString(); + const timeout = BigInt(disputedDate) + resolutionPeriod.toString(); // extend timeout for a month - const newDisputeTimeout = BigInt(timeout)+oneMonth.toString(); + const newDisputeTimeout = BigInt(timeout) + oneMonth.toString(); // Extend the dispute timeout, testing for the event await expect(disputeHandler.connect(assistant).extendDisputeTimeout(exchangeId, newDisputeTimeout)) @@ -506,7 +512,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation const blockNumber = tx.blockNumber; const block = await provider.getBlock(blockNumber); const disputedDate = block.timestamp.toString(); - const timeout = BigInt(disputedDate)+resolutionPeriod.toString(); + const timeout = BigInt(disputedDate) + resolutionPeriod.toString(); // Set time forward past the dispute resolution period await setNextBlockTimestamp(Number(timeout) + Number(oneWeek)); @@ -722,7 +728,10 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation sellerDeposit = offerToken.sellerDeposit; // top up seller's and buyer's account - await Promise.all([mockToken.mint(await assistant.getAddress(), sellerDeposit), mockToken.mint(await buyer.getAddress(), price)]); + await Promise.all([ + mockToken.mint(await assistant.getAddress(), sellerDeposit), + mockToken.mint(await buyer.getAddress(), price), + ]); // approve protocol to transfer the tokens await Promise.all([ @@ -733,14 +742,14 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // deposit to seller's pool await Promise.all([ fundsHandler.connect(assistant).depositFunds(seller.id, await mockToken.getAddress(), sellerDeposit), - fundsHandler - .connect(assistant) - .depositFunds(seller.id, ZeroAddress, sellerDeposit, { value: sellerDeposit }), + fundsHandler.connect(assistant).depositFunds(seller.id, ZeroAddress, sellerDeposit, { value: sellerDeposit }), ]); // commit to both offers await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerToken.id); - await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offerNative.id, { value: offerNative.price }); + await exchangeHandler + .connect(buyer) + .commitToOffer(await buyer.getAddress(), offerNative.id, { value: offerNative.price }); buyerId = accountId.next().value; }); @@ -761,12 +770,10 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // expected payoffs - they are the same for token and native currency // buyer: price - buyerCancelPenalty - const buyerPayoff = BigInt(offerToken.price)-offerToken.buyerCancelPenalty.toString(); + const buyerPayoff = BigInt(offerToken.price) - offerToken.buyerCancelPenalty.toString(); // seller: sellerDeposit + buyerCancelPenalty - const sellerPayoff = BigInt(offerToken.sellerDeposit) - +offerToken.buyerCancelPenalty - .toString(); + const sellerPayoff = BigInt(offerToken.sellerDeposit) + offerToken.buyerCancelPenalty.toString(); // Withdraw funds, testing for the event // Withdraw tokens @@ -774,8 +781,8 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation const tokenListBuyer = [ZeroAddress, await mockToken.getAddress()]; // Withdraw amounts - const tokenAmountsSeller = [sellerPayoff, BigInt(sellerPayoff)/"2".toString()]; - const tokenAmountsBuyer = [buyerPayoff, BigInt(buyerPayoff)/"5".toString()]; + const tokenAmountsSeller = [sellerPayoff, BigInt(sellerPayoff) / "2".toString()]; + const tokenAmountsBuyer = [buyerPayoff, BigInt(buyerPayoff) / "5".toString()]; // seller withdrawal const tx = await fundsHandler @@ -783,15 +790,21 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation .withdrawFunds(seller.id, tokenListSeller, tokenAmountsSeller); await expect(tx) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(seller.id, await treasury.getAddress(), await mockToken.getAddress(), sellerPayoff, await assistant.getAddress()); + .withArgs( + seller.id, + await treasury.getAddress(), + await mockToken.getAddress(), + sellerPayoff, + await assistant.getAddress() + ); await expect(tx) .to.emit(fundsHandler, "FundsWithdrawn") .withArgs( seller.id, await treasury.getAddress(), - constants.Zero, - BigInt(sellerPayoff)/"2", + 0n, + BigInt(sellerPayoff) / "2", await assistant.getAddress() ); @@ -803,13 +816,13 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation buyerId, await buyer.getAddress(), await mockToken.getAddress(), - BigInt(buyerPayoff)/"5", + BigInt(buyerPayoff) / "5", await buyer.getAddress() ); await expect(tx2) .to.emit(fundsHandler, "FundsWithdrawn") - .withArgs(buyerId, await buyer.getAddress(), constants.Zero, buyerPayoff, await buyer.getAddress()); + .withArgs(buyerId, await buyer.getAddress(), 0n, buyerPayoff, await buyer.getAddress()); }); }); @@ -823,12 +836,10 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // expected payoffs - they are the same for token and native currency // buyer: price - buyerCancelPenalty - const buyerPayoff = BigInt(offerToken.price)-offerToken.buyerCancelPenalty.toString(); + const buyerPayoff = BigInt(offerToken.price) - offerToken.buyerCancelPenalty.toString(); // seller: sellerDeposit + buyerCancelPenalty - const sellerPayoff = BigInt(offerToken.sellerDeposit) - +offerToken.buyerCancelPenalty - .toString(); + const sellerPayoff = BigInt(offerToken.sellerDeposit) + offerToken.buyerCancelPenalty.toString(); // Withdraw funds, testing for the event // Withdraw tokens @@ -836,8 +847,8 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation const tokenListBuyer = [ZeroAddress, await mockToken.getAddress()]; // Withdraw amounts - const tokenAmountsSeller = [sellerPayoff, BigInt(sellerPayoff)/"2".toString()]; - const tokenAmountsBuyer = [buyerPayoff, BigInt(buyerPayoff)/"5".toString()]; + const tokenAmountsSeller = [sellerPayoff, BigInt(sellerPayoff) / "2".toString()]; + const tokenAmountsBuyer = [buyerPayoff, BigInt(buyerPayoff) / "5".toString()]; // seller withdrawal // Attempt to withdraw the funds, expecting revert diff --git a/test/integration/03-DR-removes-the-seller-from-allowed-list.js b/test/integration/03-DR-removes-the-seller-from-allowed-list.js index c7c8b98a5..a3539f0dc 100644 --- a/test/integration/03-DR-removes-the-seller-from-allowed-list.js +++ b/test/integration/03-DR-removes-the-seller-from-allowed-list.js @@ -1,4 +1,5 @@ const { ethers } = require("hardhat"); +const { ZeroAddress } = ethers; const { expect } = require("chai"); const { DisputeResolverFee } = require("../../scripts/domain/DisputeResolverFee"); @@ -74,10 +75,20 @@ describe("[@skip-on-coverage] DR removes sellers from the approved seller list", const agentId = "0"; // agent id is optional while creating an offer // Create a valid seller - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + await clerk.getAddress(), + await treasury.getAddress() + ); expect(seller.isValid()).is.true; - const seller2 = mockSeller(await other1.getAddress(), await other1.getAddress(), ZeroAddress, await other1.getAddress()); + const seller2 = mockSeller( + await other1.getAddress(), + await other1.getAddress(), + ZeroAddress, + await other1.getAddress() + ); expect(seller2.isValid()).is.true; // VoucherInitValues @@ -139,7 +150,7 @@ describe("[@skip-on-coverage] DR removes sellers from the approved seller list", const voucherRedeemableFrom = offerDates.voucherRedeemableFrom; // Deposit seller funds so the commit will succeed - const fundsToDeposit = BigInt(sellerDeposit)*quantityAvailable; + const fundsToDeposit = BigInt(sellerDeposit) * quantityAvailable; await fundsHandler .connect(assistant) .depositFunds(seller.id, ZeroAddress, fundsToDeposit, { value: fundsToDeposit }); diff --git a/test/integration/04-DR-removes-fees.js b/test/integration/04-DR-removes-fees.js index 17ed61145..0387ad264 100644 --- a/test/integration/04-DR-removes-fees.js +++ b/test/integration/04-DR-removes-fees.js @@ -1,4 +1,4 @@ -const { ethers } = require("hardhat"); +const { ZeroAddress, provider } = require("hardhat"); const { expect } = require("chai"); const { @@ -66,10 +66,21 @@ describe("[@skip-on-coverage] DR removes fee", function () { expect(voucherInitValues.isValid()).is.true; // Create a seller account - seller = mockSeller(await assistant.getAddress(), await admin.getAddress(), await clerk.getAddress(), await treasury.getAddress()); + seller = mockSeller( + await assistant.getAddress(), + await admin.getAddress(), + await clerk.getAddress(), + await treasury.getAddress() + ); expect(await accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues)) .to.emit(accountHandler, "SellerCreated") - .withArgs(seller.id, seller.toStruct(), expectedCloneAddress, emptyAuthToken.toStruct(), await admin.getAddress()); + .withArgs( + seller.id, + seller.toStruct(), + expectedCloneAddress, + emptyAuthToken.toStruct(), + await admin.getAddress() + ); // Create a dispute resolver disputeResolver = mockDisputeResolver( @@ -83,9 +94,7 @@ describe("[@skip-on-coverage] DR removes fee", function () { //Create DisputeResolverFee array so offer creation will succeed disputeResolverFeeNative = "0"; - const disputeResolverFees = [ - new DisputeResolverFee(ZeroAddress, "Native", disputeResolverFeeNative), - ]; + const disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", disputeResolverFeeNative)]; // Make empty seller list, so every seller is allowed const sellerAllowList = []; @@ -106,7 +115,7 @@ describe("[@skip-on-coverage] DR removes fee", function () { await offerHandler.connect(assistant).createOffer(offer, offerDates, offerDurations, disputeResolverId, "0"); // Deposit seller funds so the commit will succeed - const fundsToDeposit = BigInt(offer.sellerDeposit)*offer.quantityAvailable; + const fundsToDeposit = BigInt(offer.sellerDeposit) * offer.quantityAvailable; await fundsHandler.connect(assistant).depositFunds(seller.id, ZeroAddress, fundsToDeposit, { value: fundsToDeposit, }); @@ -140,14 +149,14 @@ describe("[@skip-on-coverage] DR removes fee", function () { it("Buyer should be able to commit to offer even when DR removes fee", async function () { // Removes fee - await expect( - accountHandler.connect(adminDR).removeFeesFromDisputeResolver(disputeResolver.id, [ZeroAddress]) - ) + await expect(accountHandler.connect(adminDR).removeFeesFromDisputeResolver(disputeResolver.id, [ZeroAddress])) .to.emit(accountHandler, "DisputeResolverFeesRemoved") .withArgs(disputeResolver.id, [ZeroAddress], await adminDR.getAddress()); // Commit to offer - const tx = await exchangeHandler.connect(buyer).commitToOffer(await buyer.getAddress(), offer.id, { value: offer.price }); + const tx = await exchangeHandler + .connect(buyer) + .commitToOffer(await buyer.getAddress(), offer.id, { value: offer.price }); const blockTimestamp = (await provider.getBlock(tx.blockNumber)).timestamp; // Mock voucher @@ -164,7 +173,14 @@ describe("[@skip-on-coverage] DR removes fee", function () { // Check if offer was committed await expect(tx) .to.emit(exchangeHandler, "BuyerCommitted") - .withArgs(offer.id, buyerAccount.id, exchangeId, exchange.toStruct(), voucher.toStruct(), await buyer.getAddress()); + .withArgs( + offer.id, + buyerAccount.id, + exchangeId, + exchange.toStruct(), + voucher.toStruct(), + await buyer.getAddress() + ); }); context("👉 After raise dispute actions", async function () { @@ -185,11 +201,7 @@ describe("[@skip-on-coverage] DR removes fee", function () { .withArgs(exchangeId, disputeResolver.id, await buyer.getAddress()); // Removes fee - await expect( - accountHandler - .connect(adminDR) - .removeFeesFromDisputeResolver(disputeResolver.id, [ZeroAddress]) - ) + await expect(accountHandler.connect(adminDR).removeFeesFromDisputeResolver(disputeResolver.id, [ZeroAddress])) .to.emit(accountHandler, "DisputeResolverFeesRemoved") .withArgs(disputeResolver.id, [ZeroAddress], await adminDR.getAddress()); @@ -225,11 +237,7 @@ describe("[@skip-on-coverage] DR removes fee", function () { .withArgs(exchangeId, buyerPercentBasisPoints, await assistantDR.getAddress()); // Removes fee - await expect( - accountHandler - .connect(adminDR) - .removeFeesFromDisputeResolver(disputeResolver.id, [ZeroAddress]) - ) + await expect(accountHandler.connect(adminDR).removeFeesFromDisputeResolver(disputeResolver.id, [ZeroAddress])) .to.emit(accountHandler, "DisputeResolverFeesRemoved") .withArgs(disputeResolver.id, [ZeroAddress], await adminDR.getAddress()); @@ -248,11 +256,7 @@ describe("[@skip-on-coverage] DR removes fee", function () { .withArgs(exchangeId, await assistantDR.getAddress()); // Removes fee - await expect( - accountHandler - .connect(adminDR) - .removeFeesFromDisputeResolver(disputeResolver.id, [ZeroAddress]) - ) + await expect(accountHandler.connect(adminDR).removeFeesFromDisputeResolver(disputeResolver.id, [ZeroAddress])) .to.emit(accountHandler, "DisputeResolverFeesRemoved") .withArgs(disputeResolver.id, [ZeroAddress], await adminDR.getAddress()); diff --git a/test/integration/seaport/fixtures.js b/test/integration/seaport/fixtures.js index 024db442b..c65b4462a 100644 --- a/test/integration/seaport/fixtures.js +++ b/test/integration/seaport/fixtures.js @@ -1,6 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; -const { constants, BigNumber } = ethers; +const { ZeroHash, ZeroAddress } = hre.ethers; const { getOfferOrConsiderationItem, calculateOrderHash } = require("./utils"); const { expect } = require("chai"); const OrderType = require("./OrderTypeEnum"); @@ -10,13 +9,7 @@ const seaportFixtures = async (seaport) => { return getOfferOrConsiderationItem(2, token, identifierOrCriteria, startAmount, endAmount); }; - const getTestToken = function ( - identifierOrCriteria, - token = constants.AddressZero, - startAmount = 1, - endAmount = 1, - recipient - ) { + const getTestToken = function (identifierOrCriteria, token = ZeroAddress, startAmount = 1, endAmount = 1, recipient) { return getOfferOrConsiderationItem(0, token, identifierOrCriteria, startAmount, endAmount, recipient); }; @@ -29,7 +22,7 @@ const seaportFixtures = async (seaport) => { const getOrder = async function ( offerer, - zone = constants.AddressZero, + zone = ZeroAddress, offer, consideration, orderType = OrderType.FULL_OPEN, @@ -41,16 +34,16 @@ const seaportFixtures = async (seaport) => { ) { const parameters = { offerer: await offerer.getAddress(), - zone: zone?.address ?? constants.AddressZero, + zone: zone?.address ?? ZeroAddress, offer, consideration, orderType, - startTime: BigNumber.from(startTime), - endTime: BigNumber.from(endTime), + startTime: BigInt(startTime), + endTime: BigInt(endTime), zoneHash, - salt: BigNumber.from(salt), + salt: BigInt(salt), conduitKey, - totalOriginalConsiderationItems: BigNumber.from(consideration.length), + totalOriginalConsiderationItems: BigInt(consideration.length), }; const counter = await seaport.getCounter(await offerer.getAddress()); @@ -67,16 +60,12 @@ const seaportFixtures = async (seaport) => { // How much ether (at most) needs to be supplied when fulfilling the order const value = offer - .map((x) => - x.itemType === 0 ? (x.endAmount.gt(x.startAmount) ? x.endAmount : x.startAmount) : BigNumber.from(0) - ) - .reduce((a, b) => a+b, BigNumber.from(0)) + .map((x) => (x.itemType === 0 ? (x.endAmount.gt(x.startAmount) ? x.endAmount : x.startAmount) : BigInt(0))) + .reduce((a, b) => a + b, BigInt(0)) .add( consideration - .map((x) => - x.itemType === 0 ? (x.endAmount.gt(x.startAmount) ? x.endAmount : x.startAmount) : BigNumber.from(0) - ) - .reduce((a, b) => a+b, BigNumber.from(0)) + .map((x) => (x.itemType === 0 ? (x.endAmount.gt(x.startAmount) ? x.endAmount : x.startAmount) : BigInt(0))) + .reduce((a, b) => a + b, BigInt(0)) ); return { diff --git a/test/integration/seaport/seaport-integration.js b/test/integration/seaport/seaport-integration.js index 4c3e2e874..2fc2e0f20 100644 --- a/test/integration/seaport/seaport-integration.js +++ b/test/integration/seaport/seaport-integration.js @@ -1,5 +1,5 @@ const { ethers } = require("hardhat"); -const { constants, BigNumber } = ethers; +const { ZeroAddress, BigNumber, getContractAt, ZeroHash } = ethers; const { setupTestEnvironment, getEvent, calculateContractAddress, objectToArray } = require("../../util/utils"); const { SEAPORT_ADDRESS } = require("../../util/constants"); @@ -44,13 +44,24 @@ describe("[@skip-on-coverage] Seaport integration", function () { contractInstances: { accountHandler, offerHandler, fundsHandler }, } = await setupTestEnvironment(contracts)); - const seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), ZeroAddress, await assistant.getAddress()); + const seller = mockSeller( + await assistant.getAddress(), + await assistant.getAddress(), + ZeroAddress, + await assistant.getAddress() + ); const emptyAuthToken = mockAuthToken(); const voucherInitValues = mockVoucherInitValues(); await accountHandler.connect(assistant).createSeller(seller, emptyAuthToken, voucherInitValues); - const disputeResolver = mockDisputeResolver(await DR.getAddress(), await DR.getAddress(), ZeroAddress, await DR.getAddress(), true); + const disputeResolver = mockDisputeResolver( + await DR.getAddress(), + await DR.getAddress(), + ZeroAddress, + await DR.getAddress(), + true + ); const disputeResolverFees = [new DisputeResolverFee(ZeroAddress, "Native", "0")]; const sellerAllowList = []; @@ -68,13 +79,15 @@ describe("[@skip-on-coverage] Seaport integration", function () { bosonVoucher = await getContractAt("BosonVoucher", voucherAddress); // Pool needs to cover both seller deposit and price - const pool = BigInt(offer.sellerDeposit)+offer.price; + const pool = BigInt(offer.sellerDeposit) + offer.price; await fundsHandler.connect(assistant).depositFunds(seller.id, ZeroAddress, pool, { value: pool, }); // Pre mint range - await offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, await bosonVoucher.getAddress()); + await offerHandler + .connect(assistant) + .reserveRange(offer.id, offer.quantityAvailable, await bosonVoucher.getAddress()); await bosonVoucher.connect(assistant).preMint(offer.id, offer.quantityAvailable); // Create seaport offer which tokenId 1 @@ -131,9 +144,9 @@ describe("[@skip-on-coverage] Seaport integration", function () { const orders = [objectToArray(order)]; calldata = seaport.interface.encodeFunctionData("validate", [orders]); - await expect(bosonVoucher.connect(assistant).callExternalContract(await seaport.getAddress(), calldata)).to.be.revertedWith( - "0x466aa616" - ); //MissingOriginalConsiderationItems + await expect( + bosonVoucher.connect(assistant).callExternalContract(await seaport.getAddress(), calldata) + ).to.be.revertedWith("0x466aa616"); //MissingOriginalConsiderationItems }); }); }); diff --git a/test/protocol/DisputeHandlerTest.js b/test/protocol/DisputeHandlerTest.js index fbfedee3b..60e2806b5 100644 --- a/test/protocol/DisputeHandlerTest.js +++ b/test/protocol/DisputeHandlerTest.js @@ -1,5 +1,5 @@ const { ethers } = require("hardhat"); -const { ZeroAddress, provider, zeroPadBytes, MaxUint256 } = ethers; +const { ZeroAddress, provider, zeroPadBytes, MaxUint256, parseUnits } = ethers; const { expect, assert } = require("chai"); const Exchange = require("../../scripts/domain/Exchange"); const Dispute = require("../../scripts/domain/Dispute"); diff --git a/test/protocol/FundsHandlerTest.js b/test/protocol/FundsHandlerTest.js index b92507770..62e08a9d5 100644 --- a/test/protocol/FundsHandlerTest.js +++ b/test/protocol/FundsHandlerTest.js @@ -2674,7 +2674,7 @@ describe("IBosonFundsHandler", function () { timeout = BigInt(disputedDate) + BigInt(resolutionPeriod); }); - contex.only("Final state DISPUTED - RETRACTED", async function () { + context("Final state DISPUTED - RETRACTED", async function () { beforeEach(async function () { // expected payoffs // buyer: 0 @@ -4310,7 +4310,6 @@ describe("IBosonFundsHandler", function () { // Complete the exchange, expecting event const tx = await exchangeHandler.connect(buyer).completeExchange(exchangeId); - const result = await tx.wait(); await expect(tx) .to.emit(exchangeHandler, "FundsReleased") diff --git a/test/protocol/clients/BosonVoucherTest.js b/test/protocol/clients/BosonVoucherTest.js index 749c15d53..cd522d592 100644 --- a/test/protocol/clients/BosonVoucherTest.js +++ b/test/protocol/clients/BosonVoucherTest.js @@ -54,7 +54,6 @@ describe("IBosonVoucher", function () { foreign20; let disputeResolver, disputeResolverFees; let emptyAuthToken; - let agentId; let voucherInitValues, contractURI, royaltyPercentage, exchangeId, offerPrice; let forwarder; let snapshotId; diff --git a/test/upgrade/01_generic.js b/test/upgrade/01_generic.js index be2d3b7ac..ed86a62ea 100644 --- a/test/upgrade/01_generic.js +++ b/test/upgrade/01_generic.js @@ -1,6 +1,6 @@ const shell = require("shelljs"); const hre = require("hardhat"); -const ethers = hre.ethers; +const { ZeroAddress, provider } = hre.ethers; const { assert, expect } = require("chai"); const { mockOffer, mockVoucher, mockExchange } = require("../util/mock"); const { getEvent, calculateVoucherExpiry, getSnapshot, revertToSnapshot } = require("../util/utils.js"); @@ -159,14 +159,14 @@ function getGenericContext( // approve token transfer msgValue = 0; await mockToken.connect(buyer.wallet).approve(protocolDiamondAddress, offerPrice); - await mockToken.mint(buyer.await wallet.getAddress(), offerPrice); + await mockToken.mint(buyer.wallet, offerPrice); } // Commit to offer const exchangeId = await exchangeHandler.getNextExchangeId(); const tx = await exchangeHandler .connect(buyer.wallet) - .commitToOffer(buyer.await wallet.getAddress(), offer.id, { value: msgValue }); + .commitToOffer(buyer.wallet, offer.id, { value: msgValue }); const txReceipt = await tx.wait(); const event = getEvent(txReceipt, exchangeHandler, "BuyerCommitted"); @@ -227,7 +227,7 @@ function getGenericContext( const seller = preUpgradeEntities.sellers.find((s) => s.seller.id == offer.offer.sellerId); await expect(exchangeHandler.connect(seller.wallet).revokeVoucher(exchange.exchangeId)) .to.emit(exchangeHandler, "VoucherRevoked") - .withArgs(exchange.offerId, exchange.exchangeId, seller.await wallet.getAddress()); + .withArgs(exchange.offerId, exchange.exchangeId, seller.wallet); }); it("Escalate old dispute", async function () { @@ -264,7 +264,7 @@ function getGenericContext( const offerPrice = offer.price; const tx = await exchangeHandler .connect(buyer.wallet) - .commitToOffer(buyer.await wallet.getAddress(), offer.id, { value: offerPrice }); + .commitToOffer(buyer.wallet, offer.id, { value: offerPrice }); const txReceipt = await tx.wait(); const event = getEvent(txReceipt, exchangeHandler, "BuyerCommitted"); @@ -309,7 +309,7 @@ function getGenericContext( await expect(offerHandler.connect(seller.wallet).voidOffer(offerId)) .to.emit(offerHandler, "OfferVoided") - .withArgs(offerId, seller.seller.id, seller.await wallet.getAddress()); + .withArgs(offerId, seller.seller.id, seller.wallet); }); }); }; diff --git a/test/upgrade/2.0.0-2.1.0.js b/test/upgrade/2.0.0-2.1.0.js index 35f3dd7ce..80869aa57 100644 --- a/test/upgrade/2.0.0-2.1.0.js +++ b/test/upgrade/2.0.0-2.1.0.js @@ -1,4 +1,5 @@ const { ethers } = require("hardhat"); +const { ZeroAddress, getSigners } = ethers; const { assert, expect } = require("chai"); const Seller = require("../../scripts/domain/Seller"); const AuthToken = require("../../scripts/domain/AuthToken"); @@ -269,13 +270,13 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation pendingSellerUpdate.toStruct(), oldSellerAuthToken, pendingAuthTokenStruct, - oldSeller.await wallet.getAddress() + oldSeller.wallet ); // Testing for the SellerUpdatePending event await expect(tx) .to.emit(accountHandler, "SellerUpdatePending") - .withArgs(seller.id, pendingSellerUpdate.toStruct(), pendingAuthTokenStruct, oldSeller.await wallet.getAddress()); + .withArgs(seller.id, pendingSellerUpdate.toStruct(), pendingAuthTokenStruct, oldSeller.wallet); // Update seller assistant tx = await accountHandler.connect(assistant).optInToSellerUpdate(seller.id, [SellerUpdateFields.Assistant]); @@ -362,7 +363,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Update dispute resolver await expect(accountHandler.connect(oldDisputeResolver.wallet).updateDisputeResolver(disputeResolver)) .to.emit(accountHandler, "DisputeResolverUpdatePending") - .withArgs(disputeResolver.id, disputeResolverPendingUpdate.toStruct(), oldDisputeResolver.await wallet.getAddress()); + .withArgs(disputeResolver.id, disputeResolverPendingUpdate.toStruct(), oldDisputeResolver.wallet); // Approve assistant update expectedDisputeResolver.assistant = disputeResolver.assistant; diff --git a/test/upgrade/2.1.0-2.2.0.js b/test/upgrade/2.1.0-2.2.0.js index 4f77cf139..9358c73e5 100644 --- a/test/upgrade/2.1.0-2.2.0.js +++ b/test/upgrade/2.1.0-2.2.0.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const ethers = hre.ethers; +const { ZeroAddress, getContractAt, getSigners, provider, randomBytes } = hre.ethers; const { assert, expect } = require("chai"); const DisputeResolver = require("../../scripts/domain/DisputeResolver"); const { @@ -212,7 +212,14 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation expect(exist, "DR should not exist").to.be.false; // New DR must be created with active = true - const DR = mockDisputeResolver(await rando.getAddress(), await rando.getAddress(), await rando.getAddress(), await rando.getAddress(), true, true); + const DR = mockDisputeResolver( + await rando.getAddress(), + await rando.getAddress(), + await rando.getAddress(), + await rando.getAddress(), + true, + true + ); DR.id = nextAccountId.toString(); await accountHandler.connect(rando).createDisputeResolver(DR, [], []); @@ -228,11 +235,20 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation const { nextAccountId } = protocolContractState.accountContractState; // Create seller - const seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), await assistant.getAddress(), await assistant.getAddress(), true); + const seller = mockSeller( + await assistant.getAddress(), + await assistant.getAddress(), + await assistant.getAddress(), + await assistant.getAddress(), + true + ); await accountHandler.connect(assistant).createSeller(seller, mockAuthToken(), mockVoucherInitValues()); // Voucher contract - const expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), sellers.length + 1); + const expectedCloneAddress = calculateContractAddress( + await orchestrationHandler.getAddress(), + sellers.length + 1 + ); const bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); // Validate voucher name and symbol @@ -423,7 +439,13 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation let seller, functionSignature, metaTransactionType, customTransactionType, nonce, message; beforeEach(async function () { - seller = mockSeller(await assistant.getAddress(), await assistant.getAddress(), await assistant.getAddress(), await assistant.getAddress(), true); + seller = mockSeller( + await assistant.getAddress(), + await assistant.getAddress(), + await assistant.getAddress(), + await assistant.getAddress(), + true + ); // Prepare the function signature for the facet function. functionSignature = accountHandler.interface.encodeFunctionData("createSeller", [ @@ -472,7 +494,15 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation await expect( metaTransactionsHandler .connect(deployer) - .executeMetaTransaction(await assistant.getAddress(), message.functionName, functionSignature, nonce, r, s, v) + .executeMetaTransaction( + await assistant.getAddress(), + message.functionName, + functionSignature, + nonce, + r, + s, + v + ) ) .to.emit(metaTransactionsHandler, "MetaTransactionExecuted") .withArgs(await assistant.getAddress(), await deployer.getAddress(), message.functionName, nonce); @@ -494,7 +524,15 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation await expect( metaTransactionsHandler .connect(assistant) - .executeMetaTransaction(await assistant.getAddress(), message.functionName, functionSignature, nonce, r, s, v) + .executeMetaTransaction( + await assistant.getAddress(), + message.functionName, + functionSignature, + nonce, + r, + s, + v + ) ).to.revertedWith(RevertReasons.FUNCTION_NOT_ALLOWLISTED); }); @@ -659,9 +697,18 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation DRs: [, disputeResolver], // take DR that has empty allow list } = preUpgradeEntities; - seller = mockSeller(await rando.getAddress(), await rando.getAddress(), await rando.getAddress(), await rando.getAddress(), true); + seller = mockSeller( + await rando.getAddress(), + await rando.getAddress(), + await rando.getAddress(), + await rando.getAddress(), + true + ); disputeResolverId = disputeResolver.id; - expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), sellers.length + 1); + expectedCloneAddress = calculateContractAddress( + await orchestrationHandler.getAddress(), + sellers.length + 1 + ); ({ offer, offerDates, offerDurations } = await mockOffer()); agentId = 0; @@ -928,9 +975,18 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation DRs: [, disputeResolver], // take DR that has empty allow list } = preUpgradeEntities; - seller = mockSeller(await rando.getAddress(), await rando.getAddress(), await rando.getAddress(), await rando.getAddress(), true); + seller = mockSeller( + await rando.getAddress(), + await rando.getAddress(), + await rando.getAddress(), + await rando.getAddress(), + true + ); disputeResolverId = disputeResolver.id; - expectedCloneAddress = calculateContractAddress(await orchestrationHandler.getAddress(), sellers.length + 1); + expectedCloneAddress = calculateContractAddress( + await orchestrationHandler.getAddress(), + sellers.length + 1 + ); ({ offer, offerDates, offerDurations } = await mockOffer()); reservedRangeLength = offer.quantityAvailable; @@ -1263,7 +1319,9 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation const tokenId = deriveTokenId(offer.id, exchangeId); // Reserve range - await offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, await assistant.getAddress()); + await offerHandler + .connect(assistant) + .reserveRange(offer.id, offer.quantityAvailable, await assistant.getAddress()); // TODO: remove this once newVersion is 2.2.0 (not 2.2.0-rc.1) await configHandler.connect(deployer).setMaxPremintedVouchers(100); @@ -1276,7 +1334,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Commit to preminted offer, testing for the event await expect( - bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), buyer.await wallet.getAddress(), tokenId) + bosonVoucher.connect(assistant).transferFrom(await assistant.getAddress(), buyer.wallet, tokenId) ).to.emit(exchangeHandler, "BuyerCommitted"); }); }); @@ -1285,7 +1343,9 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation it("👉 reserveRange for assistant", async function () { // Reserve range await expect( - offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, await assistant.getAddress()) + offerHandler + .connect(assistant) + .reserveRange(offer.id, offer.quantityAvailable, await assistant.getAddress()) ).to.emit(offerHandler, "RangeReserved"); }); @@ -1296,7 +1356,9 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation const bosonVoucher = await getContractAt("IBosonVoucher", expectedCloneAddress); await expect( - offerHandler.connect(assistant).reserveRange(offer.id, offer.quantityAvailable, await bosonVoucher.getAddress()) + offerHandler + .connect(assistant) + .reserveRange(offer.id, offer.quantityAvailable, await bosonVoucher.getAddress()) ).to.emit(offerHandler, "RangeReserved"); }); }); diff --git a/test/upgrade/2.2.0-2.2.1.js b/test/upgrade/2.2.0-2.2.1.js index 729568f66..11d96159d 100644 --- a/test/upgrade/2.2.0-2.2.1.js +++ b/test/upgrade/2.2.0-2.2.1.js @@ -1,6 +1,7 @@ const hre = require("hardhat"); const { RevertReasons } = require("../../scripts/config/revert-reasons.js"); -const ethers = hre.ethers; +const { getSigners, getContractAt } = hre.ethers; + const { getSnapshot, revertToSnapshot } = require("../util/utils"); const { getStateModifyingFunctionsHashes } = require("../../scripts/util/diamond-utils.js"); @@ -215,7 +216,14 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation it("New seller has metadataUri field", async function () { const { nextAccountId } = accountContractState; - const seller = mockSeller(await rando.getAddress(), await rando.getAddress(), await rando.getAddress(), await rando.getAddress(), true, "metadata"); + const seller = mockSeller( + await rando.getAddress(), + await rando.getAddress(), + await rando.getAddress(), + await rando.getAddress(), + true, + "metadata" + ); const authToken = mockAuthToken(); const voucherInitValues = mockVoucherInitValues(); diff --git a/test/upgrade/clients/01_generic.js b/test/upgrade/clients/01_generic.js index 63f17ba3e..f3dba2b87 100644 --- a/test/upgrade/clients/01_generic.js +++ b/test/upgrade/clients/01_generic.js @@ -1,5 +1,4 @@ const shell = require("shelljs"); -const { ethers } = require("hardhat"); const { assert } = require("chai"); const { getStorageLayout, @@ -88,10 +87,10 @@ function getGenericContext( ); const buyerWallet = buyers[j].wallet; - const buyerIndex = entities.findIndex((e) => e.await wallet.getAddress() == await buyerWallet.getAddress()); + const buyerIndex = entities.findIndex((e) => e.wallet == buyerWallet); // Update the balance of the buyer - voucherData.balanceOf[buyerIndex] = voucherData.balanceOf[buyerIndex]-1; + voucherData.balanceOf[buyerIndex] = voucherData.balanceOf[buyerIndex] - 1; } } diff --git a/test/upgrade/clients/BosonVoucher-2.1.0-2.2.0.js b/test/upgrade/clients/BosonVoucher-2.1.0-2.2.0.js index 13763f402..ce7c8c67a 100644 --- a/test/upgrade/clients/BosonVoucher-2.1.0-2.2.0.js +++ b/test/upgrade/clients/BosonVoucher-2.1.0-2.2.0.js @@ -1,5 +1,6 @@ const hre = require("hardhat"); const ethers = hre.ethers; +const { parseUnits, ZeroAddress, getSigners, Contract, getContractAt, getContractFactory } = ethers; const { assert, expect } = require("chai"); const { deploySuite, @@ -226,10 +227,9 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio ++offerId; // Reserve range for the contract, test for event - await expect(offerHandler.connect(assistant).reserveRange(offerId, length, await bosonVoucher.getAddress())).to.emit( - bosonVoucher, - "RangeReserved" - ); + await expect( + offerHandler.connect(assistant).reserveRange(offerId, length, await bosonVoucher.getAddress()) + ).to.emit(bosonVoucher, "RangeReserved"); }); context("preMint()", async function () { @@ -345,7 +345,9 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio // Generate calldata const calldata = mockSimpleContract.interface.encodeFunctionData("testEvent"); - await expect(bosonVoucher.connect(assistant).callExternalContract(await mockSimpleContract.getAddress(), calldata)) + await expect( + bosonVoucher.connect(assistant).callExternalContract(await mockSimpleContract.getAddress(), calldata) + ) .to.emit(mockSimpleContract, "TestEvent") .withArgs("1"); }); @@ -365,21 +367,20 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio it("Can withdraw native token", async function () { // Sellers initial available funds const sellersFundsBefore = FundsList.fromStruct(await fundsHandler.getAvailableFunds(sellerId)); - let expectedAvailableFunds = new FundsList([ - new Funds(ZeroAddress, "Native currency", offer.sellerDeposit), - ]); + let expectedAvailableFunds = new FundsList([new Funds(ZeroAddress, "Native currency", offer.sellerDeposit)]); expect(sellersFundsBefore).to.eql(expectedAvailableFunds); const amount = parseUnits("1", "ether"); await deployer.sendTransaction({ to: await bosonVoucher.getAddress(), value: amount }); - await expect(() => - bosonVoucher.connect(rando).withdrawToProtocol([ZeroAddress]) - ).to.changeEtherBalances([bosonVoucher, fundsHandler], [amount*-1, amount]); + await expect(() => bosonVoucher.connect(rando).withdrawToProtocol([ZeroAddress])).to.changeEtherBalances( + [bosonVoucher, fundsHandler], + [amount * -1, amount] + ); // Seller's available balance should increase expectedAvailableFunds = new FundsList([ - new Funds(ZeroAddress, "Native currency", amount+offer.sellerDeposit.toString()), + new Funds(ZeroAddress, "Native currency", amount + offer.sellerDeposit.toString()), ]); const sellerFundsAfter = FundsList.fromStruct(await fundsHandler.getAvailableFunds(sellerId)); expect(sellerFundsAfter).to.eql(expectedAvailableFunds); @@ -388,9 +389,7 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio it("Can withdraw ERC20", async function () { // Sellers initial available funds const sellersFundsBefore = FundsList.fromStruct(await fundsHandler.getAvailableFunds(sellerId)); - let expectedAvailableFunds = new FundsList([ - new Funds(ZeroAddress, "Native currency", offer.sellerDeposit), - ]); + let expectedAvailableFunds = new FundsList([new Funds(ZeroAddress, "Native currency", offer.sellerDeposit)]); expect(sellersFundsBefore).to.eql(expectedAvailableFunds); const [foreign20] = await deployMockTokens(["Foreign20"]); @@ -399,10 +398,11 @@ describe("[@skip-on-coverage] After client upgrade, everything is still operatio await foreign20.connect(deployer).mint(await deployer.getAddress(), amount); await foreign20.connect(deployer).transfer(await bosonVoucher.getAddress(), amount); - await expect(() => bosonVoucher.connect(rando).withdrawToProtocol([await foreign20.getAddress()])).to.changeTokenBalances( + const foreign20Address = await foreign20.getAddress(); + await expect(() => bosonVoucher.connect(rando).withdrawToProtocol([foreign20Address])).to.changeTokenBalances( foreign20, [bosonVoucher, fundsHandler], - [amount*-1, amount] + [amount * -1, amount] ); // Seller's available balance should increase diff --git a/test/util/constants.js b/test/util/constants.js index e47811188..00b9de4b6 100644 --- a/test/util/constants.js +++ b/test/util/constants.js @@ -1,6 +1,4 @@ const environments = require("../../environments"); -const hre = require("hardhat"); -const ethers = hre.ethers; // Some periods in seconds const oneDay = 86400n; // 1 day in seconds diff --git a/test/util/upgrade.js b/test/util/upgrade.js index d7baba4c4..0784ba17d 100644 --- a/test/util/upgrade.js +++ b/test/util/upgrade.js @@ -3,7 +3,19 @@ const _ = require("lodash"); const { getStorageAt } = require("@nomicfoundation/hardhat-network-helpers"); const hre = require("hardhat"); const ethers = hre.ethers; -const { keccak256, formatBytes32String } = utils; + +const { + keccak256, + formatBytes32String, + ZeroAddress, + getContractAt, + Wallet, + provider, + parseEther, + toUtf8Bytes, + getContractFactory, + getSigners, +} = ethers; const AuthToken = require("../../scripts/domain/AuthToken"); const { getMetaTransactionsHandlerFacetInitArgs } = require("../../scripts/config/facet-deploy.js"); const AuthTokenType = require("../../scripts/domain/AuthTokenType"); @@ -381,7 +393,13 @@ async function populateProtocolContract( const clerkAddress = versionsWithClerkRole.includes(isBefore ? versionTags.oldVersion : versionTags.newVersion) ? await wallet.getAddress() : ZeroAddress; - const seller = mockSeller(await wallet.getAddress(), await wallet.getAddress(), clerkAddress, await wallet.getAddress(), true); + const seller = mockSeller( + await wallet.getAddress(), + await wallet.getAddress(), + clerkAddress, + await wallet.getAddress(), + true + ); const id = (seller.id = nextAccountId.toString()); let authToken; @@ -470,12 +488,8 @@ async function populateProtocolContract( // Set unique offer dates based on offer id const now = offerDates.validFrom; - offerDates.validFrom = BigInt(now) - +oneMonth + offerId * 1000 - .toString(); - offerDates.validUntil = BigInt(now) - +oneMonth * 6 * (offerId + 1) - .toString(); + offerDates.validFrom = BigInt(now) + oneMonth + offerId * (1000).toString(); + offerDates.validUntil = BigInt(now) + oneMonth * 6 * (offerId + 1).toString(); // Set unique offerDurations based on offer id offerDurations.disputePeriod = `${(offerId + 1) * oneMonth}`; @@ -495,7 +509,7 @@ async function populateProtocolContract( sellers[j].offerIds.push(offerId); // Deposit seller funds so the commit will succeed - const sellerPool = BigInt(offer.quantityAvailable)*offer.price.toString(); + const sellerPool = BigInt(offer.quantityAvailable) * offer.price.toString(); const msgValue = offer.exchangeToken == ZeroAddress ? sellerPool : "0"; await fundsHandler .connect(sellers[j].wallet) @@ -569,7 +583,7 @@ async function populateProtocolContract( await mockTwin20.connect(seller.wallet).approve(protocolDiamondAddress, twin20.supplyAvailable); // mint tokens to be transferred on redeem - await mockTwin20.connect(seller.wallet).mint(seller.await wallet.getAddress(), twin20.supplyAvailable * twin20.amount); + await mockTwin20.connect(seller.wallet).mint(seller.wallet, twin20.supplyAvailable * twin20.amount); await twinHandler.connect(seller.wallet).createTwin(twin20); twins.push(twin20); @@ -618,7 +632,9 @@ async function populateProtocolContract( await mockToken.connect(buyerWallet).approve(protocolDiamondAddress, offerPrice); await mockToken.mint(await buyerWallet.getAddress(), offerPrice); } - await exchangeHandler.connect(buyerWallet).commitToOffer(await buyerWallet.getAddress(), offer.id, { value: msgValue }); + await exchangeHandler + .connect(buyerWallet) + .commitToOffer(await buyerWallet.getAddress(), offer.id, { value: msgValue }); exchanges.push({ exchangeId: exchangeId, offerId: offer.id, buyerIndex: j }); exchangeId++; } @@ -756,7 +772,7 @@ async function getAccountContractState(accountHandler, { DRs, sellers, buyers, a } for (const seller of sellers) { - const sellerAddress = seller.await wallet.getAddress(); + const sellerAddress = seller.wallet; const sellerAuthToken = seller.authToken; sellerByAddressState.push(await getSeller(accountHandlerRando, sellerAddress, { getBy: "address" })); @@ -767,7 +783,7 @@ async function getAccountContractState(accountHandler, { DRs, sellers, buyers, a const otherAccounts = [...DRs, ...agents, ...buyers]; for (const account of otherAccounts) { - const accountAddress = account.await wallet.getAddress(); + const accountAddress = account.wallet; sellerByAddressState.push(await getSeller(accountHandlerRando, accountAddress, { getBy: "address" })); DRbyAddressState.push(await getDisputeResolver(accountHandlerRando, accountAddress, { getBy: "address" })); @@ -1038,13 +1054,13 @@ async function getMetaTxPrivateContractState(protocolDiamondAddress) { // current sender address + isMetaTransaction (they are packed since they are shorter than one slot) // should be always be 0x - const inTransactionInfo = await getStorageAt(protocolDiamondAddress, metaTxStorageSlotNumber+"0"); + const inTransactionInfo = await getStorageAt(protocolDiamondAddress, metaTxStorageSlotNumber + "0"); // domain separator - const domainSeparator = await getStorageAt(protocolDiamondAddress, metaTxStorageSlotNumber+"1"); + const domainSeparator = await getStorageAt(protocolDiamondAddress, metaTxStorageSlotNumber + "1"); // cached chain id - const cachedChainId = await getStorageAt(protocolDiamondAddress, metaTxStorageSlotNumber+"3"); + const cachedChainId = await getStorageAt(protocolDiamondAddress, metaTxStorageSlotNumber + "3"); // input type const inputTypeKeys = [ @@ -1061,7 +1077,7 @@ async function getMetaTxPrivateContractState(protocolDiamondAddress) { const inputTypesState = []; for (const inputTypeKey of inputTypeKeys) { - const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber+"4", inputTypeKey, paddingType.NONE); + const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber + "4", inputTypeKey, paddingType.NONE); inputTypesState.push(await getStorageAt(protocolDiamondAddress, storageSlot)); } @@ -1077,11 +1093,11 @@ async function getMetaTxPrivateContractState(protocolDiamondAddress) { const hashInfoState = []; for (const hashInfoType of Object.values(hashInfoTypes)) { - const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber+"5", hashInfoType, paddingType.START); + const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber + "5", hashInfoType, paddingType.START); // get also hashFunction hashInfoState.push({ typeHash: await getStorageAt(protocolDiamondAddress, storageSlot), - functionPointer: await getStorageAt(protocolDiamondAddress, BigInt(storageSlot)+1), + functionPointer: await getStorageAt(protocolDiamondAddress, BigInt(storageSlot) + 1), }); } const isAllowlistedState = {}; @@ -1108,7 +1124,7 @@ async function getMetaTxPrivateContractState(protocolDiamondAddress) { const selectors = await getMetaTransactionsHandlerFacetInitArgs(facets); for (const selector of Object.values(selectors)) { - const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber+"6", selector, paddingType.START); + const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber + "6", selector, paddingType.START); isAllowlistedState[selector] = await getStorageAt(protocolDiamondAddress, storageSlot); } @@ -1131,11 +1147,11 @@ async function getProtocolStatusPrivateContractState(protocolDiamondAddress) { const protocolStatusStorageSlotNumber = BigInt(protocolStatusStorageSlot); // pause scenario - const pauseScenario = await getStorageAt(protocolDiamondAddress, protocolStatusStorageSlotNumber+"0"); + const pauseScenario = await getStorageAt(protocolDiamondAddress, protocolStatusStorageSlotNumber + "0"); // reentrancy status // default: NOT_ENTERED = 1 - const reentrancyStatus = await getStorageAt(protocolDiamondAddress, protocolStatusStorageSlotNumber+"1"); + const reentrancyStatus = await getStorageAt(protocolDiamondAddress, protocolStatusStorageSlotNumber + "1"); // initializedInterfaces if (!preUpgradeInterfaceIds) { @@ -1145,11 +1161,7 @@ async function getProtocolStatusPrivateContractState(protocolDiamondAddress) { const initializedInterfacesState = []; for (const interfaceId of Object.values(preUpgradeInterfaceIds)) { - const storageSlot = getMappingStoragePosition( - protocolStatusStorageSlotNumber+"2", - interfaceId, - paddingType.END - ); + const storageSlot = getMappingStoragePosition(protocolStatusStorageSlotNumber + "2", interfaceId, paddingType.END); initializedInterfacesState.push(await getStorageAt(protocolDiamondAddress, storageSlot)); } @@ -1159,7 +1171,7 @@ async function getProtocolStatusPrivateContractState(protocolDiamondAddress) { const initializedVersionsState = []; for (const version of preUpgradeVersions) { - const storageSlot = getMappingStoragePosition(protocolStatusStorageSlotNumber+"3", version, paddingType.END); + const storageSlot = getMappingStoragePosition(protocolStatusStorageSlotNumber + "3", version, paddingType.END); initializedVersionsState.push(await getStorageAt(protocolDiamondAddress, storageSlot)); } @@ -1220,13 +1232,11 @@ async function getProtocolLookupsPrivateContractState( const id = Number(offer.offer.id); // exchangeIdsByOffer let exchangeIdsByOffer = []; - const arraySlot = BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber+"0", id, paddingType.START) - ); + const arraySlot = BigInt.from(getMappingStoragePosition(protocolLookupsSlotNumber + "0", id, paddingType.START)); const arrayLength = BigInt(await getStorageAt(protocolDiamondAddress, arraySlot)).toNumber(); const arrayStart = BigInt(keccak256(arraySlot)); for (let i = 0; i < arrayLength; i++) { - exchangeIdsByOffer.push(await getStorageAt(protocolDiamondAddress, arrayStart+i)); + exchangeIdsByOffer.push(await getStorageAt(protocolDiamondAddress, arrayStart + i)); } exchangeIdsByOfferState.push(exchangeIdsByOffer); @@ -1234,7 +1244,7 @@ async function getProtocolLookupsPrivateContractState( groupIdByOfferState.push( await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(protocolLookupsSlotNumber+"3", id, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber + "3", id, paddingType.START) ) ); } @@ -1247,13 +1257,13 @@ async function getProtocolLookupsPrivateContractState( const accounts = [...sellers, ...DRs, ...agents, ...buyers]; for (const account of accounts) { - const accountAddress = account.await wallet.getAddress(); + const accountAddress = account.wallet; // buyerIdByWallet buyerIdByWallet.push( await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(protocolLookupsSlotNumber+"8", accountAddress, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber + "8", accountAddress, paddingType.START) ) ); @@ -1261,13 +1271,13 @@ async function getProtocolLookupsPrivateContractState( agentIdByWallet.push( await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(protocolLookupsSlotNumber+"13", accountAddress, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber + "13", accountAddress, paddingType.START) ) ); // conditionalCommitsByAddress - const firstMappingStorageSlot = BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber+"19", accountAddress, paddingType.START) + const firstMappingStorageSlot = BigInt( + getMappingStoragePosition(protocolLookupsSlotNumber + "19", accountAddress, paddingType.START) ); let commitsPerGroup = []; for (const group of groups) { @@ -1294,8 +1304,8 @@ async function getProtocolLookupsPrivateContractState( // loop over all ids even where no data is expected for (const id of accountIds) { // disputeResolverFeeTokenIndex - let firstMappingStorageSlot = BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber+"12", id, paddingType.START) + let firstMappingStorageSlot = BigInt( + getMappingStoragePosition(protocolLookupsSlotNumber + "12", id, paddingType.START) ); disputeResolverFeeTokenIndex.push({ native: await getStorageAt( @@ -1309,8 +1319,8 @@ async function getProtocolLookupsPrivateContractState( }); // tokenIndexByAccount - firstMappingStorageSlot = BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber+"16", id, paddingType.START) + firstMappingStorageSlot = BigInt( + getMappingStoragePosition(protocolLookupsSlotNumber + "16", id, paddingType.START) ); tokenIndexByAccount.push({ native: await getStorageAt( @@ -1327,7 +1337,7 @@ async function getProtocolLookupsPrivateContractState( cloneAddress.push( await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(protocolLookupsSlotNumber+"17", id, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber + "17", id, paddingType.START) ) ); @@ -1335,7 +1345,7 @@ async function getProtocolLookupsPrivateContractState( voucherCount.push( await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(protocolLookupsSlotNumber+"18", id, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber + "18", id, paddingType.START) ) ); } @@ -1343,20 +1353,24 @@ async function getProtocolLookupsPrivateContractState( // twinRangesBySeller let twinRangesBySeller = []; for (const id of accountIds) { - const firstMappingStorageSlot = BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber+"22", id, paddingType.START) + const firstMappingStorageSlot = BigInt( + getMappingStoragePosition(protocolLookupsSlotNumber + "22", id, paddingType.START) ); let ranges = {}; for (let mockTwin of mockTwinTokens) { ranges[await mockTwin.getAddress()] = []; - const arraySlot = getMappingStoragePosition(firstMappingStorageSlot, await mockTwin.getAddress(), paddingType.START); + const arraySlot = getMappingStoragePosition( + firstMappingStorageSlot, + await mockTwin.getAddress(), + paddingType.START + ); const arrayLength = BigInt(await getStorageAt(protocolDiamondAddress, arraySlot)).toNumber(); const arrayStart = BigInt(keccak256(arraySlot)); for (let i = 0; i < arrayLength * 2; i = i + 2) { // each BosonTypes.TokenRange has length 2 ranges[await mockTwin.getAddress()].push({ - start: await getStorageAt(protocolDiamondAddress, arrayStart+i), - end: await getStorageAt(protocolDiamondAddress, arrayStart+i + 1), + start: await getStorageAt(protocolDiamondAddress, arrayStart + i), + end: await getStorageAt(protocolDiamondAddress, arrayStart + i + 1), }); } } @@ -1366,17 +1380,21 @@ async function getProtocolLookupsPrivateContractState( // twinIdsByTokenAddressAndBySeller let twinIdsByTokenAddressAndBySeller = []; for (const id of accountIds) { - const firstMappingStorageSlot = BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber+"23", id, paddingType.START) + const firstMappingStorageSlot = BigInt( + getMappingStoragePosition(protocolLookupsSlotNumber + "23", id, paddingType.START) ); let twinIds = {}; for (let mockTwin of mockTwinTokens) { twinIds[await mockTwin.getAddress()] = []; - const arraySlot = getMappingStoragePosition(firstMappingStorageSlot, await mockTwin.getAddress(), paddingType.START); + const arraySlot = getMappingStoragePosition( + firstMappingStorageSlot, + await mockTwin.getAddress(), + paddingType.START + ); const arrayLength = BigInt(await getStorageAt(protocolDiamondAddress, arraySlot)).toNumber(); const arrayStart = BigInt(keccak256(arraySlot)); for (let i = 0; i < arrayLength; i++) { - twinIds[await mockTwin.getAddress()].push(await getStorageAt(protocolDiamondAddress, arrayStart+i)); + twinIds[await mockTwin.getAddress()].push(await getStorageAt(protocolDiamondAddress, arrayStart + i)); } } twinIdsByTokenAddressAndBySeller.push(twinIds); @@ -1385,9 +1403,9 @@ async function getProtocolLookupsPrivateContractState( // allowedSellerIndex let allowedSellerIndex = []; for (const DR of DRs) { - const firstMappingStorageSlot = BigNumber.from( + const firstMappingStorageSlot = BigInt( getMappingStoragePosition( - protocolLookupsSlotNumber+"26", + protocolLookupsSlotNumber + "26", BigInt(DR.disputeResolver.id).toHexString(), paddingType.START ) @@ -1397,11 +1415,7 @@ async function getProtocolLookupsPrivateContractState( sellerStatus.push( await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition( - firstMappingStorageSlot, - BigInt(seller.seller.id).toHexString(), - paddingType.START - ) + getMappingStoragePosition(firstMappingStorageSlot, BigInt(seller.seller.id).toHexString(), paddingType.START) ) ); } @@ -1412,8 +1426,8 @@ async function getProtocolLookupsPrivateContractState( let offerIdIndexByGroup = []; for (const group of groups) { const id = group.id; - const firstMappingStorageSlot = BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber+"28", id, paddingType.START) + const firstMappingStorageSlot = BigInt( + getMappingStoragePosition(protocolLookupsSlotNumber + "28", id, paddingType.START) ); let offerInidices = []; for (const offer of offers) { @@ -1436,37 +1450,31 @@ async function getProtocolLookupsPrivateContractState( // Although pending address/auth token update is not yet defined in 2.0.0, we can check that storage slots are empty for (const id of accountIds) { // pendingAddressUpdatesBySeller - let structStorageSlot = BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber+"29", id, paddingType.START) - ); + let structStorageSlot = BigInt(getMappingStoragePosition(protocolLookupsSlotNumber + "29", id, paddingType.START)); let structFields = []; for (let i = 0; i < 5; i++) { // BosonTypes.Seller has 6 fields, but last bool is packed in one slot with previous field - structFields.push(await getStorageAt(protocolDiamondAddress, structStorageSlot+i)); + structFields.push(await getStorageAt(protocolDiamondAddress, structStorageSlot + i)); } pendingAddressUpdatesBySeller.push(structFields); // pendingAuthTokenUpdatesBySeller - structStorageSlot = BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber+"30", id, paddingType.START) - ); + structStorageSlot = BigInt(getMappingStoragePosition(protocolLookupsSlotNumber + "30", id, paddingType.START)); structFields = []; for (let i = 0; i < 2; i++) { // BosonTypes.AuthToken has 2 fields - structFields.push(await getStorageAt(protocolDiamondAddress, structStorageSlot+i)); + structFields.push(await getStorageAt(protocolDiamondAddress, structStorageSlot + i)); } pendingAuthTokenUpdatesBySeller.push(structFields); // pendingAddressUpdatesByDisputeResolver - structStorageSlot = BigNumber.from( - getMappingStoragePosition(protocolLookupsSlotNumber+"31", id, paddingType.START) - ); + structStorageSlot = BigInt(getMappingStoragePosition(protocolLookupsSlotNumber + "31", id, paddingType.START)); structFields = []; for (let i = 0; i < 8; i++) { // BosonTypes.DisputeResolver has 8 fields - structFields.push(await getStorageAt(protocolDiamondAddress, structStorageSlot+i)); + structFields.push(await getStorageAt(protocolDiamondAddress, structStorageSlot + i)); } - structFields[6] = await getStorageAt(protocolDiamondAddress, keccak256(structStorageSlot+6)); // represents field string metadataUri. Technically this value represents the length of the string, but since it should be 0, we don't do further decoding + structFields[6] = await getStorageAt(protocolDiamondAddress, keccak256(structStorageSlot + 6)); // represents field string metadataUri. Technically this value represents the length of the string, but since it should be 0, we don't do further decoding pendingAddressUpdatesByDisputeResolver.push(structFields); } @@ -1618,9 +1626,17 @@ async function populateVoucherContract( break; } case entityType.SELLER: { - const seller = mockSeller(await wallet.getAddress(), await wallet.getAddress(), await wallet.getAddress(), await wallet.getAddress(), true, undefined, { - refreshModule: true, - }); + const seller = mockSeller( + await wallet.getAddress(), + await wallet.getAddress(), + await wallet.getAddress(), + await wallet.getAddress(), + true, + undefined, + { + refreshModule: true, + } + ); const id = (seller.id = nextAccountId.toString()); let authToken = mockAuthToken(); @@ -1683,12 +1699,8 @@ async function populateVoucherContract( // Set unique offer dates based on offer id const now = offerDates.validFrom; - offerDates.validFrom = BigInt(now) - +oneMonth + offerId * 1000 - .toString(); - offerDates.validUntil = BigInt(now) - +oneMonth * 6 * (offerId + 1) - .toString(); + offerDates.validFrom = BigInt(now) + oneMonth + offerId * (1000).toString(); + offerDates.validUntil = BigInt(now) + oneMonth * 6 * (offerId + 1).toString(); // Set unique offerDurations based on offer id offerDurations.disputePeriod = `${(offerId + 1) * oneMonth}`; @@ -1708,7 +1720,7 @@ async function populateVoucherContract( sellers[j].offerIds.push(offerId); // Deposit seller funds so the commit will succeed - const sellerPool = BigInt(offer.quantityAvailable)*offer.price.toString(); + const sellerPool = BigInt(offer.quantityAvailable) * offer.price.toString(); const msgValue = offer.exchangeToken == ZeroAddress ? sellerPool : "0"; await fundsHandler .connect(sellers[j].wallet) @@ -1735,7 +1747,9 @@ async function populateVoucherContract( await mockToken.connect(buyerWallet).approve(protocolDiamondAddress, offerPrice); await mockToken.mint(await buyerWallet.getAddress(), offerPrice); } - await exchangeHandler.connect(buyerWallet).commitToOffer(await buyerWallet.getAddress(), offer.id, { value: msgValue }); + await exchangeHandler + .connect(buyerWallet) + .commitToOffer(await buyerWallet.getAddress(), offer.id, { value: msgValue }); exchanges.push({ exchangeId: exchangeId, offerId: offer.id, buyerIndex: j }); exchangeId++; } @@ -1782,7 +1796,7 @@ async function getVoucherContractState({ bosonVouchers, exchanges, sellers, buye // balanceOf(address owner) // isApprovedForAll(address owner, address assistant) - const addresses = [...sellers, ...buyers].map((acc) => acc.await wallet.getAddress()); + const addresses = [...sellers, ...buyers].map((acc) => acc.wallet); const balanceOf = await Promise.all(addresses.map((address) => bosonVoucher.balanceOf(address))); const isApprovedForAll = await Promise.all( addresses.map((address1) => diff --git a/test/util/utils.js b/test/util/utils.js index 1c4ce780b..924698e27 100644 --- a/test/util/utils.js +++ b/test/util/utils.js @@ -11,12 +11,14 @@ const { isHexString, zeroPadValue, Interface, + toUtf8Bytes, } = ethers; const { getFacets } = require("../../scripts/config/facet-deploy.js"); const { oneWeek, oneMonth, maxPriorityFeePerGas } = require("./constants"); const Role = require("../../scripts/domain/Role"); const { expect } = require("chai"); const Offer = require("../../scripts/domain/Offer"); +const { zeroPadBytes } = require("ethers"); function getEvent(receipt, factory, eventName) { let found = false; @@ -257,10 +259,10 @@ function getMappingStoragePosition(slot, key, padding = paddingType.NONE) { let keyBuffer; switch (padding) { case paddingType.NONE: - keyBuffer = utils.toUtf8Bytes(key); + keyBuffer = toUtf8Bytes(key); break; case paddingType.START: - keyBuffer = Buffer.from(utils.hexZeroPad(key, 32).toString().slice(2), "hex"); + keyBuffer = Buffer.from(zeroPadBytes(key, 32).toString().slice(2), "hex"); break; case paddingType.END: keyBuffer = Buffer.from(key.slice(2).padEnd(64, "0"), "hex"); // assume key is prefixed with 0x @@ -281,7 +283,7 @@ async function getFacetsWithArgs(facetNames, config) { function objectToArray(input) { // If the input is not an object, return it as-is - if (BigNumber.isBigNumber(input) || typeof input !== "object" || input === null) { + if (typeof input !== "object" || input === null) { return input; } From 86d4f38d75de00ce43e17d387b898e13696799ea Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Tue, 27 Jun 2023 08:47:36 -0300 Subject: [PATCH 22/32] Fixing broken tests on FundsHandler --- test/protocol/FundsHandlerTest.js | 155 ++++++++++++++++++------------ 1 file changed, 95 insertions(+), 60 deletions(-) diff --git a/test/protocol/FundsHandlerTest.js b/test/protocol/FundsHandlerTest.js index 62e08a9d5..9bcf55105 100644 --- a/test/protocol/FundsHandlerTest.js +++ b/test/protocol/FundsHandlerTest.js @@ -2742,7 +2742,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit) + sellerPayoff.toString() + (BigInt(sellerDeposit) + BigInt(sellerPayoff)).toString() ); expectedProtocolAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), @@ -2766,12 +2766,16 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // agentPayoff: agentFee - agentFee = (BigInt(agentOffer.price) * agentFeePercentage) / "10000".toString(); + agentFee = ((BigInt(agentOffer.price) * BigInt(agentFeePercentage)) / 10000n).toString(); agentPayoff = agentFee; // seller: sellerDeposit + price - protocolFee - agentFee - sellerPayoff = - BigInt(agentOffer.sellerDeposit) + agentOffer.price - agentOfferProtocolFee - agentFee.toString(); + sellerPayoff = ( + BigInt(agentOffer.sellerDeposit) + + BigInt(agentOffer.price) - + BigInt(agentOfferProtocolFee) - + BigInt(agentFee) + ).toString(); // protocol: 0 protocolPayoff = agentOfferProtocolFee; @@ -2862,7 +2866,11 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // seller: sellerDeposit + price - protocolFee - sellerPayoff = BigInt(offerToken.sellerDeposit) + offerToken.price - offerTokenProtocolFee.toString(); + sellerPayoff = ( + BigInt(offerToken.sellerDeposit) + + BigInt(offerToken.price) - + BigInt(offerTokenProtocolFee) + ).toString(); // protocol: protocolFee protocolPayoff = offerTokenProtocolFee; @@ -2924,7 +2932,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit) + sellerPayoff.toString() + (BigInt(sellerDeposit) + BigInt(sellerPayoff)).toString() ); expectedProtocolAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), @@ -2956,12 +2964,16 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // agentPayoff: agentFee - agentFee = (BigInt(agentOffer.price) * agentFeePercentage) / "10000".toString(); + agentFee = ((BigInt(agentOffer.price) * BigInt(agentFeePercentage)) / 10000n).toString(); agentPayoff = agentFee; // seller: sellerDeposit + price - protocolFee - agent fee - sellerPayoff = - BigInt(agentOffer.sellerDeposit) + agentOffer.price - agentOfferProtocolFee - agentFee.toString(); + sellerPayoff = ( + BigInt(agentOffer.sellerDeposit) + + BigInt(agentOffer.price) - + BigInt(agentOfferProtocolFee) - + BigInt(agentFee) + ).toString(); // protocol: protocolFee protocolPayoff = agentOfferProtocolFee; @@ -3059,7 +3071,8 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: (price + sellerDeposit)*buyerPercentage buyerPayoff = - BigInt(offerToken.price) + (BigInt(offerToken.sellerDeposit) * BigInt(buyerPercentBasisPoints)) / 10000n; + ((BigInt(offerToken.price) + BigInt(offerToken.sellerDeposit)) * BigInt(buyerPercentBasisPoints)) / + 10000n; // seller: (price + sellerDeposit)*(1-buyerPercentage) sellerPayoff = BigInt(offerToken.price) + BigInt(offerToken.sellerDeposit) - buyerPayoff; @@ -3118,7 +3131,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ new Funds(await mockToken.getAddress(), "Foreign20", sellerDeposit), - new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", (2n * BigInt(sellerDeposit)).toString()), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -3139,7 +3152,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit) + sellerPayoff.toString() + (BigInt(sellerDeposit) + BigInt(sellerPayoff)).toString() ); expectedBuyerAvailableFunds = new FundsList([ new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff), @@ -3178,8 +3191,8 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: (price + sellerDeposit)*buyerPercentage buyerPayoff = ( - BigInt(agentOffer.price) + - (BigInt(agentOffer.sellerDeposit) * BigInt(buyerPercentBasisPoints)) / 10000n + ((BigInt(agentOffer.price) + BigInt(agentOffer.sellerDeposit)) * BigInt(buyerPercentBasisPoints)) / + 10000n ).toString(); // seller: (price + sellerDeposit)*(1-buyerPercentage) @@ -3270,11 +3283,12 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // seller: sellerDeposit + price - protocolFee + buyerEscalationDeposit - sellerPayoff = + sellerPayoff = ( BigInt(offerToken.sellerDeposit) + - offerToken.price - - offerTokenProtocolFee + - buyerEscalationDeposit.toString(); + BigInt(offerToken.price) - + BigInt(offerTokenProtocolFee) + + BigInt(buyerEscalationDeposit) + ).toString(); // protocol: 0 protocolPayoff = offerTokenProtocolFee; @@ -3338,7 +3352,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit) + sellerPayoff.toString() + (BigInt(sellerDeposit) + BigInt(sellerPayoff)).toString() ); expectedProtocolAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), @@ -3362,16 +3376,17 @@ describe("IBosonFundsHandler", function () { buyerPayoff = 0; // agentPayoff: agentFee - agentFee = (BigInt(agentOffer.price) * agentFeePercentage) / "10000".toString(); + agentFee = ((BigInt(agentOffer.price) * BigInt(agentFeePercentage)) / 10000n).toString(); agentPayoff = agentFee; // seller: sellerDeposit + price - protocolFee - agentFee + buyerEscalationDeposit - sellerPayoff = + sellerPayoff = ( BigInt(agentOffer.sellerDeposit) + - agentOffer.price - - agentOfferProtocolFee - - agentFee + - buyerEscalationDeposit.toString(); + BigInt(agentOffer.price) - + BigInt(agentOfferProtocolFee) - + BigInt(agentFee) + + BigInt(buyerEscalationDeposit) + ).toString(); // protocol: 0 protocolPayoff = agentOfferProtocolFee; @@ -3453,14 +3468,19 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: (price + sellerDeposit + buyerEscalationDeposit)*buyerPercentage - buyerPayoff = - BigInt(offerToken.price) + - offerToken.sellerDeposit + - (buyerEscalationDeposit * buyerPercentBasisPoints) / "10000".toString(); + buyerPayoff = ( + ((BigInt(offerToken.price) + BigInt(offerToken.sellerDeposit) + BigInt(buyerEscalationDeposit)) * + BigInt(buyerPercentBasisPoints)) / + 10000n + ).toString(); // seller: (price + sellerDeposit + buyerEscalationDeposit)*(1-buyerPercentage) - sellerPayoff = - BigInt(offerToken.price) + offerToken.sellerDeposit + buyerEscalationDeposit - buyerPayoff.toString(); + sellerPayoff = ( + BigInt(offerToken.price) + + BigInt(offerToken.sellerDeposit) + + BigInt(buyerEscalationDeposit) - + BigInt(buyerPayoff) + ).toString(); // protocol: 0 protocolPayoff = 0; @@ -3541,7 +3561,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit) + sellerPayoff.toString() + (BigInt(sellerDeposit) + BigInt(sellerPayoff)).toString() ); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -3579,14 +3599,19 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: (price + sellerDeposit + buyerEscalationDeposit)*buyerPercentage - buyerPayoff = - BigInt(agentOffer.price) + - agentOffer.sellerDeposit + - (buyerEscalationDeposit * buyerPercentBasisPoints) / "10000".toString(); + buyerPayoff = ( + ((BigInt(agentOffer.price) + BigInt(agentOffer.sellerDeposit) + BigInt(buyerEscalationDeposit)) * + BigInt(buyerPercentBasisPoints)) / + 10000n + ).toString(); // seller: (price + sellerDeposit + buyerEscalationDeposit)*(1-buyerPercentage) - sellerPayoff = - BigInt(agentOffer.price) + agentOffer.sellerDeposit + buyerEscalationDeposit - buyerPayoff.toString(); + sellerPayoff = ( + BigInt(agentOffer.price) + + BigInt(agentOffer.sellerDeposit) + + BigInt(buyerEscalationDeposit) - + BigInt(buyerPayoff) + ).toString(); // protocol: 0 protocolPayoff = 0; @@ -3673,14 +3698,19 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: (price + sellerDeposit + buyerEscalationDeposit)*buyerPercentage - buyerPayoff = - BigInt(offerToken.price) + - offerToken.sellerDeposit + - (buyerEscalationDeposit * buyerPercentBasisPoints) / "10000".toString(); + buyerPayoff = ( + ((BigInt(offerToken.price) + BigInt(offerToken.sellerDeposit) + BigInt(buyerEscalationDeposit)) * + BigInt(buyerPercentBasisPoints)) / + 10000n + ).toString(); // seller: (price + sellerDeposit + buyerEscalationDeposit)*(1-buyerPercentage) - sellerPayoff = - BigInt(offerToken.price) + offerToken.sellerDeposit + buyerEscalationDeposit - buyerPayoff.toString(); + sellerPayoff = ( + BigInt(offerToken.price) + + BigInt(offerToken.sellerDeposit) + + BigInt(buyerEscalationDeposit) - + BigInt(buyerPayoff) + ).toString(); // protocol: 0 protocolPayoff = 0; @@ -3735,7 +3765,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit) + sellerPayoff.toString() + (BigInt(sellerDeposit) + BigInt(sellerPayoff)).toString() ); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -3773,20 +3803,25 @@ describe("IBosonFundsHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate) + resolutionPeriod.toString(); + timeout = (BigInt(disputedDate) + BigInt(resolutionPeriod)).toString(); buyerPercentBasisPoints = "5566"; // 55.66% // expected payoffs // buyer: (price + sellerDeposit + buyerEscalationDeposit)*buyerPercentage - buyerPayoff = - BigInt(agentOffer.price) + - agentOffer.sellerDeposit + - (buyerEscalationDeposit * buyerPercentBasisPoints) / "10000".toString(); + buyerPayoff = ( + ((BigInt(agentOffer.price) + BigInt(agentOffer.sellerDeposit) + BigInt(buyerEscalationDeposit)) * + BigInt(buyerPercentBasisPoints)) / + 10000n + ).toString(); // seller: (price + sellerDeposit + buyerEscalationDeposit)*(1-buyerPercentage) - sellerPayoff = - BigInt(agentOffer.price) + agentOffer.sellerDeposit + buyerEscalationDeposit - buyerPayoff.toString(); + sellerPayoff = ( + BigInt(agentOffer.price) + + BigInt(agentOffer.sellerDeposit) + + BigInt(buyerEscalationDeposit) - + BigInt(buyerPayoff) + ).toString(); // protocol: 0 protocolPayoff = 0; @@ -3825,7 +3860,7 @@ describe("IBosonFundsHandler", function () { // protocol: 0 // agent: 0 expectedSellerAvailableFunds.funds.push( - new Funds(await mockToken.getAddress(), "Foreign20", BigInt(sellerPayoff).toString()) + new Funds(await mockToken.getAddress(), "Foreign20", sellerPayoff) ); expectedBuyerAvailableFunds = new FundsList([ new Funds(await mockToken.getAddress(), "Foreign20", buyerPayoff), @@ -3848,7 +3883,7 @@ describe("IBosonFundsHandler", function () { beforeEach(async function () { // expected payoffs // buyer: price + buyerEscalationDeposit - buyerPayoff = BigInt(offerToken.price) + buyerEscalationDeposit.toString(); + buyerPayoff = (BigInt(offerToken.price) + BigInt(buyerEscalationDeposit)).toString(); // seller: sellerDeposit sellerPayoff = offerToken.sellerDeposit; @@ -3912,7 +3947,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit) + sellerPayoff.toString() + (BigInt(sellerDeposit) + BigInt(sellerPayoff)).toString() ); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -3948,7 +3983,7 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: price + buyerEscalationDeposit - buyerPayoff = BigInt(offerToken.price) + buyerEscalationDeposit.toString(); + buyerPayoff = (BigInt(offerToken.price) + BigInt(buyerEscalationDeposit)).toString(); // seller: sellerDeposit sellerPayoff = offerToken.sellerDeposit; @@ -4023,7 +4058,7 @@ describe("IBosonFundsHandler", function () { beforeEach(async function () { // expected payoffs // buyer: price + buyerEscalationDeposit - buyerPayoff = BigInt(offerToken.price) + buyerEscalationDeposit.toString(); + buyerPayoff = (BigInt(offerToken.price) + BigInt(buyerEscalationDeposit)).toString(); // seller: sellerDeposit sellerPayoff = offerToken.sellerDeposit; @@ -4077,7 +4112,7 @@ describe("IBosonFundsHandler", function () { // Chain state should match the expected available funds expectedSellerAvailableFunds = new FundsList([ new Funds(await mockToken.getAddress(), "Foreign20", sellerDeposit), - new Funds(ZeroAddress, "Native currency", `${2 * sellerDeposit}`), + new Funds(ZeroAddress, "Native currency", (2n * BigInt(sellerDeposit)).toString()), ]); expectedBuyerAvailableFunds = new FundsList([]); expectedProtocolAvailableFunds = new FundsList([]); @@ -4099,7 +4134,7 @@ describe("IBosonFundsHandler", function () { expectedSellerAvailableFunds.funds[0] = new Funds( await mockToken.getAddress(), "Foreign20", - BigInt(sellerDeposit) + sellerPayoff.toString() + (BigInt(sellerDeposit) + BigInt(sellerPayoff)).toString() ); sellersAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(seller.id)); buyerAvailableFunds = FundsList.fromStruct(await fundsHandler.getAvailableFunds(buyerId)); @@ -4135,7 +4170,7 @@ describe("IBosonFundsHandler", function () { // expected payoffs // buyer: price + buyerEscalationDeposit - buyerPayoff = BigInt(offerToken.price) + buyerEscalationDeposit.toString(); + buyerPayoff = (BigInt(offerToken.price) + BigInt(buyerEscalationDeposit)).toString(); // seller: sellerDeposit sellerPayoff = offerToken.sellerDeposit; From 92430e366b3f739dbfd169c7992c9af2caade8bc Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Tue, 27 Jun 2023 15:07:28 -0300 Subject: [PATCH 23/32] Review changes --- package-lock.json | 52 +++++++++++++++-------- package.json | 6 +-- scripts/deploy-suite.js | 8 ++-- scripts/domain/DisputeDates.js | 8 ++-- scripts/manage-roles.js | 2 +- scripts/util/create-dispute-resolver.js | 4 +- scripts/util/utils.js | 3 +- test/domain/AuthTokenTest.js | 5 +++ test/protocol/DisputeHandlerTest.js | 10 ++--- test/protocol/ExchangeHandlerTest.js | 3 +- test/protocol/OfferHandlerTest.js | 8 ++-- test/protocol/OrchestrationHandlerTest.js | 2 +- test/upgrade/2.1.0-2.2.0.js | 3 +- test/util/constants.js | 2 +- test/util/upgrade.js | 12 +++--- test/util/utils.js | 2 +- 16 files changed, 75 insertions(+), 55 deletions(-) diff --git a/package-lock.json b/package-lock.json index a77351528..6d638e959 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,8 +10,7 @@ "license": "GPL-3.0-or-later", "dependencies": { "@openzeppelin/contracts": "^4.9.0", - "@openzeppelin/contracts-upgradeable": "4.9.0", - "ethers": "^6.6.0" + "@openzeppelin/contracts-upgradeable": "4.9.0" }, "devDependencies": { "@bosonprotocol/solidoc": "3.0.3", @@ -27,6 +26,7 @@ "eslint-config-prettier": "^8.6.0", "eslint-plugin-no-only-tests": "^3.1.0", "ethereum-input-data-decoder": "^0.4.2", + "ethers": "^6.6.0", "glob": "^10.2.7", "hardhat": "^2.14.1", "hardhat-contract-sizer": "^2.7.0", @@ -44,7 +44,8 @@ "node_modules/@adraffy/ens-normalize": { "version": "1.9.2", "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.9.2.tgz", - "integrity": "sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg==" + "integrity": "sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg==", + "dev": true }, "node_modules/@apollo/protobufjs": { "version": "1.2.7", @@ -1626,6 +1627,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", "integrity": "sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==", + "dev": true, "funding": [ { "type": "individual", @@ -1637,6 +1639,7 @@ "version": "1.7.1", "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==", + "dev": true, "funding": [ { "type": "individual", @@ -4112,7 +4115,8 @@ "node_modules/aes-js": { "version": "4.0.0-beta.5", "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", - "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" + "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==", + "dev": true }, "node_modules/agent-base": { "version": "6.0.2", @@ -5155,7 +5159,7 @@ "version": "4.0.7", "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz", "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", - "devOptional": true, + "dev": true, "hasInstallScript": true, "dependencies": { "node-gyp-build": "^4.3.0" @@ -8500,6 +8504,7 @@ "version": "6.6.1", "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.6.1.tgz", "integrity": "sha512-bjNPf/EU4l1jQlAslOmOlyHqjOnM0W7LRPuSf0Kt0tYV4RpUEZsdGWDhvFXfogIhfzXJ/v2tPz4HqXwBt5T8mA==", + "dev": true, "funding": [ { "type": "individual", @@ -8526,7 +8531,8 @@ "node_modules/ethers/node_modules/@types/node": { "version": "18.15.13", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", - "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==" + "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==", + "dev": true }, "node_modules/ethjs-abi": { "version": "0.2.1", @@ -13285,7 +13291,7 @@ "version": "4.6.0", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==", - "devOptional": true, + "dev": true, "bin": { "node-gyp-build": "bin.js", "node-gyp-build-optional": "optional.js", @@ -18179,7 +18185,8 @@ "node_modules/tslib": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "dev": true }, "node_modules/tsort": { "version": "0.0.1", @@ -18501,7 +18508,7 @@ "version": "5.0.10", "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", - "devOptional": true, + "dev": true, "hasInstallScript": true, "dependencies": { "node-gyp-build": "^4.3.0" @@ -19393,6 +19400,7 @@ "version": "8.5.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "dev": true, "engines": { "node": ">=10.0.0" }, @@ -19613,7 +19621,8 @@ "@adraffy/ens-normalize": { "version": "1.9.2", "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.9.2.tgz", - "integrity": "sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg==" + "integrity": "sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg==", + "dev": true }, "@apollo/protobufjs": { "version": "1.2.7", @@ -20725,12 +20734,14 @@ "@noble/hashes": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", - "integrity": "sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==" + "integrity": "sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==", + "dev": true }, "@noble/secp256k1": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", - "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==" + "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==", + "dev": true }, "@nodelib/fs.scandir": { "version": "2.1.5", @@ -22805,7 +22816,8 @@ "aes-js": { "version": "4.0.0-beta.5", "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", - "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" + "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==", + "dev": true }, "agent-base": { "version": "6.0.2", @@ -23635,7 +23647,7 @@ "version": "4.0.7", "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz", "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", - "devOptional": true, + "dev": true, "requires": { "node-gyp-build": "^4.3.0" } @@ -26291,6 +26303,7 @@ "version": "6.6.1", "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.6.1.tgz", "integrity": "sha512-bjNPf/EU4l1jQlAslOmOlyHqjOnM0W7LRPuSf0Kt0tYV4RpUEZsdGWDhvFXfogIhfzXJ/v2tPz4HqXwBt5T8mA==", + "dev": true, "requires": { "@adraffy/ens-normalize": "1.9.2", "@noble/hashes": "1.1.2", @@ -26304,7 +26317,8 @@ "@types/node": { "version": "18.15.13", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", - "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==" + "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==", + "dev": true } } }, @@ -29968,7 +29982,7 @@ "version": "4.6.0", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==", - "devOptional": true + "dev": true }, "node-interval-tree": { "version": "1.3.3", @@ -33847,7 +33861,8 @@ "tslib": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "dev": true }, "tsort": { "version": "0.0.1", @@ -34104,7 +34119,7 @@ "version": "5.0.10", "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", - "devOptional": true, + "dev": true, "requires": { "node-gyp-build": "^4.3.0" } @@ -34831,6 +34846,7 @@ "version": "8.5.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "dev": true, "requires": {} }, "xhr": { diff --git a/package.json b/package.json index be7feb028..a14a805ec 100644 --- a/package.json +++ b/package.json @@ -70,8 +70,7 @@ }, "dependencies": { "@openzeppelin/contracts": "^4.9.0", - "@openzeppelin/contracts-upgradeable": "4.9.0", - "ethers": "^6.6.0" + "@openzeppelin/contracts-upgradeable": "4.9.0" }, "devDependencies": { "@bosonprotocol/solidoc": "3.0.3", @@ -98,6 +97,7 @@ "simple-statistics": "^7.8.2", "solhint": "^3.3.8", "truffle": "^5.9.4", - "web3": "^1.8.1" + "web3": "^1.8.1", + "ethers": "^6.6.0" } } diff --git a/scripts/deploy-suite.js b/scripts/deploy-suite.js index 8be1f35aa..186f60a93 100644 --- a/scripts/deploy-suite.js +++ b/scripts/deploy-suite.js @@ -4,8 +4,8 @@ const { ZeroAddress, getContractAt, getSigners } = hre.ethers; const network = hre.network.name; const confirmations = network == "hardhat" ? 1 : environments.confirmations; const tipMultiplier = BigInt(environments.tipMultiplier); -const tipSuggestion = "1500000000"; // js always returns this constant, it does not vary per block -const maxPriorityFeePerGas = BigInt(tipSuggestion).mul(tipMultiplier); +const tipSuggestion = "1500000000"; // ethers.js always returns this constant, it does not vary per block +const maxPriorityFeePerGas = BigInt(tipSuggestion) * tipMultiplier; const packageFile = require("../package.json"); const authTokenAddresses = require("./config/auth-token-addresses"); @@ -135,7 +135,7 @@ async function main(env, facetConfig) { for (const deployedFacet of deployedFacets) { deploymentComplete( deployedFacet.name, - deployedFacet.contract, + deployedFacet.contract.target, deployedFacet.constructorArgs, interfaceIdFromFacetName(deployedFacet.name), contracts @@ -222,7 +222,7 @@ async function main(env, facetConfig) { ); await transactionResponse.wait(confirmations); - if (adminAddress.toLowerCase() != (await deployer.getAddress().toLowerCase())) { + if (adminAddress.toLowerCase() != (await deployer.getAddress()).toLowerCase()) { // Grant ADMIN role to the specified admin address // Skip this step if adminAddress is the deployer transactionResponse = await accessController.grantRole( diff --git a/scripts/domain/DisputeDates.js b/scripts/domain/DisputeDates.js index d69a50e9f..9dfbd2cb1 100644 --- a/scripts/domain/DisputeDates.js +++ b/scripts/domain/DisputeDates.js @@ -16,10 +16,10 @@ class DisputeDates { */ constructor(disputed, escalated, finalized, timeout) { - this.disputed = disputed && disputed.toString(); - this.escalated = escalated && escalated.toString(); - this.finalized = finalized && finalized.toString(); - this.timeout = timeout && timeout.toString(); + this.disputed = disputed?.toString(); + this.escalated = escalated?.toString(); + this.finalized = finalized?.toString(); + this.timeout = timeout?.toString(); } /** diff --git a/scripts/manage-roles.js b/scripts/manage-roles.js index e1799efcc..8ca209e5f 100644 --- a/scripts/manage-roles.js +++ b/scripts/manage-roles.js @@ -31,7 +31,7 @@ async function main(env) { // Bail now if hardhat network if (network === "hardhat") process.exit(); - const chainId = (await hre.provider.getNetwork()).chainId; + const chainId = (await provider.getNetwork()).chainId; const contractsFile = readContracts(chainId, network, env); const divider = "-".repeat(80); diff --git a/scripts/util/create-dispute-resolver.js b/scripts/util/create-dispute-resolver.js index 05ec8ed94..13e260023 100644 --- a/scripts/util/create-dispute-resolver.js +++ b/scripts/util/create-dispute-resolver.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const { ZeroAddress, getContractAt, getSigner, Wallet } = hre.ethers; +const { ZeroAddress, getContractAt, getSigner, Wallet, provider } = hre.ethers; const fs = require("fs").promises; const environments = require("../../environments"); const network = hre.network.name; @@ -53,7 +53,7 @@ const createDisputeResolver = async (path) => { } // Find protocol diamond and accessController addresses - const chainId = (await hre.provider.getNetwork()).chainId; + const chainId = (await provider.getNetwork()).chainId; const addressList = require(`../../addresses/${chainId}-${network}.json`).contracts; const protocolAddress = addressList.find((c) => c.name === "ProtocolDiamond").address; const accessControllerAddress = addressList.find((c) => c.name === "AccessController").address; diff --git a/scripts/util/utils.js b/scripts/util/utils.js index 93f4e1d26..cfa0478b1 100644 --- a/scripts/util/utils.js +++ b/scripts/util/utils.js @@ -12,6 +12,7 @@ function delay(ms) { } function deploymentComplete(name, address, args, interfaceId, contracts) { + console.log("address", address); contracts.push({ name, address, args, interfaceId }); console.log(`✅ ${name} deployed to: ${address}`); } @@ -21,7 +22,7 @@ async function writeContracts(contracts, env, version) { fs.mkdirSync(addressesDirPath); } - const chainId = (await hre.provider.getNetwork()).chainId; + const chainId = Number((await provider.getNetwork()).chainId); const network = hre.network.name; const path = getAddressesFilePath(chainId, network, env); fs.writeFileSync( diff --git a/test/domain/AuthTokenTest.js b/test/domain/AuthTokenTest.js index 199304638..d7130bb68 100644 --- a/test/domain/AuthTokenTest.js +++ b/test/domain/AuthTokenTest.js @@ -43,6 +43,11 @@ describe("AuthToken", function () { expect(authToken.tokenIdIsValid()).is.false; expect(authToken.isValid()).is.false; + // Invalid field value + authToken.tokenId = new Date(); + expect(authToken.tokenIdIsValid()).is.false; + expect(authToken.isValid()).is.false; + // Valid field value authToken.tokenId = "0"; expect(authToken.tokenIdIsValid()).is.true; diff --git a/test/protocol/DisputeHandlerTest.js b/test/protocol/DisputeHandlerTest.js index 60e2806b5..042ebff0a 100644 --- a/test/protocol/DisputeHandlerTest.js +++ b/test/protocol/DisputeHandlerTest.js @@ -1419,7 +1419,7 @@ describe("IBosonDisputeHandler", function () { // Attempt to escalate the dispute, expecting revert await expect( disputeHandler.connect(buyer).escalateDispute(exchangeId, { - value: BigInt(buyerEscalationDepositNative) - "1".toString(), + value: BigInt(buyerEscalationDepositNative) - 1n, }) ).to.revertedWith(RevertReasons.INSUFFICIENT_VALUE_RECEIVED); }); @@ -1430,7 +1430,7 @@ describe("IBosonDisputeHandler", function () { // Attempt to escalate the dispute, expecting revert await expect( disputeHandler.connect(buyer).escalateDispute(exchangeId, { - value: BigInt("1").toString(), + value: 1n, }) ).to.revertedWith(RevertReasons.NATIVE_NOT_ALLOWED); }); @@ -2053,7 +2053,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate) + resolutionPeriod.toString(); + timeout = (BigInt(disputedDate) + BigInt(resolutionPeriod)).toString(); }); it("should return true for exists if exchange id is valid", async function () { @@ -2110,7 +2110,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); disputedDate = block.timestamp.toString(); - timeout = BigInt(disputedDate) + resolutionPeriod.toString(); + timeout = (BigInt(disputedDate) + BigInt(resolutionPeriod)).toString(); buyerPercentBasisPoints = "1234"; @@ -2167,7 +2167,7 @@ describe("IBosonDisputeHandler", function () { blockNumber = tx.blockNumber; block = await provider.getBlock(blockNumber); escalatedDate = block.timestamp.toString(); - timeout = BigInt(escalatedDate) + escalationPeriod.toString(); + timeout = (BigInt(escalatedDate) + BigInt(escalationPeriod)).toString(); // buyer percent used in tests buyerPercentBasisPoints = "4321"; diff --git a/test/protocol/ExchangeHandlerTest.js b/test/protocol/ExchangeHandlerTest.js index b3da5d6b0..61b3b9d45 100644 --- a/test/protocol/ExchangeHandlerTest.js +++ b/test/protocol/ExchangeHandlerTest.js @@ -786,7 +786,6 @@ describe("IBosonExchangeHandler", function () { bosonVoucher = await getContractAt("BosonVoucher", voucherCloneAddress); await bosonVoucher.connect(assistant).preMint(offer.id, offer.quantityAvailable); - tokenId = "1"; tokenId = deriveTokenId(offer.id, exchangeId); }); @@ -3577,7 +3576,7 @@ describe("IBosonExchangeHandler", function () { block = await provider.getBlock(blockNumber); // Set time forward to run out the dispute period - newTime = Number(voucherRedeemableFrom + disputePeriod + 1); + newTime = Number(BigInt(voucherRedeemableFrom) + BigInt(disputePeriod) + 1n); await setNextBlockTimestamp(newTime); // Complete exchange diff --git a/test/protocol/OfferHandlerTest.js b/test/protocol/OfferHandlerTest.js index c945a795c..e6b418496 100644 --- a/test/protocol/OfferHandlerTest.js +++ b/test/protocol/OfferHandlerTest.js @@ -581,7 +581,7 @@ describe("IBosonOfferHandler", function () { it("Buyer cancel penalty is greater than price", async function () { // Set buyer cancel penalty higher than offer price - offer.buyerCancelPenalty = BigInt(offer.price) + "10".toString(); + offer.buyerCancelPenalty = (BigInt(offer.price) + 10n).toString(); // Attempt to Create an offer, expecting revert await expect( @@ -1190,7 +1190,7 @@ describe("IBosonOfferHandler", function () { context("Offers with fixed voucher expiration date", async function () { beforeEach(async function () { - offerDates.voucherRedeemableUntil = BigInt(offerDates.validUntil) + oneMonth.toString(); + offerDates.voucherRedeemableUntil = (BigInt(offerDates.validUntil) + oneMonth).toString(); offerDurations.voucherValid = "0"; // only one of voucherRedeemableUntil and voucherValid can be non zero // Create an offer @@ -1202,7 +1202,7 @@ describe("IBosonOfferHandler", function () { id = nextOfferId++; // update the values - offerDates.validUntil = BigInt(offerDates.validUntil) + "10000".toString(); + offerDates.validUntil = (BigInt(offerDates.validUntil) + 10000n).toString(); offerStruct = offer.toStruct(); }); @@ -2233,7 +2233,7 @@ describe("IBosonOfferHandler", function () { it("Buyer cancel penalty is greater than price", async function () { // Set buyer cancel penalty higher than offer price - offers[0].buyerCancelPenalty = BigInt(offers[0].price) + "10".toString(); + offers[0].buyerCancelPenalty = (BigInt(offers[0].price) + 10n).toString(); // Attempt to Create an offer, expecting revert await expect( diff --git a/test/protocol/OrchestrationHandlerTest.js b/test/protocol/OrchestrationHandlerTest.js index 1fbf06579..b1689c190 100644 --- a/test/protocol/OrchestrationHandlerTest.js +++ b/test/protocol/OrchestrationHandlerTest.js @@ -567,7 +567,7 @@ describe("IBosonOrchestrationHandler", function () { const voucherRedeemedDate = voucherStruct.redeemedDate; // Set time forward past the dispute period - await setNextBlockTimestamp(Number(voucherRedeemedDate + disputePeriod + 1)); + await setNextBlockTimestamp(Number(voucherRedeemedDate + BigInt(disputePeriod) + 1n)); // Attempt to raise a dispute, expecting revert await expect( diff --git a/test/upgrade/2.1.0-2.2.0.js b/test/upgrade/2.1.0-2.2.0.js index 9358c73e5..bb63bd1d6 100644 --- a/test/upgrade/2.1.0-2.2.0.js +++ b/test/upgrade/2.1.0-2.2.0.js @@ -1,5 +1,5 @@ const hre = require("hardhat"); -const { ZeroAddress, getContractAt, getSigners, provider, randomBytes } = hre.ethers; +const { ZeroAddress, getContractAt, getSigners, provider, randomBytes, keccak256, toUtf8Bytes } = hre.ethers; const { assert, expect } = require("chai"); const DisputeResolver = require("../../scripts/domain/DisputeResolver"); const { @@ -21,7 +21,6 @@ const { revertState, } = require("../util/upgrade"); const { getGenericContext } = require("./01_generic"); -const { keccak256, toUtf8Bytes } = require("ethers/lib/utils"); const TokenType = require("../../scripts/domain/TokenType"); const Twin = require("../../scripts/domain/Twin"); const { diff --git a/test/util/constants.js b/test/util/constants.js index 00b9de4b6..1fdd7a2c2 100644 --- a/test/util/constants.js +++ b/test/util/constants.js @@ -9,7 +9,7 @@ const VOUCHER_NAME = "Boson Voucher (rNFT)"; const VOUCHER_SYMBOL = "BOSON_VOUCHER_RNFT"; const SEAPORT_ADDRESS = "0x00000000000001ad428e4906aE43D8F9852d0dD6"; // 1.4 const tipMultiplier = BigInt(environments.tipMultiplier); -const tipSuggestion = "1500000000"; // js always returns this constant, it does not vary per block +const tipSuggestion = "1500000000"; // ethers.js always returns this constant, it does not vary per block const maxPriorityFeePerGas = BigInt(tipSuggestion) * tipMultiplier; exports.oneDay = oneDay; diff --git a/test/util/upgrade.js b/test/util/upgrade.js index 0784ba17d..9b3963395 100644 --- a/test/util/upgrade.js +++ b/test/util/upgrade.js @@ -116,7 +116,7 @@ async function deploySuite(deployer, newVersion) { }); // Read contract info from file - const chainId = (await hre.provider.getNetwork()).chainId; + const chainId = (await provider.getNetwork()).chainId; const contractsFile = readContracts(chainId, "hardhat", "upgrade-test"); // Get AccessController abstraction @@ -489,7 +489,7 @@ async function populateProtocolContract( // Set unique offer dates based on offer id const now = offerDates.validFrom; offerDates.validFrom = BigInt(now) + oneMonth + offerId * (1000).toString(); - offerDates.validUntil = BigInt(now) + oneMonth * 6 * (offerId + 1).toString(); + offerDates.validUntil = (BigInt(now) + oneMonth * 6n * BigInt(offerId + 1)).toString(); // Set unique offerDurations based on offer id offerDurations.disputePeriod = `${(offerId + 1) * oneMonth}`; @@ -509,7 +509,7 @@ async function populateProtocolContract( sellers[j].offerIds.push(offerId); // Deposit seller funds so the commit will succeed - const sellerPool = BigInt(offer.quantityAvailable) * offer.price.toString(); + const sellerPool = BigInt(offer.quantityAvailable) * BigInt(offer.price); const msgValue = offer.exchangeToken == ZeroAddress ? sellerPool : "0"; await fundsHandler .connect(sellers[j].wallet) @@ -1699,8 +1699,8 @@ async function populateVoucherContract( // Set unique offer dates based on offer id const now = offerDates.validFrom; - offerDates.validFrom = BigInt(now) + oneMonth + offerId * (1000).toString(); - offerDates.validUntil = BigInt(now) + oneMonth * 6 * (offerId + 1).toString(); + offerDates.validFrom = (BigInt(now) + oneMonth + BigInt(offerId) * 1000n).toString(); + offerDates.validUntil = (BigInt(now) + oneMonth * 6n * BigInt(offerId + 1)).toString(); // Set unique offerDurations based on offer id offerDurations.disputePeriod = `${(offerId + 1) * oneMonth}`; @@ -1720,7 +1720,7 @@ async function populateVoucherContract( sellers[j].offerIds.push(offerId); // Deposit seller funds so the commit will succeed - const sellerPool = BigInt(offer.quantityAvailable) * offer.price.toString(); + const sellerPool = BigInt(offer.quantityAvailable) * BigInt(offer.price); const msgValue = offer.exchangeToken == ZeroAddress ? sellerPool : "0"; await fundsHandler .connect(sellers[j].wallet) diff --git a/test/util/utils.js b/test/util/utils.js index 924698e27..1187c4737 100644 --- a/test/util/utils.js +++ b/test/util/utils.js @@ -427,7 +427,7 @@ async function revertToSnapshot(snapshotId) { } function deriveTokenId(offerId, exchangeId) { - return BigInt(offerId) * 2n ** 128n + BigInt(exchangeId); + return (BigInt(offerId) << 128n) + BigInt(exchangeId); } exports.setNextBlockTimestamp = setNextBlockTimestamp; From 676a603fd822273da92b41ad487286efd1d4b320 Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Tue, 27 Jun 2023 15:53:42 -0300 Subject: [PATCH 24/32] Fixing integration tests --- test/example/SnapshotGateTest.js | 15 +++++---- .../01-update-account-roles-addresses.js | 10 +++--- test/integration/02-Upgraded-facet.js | 32 +++++++++---------- ...DR-removes-the-seller-from-allowed-list.js | 6 ++-- test/integration/04-DR-removes-fees.js | 6 ++-- 5 files changed, 36 insertions(+), 33 deletions(-) diff --git a/test/example/SnapshotGateTest.js b/test/example/SnapshotGateTest.js index 1784b6439..088f5be6a 100644 --- a/test/example/SnapshotGateTest.js +++ b/test/example/SnapshotGateTest.js @@ -173,6 +173,8 @@ describe("SnapshotGate", function () { // Cast Diamond to IBosonExchangeHandler exchangeHandler = await getContractAt("IBosonExchangeHandler", await protocolDiamond.getAddress()); + accountId.next(true); + // Deploy the SnapshotGate example sellerId = "1"; [snapshotGate] = await deploySnapshotGateExample([ @@ -194,7 +196,7 @@ describe("SnapshotGate", function () { seller = mockSeller( await assistant.getAddress(), await admin.getAddress(), - await clerk.getAddress(), + clerk.address, await treasury.getAddress() ); expect(seller.isValid()).is.true; @@ -226,10 +228,11 @@ describe("SnapshotGate", function () { disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); + expect(disputeResolver.isValid()).is.true; // Create DisputeResolverFee array so offer creation will succeed @@ -402,7 +405,7 @@ describe("SnapshotGate", function () { const event = getEvent(txReceipt, snapshotGate, "SnapshotAppended"); // Check executedBy - expect(event.executedBy.toString()).to.equal(await deployer.getAddress().toString()); + expect(event.executedBy.toString()).to.equal((await deployer.getAddress()).toString()); // Verify batch contents emitted match what was sent for (let i = 0; i < batch.length; i++) { @@ -425,7 +428,7 @@ describe("SnapshotGate", function () { let event = getEvent(txReceipt, snapshotGate, "SnapshotAppended"); // Check executedBy - expect(event.executedBy.toString()).to.equal(await deployer.getAddress().toString()); + expect(event.executedBy.toString()).to.equal((await deployer.getAddress()).toString()); // Verify batch contents emitted match what was sent for (let i = 0; i < batch1.length; i++) { @@ -441,7 +444,7 @@ describe("SnapshotGate", function () { event = getEvent(txReceipt, snapshotGate, "SnapshotAppended"); // Check executedBy - expect(event.executedBy.toString()).to.equal(await deployer.getAddress().toString()); + expect(event.executedBy.toString()).to.equal((await deployer.getAddress()).toString()); // Verify batch contents emitted match what was sent for (let i = 0; i < batch2.length; i++) { @@ -753,7 +756,7 @@ describe("SnapshotGate", function () { let holder = holderByAddress[entry.owner]; // Wrong price - const halfPrice = BigInt(price) / BigInt(2).toString(); + const halfPrice = (BigInt(price) / BigInt(2)).toString(); // Commit to the offer await expect( diff --git a/test/integration/01-update-account-roles-addresses.js b/test/integration/01-update-account-roles-addresses.js index 5bce253c7..9d572ef18 100644 --- a/test/integration/01-update-account-roles-addresses.js +++ b/test/integration/01-update-account-roles-addresses.js @@ -86,7 +86,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { seller = mockSeller( await assistant.getAddress(), await admin.getAddress(), - await clerk.getAddress(), + clerk.address, await treasury.getAddress() ); await expect(accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues)) @@ -103,7 +103,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -130,7 +130,7 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { // Create an offer ({ offer, offerDates, offerDurations, disputeResolverId } = await mockOffer()); - offerDurations.disputePeriod = (oneMonth * 6).toString(); + offerDurations.disputePeriod = (oneMonth * 6n).toString(); // Check if domains are valid expect(offer.isValid()).is.true; @@ -241,9 +241,9 @@ describe("[@skip-on-coverage] Update account roles addresses", function () { await exchangeHandler.connect(buyer).cancelVoucher(exchangeId); // Expected buyer payoff: price - buyerCancelPenalty - buyerPayoff = BigInt(offer.price) - offer.buyerCancelPenalty.toString(); + buyerPayoff = (BigInt(offer.price) - BigInt(offer.buyerCancelPenalty)).toString(); // Expected seller payoff: sellerDeposit + buyerCancelPenalty - sellerPayoff = BigInt(offer.sellerDeposit) + offer.buyerCancelPenalty.toString(); + sellerPayoff = (BigInt(offer.sellerDeposit) + BigInt(offer.buyerCancelPenalty)).toString(); }); it("Buyer should be able to withdraw funds after updating wallet address", async function () { diff --git a/test/integration/02-Upgraded-facet.js b/test/integration/02-Upgraded-facet.js index 73a32f9a5..cd8e9357f 100644 --- a/test/integration/02-Upgraded-facet.js +++ b/test/integration/02-Upgraded-facet.js @@ -89,7 +89,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation seller = mockSeller( await assistant.getAddress(), await admin.getAddress(), - await clerk.getAddress(), + clerk.address, await treasury.getAddress() ); expect(seller.isValid()).is.true; @@ -126,7 +126,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // Deploy MockExchangeHandlerFacet const MockExchangeHandlerFacet = await getContractFactory(mockFacet); const mockExchangeHandlerFacet = await MockExchangeHandlerFacet.deploy(); - await mockExchangeHandlerFacet.deployed(); + await mockExchangeHandlerFacet.waitForDeployment(); // Define the facet cut const facetCuts = [ @@ -157,7 +157,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -386,7 +386,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -428,7 +428,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation escalationPeriod = disputeResolver.escalationResponsePeriod; // Deposit seller funds so the commit will succeed - const fundsToDeposit = BigInt(sellerDeposit) * quantityAvailable; + const fundsToDeposit = BigInt(sellerDeposit) * BigInt(quantityAvailable); await fundsHandler .connect(assistant) .depositFunds(seller.id, ZeroAddress, fundsToDeposit, { value: fundsToDeposit }); @@ -674,7 +674,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -770,10 +770,10 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // expected payoffs - they are the same for token and native currency // buyer: price - buyerCancelPenalty - const buyerPayoff = BigInt(offerToken.price) - offerToken.buyerCancelPenalty.toString(); + const buyerPayoff = (BigInt(offerToken.price) - BigInt(offerToken.buyerCancelPenalty)).toString(); // seller: sellerDeposit + buyerCancelPenalty - const sellerPayoff = BigInt(offerToken.sellerDeposit) + offerToken.buyerCancelPenalty.toString(); + const sellerPayoff = (BigInt(offerToken.sellerDeposit) + BigInt(offerToken.buyerCancelPenalty)).toString(); // Withdraw funds, testing for the event // Withdraw tokens @@ -781,8 +781,8 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation const tokenListBuyer = [ZeroAddress, await mockToken.getAddress()]; // Withdraw amounts - const tokenAmountsSeller = [sellerPayoff, BigInt(sellerPayoff) / "2".toString()]; - const tokenAmountsBuyer = [buyerPayoff, BigInt(buyerPayoff) / "5".toString()]; + const tokenAmountsSeller = [sellerPayoff, (BigInt(sellerPayoff) / 2n).toString()]; + const tokenAmountsBuyer = [buyerPayoff, (BigInt(buyerPayoff) / 5n).toString()]; // seller withdrawal const tx = await fundsHandler @@ -804,7 +804,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation seller.id, await treasury.getAddress(), 0n, - BigInt(sellerPayoff) / "2", + BigInt(sellerPayoff) / 2n, await assistant.getAddress() ); @@ -816,7 +816,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation buyerId, await buyer.getAddress(), await mockToken.getAddress(), - BigInt(buyerPayoff) / "5", + BigInt(buyerPayoff) / 5n, await buyer.getAddress() ); @@ -836,10 +836,10 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation // expected payoffs - they are the same for token and native currency // buyer: price - buyerCancelPenalty - const buyerPayoff = BigInt(offerToken.price) - offerToken.buyerCancelPenalty.toString(); + const buyerPayoff = (BigInt(offerToken.price) - BigInt(offerToken.buyerCancelPenalty)).toString(); // seller: sellerDeposit + buyerCancelPenalty - const sellerPayoff = BigInt(offerToken.sellerDeposit) + offerToken.buyerCancelPenalty.toString(); + const sellerPayoff = (BigInt(offerToken.sellerDeposit) + BigInt(offerToken.buyerCancelPenalty)).toString(); // Withdraw funds, testing for the event // Withdraw tokens @@ -847,8 +847,8 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation const tokenListBuyer = [ZeroAddress, await mockToken.getAddress()]; // Withdraw amounts - const tokenAmountsSeller = [sellerPayoff, BigInt(sellerPayoff) / "2".toString()]; - const tokenAmountsBuyer = [buyerPayoff, BigInt(buyerPayoff) / "5".toString()]; + const tokenAmountsSeller = [sellerPayoff, (BigInt(sellerPayoff) / 2n).toString()]; + const tokenAmountsBuyer = [buyerPayoff, (BigInt(buyerPayoff) / 5n).toString()]; // seller withdrawal // Attempt to withdraw the funds, expecting revert diff --git a/test/integration/03-DR-removes-the-seller-from-allowed-list.js b/test/integration/03-DR-removes-the-seller-from-allowed-list.js index a3539f0dc..f0c12904d 100644 --- a/test/integration/03-DR-removes-the-seller-from-allowed-list.js +++ b/test/integration/03-DR-removes-the-seller-from-allowed-list.js @@ -78,7 +78,7 @@ describe("[@skip-on-coverage] DR removes sellers from the approved seller list", seller = mockSeller( await assistant.getAddress(), await admin.getAddress(), - await clerk.getAddress(), + clerk.address, await treasury.getAddress() ); expect(seller.isValid()).is.true; @@ -109,7 +109,7 @@ describe("[@skip-on-coverage] DR removes sellers from the approved seller list", disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -150,7 +150,7 @@ describe("[@skip-on-coverage] DR removes sellers from the approved seller list", const voucherRedeemableFrom = offerDates.voucherRedeemableFrom; // Deposit seller funds so the commit will succeed - const fundsToDeposit = BigInt(sellerDeposit) * quantityAvailable; + const fundsToDeposit = BigInt(sellerDeposit) * BigInt(quantityAvailable); await fundsHandler .connect(assistant) .depositFunds(seller.id, ZeroAddress, fundsToDeposit, { value: fundsToDeposit }); diff --git a/test/integration/04-DR-removes-fees.js b/test/integration/04-DR-removes-fees.js index 0387ad264..eedbefee0 100644 --- a/test/integration/04-DR-removes-fees.js +++ b/test/integration/04-DR-removes-fees.js @@ -69,7 +69,7 @@ describe("[@skip-on-coverage] DR removes fee", function () { seller = mockSeller( await assistant.getAddress(), await admin.getAddress(), - await clerk.getAddress(), + clerk.address, await treasury.getAddress() ); expect(await accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues)) @@ -86,7 +86,7 @@ describe("[@skip-on-coverage] DR removes fee", function () { disputeResolver = mockDisputeResolver( await assistantDR.getAddress(), await adminDR.getAddress(), - await clerkDR.getAddress(), + clerkDR.address, await treasuryDR.getAddress(), true ); @@ -115,7 +115,7 @@ describe("[@skip-on-coverage] DR removes fee", function () { await offerHandler.connect(assistant).createOffer(offer, offerDates, offerDurations, disputeResolverId, "0"); // Deposit seller funds so the commit will succeed - const fundsToDeposit = BigInt(offer.sellerDeposit) * offer.quantityAvailable; + const fundsToDeposit = BigInt(offer.sellerDeposit) * BigInt(offer.quantityAvailable); await fundsHandler.connect(assistant).depositFunds(seller.id, ZeroAddress, fundsToDeposit, { value: fundsToDeposit, }); From 60b840481a2f79bacf36f847059a2d061222e1ba Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Tue, 27 Jun 2023 21:12:36 -0300 Subject: [PATCH 25/32] Fix integration test 04 --- package-lock.json | 42 ++++++++++++++++++++------ test/integration/04-DR-removes-fees.js | 4 ++- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6d638e959..5f4836a54 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4004,6 +4004,7 @@ "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz", "integrity": "sha512-DnhQwcFEaYsvYDnACLZhMmCWd3rkOeEvglpa4q5i/5Jlm3UIsWaxVzuXvDLFCSCWRO3yy2/+V/G7FusFgejnfQ==", "dev": true, + "optional": true, "dependencies": { "buffer": "^6.0.3", "catering": "^2.0.0", @@ -4035,6 +4036,7 @@ "url": "https://feross.org/support" } ], + "optional": true, "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.2.1" @@ -4045,6 +4047,7 @@ "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-2.1.0.tgz", "integrity": "sha512-E486g1NCjW5cF78KGPrMDRBYzPuueMZ6VBXHT6gC7A8UYWGiM14fGgp+s/L1oFfDWSPV/+SFkYCmZ0SiESkRKA==", "dev": true, + "optional": true, "engines": { "node": ">=10" } @@ -6796,6 +6799,7 @@ "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.4.1.tgz", "integrity": "sha512-r4eRSeStEGf6M5SKdrQhhLK5bOwOBxQhIE3YSTnZE3GpKiLfnnhE+tPtrJE79+eDJgm39BM6LSoI8SCx4HbwlQ==", "dev": true, + "optional": true, "engines": { "node": ">=6" } @@ -9436,7 +9440,6 @@ "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz", "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==", "dev": true, - "hasInstallScript": true, "optional": true, "dependencies": { "node-gyp-build": "^4.3.0" @@ -9794,7 +9797,6 @@ "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz", "integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==", "dev": true, - "hasInstallScript": true, "optional": true, "dependencies": { "node-gyp-build": "^4.3.0" @@ -11055,7 +11057,8 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.3.0.tgz", "integrity": "sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q==", - "dev": true + "dev": true, + "optional": true }, "node_modules/immutable": { "version": "4.3.0", @@ -11888,6 +11891,7 @@ "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz", "integrity": "sha512-BWRCMHBxbIqPxJ8vHOvKUsaO0v1sLYZtjN3K2iZJsRBYtp+ONsY6Jfi6hy9K3+zolgQRryhIn2NRZjZnWJ9NmQ==", "dev": true, + "optional": true, "dependencies": { "catering": "^2.1.0" }, @@ -12052,6 +12056,7 @@ "integrity": "sha512-iB8O/7Db9lPaITU1aA2txU/cBEXAt4vWwKQRrrWuS6XDgbP4QZGj9BL2aNbwb002atoQ/lIotJkfyzz+ygQnUQ==", "dev": true, "hasInstallScript": true, + "optional": true, "dependencies": { "abstract-leveldown": "~6.2.1", "napi-macros": "~2.0.0", @@ -12066,6 +12071,7 @@ "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", "dev": true, + "optional": true, "dependencies": { "buffer": "^5.5.0", "immediate": "^3.2.3", @@ -12082,6 +12088,7 @@ "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz", "integrity": "sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==", "dev": true, + "optional": true, "engines": { "node": ">=6" } @@ -12091,6 +12098,7 @@ "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-1.0.1.tgz", "integrity": "sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg==", "dev": true, + "optional": true, "dependencies": { "xtend": "^4.0.2" }, @@ -12102,13 +12110,15 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz", "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==", - "dev": true + "dev": true, + "optional": true }, "node_modules/leveldown/node_modules/node-gyp-build": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.1.1.tgz", "integrity": "sha512-dSq1xmcPDKPZ2EED2S6zw/b9NKsqzXRE6dVr8TVQnI3FJOTteUMuqF3Qqs6LZg+mLGYJWqQzMbIjMtJqTv87nQ==", "dev": true, + "optional": true, "bin": { "node-gyp-build": "bin.js", "node-gyp-build-optional": "optional.js", @@ -22743,6 +22753,7 @@ "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz", "integrity": "sha512-DnhQwcFEaYsvYDnACLZhMmCWd3rkOeEvglpa4q5i/5Jlm3UIsWaxVzuXvDLFCSCWRO3yy2/+V/G7FusFgejnfQ==", "dev": true, + "optional": true, "requires": { "buffer": "^6.0.3", "catering": "^2.0.0", @@ -22757,6 +22768,7 @@ "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "dev": true, + "optional": true, "requires": { "base64-js": "^1.3.1", "ieee754": "^1.2.1" @@ -22766,7 +22778,8 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-2.1.0.tgz", "integrity": "sha512-E486g1NCjW5cF78KGPrMDRBYzPuueMZ6VBXHT6gC7A8UYWGiM14fGgp+s/L1oFfDWSPV/+SFkYCmZ0SiESkRKA==", - "dev": true + "dev": true, + "optional": true } } }, @@ -24932,7 +24945,8 @@ "version": "0.4.1", "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.4.1.tgz", "integrity": "sha512-r4eRSeStEGf6M5SKdrQhhLK5bOwOBxQhIE3YSTnZE3GpKiLfnnhE+tPtrJE79+eDJgm39BM6LSoI8SCx4HbwlQ==", - "dev": true + "dev": true, + "optional": true }, "emoji-regex": { "version": "8.0.0", @@ -28246,7 +28260,8 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.3.0.tgz", "integrity": "sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q==", - "dev": true + "dev": true, + "optional": true }, "immutable": { "version": "4.3.0", @@ -28865,6 +28880,7 @@ "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz", "integrity": "sha512-BWRCMHBxbIqPxJ8vHOvKUsaO0v1sLYZtjN3K2iZJsRBYtp+ONsY6Jfi6hy9K3+zolgQRryhIn2NRZjZnWJ9NmQ==", "dev": true, + "optional": true, "requires": { "catering": "^2.1.0" } @@ -28991,6 +29007,7 @@ "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-5.6.0.tgz", "integrity": "sha512-iB8O/7Db9lPaITU1aA2txU/cBEXAt4vWwKQRrrWuS6XDgbP4QZGj9BL2aNbwb002atoQ/lIotJkfyzz+ygQnUQ==", "dev": true, + "optional": true, "requires": { "abstract-leveldown": "~6.2.1", "napi-macros": "~2.0.0", @@ -29002,6 +29019,7 @@ "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", "dev": true, + "optional": true, "requires": { "buffer": "^5.5.0", "immediate": "^3.2.3", @@ -29014,13 +29032,15 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz", "integrity": "sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==", - "dev": true + "dev": true, + "optional": true }, "level-supports": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-1.0.1.tgz", "integrity": "sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg==", "dev": true, + "optional": true, "requires": { "xtend": "^4.0.2" } @@ -29029,13 +29049,15 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz", "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==", - "dev": true + "dev": true, + "optional": true }, "node-gyp-build": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.1.1.tgz", "integrity": "sha512-dSq1xmcPDKPZ2EED2S6zw/b9NKsqzXRE6dVr8TVQnI3FJOTteUMuqF3Qqs6LZg+mLGYJWqQzMbIjMtJqTv87nQ==", - "dev": true + "dev": true, + "optional": true } } }, diff --git a/test/integration/04-DR-removes-fees.js b/test/integration/04-DR-removes-fees.js index eedbefee0..044d9794e 100644 --- a/test/integration/04-DR-removes-fees.js +++ b/test/integration/04-DR-removes-fees.js @@ -1,4 +1,5 @@ -const { ZeroAddress, provider } = require("hardhat"); +const { ethers } = require("hardhat"); +const { ZeroAddress, provider } = ethers; const { expect } = require("chai"); const { @@ -72,6 +73,7 @@ describe("[@skip-on-coverage] DR removes fee", function () { clerk.address, await treasury.getAddress() ); + expect(await accountHandler.connect(admin).createSeller(seller, emptyAuthToken, voucherInitValues)) .to.emit(accountHandler, "SellerCreated") .withArgs( From 11dba7bd54925a398871bd8e3e18db19d2d13094 Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Tue, 27 Jun 2023 21:24:23 -0300 Subject: [PATCH 26/32] Fixing upgrade tests --- scripts/config/protocol-parameters.js | 6 +++--- test/domain/AuthTokenTest.js | 5 ----- test/util/upgrade.js | 10 +++++----- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/scripts/config/protocol-parameters.js b/scripts/config/protocol-parameters.js index 6fc9ceab7..c222d16c6 100644 --- a/scripts/config/protocol-parameters.js +++ b/scripts/config/protocol-parameters.js @@ -20,13 +20,13 @@ module.exports = { maxOffersPerBatch: "12", maxTokensPerWithdrawal: "125", maxFeesPerDisputeResolver: "75", - maxEscalationResponsePeriod: ninetyDays, + maxEscalationResponsePeriod: ninetyDays.toString(), maxDisputesPerBatch: "75", maxAllowedSellers: "140", maxTotalOfferFeePercentage: "10000", // 100% maxRoyaltyPecentage: "10000", //100% - maxResolutionPeriod: ninetyDays, - minDisputePeriod: oneWeek, + maxResolutionPeriod: ninetyDays.toString(), + minDisputePeriod: oneWeek.toString(), maxPremintedVouchers: "10000", }, diff --git a/test/domain/AuthTokenTest.js b/test/domain/AuthTokenTest.js index d7130bb68..199304638 100644 --- a/test/domain/AuthTokenTest.js +++ b/test/domain/AuthTokenTest.js @@ -43,11 +43,6 @@ describe("AuthToken", function () { expect(authToken.tokenIdIsValid()).is.false; expect(authToken.isValid()).is.false; - // Invalid field value - authToken.tokenId = new Date(); - expect(authToken.tokenIdIsValid()).is.false; - expect(authToken.isValid()).is.false; - // Valid field value authToken.tokenId = "0"; expect(authToken.tokenIdIsValid()).is.true; diff --git a/test/util/upgrade.js b/test/util/upgrade.js index 9b3963395..cb4b42d73 100644 --- a/test/util/upgrade.js +++ b/test/util/upgrade.js @@ -2,8 +2,6 @@ const shell = require("shelljs"); const _ = require("lodash"); const { getStorageAt } = require("@nomicfoundation/hardhat-network-helpers"); const hre = require("hardhat"); -const ethers = hre.ethers; - const { keccak256, formatBytes32String, @@ -15,7 +13,7 @@ const { toUtf8Bytes, getContractFactory, getSigners, -} = ethers; +} = hre.ethers; const AuthToken = require("../../scripts/domain/AuthToken"); const { getMetaTransactionsHandlerFacetInitArgs } = require("../../scripts/config/facet-deploy.js"); const AuthTokenType = require("../../scripts/domain/AuthTokenType"); @@ -95,7 +93,8 @@ async function deploySuite(deployer, newVersion) { shell.exec(`git fetch --force --tags origin`); console.log(`Checking out version ${tag}`); shell.exec(`rm -rf contracts/*`); - shell.exec(`git checkout ${tag} contracts`); + shell.exec(`git checkout ${tag} -- "contracts/**`); + if (scriptsTag) { console.log(`Checking out scripts on version ${scriptsTag}`); shell.exec(`rm -rf scripts/*`); @@ -121,7 +120,7 @@ async function deploySuite(deployer, newVersion) { // Get AccessController abstraction const accessControllerInfo = contractsFile.contracts.find((i) => i.name === "AccessController"); - const accessController = await getContractAt("AccessController", await accessControllerInfo.getAddress()); + const accessController = await getContractAt("AccessController", accessControllerInfo.address); // Temporarily grant UPGRADER role to deployer account await accessController.grantRole(Role.UPGRADER, await deployer.getAddress()); @@ -374,6 +373,7 @@ async function populateProtocolContract( await accountHandler .connect(connectedWallet) .createDisputeResolver(disputeResolver, disputeResolverFees, sellerAllowList); + console.log("after"); DRs.push({ wallet: connectedWallet, id: disputeResolver.id, From 57a6ae514321f7dfcd8c5fb0b34beff86897ba2e Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Wed, 28 Jun 2023 08:24:16 -0300 Subject: [PATCH 27/32] Remove maxPremintedVouchers check --- contracts/protocol/clients/voucher/BosonVoucher.sol | 5 ----- 1 file changed, 5 deletions(-) diff --git a/contracts/protocol/clients/voucher/BosonVoucher.sol b/contracts/protocol/clients/voucher/BosonVoucher.sol index c129b08a9..b383f5a64 100644 --- a/contracts/protocol/clients/voucher/BosonVoucher.sol +++ b/contracts/protocol/clients/voucher/BosonVoucher.sol @@ -297,11 +297,6 @@ contract BosonVoucherBase is IBosonVoucher, BeaconClientBase, OwnableUpgradeable // End should be greater than start require(end > start, NOTHING_TO_BURN); - // If amount to burn is more than maxPremintedVouchers, burn only maxPremintedVouchers - if (end > start + maxPremintedVouchers) { - end = start + maxPremintedVouchers; - } - // Burn the range address rangeOwner = range.owner; uint256 burned; From 8c3762fb16c7e7a387091864ef8f3526197d0859 Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Thu, 29 Jun 2023 14:46:30 -0300 Subject: [PATCH 28/32] Add dates checks back again --- scripts/util/validations.js | 5 +- test/domain/AgentTest.js | 5 ++ test/domain/AuthTokenTest.js | 5 ++ test/domain/BundleTest.js | 5 ++ test/domain/BuyerTest.js | 5 ++ test/domain/ConditionTest.js | 40 ++++++++---- test/domain/DisputeDatesTest.js | 20 ++++++ test/domain/DisputeResolutionTermsTest.js | 20 ++++++ test/domain/DisputeResolverFeeTest.js | 5 ++ test/domain/DisputeResolverTest.js | 10 +++ test/domain/DisputeTest.js | 15 +++++ test/domain/ExchangeTest.js | 20 ++++++ test/domain/FacetCutTest.js | 5 ++ test/domain/FundsTest.js | 5 ++ test/domain/GroupTest.js | 14 +++++ test/domain/OfferDatesTest.js | 20 ++++++ test/domain/OfferDurationsTest.js | 15 +++++ test/domain/OfferFeesTest.js | 10 +++ test/domain/OfferTest.js | 30 +++++++++ test/domain/RangeTest.js | 20 ++++++ test/domain/ReceiptTest.js | 75 +++++++++++++++++++++++ test/domain/SellerTest.js | 5 ++ test/domain/TwinReceiptTest.js | 19 ++++++ test/domain/TwinTest.js | 25 ++++++++ test/domain/VoucherInitValuesTest.js | 5 ++ test/domain/VoucherTest.js | 15 +++++ 26 files changed, 404 insertions(+), 14 deletions(-) diff --git a/scripts/util/validations.js b/scripts/util/validations.js index 27179f2c2..a6186f0c6 100644 --- a/scripts/util/validations.js +++ b/scripts/util/validations.js @@ -20,7 +20,10 @@ function bigNumberIsValid(bigNumber, { optional, gt, lte, empty } = {}) { } else { try { const bigNumberValue = BigInt(bigNumber); - valid = (gt == undefined || bigNumberValue > BigInt(gt)) && (lte == undefined || bigNumberValue <= BigInt(lte)); + valid = + typeof bigNumber === "string" && + (gt == undefined || bigNumberValue > BigInt(gt)) && + (lte == undefined || bigNumberValue <= BigInt(lte)); } catch (e) { valid = false; } diff --git a/test/domain/AgentTest.js b/test/domain/AgentTest.js index f6275b889..f355f1be0 100644 --- a/test/domain/AgentTest.js +++ b/test/domain/AgentTest.js @@ -58,6 +58,11 @@ describe("Agent", function () { expect(agent.idIsValid()).is.false; expect(agent.isValid()).is.false; + // Invalid field value + agent.id = new Date(); + expect(agent.idIsValid()).is.false; + expect(agent.isValid()).is.false; + // Valid field value agent.id = "0"; expect(agent.idIsValid()).is.true; diff --git a/test/domain/AuthTokenTest.js b/test/domain/AuthTokenTest.js index 199304638..d7130bb68 100644 --- a/test/domain/AuthTokenTest.js +++ b/test/domain/AuthTokenTest.js @@ -43,6 +43,11 @@ describe("AuthToken", function () { expect(authToken.tokenIdIsValid()).is.false; expect(authToken.isValid()).is.false; + // Invalid field value + authToken.tokenId = new Date(); + expect(authToken.tokenIdIsValid()).is.false; + expect(authToken.isValid()).is.false; + // Valid field value authToken.tokenId = "0"; expect(authToken.tokenIdIsValid()).is.true; diff --git a/test/domain/BundleTest.js b/test/domain/BundleTest.js index 0b778bbc3..a9e5a75b0 100644 --- a/test/domain/BundleTest.js +++ b/test/domain/BundleTest.js @@ -40,6 +40,11 @@ describe("Bundle", function () { expect(bundle.idIsValid()).is.false; expect(bundle.isValid()).is.false; + // Invalid field value + bundle.id = new Date(); + expect(bundle.idIsValid()).is.false; + expect(bundle.isValid()).is.false; + // Valid field value bundle.id = "0"; expect(bundle.idIsValid()).is.true; diff --git a/test/domain/BuyerTest.js b/test/domain/BuyerTest.js index 38c246e49..0e506033c 100644 --- a/test/domain/BuyerTest.js +++ b/test/domain/BuyerTest.js @@ -55,6 +55,11 @@ describe("Buyer", function () { expect(buyer.idIsValid()).is.true; expect(buyer.isValid()).is.true; + // Invalid field value + buyer.id = new Date(); + expect(buyer.idIsValid()).is.false; + expect(buyer.isValid()).is.false; + // Valid field value buyer.id = "126"; expect(buyer.idIsValid()).is.true; diff --git a/test/domain/ConditionTest.js b/test/domain/ConditionTest.js index 7e7756e7c..b746edec6 100644 --- a/test/domain/ConditionTest.js +++ b/test/domain/ConditionTest.js @@ -12,21 +12,20 @@ describe("Condition", function () { // Suite-wide scope let condition, object, promoted, clone, dehydrated, rehydrated, key, value, struct; let accounts, method, tokenType, tokenAddress, tokenId, threshold, maxCommits; + beforeEach(async function () { + // Get a list of accounts + accounts = await getSigners(); + tokenAddress = accounts[1].address; + + // Required constructor params + method = EvaluationMethod.None; + tokenType = TokenType.MultiToken; + tokenId = "1"; + threshold = "1"; + maxCommits = "3"; + }); context("📋 Constructor", async function () { - beforeEach(async function () { - // Get a list of accounts - accounts = await getSigners(); - tokenAddress = accounts[1].address; - - // Required constructor params - method = EvaluationMethod.None; - tokenType = TokenType.MultiToken; - tokenId = "1"; - threshold = "1"; - maxCommits = "3"; - }); - it("Should allow creation of valid, fully populated Condition instance", async function () { // Create a valid condition condition = new Condition(method, tokenType, tokenAddress, tokenId, threshold, maxCommits); @@ -61,6 +60,11 @@ describe("Condition", function () { expect(condition.methodIsValid()).is.false; expect(condition.isValid()).is.false; + // Invalid field value + condition.method = new Date(); + expect(condition.methodIsValid()).is.false; + expect(condition.isValid()).is.false; + // Invalid field value condition.method = "126"; expect(condition.methodIsValid()).is.false; @@ -127,6 +131,11 @@ describe("Condition", function () { expect(condition.thresholdIsValid()).is.true; expect(condition.isValid()).is.true; + // Invalid field value + condition.threshold = new Date(); + expect(condition.thresholdIsValid()).is.false; + expect(condition.isValid()).is.false; + // Valid field value condition.threshold = "126"; expect(condition.thresholdIsValid()).is.true; @@ -148,6 +157,11 @@ describe("Condition", function () { condition.maxCommits = "126"; expect(condition.maxCommitsIsValid()).is.true; expect(condition.isValid()).is.true; + + // Invalid field value + condition.maxCommits = new Date(); + expect(condition.maxCommitsIsValid()).is.false; + expect(condition.isValid()).is.false; }); }); diff --git a/test/domain/DisputeDatesTest.js b/test/domain/DisputeDatesTest.js index 7ce3b6c26..20d2b62f8 100644 --- a/test/domain/DisputeDatesTest.js +++ b/test/domain/DisputeDatesTest.js @@ -41,6 +41,11 @@ describe("DisputeDates", function () { expect(disputeDates.disputedIsValid()).is.false; expect(disputeDates.isValid()).is.false; + // Invalid field value + disputeDates.disputed = new Date(); + expect(disputeDates.disputedIsValid()).is.false; + expect(disputeDates.isValid()).is.false; + // Valid field value disputeDates.disputed = "0"; expect(disputeDates.disputedIsValid()).is.true; @@ -68,6 +73,11 @@ describe("DisputeDates", function () { expect(disputeDates.escalatedIsValid()).is.true; expect(disputeDates.isValid()).is.true; + // Invalid field value + disputeDates.escalated = new Date(); + expect(disputeDates.escalatedIsValid()).is.false; + expect(disputeDates.isValid()).is.false; + // Valid field value disputeDates.escalated = null; expect(disputeDates.escalatedIsValid()).is.true; @@ -95,6 +105,11 @@ describe("DisputeDates", function () { expect(disputeDates.finalizedIsValid()).is.true; expect(disputeDates.isValid()).is.true; + // Invalid field value + disputeDates.finalized = new Date(); + expect(disputeDates.finalizedIsValid()).is.false; + expect(disputeDates.isValid()).is.false; + // Valid field value disputeDates.finalized = null; expect(disputeDates.finalizedIsValid()).is.true; @@ -121,6 +136,11 @@ describe("DisputeDates", function () { disputeDates.timeout = "126"; expect(disputeDates.timeoutIsValid()).is.true; expect(disputeDates.isValid()).is.true; + + // Invalid field value + disputeDates.timeout = new Date(); + expect(disputeDates.timeoutIsValid()).is.false; + expect(disputeDates.isValid()).is.false; }); }); diff --git a/test/domain/DisputeResolutionTermsTest.js b/test/domain/DisputeResolutionTermsTest.js index ec23a23c6..d254a4530 100644 --- a/test/domain/DisputeResolutionTermsTest.js +++ b/test/domain/DisputeResolutionTermsTest.js @@ -57,6 +57,11 @@ describe("DisputeResolutionTerms", function () { expect(disputeResolutionTerms.disputeResolverIdIsValid()).is.true; expect(disputeResolutionTerms.isValid()).is.true; + // Invalid field value + disputeResolutionTerms.disputeResolverId = new Date(); + expect(disputeResolutionTerms.disputeResolverIdIsValid()).is.false; + expect(disputeResolutionTerms.isValid()).is.false; + // Valid field value disputeResolutionTerms.disputeResolverId = "126"; expect(disputeResolutionTerms.disputeResolverIdIsValid()).is.true; @@ -74,6 +79,11 @@ describe("DisputeResolutionTerms", function () { expect(disputeResolutionTerms.escalationResponsePeriodIsValid()).is.true; expect(disputeResolutionTerms.isValid()).is.true; + // Invalid field value + disputeResolutionTerms.escalationResponsePeriod = new Date(); + expect(disputeResolutionTerms.escalationResponsePeriodIsValid()).is.false; + expect(disputeResolutionTerms.isValid()).is.false; + // Valid field value disputeResolutionTerms.escalationResponsePeriod = "126"; expect(disputeResolutionTerms.escalationResponsePeriodIsValid()).is.true; @@ -96,6 +106,11 @@ describe("DisputeResolutionTerms", function () { expect(disputeResolutionTerms.feeAmountIsValid()).is.true; expect(disputeResolutionTerms.isValid()).is.true; + // Invalid field value + disputeResolutionTerms.feeAmount = new Date(); + expect(disputeResolutionTerms.feeAmountIsValid()).is.false; + expect(disputeResolutionTerms.isValid()).is.false; + // Valid field value disputeResolutionTerms.feeAmount = "126"; expect(disputeResolutionTerms.feeAmountIsValid()).is.true; @@ -117,6 +132,11 @@ describe("DisputeResolutionTerms", function () { disputeResolutionTerms.buyerEscalationDeposit = "126"; expect(disputeResolutionTerms.buyerEscalationDepositIsValid()).is.true; expect(disputeResolutionTerms.isValid()).is.true; + + // Invalid field value + disputeResolutionTerms.buyerEscalationDeposit = new Date(); + expect(disputeResolutionTerms.buyerEscalationDepositIsValid()).is.false; + expect(disputeResolutionTerms.isValid()).is.false; }); }); diff --git a/test/domain/DisputeResolverFeeTest.js b/test/domain/DisputeResolverFeeTest.js index e71ee0f30..338373451 100644 --- a/test/domain/DisputeResolverFeeTest.js +++ b/test/domain/DisputeResolverFeeTest.js @@ -89,6 +89,11 @@ describe("DisputeResolverFee", function () { expect(disputeResolverFee.feeAmountIsValid()).is.false; expect(disputeResolverFee.isValid()).is.false; + // Invalid field value + disputeResolverFee.feeAmount = new Date(); + expect(disputeResolverFee.feeAmountIsValid()).is.false; + expect(disputeResolverFee.isValid()).is.false; + // Valid field value disputeResolverFee.feeAmount = "0"; expect(disputeResolverFee.feeAmountIsValid()).is.true; diff --git a/test/domain/DisputeResolverTest.js b/test/domain/DisputeResolverTest.js index 90780b005..9f9fc8fc6 100644 --- a/test/domain/DisputeResolverTest.js +++ b/test/domain/DisputeResolverTest.js @@ -74,6 +74,11 @@ describe("DisputeResolver", function () { expect(disputeResolver.idIsValid()).is.false; expect(disputeResolver.isValid()).is.false; + // Invalid field value + disputeResolver.id = new Date(); + expect(disputeResolver.idIsValid()).is.false; + expect(disputeResolver.isValid()).is.false; + // Valid field value disputeResolver.id = "0"; expect(disputeResolver.idIsValid()).is.true; @@ -96,6 +101,11 @@ describe("DisputeResolver", function () { expect(disputeResolver.escalationResponsePeriodIsValid()).is.true; expect(disputeResolver.isValid()).is.true; + // Invalid field value + disputeResolver.escalationResponsePeriod = new Date(); + expect(disputeResolver.escalationResponsePeriodIsValid()).is.false; + expect(disputeResolver.isValid()).is.false; + // Valid field value disputeResolver.escalationResponsePeriod = "126"; expect(disputeResolver.escalationResponsePeriodIsValid()).is.true; diff --git a/test/domain/DisputeTest.js b/test/domain/DisputeTest.js index 6aeb32154..21f327f05 100644 --- a/test/domain/DisputeTest.js +++ b/test/domain/DisputeTest.js @@ -40,6 +40,11 @@ describe("Dispute", function () { expect(dispute.exchangeIdIsValid()).is.false; expect(dispute.isValid()).is.false; + // Invalid field value + dispute.exchangeId = new Date(); + expect(dispute.exchangeIdIsValid()).is.false; + expect(dispute.isValid()).is.false; + // Valid field value dispute.exchangeId = "0"; expect(dispute.exchangeIdIsValid()).is.true; @@ -71,6 +76,11 @@ describe("Dispute", function () { dispute.state = DisputeState.Resolving; expect(dispute.stateIsValid()).is.true; expect(dispute.isValid()).is.true; + + // Invalid field value + dispute.state = new Date(); + expect(dispute.stateIsValid()).is.false; + expect(dispute.isValid()).is.false; }); it("Always present, buyerPercent must be the string representation of a BigNumber", async function () { @@ -84,6 +94,11 @@ describe("Dispute", function () { expect(dispute.buyerPercentIsValid()).is.true; expect(dispute.isValid()).is.true; + // Invalid field value + dispute.buyerPercent = new Date(); + expect(dispute.buyerPercentIsValid()).is.false; + expect(dispute.isValid()).is.false; + // Valid field value dispute.buyerPercent = "126"; expect(dispute.buyerPercentIsValid()).is.true; diff --git a/test/domain/ExchangeTest.js b/test/domain/ExchangeTest.js index 9034eb27e..ea8e7b158 100644 --- a/test/domain/ExchangeTest.js +++ b/test/domain/ExchangeTest.js @@ -46,6 +46,11 @@ describe("Exchange", function () { expect(exchange.idIsValid()).is.false; expect(exchange.isValid()).is.false; + // Invalid field value + exchange.id = new Date(); + expect(exchange.idIsValid()).is.false; + expect(exchange.isValid()).is.false; + // Invalid field value exchange.id = "0"; expect(exchange.idIsValid()).is.false; @@ -68,6 +73,11 @@ describe("Exchange", function () { expect(exchange.offerIdIsValid()).is.false; expect(exchange.isValid()).is.false; + // Invalid field value + exchange.offerId = new Date(); + expect(exchange.offerIdIsValid()).is.false; + expect(exchange.isValid()).is.false; + // Valid field value exchange.offerId = "126"; expect(exchange.offerIdIsValid()).is.true; @@ -89,6 +99,11 @@ describe("Exchange", function () { exchange.buyerId = "126"; expect(exchange.buyerIdIsValid()).is.true; expect(exchange.isValid()).is.true; + + // Invalid field value + exchange.buyerId = new Date(); + expect(exchange.buyerIdIsValid()).is.false; + expect(exchange.isValid()).is.false; }); it("If present, finalizedDate must be the string representation of a non-zero BigNumber", async function () { @@ -112,6 +127,11 @@ describe("Exchange", function () { expect(exchange.finalizedDateIsValid()).is.true; expect(exchange.isValid()).is.true; + // Invalid field value + exchange.finalizedDate = new Date(); + expect(exchange.finalizedDateIsValid()).is.false; + expect(exchange.isValid()).is.false; + // Valid field value exchange.finalizedDate = undefined; expect(exchange.finalizedDateIsValid()).is.true; diff --git a/test/domain/FacetCutTest.js b/test/domain/FacetCutTest.js index 090da4142..d29b18451 100644 --- a/test/domain/FacetCutTest.js +++ b/test/domain/FacetCutTest.js @@ -71,6 +71,11 @@ describe("FacetCut", function () { expect(facet.actionIsValid()).is.false; expect(facet.isValid()).is.false; + // Invalid field value + facet.action = new Date(); + expect(facet.actionIsValid()).is.false; + expect(facet.isValid()).is.false; + // Invalid field value facet.action = "0"; expect(facet.actionIsValid()).is.false; diff --git a/test/domain/FundsTest.js b/test/domain/FundsTest.js index 74d3ebf87..fd249d3bd 100644 --- a/test/domain/FundsTest.js +++ b/test/domain/FundsTest.js @@ -89,6 +89,11 @@ describe("Funds", function () { expect(funds.availableAmountIsValid()).is.false; expect(funds.isValid()).is.false; + // Invalid field value + funds.availableAmount = new Date(); + expect(funds.availableAmountIsValid()).is.false; + expect(funds.isValid()).is.false; + // Valid field value funds.availableAmount = "0"; expect(funds.availableAmountIsValid()).is.true; diff --git a/test/domain/GroupTest.js b/test/domain/GroupTest.js index 9095676de..8148baf43 100644 --- a/test/domain/GroupTest.js +++ b/test/domain/GroupTest.js @@ -49,6 +49,11 @@ describe("Group", function () { expect(group.idIsValid()).is.true; expect(group.isValid()).is.true; + // Invalid field value + group.id = new Date(); + expect(group.idIsValid()).is.false; + expect(group.isValid()).is.false; + // Valid field value group.id = "126"; expect(group.idIsValid()).is.true; @@ -66,6 +71,11 @@ describe("Group", function () { expect(group.sellerIdIsValid()).is.true; expect(group.isValid()).is.true; + // Invalid field value + group.sellerId = new Date(); + expect(group.sellerIdIsValid()).is.false; + expect(group.isValid()).is.false; + // Valid field value group.sellerId = "126"; expect(group.sellerIdIsValid()).is.true; @@ -87,6 +97,10 @@ describe("Group", function () { group.offerIds = ["126"]; expect(group.offerIdsIsValid()).is.true; expect(group.isValid()).is.true; + + // Invalid field value + group.offerIds = new Date(); + expect(group.offerIdsIsValid()).is.false; }); }); diff --git a/test/domain/OfferDatesTest.js b/test/domain/OfferDatesTest.js index 0f32c9023..83ea11ef4 100644 --- a/test/domain/OfferDatesTest.js +++ b/test/domain/OfferDatesTest.js @@ -48,6 +48,11 @@ describe("OfferDates", function () { expect(offerDates.validFromIsValid()).is.true; expect(offerDates.isValid()).is.true; + // Invalid field value + offerDates.validFrom = new Date(); + expect(offerDates.validFromIsValid()).is.false; + expect(offerDates.isValid()).is.false; + // Valid field value offerDates.validFrom = "126"; expect(offerDates.validFromIsValid()).is.true; @@ -69,6 +74,11 @@ describe("OfferDates", function () { offerDates.validUntil = "126"; expect(offerDates.validUntilIsValid()).is.true; expect(offerDates.isValid()).is.true; + + // Invalid field value + offerDates.validUntil = new Date(); + expect(offerDates.validUntilIsValid()).is.false; + expect(offerDates.isValid()).is.false; }); it("Always present, voucherRedeemableFrom must be the string representation of a BigNumber", async function () { @@ -94,6 +104,11 @@ describe("OfferDates", function () { expect(offerDates.voucherRedeemableUntilIsValid()).is.false; expect(offerDates.isValid()).is.false; + // Invalid field value + offerDates.voucherRedeemableUntil = new Date(); + expect(offerDates.voucherRedeemableUntilIsValid()).is.false; + expect(offerDates.isValid()).is.false; + // Valid field value offerDates.voucherRedeemableUntil = "0"; expect(offerDates.voucherRedeemableUntilIsValid()).is.true; @@ -103,6 +118,11 @@ describe("OfferDates", function () { offerDates.voucherRedeemableUntil = "126"; expect(offerDates.voucherRedeemableUntilIsValid()).is.true; expect(offerDates.isValid()).is.true; + + // Invalid field value + offerDates.voucherRedeemableUntil = new Date(); + expect(offerDates.voucherRedeemableUntilIsValid()).is.false; + expect(offerDates.isValid()).is.false; }); }); diff --git a/test/domain/OfferDurationsTest.js b/test/domain/OfferDurationsTest.js index 79d2624d1..79f7ac16d 100644 --- a/test/domain/OfferDurationsTest.js +++ b/test/domain/OfferDurationsTest.js @@ -41,6 +41,11 @@ describe("OfferDurations", function () { expect(offerDurations.disputePeriodIsValid()).is.false; expect(offerDurations.isValid()).is.false; + // Invalid field value + offerDurations.disputePeriod = new Date(); + expect(offerDurations.disputePeriodIsValid()).is.false; + expect(offerDurations.isValid()).is.false; + // Valid field value offerDurations.disputePeriod = "0"; expect(offerDurations.disputePeriodIsValid()).is.true; @@ -63,6 +68,11 @@ describe("OfferDurations", function () { expect(offerDurations.voucherValidIsValid()).is.true; expect(offerDurations.isValid()).is.true; + // Invalid field value + offerDurations.voucherValid = new Date(); + expect(offerDurations.voucherValidIsValid()).is.false; + expect(offerDurations.isValid()).is.false; + // Valid field value offerDurations.voucherValid = "126"; expect(offerDurations.voucherValidIsValid()).is.true; @@ -84,6 +94,11 @@ describe("OfferDurations", function () { offerDurations.resolutionPeriod = "126"; expect(offerDurations.resolutionPeriodIsValid()).is.true; expect(offerDurations.isValid()).is.true; + + // Invalid field value + offerDurations.resolutionPeriod = new Date(); + expect(offerDurations.resolutionPeriodIsValid()).is.false; + expect(offerDurations.isValid()).is.false; }); }); diff --git a/test/domain/OfferFeesTest.js b/test/domain/OfferFeesTest.js index c1355cde3..759f01781 100644 --- a/test/domain/OfferFeesTest.js +++ b/test/domain/OfferFeesTest.js @@ -38,6 +38,11 @@ describe("OfferFees", function () { expect(offerFees.protocolFeeIsValid()).is.false; expect(offerFees.isValid()).is.false; + // Invalid field value + offerFees.protocolFee = new Date(); + expect(offerFees.protocolFeeIsValid()).is.false; + expect(offerFees.isValid()).is.false; + // Valid field value offerFees.protocolFee = "0"; expect(offerFees.protocolFeeIsValid()).is.true; @@ -60,6 +65,11 @@ describe("OfferFees", function () { expect(offerFees.agentFeeIsValid()).is.true; expect(offerFees.isValid()).is.true; + // Invalid field value + offerFees.agentFee = new Date(); + expect(offerFees.agentFeeIsValid()).is.false; + expect(offerFees.isValid()).is.false; + // Valid field value offerFees.agentFee = "126"; expect(offerFees.agentFeeIsValid()).is.true; diff --git a/test/domain/OfferTest.js b/test/domain/OfferTest.js index 8ee841fd5..8ecdc7e8a 100644 --- a/test/domain/OfferTest.js +++ b/test/domain/OfferTest.js @@ -90,6 +90,11 @@ describe("Offer", function () { expect(offer.idIsValid()).is.false; expect(offer.isValid()).is.false; + // Invalid field value + offer.id = new Date(); + expect(offer.idIsValid()).is.false; + expect(offer.isValid()).is.false; + // Valid field value offer.id = "0"; expect(offer.idIsValid()).is.true; @@ -112,6 +117,11 @@ describe("Offer", function () { expect(offer.priceIsValid()).is.true; expect(offer.isValid()).is.true; + // Invalid field value + offer.price = new Date(); + expect(offer.priceIsValid()).is.false; + expect(offer.isValid()).is.false; + // Valid field value offer.price = "126"; expect(offer.priceIsValid()).is.true; @@ -133,6 +143,11 @@ describe("Offer", function () { offer.sellerDeposit = "126"; expect(offer.sellerDepositIsValid()).is.true; expect(offer.isValid()).is.true; + + // Invalid field value + offer.sellerDeposit = new Date(); + expect(offer.sellerDepositIsValid()).is.false; + expect(offer.isValid()).is.false; }); it("Always present, buyerCancelPenalty must be the string representation of a BigNumber", async function () { @@ -150,6 +165,11 @@ describe("Offer", function () { offer.buyerCancelPenalty = "126"; expect(offer.buyerCancelPenaltyIsValid()).is.true; expect(offer.isValid()).is.true; + + // Invalid field value + offer.buyerCancelPenalty = new Date(); + expect(offer.buyerCancelPenaltyIsValid()).is.false; + expect(offer.isValid()).is.false; }); it("Always present, quantityAvailable must be the string representation of a BigNumber", async function () { @@ -167,6 +187,11 @@ describe("Offer", function () { offer.quantityAvailable = "126"; expect(offer.quantityAvailableIsValid()).is.true; expect(offer.isValid()).is.true; + + // Invalid field value + offer.quantityAvailable = new Date(); + expect(offer.quantityAvailableIsValid()).is.false; + expect(offer.isValid()).is.false; }); it("Always present, sellerId must be the string representation of a BigNumber", async function () { @@ -184,6 +209,11 @@ describe("Offer", function () { offer.sellerId = "126"; expect(offer.sellerIdIsValid()).is.true; expect(offer.isValid()).is.true; + + // Invalid field value + offer.sellerId = new Date(); + expect(offer.sellerIdIsValid()).is.false; + expect(offer.isValid()).is.false; }); it("Always present, exchangeToken must be a string representation of an EIP-55 compliant address", async function () { diff --git a/test/domain/RangeTest.js b/test/domain/RangeTest.js index 25ffb89dd..ea7e885b0 100644 --- a/test/domain/RangeTest.js +++ b/test/domain/RangeTest.js @@ -41,6 +41,11 @@ describe("Range", function () { expect(range.startIsValid()).is.false; expect(range.isValid()).is.false; + // Invalid field value + range.start = new Date(); + expect(range.startIsValid()).is.false; + expect(range.isValid()).is.false; + // Valid field value range.start = "0"; expect(range.startIsValid()).is.true; @@ -67,6 +72,11 @@ describe("Range", function () { range.length = "126"; expect(range.lengthIsValid()).is.true; expect(range.isValid()).is.true; + + // Invalid field value + range.length = new Date(); + expect(range.lengthIsValid()).is.false; + expect(range.isValid()).is.false; }); it("If present, minted must be the string representation of a BigNumber", async function () { @@ -84,6 +94,11 @@ describe("Range", function () { range.minted = "126"; expect(range.mintedIsValid()).is.true; expect(range.isValid()).is.true; + + // Invalid field value + range.minted = new Date(); + expect(range.mintedIsValid()).is.false; + expect(range.isValid()).is.false; }); it("If present, lastBurnedTokenId must be the string representation of a BigNumber", async function () { @@ -101,6 +116,11 @@ describe("Range", function () { range.lastBurnedTokenId = "126"; expect(range.lastBurnedTokenIdIsValid()).is.true; expect(range.isValid()).is.true; + + // Invalid field value + range.lastBurnedTokenId = new Date(); + expect(range.lastBurnedTokenIdIsValid()).is.false; + expect(range.isValid()).is.false; }); }); diff --git a/test/domain/ReceiptTest.js b/test/domain/ReceiptTest.js index bc8239d09..46ae0d974 100644 --- a/test/domain/ReceiptTest.js +++ b/test/domain/ReceiptTest.js @@ -57,6 +57,11 @@ describe("Receipt", function () { expect(receipt.exchangeIdIsValid()).is.false; expect(receipt.isValid()).is.false; + // Invalid field value + receipt.exchangeId = new Date(); + expect(receipt.exchangeIdIsValid()).is.false; + expect(receipt.isValid()).is.false; + // Invalid field value receipt.exchangeId = "0"; expect(receipt.exchangeIdIsValid()).is.false; @@ -79,6 +84,11 @@ describe("Receipt", function () { expect(receipt.offerIdIsValid()).is.false; expect(receipt.isValid()).is.false; + // Invalid field value + receipt.offerId = new Date(); + expect(receipt.offerIdIsValid()).is.false; + expect(receipt.isValid()).is.false; + // Valid field value receipt.offerId = "126"; expect(receipt.offerIdIsValid()).is.true; @@ -100,6 +110,11 @@ describe("Receipt", function () { receipt.buyerId = "126"; expect(receipt.buyerIdIsValid()).is.true; expect(receipt.isValid()).is.true; + + // Invalid field value + receipt.buyerId = new Date(); + expect(receipt.buyerIdIsValid()).is.false; + expect(receipt.isValid()).is.false; }); it("Always present, price must be the string representation of BigNumber", async function () { @@ -117,6 +132,11 @@ describe("Receipt", function () { receipt.price = "126"; expect(receipt.priceIsValid()).is.true; expect(receipt.isValid()).is.true; + + // Invalid field value + receipt.price = new Date(); + expect(receipt.priceIsValid()).is.false; + expect(receipt.isValid()).is.false; }); it("Always present, sellerDeposit must be the string representation of BigNumber", async function () { @@ -134,6 +154,11 @@ describe("Receipt", function () { receipt.sellerDeposit = "126"; expect(receipt.sellerDepositIsValid()).is.true; expect(receipt.isValid()).is.true; + + // Invalid field value + receipt.sellerDeposit = new Date(); + expect(receipt.sellerDepositIsValid()).is.false; + expect(receipt.isValid()).is.false; }); it("Always present, buyerCancelPenalty must be the string representation of BigNumber", async function () { @@ -151,6 +176,11 @@ describe("Receipt", function () { receipt.buyerCancelPenalty = "126"; expect(receipt.buyerCancelPenaltyIsValid()).is.true; expect(receipt.isValid()).is.true; + + // Invalid field value + receipt.buyerCancelPenalty = new Date(); + expect(receipt.buyerCancelPenaltyIsValid()).is.false; + expect(receipt.isValid()).is.false; }); it("Always present, offerFees must be a valid OfferFees instance", async function () { @@ -174,6 +204,11 @@ describe("Receipt", function () { receipt.offerFees = mo.offerFees; expect(receipt.offerFeesIsValid()).is.true; expect(receipt.isValid()).is.true; + + // Valid field value + receipt.offerFees = new Date(); + expect(receipt.offerFeesIsValid()).is.false; + expect(receipt.isValid()).is.false; }); it("If present, agentId must be the string representation of BigNumber", async function () { @@ -191,6 +226,11 @@ describe("Receipt", function () { receipt.agentId = "126"; expect(receipt.agentIdIsValid()).is.true; expect(receipt.isValid()).is.true; + + // Invalid field value + receipt.agentId = new Date(); + expect(receipt.agentIdIsValid()).is.false; + expect(receipt.isValid()).is.false; }); it("Always present, exchangeToken must be a string representation of an EIP-55 compliant address", async function () { @@ -230,6 +270,11 @@ describe("Receipt", function () { receipt.finalizedDate = "126"; expect(receipt.finalizedDateIsValid()).is.true; expect(receipt.isValid()).is.true; + + // Invalid field value + receipt.finalizedDate = new Date(); + expect(receipt.finalizedDateIsValid()).is.false; + expect(receipt.isValid()).is.false; }); it("If present, condition must be a valid Condition instance", async function () { @@ -247,6 +292,11 @@ describe("Receipt", function () { receipt.condition = mockCondition(ZeroAddress); expect(receipt.conditionIsValid()).is.true; expect(receipt.isValid()).is.true; + + // Invalid field value + receipt.condition = new Date(); + expect(receipt.conditionIsValid()).is.false; + expect(receipt.isValid()).is.false; }); it("Always present, committedDate must be the string representation of BigNumber", async function () { @@ -259,6 +309,11 @@ describe("Receipt", function () { receipt.committedDate = "126"; expect(receipt.committedDateIsValid()).is.true; expect(receipt.isValid()).is.true; + + // Invalid field value + receipt.committedDate = new Date(); + expect(receipt.committedDateIsValid()).is.false; + expect(receipt.isValid()).is.false; }); it("If present, redeemedDate must be the string representation of BigNumber", async function () { @@ -276,6 +331,11 @@ describe("Receipt", function () { receipt.redeemedDate = "126"; expect(receipt.redeemedDateIsValid()).is.true; expect(receipt.isValid()).is.true; + + // Invalid field value + receipt.redeemedDate = new Date(); + expect(receipt.redeemedDateIsValid()).is.false; + expect(receipt.isValid()).is.false; }); it("Always present, voucherExpired must be a boolean", async function () { @@ -315,6 +375,11 @@ describe("Receipt", function () { receipt.disputeResolverId = "126"; expect(receipt.disputeResolverIdIsValid()).is.true; expect(receipt.isValid()).is.true; + + // Invalid field value + receipt.disputeResolverId = new Date(); + expect(receipt.disputeResolverIdIsValid()).is.false; + expect(receipt.isValid()).is.false; }); it("If present, disputedDate must be the string representation of BigNumber", async function () { @@ -332,6 +397,11 @@ describe("Receipt", function () { receipt.disputedDate = "126"; expect(receipt.disputedDateIsValid()).is.true; expect(receipt.isValid()).is.true; + + // Invalid field value + receipt.disputedDate = new Date(); + expect(receipt.disputedDateIsValid()).is.false; + expect(receipt.isValid()).is.false; }); it("If present, escalatedDate must be the string representation of BigNumber", async function () { @@ -349,6 +419,11 @@ describe("Receipt", function () { receipt.escalatedDate = "126"; expect(receipt.escalatedDateIsValid()).is.true; expect(receipt.isValid()).is.true; + + // Invalid field value + receipt.escalatedDate = new Date(); + expect(receipt.escalatedDateIsValid()).is.false; + expect(receipt.isValid()).is.false; }); it("If present, disputeState must be the string representation of a BigNumber", async function () { diff --git a/test/domain/SellerTest.js b/test/domain/SellerTest.js index bffa2fabc..578448929 100644 --- a/test/domain/SellerTest.js +++ b/test/domain/SellerTest.js @@ -62,6 +62,11 @@ describe("Seller", function () { seller.id = "126"; expect(seller.idIsValid()).is.true; expect(seller.isValid()).is.true; + + // Invalid field value + seller.id = new Date(); + expect(seller.idIsValid()).is.false; + expect(seller.isValid()).is.false; }); it("Always present, assistant must be a string representation of an EIP-55 compliant address", async function () { diff --git a/test/domain/TwinReceiptTest.js b/test/domain/TwinReceiptTest.js index 135d9c0b4..a02f15e14 100644 --- a/test/domain/TwinReceiptTest.js +++ b/test/domain/TwinReceiptTest.js @@ -44,6 +44,11 @@ describe("TwinReceipt", function () { expect(twinReceipt.twinIdIsValid()).is.false; expect(twinReceipt.isValid()).is.false; + // Invalid field value + twinReceipt.twinId = new Date(); + expect(twinReceipt.twinIdIsValid()).is.false; + expect(twinReceipt.isValid()).is.false; + // Valid field value twinReceipt.twinId = "0"; expect(twinReceipt.twinIdIsValid()).is.true; @@ -66,6 +71,11 @@ describe("TwinReceipt", function () { expect(twinReceipt.amountIsValid()).is.true; expect(twinReceipt.isValid()).is.true; + // Invalid field value + twinReceipt.amount = new Date(); + expect(twinReceipt.amountIsValid()).is.false; + expect(twinReceipt.isValid()).is.false; + // Valid field value twinReceipt.amount = "126"; expect(twinReceipt.amountIsValid()).is.true; @@ -83,6 +93,10 @@ describe("TwinReceipt", function () { expect(twinReceipt.tokenIdIsValid()).is.true; expect(twinReceipt.isValid()).is.true; + // Invalid field value + twinReceipt.tokenId = new Date(); + expect(twinReceipt.tokenIdIsValid()).is.false; + // Valid field value twinReceipt.tokenId = "126"; expect(twinReceipt.tokenIdIsValid()).is.true; @@ -122,6 +136,11 @@ describe("TwinReceipt", function () { expect(twinReceipt.tokenTypeIsValid()).is.false; expect(twinReceipt.isValid()).is.false; + // Invalid field value + twinReceipt.tokenType = new Date(); + expect(twinReceipt.tokenTypeIsValid()).is.false; + expect(twinReceipt.isValid()).is.false; + // Invalid field value twinReceipt.tokenType = "126"; expect(twinReceipt.tokenTypeIsValid()).is.false; diff --git a/test/domain/TwinTest.js b/test/domain/TwinTest.js index 1bdcd8170..a5290a5d9 100644 --- a/test/domain/TwinTest.js +++ b/test/domain/TwinTest.js @@ -46,6 +46,11 @@ describe("Twin", function () { expect(twin.idIsValid()).is.false; expect(twin.isValid()).is.false; + // Invalid field value + twin.id = new Date(); + expect(twin.idIsValid()).is.false; + expect(twin.isValid()).is.false; + // Valid field value twin.id = "0"; expect(twin.idIsValid()).is.true; @@ -68,6 +73,11 @@ describe("Twin", function () { expect(twin.sellerIdIsValid()).is.true; expect(twin.isValid()).is.true; + // Invalid field value + twin.sellerId = new Date(); + expect(twin.sellerIdIsValid()).is.false; + expect(twin.isValid()).is.false; + // Valid field value twin.sellerId = "126"; expect(twin.sellerIdIsValid()).is.true; @@ -85,6 +95,11 @@ describe("Twin", function () { expect(twin.amountIsValid()).is.true; expect(twin.isValid()).is.true; + // Invalid field value + twin.amount = new Date(); + expect(twin.amountIsValid()).is.false; + expect(twin.isValid()).is.false; + // Valid field value twin.amount = "126"; expect(twin.amountIsValid()).is.true; @@ -102,6 +117,11 @@ describe("Twin", function () { expect(twin.supplyAvailableIsValid()).is.false; expect(twin.isValid()).is.false; + // Invalid field value + twin.supplyAvailable = new Date(); + expect(twin.supplyAvailableIsValid()).is.false; + expect(twin.isValid()).is.false; + // Valid field value twin.supplyAvailable = "126"; expect(twin.supplyAvailableIsValid()).is.true; @@ -123,6 +143,11 @@ describe("Twin", function () { twin.tokenId = "126"; expect(twin.tokenIdIsValid()).is.true; expect(twin.isValid()).is.true; + + // Invalid field value + twin.tokenId = new Date(); + expect(twin.tokenIdIsValid()).is.false; + expect(twin.isValid()).is.false; }); it("Always present, tokenAddress must be a string representation of an EIP-55 compliant address", async function () { diff --git a/test/domain/VoucherInitValuesTest.js b/test/domain/VoucherInitValuesTest.js index a01a86c4d..112ba3e26 100644 --- a/test/domain/VoucherInitValuesTest.js +++ b/test/domain/VoucherInitValuesTest.js @@ -60,6 +60,11 @@ describe("VoucherInitValues", function () { expect(voucherInitValues.royaltyPercentageIsValid()).is.false; expect(voucherInitValues.isValid()).is.false; + // Invalid field value + voucherInitValues.royaltyPercentage = new Date(); + expect(voucherInitValues.royaltyPercentageIsValid()).is.false; + expect(voucherInitValues.isValid()).is.false; + // Invalid field value voucherInitValues.royaltyPercentage = "10001"; // Value greater than 100% should be invalid expect(voucherInitValues.royaltyPercentageIsValid()).is.false; diff --git a/test/domain/VoucherTest.js b/test/domain/VoucherTest.js index 986eef895..10996ebc6 100644 --- a/test/domain/VoucherTest.js +++ b/test/domain/VoucherTest.js @@ -50,6 +50,11 @@ describe("Voucher", function () { expect(voucher.committedDateIsValid()).is.false; expect(voucher.isValid()).is.false; + // Invalid field value + voucher.committedDate = new Date(); + expect(voucher.committedDateIsValid()).is.false; + expect(voucher.isValid()).is.false; + // Valid field value voucher.committedDate = "0"; expect(voucher.committedDateIsValid()).is.false; @@ -67,6 +72,11 @@ describe("Voucher", function () { expect(voucher.validUntilDateIsValid()).is.false; expect(voucher.isValid()).is.false; + // Invalid field value + voucher.validUntilDate = new Date(); + expect(voucher.validUntilDateIsValid()).is.false; + expect(voucher.isValid()).is.false; + // Valid field value voucher.validUntilDate = "0"; expect(voucher.validUntilDateIsValid()).is.false; @@ -84,6 +94,11 @@ describe("Voucher", function () { expect(voucher.redeemedDateIsValid()).is.false; expect(voucher.isValid()).is.false; + // Invalid field value + voucher.redeemedDate = new Date(); + expect(voucher.redeemedDateIsValid()).is.false; + expect(voucher.isValid()).is.false; + // Valid field value voucher.redeemedDate = "0"; expect(voucher.redeemedDateIsValid()).is.false; From e8a497364dd3137b19e0e0e7a6a3278f71091251 Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Thu, 29 Jun 2023 16:02:50 -0300 Subject: [PATCH 29/32] Review changes --- package-lock.json | 2 ++ scripts/util/validations.js | 2 +- test/util/upgrade.js | 64 ++++++++++++++++++------------------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5f4836a54..ed6f01ac2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9440,6 +9440,7 @@ "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz", "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==", "dev": true, + "hasInstallScript": true, "optional": true, "dependencies": { "node-gyp-build": "^4.3.0" @@ -9797,6 +9798,7 @@ "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz", "integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==", "dev": true, + "hasInstallScript": true, "optional": true, "dependencies": { "node-gyp-build": "^4.3.0" diff --git a/scripts/util/validations.js b/scripts/util/validations.js index a6186f0c6..f29da1cee 100644 --- a/scripts/util/validations.js +++ b/scripts/util/validations.js @@ -21,7 +21,7 @@ function bigNumberIsValid(bigNumber, { optional, gt, lte, empty } = {}) { try { const bigNumberValue = BigInt(bigNumber); valid = - typeof bigNumber === "string" && + (typeof bigNumber === "string" || typeof bigNumber === "bigint") && (gt == undefined || bigNumberValue > BigInt(gt)) && (lte == undefined || bigNumberValue <= BigInt(lte)); } catch (e) { diff --git a/test/util/upgrade.js b/test/util/upgrade.js index cb4b42d73..959ef3f29 100644 --- a/test/util/upgrade.js +++ b/test/util/upgrade.js @@ -93,12 +93,12 @@ async function deploySuite(deployer, newVersion) { shell.exec(`git fetch --force --tags origin`); console.log(`Checking out version ${tag}`); shell.exec(`rm -rf contracts/*`); - shell.exec(`git checkout ${tag} -- "contracts/**`); + shell.exec(`find contracts -type f | xargs git checkout ${tag} --`); if (scriptsTag) { console.log(`Checking out scripts on version ${scriptsTag}`); shell.exec(`rm -rf scripts/*`); - shell.exec(`git checkout ${scriptsTag} scripts`); + shell.exec(`git checkout ${scriptsTag} scripts/**`); } const deployConfig = facets.deploy[tag]; @@ -107,6 +107,7 @@ async function deploySuite(deployer, newVersion) { throw new Error(`No deploy config found for tag ${tag}`); } + await hre.run("compile"); // run deploy suite, which automatically compiles the contracts await hre.run("deploy-suite", { env: "upgrade-test", @@ -373,7 +374,6 @@ async function populateProtocolContract( await accountHandler .connect(connectedWallet) .createDisputeResolver(disputeResolver, disputeResolverFees, sellerAllowList); - console.log("after"); DRs.push({ wallet: connectedWallet, id: disputeResolver.id, @@ -488,8 +488,8 @@ async function populateProtocolContract( // Set unique offer dates based on offer id const now = offerDates.validFrom; - offerDates.validFrom = BigInt(now) + oneMonth + offerId * (1000).toString(); - offerDates.validUntil = (BigInt(now) + oneMonth * 6n * BigInt(offerId + 1)).toString(); + offerDates.validFrom = (BigInt(now) + oneMonth + BigInt(offerId) * 1000n).toString(); + offerDates.validUntil = (BigInt(now) + oneMonth * 6n * BigInt(offerId) + 1n).toString(); // Set unique offerDurations based on offer id offerDurations.disputePeriod = `${(offerId + 1) * oneMonth}`; @@ -1054,13 +1054,13 @@ async function getMetaTxPrivateContractState(protocolDiamondAddress) { // current sender address + isMetaTransaction (they are packed since they are shorter than one slot) // should be always be 0x - const inTransactionInfo = await getStorageAt(protocolDiamondAddress, metaTxStorageSlotNumber + "0"); + const inTransactionInfo = await getStorageAt(protocolDiamondAddress, metaTxStorageSlotNumber + 0n); // domain separator - const domainSeparator = await getStorageAt(protocolDiamondAddress, metaTxStorageSlotNumber + "1"); + const domainSeparator = await getStorageAt(protocolDiamondAddress, metaTxStorageSlotNumber + 1n); // cached chain id - const cachedChainId = await getStorageAt(protocolDiamondAddress, metaTxStorageSlotNumber + "3"); + const cachedChainId = await getStorageAt(protocolDiamondAddress, metaTxStorageSlotNumber + 3n); // input type const inputTypeKeys = [ @@ -1077,7 +1077,7 @@ async function getMetaTxPrivateContractState(protocolDiamondAddress) { const inputTypesState = []; for (const inputTypeKey of inputTypeKeys) { - const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber + "4", inputTypeKey, paddingType.NONE); + const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber + 4n, inputTypeKey, paddingType.NONE); inputTypesState.push(await getStorageAt(protocolDiamondAddress, storageSlot)); } @@ -1093,7 +1093,7 @@ async function getMetaTxPrivateContractState(protocolDiamondAddress) { const hashInfoState = []; for (const hashInfoType of Object.values(hashInfoTypes)) { - const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber + "5", hashInfoType, paddingType.START); + const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber + 5n, hashInfoType, paddingType.START); // get also hashFunction hashInfoState.push({ typeHash: await getStorageAt(protocolDiamondAddress, storageSlot), @@ -1124,7 +1124,7 @@ async function getMetaTxPrivateContractState(protocolDiamondAddress) { const selectors = await getMetaTransactionsHandlerFacetInitArgs(facets); for (const selector of Object.values(selectors)) { - const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber + "6", selector, paddingType.START); + const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber + 6n, selector, paddingType.START); isAllowlistedState[selector] = await getStorageAt(protocolDiamondAddress, storageSlot); } @@ -1147,11 +1147,11 @@ async function getProtocolStatusPrivateContractState(protocolDiamondAddress) { const protocolStatusStorageSlotNumber = BigInt(protocolStatusStorageSlot); // pause scenario - const pauseScenario = await getStorageAt(protocolDiamondAddress, protocolStatusStorageSlotNumber + "0"); + const pauseScenario = await getStorageAt(protocolDiamondAddress, protocolStatusStorageSlotNumber + 0n); // reentrancy status // default: NOT_ENTERED = 1 - const reentrancyStatus = await getStorageAt(protocolDiamondAddress, protocolStatusStorageSlotNumber + "1"); + const reentrancyStatus = await getStorageAt(protocolDiamondAddress, protocolStatusStorageSlotNumber + 1n); // initializedInterfaces if (!preUpgradeInterfaceIds) { @@ -1161,7 +1161,7 @@ async function getProtocolStatusPrivateContractState(protocolDiamondAddress) { const initializedInterfacesState = []; for (const interfaceId of Object.values(preUpgradeInterfaceIds)) { - const storageSlot = getMappingStoragePosition(protocolStatusStorageSlotNumber + "2", interfaceId, paddingType.END); + const storageSlot = getMappingStoragePosition(protocolStatusStorageSlotNumber + 2n, interfaceId, paddingType.END); initializedInterfacesState.push(await getStorageAt(protocolDiamondAddress, storageSlot)); } @@ -1171,7 +1171,7 @@ async function getProtocolStatusPrivateContractState(protocolDiamondAddress) { const initializedVersionsState = []; for (const version of preUpgradeVersions) { - const storageSlot = getMappingStoragePosition(protocolStatusStorageSlotNumber + "3", version, paddingType.END); + const storageSlot = getMappingStoragePosition(protocolStatusStorageSlotNumber + 3n, version, paddingType.END); initializedVersionsState.push(await getStorageAt(protocolDiamondAddress, storageSlot)); } @@ -1232,7 +1232,7 @@ async function getProtocolLookupsPrivateContractState( const id = Number(offer.offer.id); // exchangeIdsByOffer let exchangeIdsByOffer = []; - const arraySlot = BigInt.from(getMappingStoragePosition(protocolLookupsSlotNumber + "0", id, paddingType.START)); + const arraySlot = BigInt.from(getMappingStoragePosition(protocolLookupsSlotNumber + 0n, id, paddingType.START)); const arrayLength = BigInt(await getStorageAt(protocolDiamondAddress, arraySlot)).toNumber(); const arrayStart = BigInt(keccak256(arraySlot)); for (let i = 0; i < arrayLength; i++) { @@ -1244,7 +1244,7 @@ async function getProtocolLookupsPrivateContractState( groupIdByOfferState.push( await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(protocolLookupsSlotNumber + "3", id, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber + 3n, id, paddingType.START) ) ); } @@ -1263,7 +1263,7 @@ async function getProtocolLookupsPrivateContractState( buyerIdByWallet.push( await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(protocolLookupsSlotNumber + "8", accountAddress, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber + 8n, accountAddress, paddingType.START) ) ); @@ -1271,13 +1271,13 @@ async function getProtocolLookupsPrivateContractState( agentIdByWallet.push( await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(protocolLookupsSlotNumber + "13", accountAddress, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber + 13n, accountAddress, paddingType.START) ) ); // conditionalCommitsByAddress const firstMappingStorageSlot = BigInt( - getMappingStoragePosition(protocolLookupsSlotNumber + "19", accountAddress, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber + 19n, accountAddress, paddingType.START) ); let commitsPerGroup = []; for (const group of groups) { @@ -1305,7 +1305,7 @@ async function getProtocolLookupsPrivateContractState( for (const id of accountIds) { // disputeResolverFeeTokenIndex let firstMappingStorageSlot = BigInt( - getMappingStoragePosition(protocolLookupsSlotNumber + "12", id, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber + 12n, id, paddingType.START) ); disputeResolverFeeTokenIndex.push({ native: await getStorageAt( @@ -1319,9 +1319,7 @@ async function getProtocolLookupsPrivateContractState( }); // tokenIndexByAccount - firstMappingStorageSlot = BigInt( - getMappingStoragePosition(protocolLookupsSlotNumber + "16", id, paddingType.START) - ); + firstMappingStorageSlot = BigInt(getMappingStoragePosition(protocolLookupsSlotNumber + 16n, id, paddingType.START)); tokenIndexByAccount.push({ native: await getStorageAt( protocolDiamondAddress, @@ -1337,7 +1335,7 @@ async function getProtocolLookupsPrivateContractState( cloneAddress.push( await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(protocolLookupsSlotNumber + "17", id, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber + 17n, id, paddingType.START) ) ); @@ -1345,7 +1343,7 @@ async function getProtocolLookupsPrivateContractState( voucherCount.push( await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(protocolLookupsSlotNumber + "18", id, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber + 18n, id, paddingType.START) ) ); } @@ -1354,7 +1352,7 @@ async function getProtocolLookupsPrivateContractState( let twinRangesBySeller = []; for (const id of accountIds) { const firstMappingStorageSlot = BigInt( - getMappingStoragePosition(protocolLookupsSlotNumber + "22", id, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber + 22n, id, paddingType.START) ); let ranges = {}; for (let mockTwin of mockTwinTokens) { @@ -1381,7 +1379,7 @@ async function getProtocolLookupsPrivateContractState( let twinIdsByTokenAddressAndBySeller = []; for (const id of accountIds) { const firstMappingStorageSlot = BigInt( - getMappingStoragePosition(protocolLookupsSlotNumber + "23", id, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber + 23n, id, paddingType.START) ); let twinIds = {}; for (let mockTwin of mockTwinTokens) { @@ -1405,7 +1403,7 @@ async function getProtocolLookupsPrivateContractState( for (const DR of DRs) { const firstMappingStorageSlot = BigInt( getMappingStoragePosition( - protocolLookupsSlotNumber + "26", + protocolLookupsSlotNumber + 26n, BigInt(DR.disputeResolver.id).toHexString(), paddingType.START ) @@ -1427,7 +1425,7 @@ async function getProtocolLookupsPrivateContractState( for (const group of groups) { const id = group.id; const firstMappingStorageSlot = BigInt( - getMappingStoragePosition(protocolLookupsSlotNumber + "28", id, paddingType.START) + getMappingStoragePosition(protocolLookupsSlotNumber + 28n, id, paddingType.START) ); let offerInidices = []; for (const offer of offers) { @@ -1450,7 +1448,7 @@ async function getProtocolLookupsPrivateContractState( // Although pending address/auth token update is not yet defined in 2.0.0, we can check that storage slots are empty for (const id of accountIds) { // pendingAddressUpdatesBySeller - let structStorageSlot = BigInt(getMappingStoragePosition(protocolLookupsSlotNumber + "29", id, paddingType.START)); + let structStorageSlot = BigInt(getMappingStoragePosition(protocolLookupsSlotNumber + 29n, id, paddingType.START)); let structFields = []; for (let i = 0; i < 5; i++) { // BosonTypes.Seller has 6 fields, but last bool is packed in one slot with previous field @@ -1459,7 +1457,7 @@ async function getProtocolLookupsPrivateContractState( pendingAddressUpdatesBySeller.push(structFields); // pendingAuthTokenUpdatesBySeller - structStorageSlot = BigInt(getMappingStoragePosition(protocolLookupsSlotNumber + "30", id, paddingType.START)); + structStorageSlot = BigInt(getMappingStoragePosition(protocolLookupsSlotNumber + 30n, id, paddingType.START)); structFields = []; for (let i = 0; i < 2; i++) { // BosonTypes.AuthToken has 2 fields @@ -1468,7 +1466,7 @@ async function getProtocolLookupsPrivateContractState( pendingAuthTokenUpdatesBySeller.push(structFields); // pendingAddressUpdatesByDisputeResolver - structStorageSlot = BigInt(getMappingStoragePosition(protocolLookupsSlotNumber + "31", id, paddingType.START)); + structStorageSlot = BigInt(getMappingStoragePosition(protocolLookupsSlotNumber + 31n, id, paddingType.START)); structFields = []; for (let i = 0; i < 8; i++) { // BosonTypes.DisputeResolver has 8 fields From ba46cc95360bd6f512073add099c0c97566cfaa8 Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Fri, 30 Jun 2023 13:13:24 -0300 Subject: [PATCH 30/32] Replacing toHexString --- scripts/util/diamond-utils.js | 2 +- test/integration/seaport/utils.js | 20 ++++++++++---------- test/protocol/DisputeHandlerTest.js | 3 ++- test/protocol/MetaTransactionsHandlerTest.js | 3 ++- test/upgrade/clients/01_generic.js | 4 ++-- test/util/upgrade.js | 13 ++++--------- test/util/utils.js | 5 +++-- 7 files changed, 24 insertions(+), 26 deletions(-) diff --git a/scripts/util/diamond-utils.js b/scripts/util/diamond-utils.js index bab1ccb3a..efcc7da04 100644 --- a/scripts/util/diamond-utils.js +++ b/scripts/util/diamond-utils.js @@ -74,7 +74,7 @@ async function getInterfaceId(contractName, skipBaseCheck = false, isFullPath = interfaceId = interfaceId ^ baseContractInterfaceId; } } - return interfaceId == 0n ? "0x00000000" : "0x" + interfaceId.toString(16).padStart(8, "0"); + return interfaceId == 0n ? "0x00000000" : toHexString(interfaceId, { startPad: 8 }); } // used with getSelectors to remove selectors from an array of selectors diff --git a/test/integration/seaport/utils.js b/test/integration/seaport/utils.js index 19fcfc268..04d49f02c 100644 --- a/test/integration/seaport/utils.js +++ b/test/integration/seaport/utils.js @@ -46,9 +46,9 @@ const calculateOrderHash = (orderComponents) => { offerItemTypeHash.slice(2), offerItem.itemType.toString().padStart(64, "0"), offerItem.token.slice(2).padStart(64, "0"), - BigNumber.from(offerItem.identifierOrCriteria).toHexString().slice(2).padStart(64, "0"), - BigNumber.from(offerItem.startAmount).toHexString().slice(2).padStart(64, "0"), - BigNumber.from(offerItem.endAmount).toHexString().slice(2).padStart(64, "0"), + BigNumber.from(offerItem.identifierOrCriteria).toString(16).slice(2).padStart(64, "0"), + BigNumber.from(offerItem.startAmount).toString(16).slice(2).padStart(64, "0"), + BigNumber.from(offerItem.endAmount).toString(16).slice(2).padStart(64, "0"), ].join("") ) .slice(2); @@ -67,9 +67,9 @@ const calculateOrderHash = (orderComponents) => { considerationItemTypeHash.slice(2), considerationItem.itemType.toString().padStart(64, "0"), considerationItem.token.slice(2).padStart(64, "0"), - BigNumber.from(considerationItem.identifierOrCriteria).toHexString().slice(2).padStart(64, "0"), - BigNumber.from(considerationItem.startAmount).toHexString().slice(2).padStart(64, "0"), - BigNumber.from(considerationItem.endAmount).toHexString().slice(2).padStart(64, "0"), + BigNumber.from(considerationItem.identifierOrCriteria).toString(16).slice(2).padStart(64, "0"), + BigNumber.from(considerationItem.startAmount).toString(16).slice(2).padStart(64, "0"), + BigNumber.from(considerationItem.endAmount).toString(16).slice(2).padStart(64, "0"), considerationItem.recipient.slice(2).padStart(64, "0"), ].join("") ) @@ -87,12 +87,12 @@ const calculateOrderHash = (orderComponents) => { offerHash.slice(2), considerationHash.slice(2), orderComponents.orderType.toString().padStart(64, "0"), - BigNumber.from(orderComponents.startTime).toHexString().slice(2).padStart(64, "0"), - BigNumber.from(orderComponents.endTime).toHexString().slice(2).padStart(64, "0"), + BigNumber.from(orderComponents.startTime).toString(16).slice(2).padStart(64, "0"), + BigNumber.from(orderComponents.endTime).toString(16).slice(2).padStart(64, "0"), orderComponents.zoneHash.slice(2), - BigNumber.from(orderComponents.salt).toHexString().slice(2).padStart(64, "0"), + BigNumber.from(orderComponents.salt).toString(16).slice(2).padStart(64, "0"), orderComponents.conduitKey.slice(2).padStart(64, "0"), - BigNumber.from(orderComponents.counter).toHexString().slice(2).padStart(64, "0"), + BigNumber.from(orderComponents.counter).toString(16).slice(2).padStart(64, "0"), ].join("") ); diff --git a/test/protocol/DisputeHandlerTest.js b/test/protocol/DisputeHandlerTest.js index 042ebff0a..89c478068 100644 --- a/test/protocol/DisputeHandlerTest.js +++ b/test/protocol/DisputeHandlerTest.js @@ -9,6 +9,7 @@ const { DisputeResolverFee } = require("../../scripts/domain/DisputeResolverFee" const PausableRegion = require("../../scripts/domain/PausableRegion.js"); const { getInterfaceIds } = require("../../scripts/config/supported-interfaces.js"); const { RevertReasons } = require("../../scripts/config/revert-reasons.js"); +const { toHexString } = require('../../scripts/util/utils.js') const { deployMockTokens } = require("../../scripts/util/deploy-mock-tokens"); const { setNextBlockTimestamp, @@ -1195,7 +1196,7 @@ describe("IBosonDisputeHandler", function () { await expect( disputeHandler .connect(assistant) - .resolveDispute(exchangeId, buyerPercentBasisPoints, r, "0x" + MaxUint256.toString(16), v) + .resolveDispute(exchangeId, buyerPercentBasisPoints, r, toHexString(MaxUint256), v) ).to.revertedWith(RevertReasons.INVALID_SIGNATURE); }); diff --git a/test/protocol/MetaTransactionsHandlerTest.js b/test/protocol/MetaTransactionsHandlerTest.js index 80c0e4fe6..8c5460f48 100644 --- a/test/protocol/MetaTransactionsHandlerTest.js +++ b/test/protocol/MetaTransactionsHandlerTest.js @@ -23,6 +23,7 @@ const { DisputeResolverFee } = require("../../scripts/domain/DisputeResolverFee" const { getInterfaceIds } = require("../../scripts/config/supported-interfaces.js"); const { RevertReasons } = require("../../scripts/config/revert-reasons.js"); const { deployMockTokens } = require("../../scripts/util/deploy-mock-tokens"); +const { toHexString } = require('../../scripts/util/utils.js') const { prepareDataSignatureParameters, setNextBlockTimestamp, @@ -1081,7 +1082,7 @@ describe("IBosonMetaTransactionsHandler", function () { functionSignature, nonce, r, - "0x" + MaxUint256.toString(16), // invalid s signature component + toHexString(MaxUint256), // invalid s signature component v ) ).to.revertedWith(RevertReasons.INVALID_SIGNATURE); diff --git a/test/upgrade/clients/01_generic.js b/test/upgrade/clients/01_generic.js index f3dba2b87..874738474 100644 --- a/test/upgrade/clients/01_generic.js +++ b/test/upgrade/clients/01_generic.js @@ -79,11 +79,11 @@ function getGenericContext( // loop matches the loop in populateVoucherContract for (let j = i; j < buyers.length; j++) { const offer = preUpgradeEntities.offers[i + j].offer; - const sellerId = BigInt(offer.sellerId).toHexString(); + const sellerId = BigInt(offer.sellerId).toString(); // Find the voucher data for the seller const voucherData = voucherContractStateAfterUpgradeAndActions.find( - (vd) => vd.sellerId.toHexString() == sellerId + (vd) => vd.sellerId.toString() == sellerId ); const buyerWallet = buyers[j].wallet; diff --git a/test/util/upgrade.js b/test/util/upgrade.js index 959ef3f29..57be5dfab 100644 --- a/test/util/upgrade.js +++ b/test/util/upgrade.js @@ -88,6 +88,7 @@ async function deploySuite(deployer, newVersion) { // checkout old version const { oldVersion: tag, deployScript: scriptsTag } = versionTags; + console.log("only",versionTags); console.log(`Fetching tags`); shell.exec(`git fetch --force --tags origin`); @@ -1402,18 +1403,14 @@ async function getProtocolLookupsPrivateContractState( let allowedSellerIndex = []; for (const DR of DRs) { const firstMappingStorageSlot = BigInt( - getMappingStoragePosition( - protocolLookupsSlotNumber + 26n, - BigInt(DR.disputeResolver.id).toHexString(), - paddingType.START - ) + getMappingStoragePosition(protocolLookupsSlotNumber + 26n, BigInt(DR.disputeResolver.id), paddingType.START) ); let sellerStatus = []; for (const seller of sellers) { sellerStatus.push( await getStorageAt( protocolDiamondAddress, - getMappingStoragePosition(firstMappingStorageSlot, BigInt(seller.seller.id).toHexString(), paddingType.START) + getMappingStoragePosition(firstMappingStorageSlot, BigInt(seller.seller.id), paddingType.START) ) ); } @@ -1424,9 +1421,7 @@ async function getProtocolLookupsPrivateContractState( let offerIdIndexByGroup = []; for (const group of groups) { const id = group.id; - const firstMappingStorageSlot = BigInt( - getMappingStoragePosition(protocolLookupsSlotNumber + 28n, id, paddingType.START) - ); + const firstMappingStorageSlot = BigInt(getMappingStoragePosition(protocolLookupsSlotNumber, id, paddingType.START)); let offerInidices = []; for (const offer of offers) { const id2 = Number(offer.offer.id); diff --git a/test/util/utils.js b/test/util/utils.js index 1187c4737..6c8cafe03 100644 --- a/test/util/utils.js +++ b/test/util/utils.js @@ -16,6 +16,7 @@ const { const { getFacets } = require("../../scripts/config/facet-deploy.js"); const { oneWeek, oneMonth, maxPriorityFeePerGas } = require("./constants"); const Role = require("../../scripts/domain/Role"); +const { toHexString } = require("../../scripts/util/utils.js"); const { expect } = require("chai"); const Offer = require("../../scripts/domain/Offer"); const { zeroPadBytes } = require("ethers"); @@ -189,7 +190,7 @@ async function prepareDataSignatureParameters( if (type == "Protocol") { //hardhat default chain id is 31337 - domainData.salt = zeroPadValue("0x" + 31337n.toString(16), 32); + domainData.salt = zeroPadValue(toHexString(31337n), 32); } else { const { chainId } = await provider.getNetwork(); domainData.chainId = chainId.toString(); @@ -268,7 +269,7 @@ function getMappingStoragePosition(slot, key, padding = paddingType.NONE) { keyBuffer = Buffer.from(key.slice(2).padEnd(64, "0"), "hex"); // assume key is prefixed with 0x break; } - const pBuffer = Buffer.from(slot.toHexString().slice(2), "hex"); + const pBuffer = Buffer.from(toHexString(slot).slice(2), "hex"); return keccak256(Buffer.concat([keyBuffer, pBuffer])); } From ab1d68557e2096a9352ad0fe924b95b57814632d Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Fri, 30 Jun 2023 14:47:47 -0300 Subject: [PATCH 31/32] Review changes --- package-lock.json | 2 - scripts/util/diamond-utils.js | 9 ++++ scripts/util/estimate-limits.js | 8 ++-- scripts/util/utils.js | 5 +++ test/domain/OfferDatesTest.js | 5 --- .../seaport/seaport-integration.js | 4 +- test/util/upgrade.js | 42 +++++++++---------- 7 files changed, 41 insertions(+), 34 deletions(-) diff --git a/package-lock.json b/package-lock.json index ed6f01ac2..5f4836a54 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9440,7 +9440,6 @@ "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz", "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==", "dev": true, - "hasInstallScript": true, "optional": true, "dependencies": { "node-gyp-build": "^4.3.0" @@ -9798,7 +9797,6 @@ "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz", "integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==", "dev": true, - "hasInstallScript": true, "optional": true, "dependencies": { "node-gyp-build": "^4.3.0" diff --git a/scripts/util/diamond-utils.js b/scripts/util/diamond-utils.js index efcc7da04..aaf50b5d5 100644 --- a/scripts/util/diamond-utils.js +++ b/scripts/util/diamond-utils.js @@ -2,6 +2,7 @@ const hre = require("hardhat"); const { keccak256, toUtf8Bytes, getContractAt, ZeroAddress, Interface, getContractFactory, encodeBytes32String } = hre.ethers; const environments = "../../environments.js"; + const confirmations = hre.network.name === "hardhat" ? 1 : environments.confirmations; const FacetCutAction = require("../domain/FacetCutAction"); const { interfacesWithMultipleArtifacts } = require("./constants"); @@ -9,6 +10,10 @@ const { getFees } = require("./utils"); /** * Utilities for testing and interacting with Diamond + + + + * * @author Nick Mudge (https://twitter.com/mudgen) */ @@ -233,6 +238,10 @@ async function cutDiamond( return transactionResponse; } +function toHexString(bigNumber, { startPad }) { + return "0x" + (startPad ? bigNumber.toString(16).padStart(startPad, "0") : bigNumber.toString(16)); +} + exports.getSelectors = getSelectors; exports.FacetCutAction = FacetCutAction; exports.remove = remove; diff --git a/scripts/util/estimate-limits.js b/scripts/util/estimate-limits.js index 4a2bbe0af..5ec712ad7 100644 --- a/scripts/util/estimate-limits.js +++ b/scripts/util/estimate-limits.js @@ -576,7 +576,7 @@ setupEnvironment["maxExchangesPerBatch"] = async function (exchangesCount = 10) // Set time forward to run out the dispute period const blockNumber = await provider.getBlockNumber(); const block = await provider.getBlock(blockNumber); - const newTime = BigInt(block.timestamp).add(offerDurations.disputePeriod).add(1).toNumber(); + const newTime = Number(BigInt(block.timestamp) + BigInt(offerDurations.disputePeriod) + 1n); await setNextBlockTimestamp(newTime); const exchangeIds = [...Array(exchangesCount + 1).keys()].slice(1); @@ -645,7 +645,7 @@ setupEnvironment["maxDisputesPerBatch"] = async function (exchangesCount = 10) { // Set time forward to run out the dispute period const blockNumber = await provider.getBlockNumber(); const block = await provider.getBlock(blockNumber); - const newTime = BigInt(block.timestamp).add(offerDurations.resolutionPeriod).add(1).toNumber(); + const newTime = Number(BigInt(block.timestamp) + BigInt(offerDurations.resolutionPeriod) + 1n); await setNextBlockTimestamp(newTime); const exchangeIds = [...Array(exchangesCount + 1).keys()].slice(1); @@ -874,8 +874,8 @@ async function estimateLimit(limit, inputs, safeGasLimitPercent) { const gasEstimate = await handlers[handler] .connect(methodInputs.account) .estimateGas[method](...adjustedArgs, { gasLimit }); - console.log("Length:", arrayLength, "Gas:", gasEstimate.toNumber()); - gasEstimates.push([gasEstimate.toNumber(), arrayLength]); + console.log("Length:", arrayLength, "Gas:", Number(gasEstimate)); + gasEstimates.push([Number(gasEstimate), arrayLength]); } catch (e) { // console.log(e) console.log("Block gas limit already hit"); diff --git a/scripts/util/utils.js b/scripts/util/utils.js index cfa0478b1..96dd28e88 100644 --- a/scripts/util/utils.js +++ b/scripts/util/utils.js @@ -92,6 +92,10 @@ const addressNotFound = (address) => { process.exit(1); }; +function toHexString(bigNumber, { startPad } = { startPad: 8 }) { + return "0x" + (startPad ? bigNumber.toString(16).padStart(startPad, "0") : bigNumber.toString(16)); +} + exports.getAddressesFilePath = getAddressesFilePath; exports.writeContracts = writeContracts; exports.readContracts = readContracts; @@ -102,3 +106,4 @@ exports.getMaxFeePerGas = getMaxFeePerGas; exports.getFees = getFees; exports.checkRole = checkRole; exports.addressNotFound = addressNotFound; +exports.toHexString = toHexString; diff --git a/test/domain/OfferDatesTest.js b/test/domain/OfferDatesTest.js index 83ea11ef4..5cd5baead 100644 --- a/test/domain/OfferDatesTest.js +++ b/test/domain/OfferDatesTest.js @@ -118,11 +118,6 @@ describe("OfferDates", function () { offerDates.voucherRedeemableUntil = "126"; expect(offerDates.voucherRedeemableUntilIsValid()).is.true; expect(offerDates.isValid()).is.true; - - // Invalid field value - offerDates.voucherRedeemableUntil = new Date(); - expect(offerDates.voucherRedeemableUntilIsValid()).is.false; - expect(offerDates.isValid()).is.false; }); }); diff --git a/test/integration/seaport/seaport-integration.js b/test/integration/seaport/seaport-integration.js index 2fc2e0f20..86d4181c6 100644 --- a/test/integration/seaport/seaport-integration.js +++ b/test/integration/seaport/seaport-integration.js @@ -125,7 +125,7 @@ describe("[@skip-on-coverage] Seaport integration", function () { ({ isValidated, totalFilled } = await seaport.getOrderStatus(orderHash)); assert(isValidated, "Order is not validated"); - assert.equal(totalFilled.toNumber(), 0); + assert.equal(totalFilled, 0n); const tx = await seaport.connect(buyer).fulfillOrder(order, ZeroHash, { value }); const receipt = await tx.wait(); @@ -133,7 +133,7 @@ describe("[@skip-on-coverage] Seaport integration", function () { const event = getEvent(receipt, seaport, "OrderFulfilled"); ({ totalFilled } = await seaport.getOrderStatus(orderHash)); - assert.equal(totalFilled.toNumber(), 1); + assert.equal(totalFilled, 1n); assert.equal(orderHash, event[0]); }); diff --git a/test/util/upgrade.js b/test/util/upgrade.js index 57be5dfab..a33dfa45e 100644 --- a/test/util/upgrade.js +++ b/test/util/upgrade.js @@ -468,7 +468,7 @@ async function populateProtocolContract( } // create offers - first seller has 5 offers, second 4, third 3 etc - let offerId = (await offerHandler.getNextOfferId()).toNumber(); + let offerId = Number(await offerHandler.getNextOfferId()); for (let i = 0; i < sellers.length; i++) { for (let j = i; j >= 0; j--) { // Mock offer, offerDates and offerDurations @@ -521,7 +521,7 @@ async function populateProtocolContract( } // group some offers - let groupId = (await groupHandler.getNextGroupId()).toNumber(); + let groupId = Number(await groupHandler.getNextGroupId()); for (let i = 0; i < sellers.length; i = i + 2) { const seller = sellers[i]; const group = new Group(groupId, seller.seller.id, seller.offerIds); // group all seller's offers @@ -537,8 +537,8 @@ async function populateProtocolContract( } // create some twins and bundles - let twinId = (await twinHandler.getNextTwinId()).toNumber(); - let bundleId = (await bundleHandler.getNextBundleId()).toNumber(); + let twinId = Number(await twinHandler.getNextTwinId()); + let bundleId = Number(await bundleHandler.getNextBundleId()); for (let i = 1; i < sellers.length; i = i + 2) { const seller = sellers[i]; const sellerId = seller.id; @@ -618,7 +618,7 @@ async function populateProtocolContract( // commit to some offers: first buyer commit to 1 offer, second to 2, third to 3 etc await setNextBlockTimestamp(Number(offers[offers.length - 1].offerDates.validFrom)); // When latest offer is valid, also other offers are valid - let exchangeId = (await exchangeHandler.getNextExchangeId()).toNumber(); + let exchangeId = Number(await exchangeHandler.getNextExchangeId()); for (let i = 0; i < buyers.length; i++) { for (let j = i; j < buyers.length; j++) { const offer = offers[i + j].offer; // some offers will be picked multiple times, some never. @@ -1233,10 +1233,10 @@ async function getProtocolLookupsPrivateContractState( const id = Number(offer.offer.id); // exchangeIdsByOffer let exchangeIdsByOffer = []; - const arraySlot = BigInt.from(getMappingStoragePosition(protocolLookupsSlotNumber + 0n, id, paddingType.START)); - const arrayLength = BigInt(await getStorageAt(protocolDiamondAddress, arraySlot)).toNumber(); - const arrayStart = BigInt(keccak256(arraySlot)); - for (let i = 0; i < arrayLength; i++) { + const arraySlot = BigInt(getMappingStoragePosition(protocolLookupsSlotNumber + 0n, id, paddingType.START)); + const arrayLength = await getStorageAt(protocolDiamondAddress, arraySlot); + const arrayStart = keccak256(arraySlot); + for (let i = 0n; i < arrayLength; i++) { exchangeIdsByOffer.push(await getStorageAt(protocolDiamondAddress, arrayStart + i)); } exchangeIdsByOfferState.push(exchangeIdsByOffer); @@ -1363,13 +1363,13 @@ async function getProtocolLookupsPrivateContractState( await mockTwin.getAddress(), paddingType.START ); - const arrayLength = BigInt(await getStorageAt(protocolDiamondAddress, arraySlot)).toNumber(); - const arrayStart = BigInt(keccak256(arraySlot)); - for (let i = 0; i < arrayLength * 2; i = i + 2) { + const arrayLength = await getStorageAt(protocolDiamondAddress, arraySlot); + const arrayStart = keccak256(arraySlot); + for (let i = 0; i < arrayLength * 2n; i = i + 2n) { // each BosonTypes.TokenRange has length 2 ranges[await mockTwin.getAddress()].push({ start: await getStorageAt(protocolDiamondAddress, arrayStart + i), - end: await getStorageAt(protocolDiamondAddress, arrayStart + i + 1), + end: await getStorageAt(protocolDiamondAddress, arrayStart + i + 1n), }); } } @@ -1390,8 +1390,8 @@ async function getProtocolLookupsPrivateContractState( await mockTwin.getAddress(), paddingType.START ); - const arrayLength = BigInt(await getStorageAt(protocolDiamondAddress, arraySlot)).toNumber(); - const arrayStart = BigInt(keccak256(arraySlot)); + const arrayLength = await getStorageAt(protocolDiamondAddress, arraySlot); + const arrayStart = keccak256(arraySlot); for (let i = 0; i < arrayLength; i++) { twinIds[await mockTwin.getAddress()].push(await getStorageAt(protocolDiamondAddress, arrayStart + i)); } @@ -1445,7 +1445,7 @@ async function getProtocolLookupsPrivateContractState( // pendingAddressUpdatesBySeller let structStorageSlot = BigInt(getMappingStoragePosition(protocolLookupsSlotNumber + 29n, id, paddingType.START)); let structFields = []; - for (let i = 0; i < 5; i++) { + for (let i = 0n; i < 5n; i++) { // BosonTypes.Seller has 6 fields, but last bool is packed in one slot with previous field structFields.push(await getStorageAt(protocolDiamondAddress, structStorageSlot + i)); } @@ -1454,7 +1454,7 @@ async function getProtocolLookupsPrivateContractState( // pendingAuthTokenUpdatesBySeller structStorageSlot = BigInt(getMappingStoragePosition(protocolLookupsSlotNumber + 30n, id, paddingType.START)); structFields = []; - for (let i = 0; i < 2; i++) { + for (let i = 0n; i < 2n; i++) { // BosonTypes.AuthToken has 2 fields structFields.push(await getStorageAt(protocolDiamondAddress, structStorageSlot + i)); } @@ -1463,11 +1463,11 @@ async function getProtocolLookupsPrivateContractState( // pendingAddressUpdatesByDisputeResolver structStorageSlot = BigInt(getMappingStoragePosition(protocolLookupsSlotNumber + 31n, id, paddingType.START)); structFields = []; - for (let i = 0; i < 8; i++) { + for (let i = 0n; i < 8n; i++) { // BosonTypes.DisputeResolver has 8 fields structFields.push(await getStorageAt(protocolDiamondAddress, structStorageSlot + i)); } - structFields[6] = await getStorageAt(protocolDiamondAddress, keccak256(structStorageSlot + 6)); // represents field string metadataUri. Technically this value represents the length of the string, but since it should be 0, we don't do further decoding + structFields[6] = await getStorageAt(protocolDiamondAddress, keccak256(structStorageSlot + 6n)); // represents field string metadataUri. Technically this value represents the length of the string, but since it should be 0, we don't do further decoding pendingAddressUpdatesByDisputeResolver.push(structFields); } @@ -1671,7 +1671,7 @@ async function populateVoucherContract( } // create offers - first seller has 5 offers, second 4, third 3 etc - let offerId = (await offerHandler.getNextOfferId()).toNumber(); + let offerId = Number(await offerHandler.getNextOfferId()); for (let i = 0; i < sellers.length; i++) { for (let j = i; j >= 0; j--) { // Mock offer, offerDates and offerDurations @@ -1725,7 +1725,7 @@ async function populateVoucherContract( // commit to some offers: first buyer commit to 1 offer, second to 2, third to 3 etc await setNextBlockTimestamp(Number(offers[offers.length - 1].offerDates.validFrom)); // When latest offer is valid, also other offers are valid - let exchangeId = (await exchangeHandler.getNextExchangeId()).toNumber(); + let exchangeId = Number(await exchangeHandler.getNextExchangeId()); for (let i = 0; i < buyers.length; i++) { for (let j = i; j < buyers.length; j++) { const offer = offers[i + j].offer; // some offers will be picked multiple times, some never. From 353cb4da6275efa3b1c4f7f6b586a3848ca12803 Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Fri, 30 Jun 2023 16:36:29 -0300 Subject: [PATCH 32/32] tidy --- scripts/util/diamond-utils.js | 10 +--------- test/protocol/DisputeHandlerTest.js | 2 +- test/protocol/MetaTransactionsHandlerTest.js | 2 +- test/util/upgrade.js | 2 +- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/scripts/util/diamond-utils.js b/scripts/util/diamond-utils.js index aaf50b5d5..1262fc48e 100644 --- a/scripts/util/diamond-utils.js +++ b/scripts/util/diamond-utils.js @@ -6,14 +6,10 @@ const environments = "../../environments.js"; const confirmations = hre.network.name === "hardhat" ? 1 : environments.confirmations; const FacetCutAction = require("../domain/FacetCutAction"); const { interfacesWithMultipleArtifacts } = require("./constants"); -const { getFees } = require("./utils"); +const { getFees, toHexString } = require("./utils"); /** * Utilities for testing and interacting with Diamond - - - - * * @author Nick Mudge (https://twitter.com/mudgen) */ @@ -238,10 +234,6 @@ async function cutDiamond( return transactionResponse; } -function toHexString(bigNumber, { startPad }) { - return "0x" + (startPad ? bigNumber.toString(16).padStart(startPad, "0") : bigNumber.toString(16)); -} - exports.getSelectors = getSelectors; exports.FacetCutAction = FacetCutAction; exports.remove = remove; diff --git a/test/protocol/DisputeHandlerTest.js b/test/protocol/DisputeHandlerTest.js index 89c478068..16b53c529 100644 --- a/test/protocol/DisputeHandlerTest.js +++ b/test/protocol/DisputeHandlerTest.js @@ -9,7 +9,7 @@ const { DisputeResolverFee } = require("../../scripts/domain/DisputeResolverFee" const PausableRegion = require("../../scripts/domain/PausableRegion.js"); const { getInterfaceIds } = require("../../scripts/config/supported-interfaces.js"); const { RevertReasons } = require("../../scripts/config/revert-reasons.js"); -const { toHexString } = require('../../scripts/util/utils.js') +const { toHexString } = require("../../scripts/util/utils.js"); const { deployMockTokens } = require("../../scripts/util/deploy-mock-tokens"); const { setNextBlockTimestamp, diff --git a/test/protocol/MetaTransactionsHandlerTest.js b/test/protocol/MetaTransactionsHandlerTest.js index 8c5460f48..0289ef260 100644 --- a/test/protocol/MetaTransactionsHandlerTest.js +++ b/test/protocol/MetaTransactionsHandlerTest.js @@ -23,7 +23,7 @@ const { DisputeResolverFee } = require("../../scripts/domain/DisputeResolverFee" const { getInterfaceIds } = require("../../scripts/config/supported-interfaces.js"); const { RevertReasons } = require("../../scripts/config/revert-reasons.js"); const { deployMockTokens } = require("../../scripts/util/deploy-mock-tokens"); -const { toHexString } = require('../../scripts/util/utils.js') +const { toHexString } = require("../../scripts/util/utils.js"); const { prepareDataSignatureParameters, setNextBlockTimestamp, diff --git a/test/util/upgrade.js b/test/util/upgrade.js index a33dfa45e..48389f0cf 100644 --- a/test/util/upgrade.js +++ b/test/util/upgrade.js @@ -88,7 +88,7 @@ async function deploySuite(deployer, newVersion) { // checkout old version const { oldVersion: tag, deployScript: scriptsTag } = versionTags; - console.log("only",versionTags); + console.log("only", versionTags); console.log(`Fetching tags`); shell.exec(`git fetch --force --tags origin`);