diff --git a/contracts/LockDealNFT/LockDealNFT.sol b/contracts/LockDealNFT/LockDealNFT.sol index 7d87f1ee..bc834ccb 100644 --- a/contracts/LockDealNFT/LockDealNFT.sol +++ b/contracts/LockDealNFT/LockDealNFT.sol @@ -8,7 +8,7 @@ import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /// @title LockDealNFT contract /// @notice Implements a non-fungible token (NFT) contract for locking deals contract LockDealNFT is LockDealNFTInternal, IERC721Receiver { - constructor(address _vaultManager, string memory _baseURI) ERC721("LockDealNFT", "LDNFT") { + constructor(address _vaultManager, string memory _baseURI) ERC721("LockDealNFT", "LDNFT") Ownable(_msgSender()){ _notZeroAddress(_vaultManager); vaultManager = IVaultManager(_vaultManager); approvedContracts[address(this)] = true; @@ -71,7 +71,7 @@ contract LockDealNFT is LockDealNFTInternal, IERC721Receiver { /// @dev Sets the approved status of a contract /// @param contractAddress The address of the contract /// @param status The new approved status (true or false) - function setApprovedContract(address contractAddress, bool status) external onlyOwner onlyContract(contractAddress) { + function setApprovedContract(address contractAddress, bool status) external onlyOwner notZeroAddress(contractAddress) { approvedContracts[contractAddress] = status; emit ContractApproved(contractAddress, status); } @@ -98,8 +98,7 @@ contract LockDealNFT is LockDealNFTInternal, IERC721Receiver { } function transferFrom(address from, address to, uint256 tokenId) public override(ERC721, IERC721) { - require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); - _safeTransfer(from, to, tokenId, ""); + ERC721.transferFrom(from, to, tokenId); } function setBaseURI(string memory newBaseURI) external onlyOwner { diff --git a/contracts/LockDealNFT/LockDealNFTInternal.sol b/contracts/LockDealNFT/LockDealNFTInternal.sol index e5dbb337..dec02940 100644 --- a/contracts/LockDealNFT/LockDealNFTInternal.sol +++ b/contracts/LockDealNFT/LockDealNFTInternal.sol @@ -8,26 +8,23 @@ import "@poolzfinance/poolz-helper-v2/contracts/interfaces/IInnerWithdraw.sol"; import "@ironblocks/firewall-consumer/contracts/FirewallConsumer.sol"; abstract contract LockDealNFTInternal is LockDealNFTModifiers, FirewallConsumer { - function _transfer(address from, address to, uint256 poolId) - internal - override - firewallProtectedSig(0x30e0789e) - { - if ( - from != address(0) && - ERC165Checker.supportsInterface(address(poolIdToProvider[poolId]), type(IBeforeTransfer).interfaceId) - ) { - IBeforeTransfer(address(poolIdToProvider[poolId])).beforeTransfer(from, to, poolId); + function _update( + address to, + uint256 poolId, + address auth + ) internal override firewallProtectedSig(0x30e0789e) returns (address from) { + if (auth != address(0) && ERC165Checker.supportsInterface(address(poolIdToProvider[poolId]), type(IBeforeTransfer).interfaceId)) { + IBeforeTransfer(address(poolIdToProvider[poolId])).beforeTransfer(auth, to, poolId); } // check for split and withdraw transfers - if (!(approvedContracts[to] || approvedContracts[from])) { - require(approvedPoolUserTransfers[from], "Pool transfer not approved by user"); + if (auth != address(0) && !(approvedContracts[to] || approvedContracts[auth])) { + require(approvedPoolUserTransfers[auth], "Pool transfer not approved by user"); require( vaultManager.vaultIdToTradeStartTime(poolIdToVaultId[poolId]) < block.timestamp, "Can't transfer before trade start time" ); } - super._transfer(from, to, poolId); + from = super._update(to, poolId, auth); } /// @param owner The address to assign the token to diff --git a/contracts/LockDealNFT/LockDealNFTModifiers.sol b/contracts/LockDealNFT/LockDealNFTModifiers.sol index 6cde1e03..8fe8f5a0 100644 --- a/contracts/LockDealNFT/LockDealNFTModifiers.sol +++ b/contracts/LockDealNFT/LockDealNFTModifiers.sol @@ -12,11 +12,6 @@ abstract contract LockDealNFTModifiers is LockDealNFTState { _; } - modifier onlyContract(address contractAddress) { - _onlyContract(contractAddress); - _; - } - modifier notZeroAddress(address _address) { _notZeroAddress(_address); _; @@ -36,10 +31,6 @@ abstract contract LockDealNFTModifiers is LockDealNFTState { require(_address != address(0x0), "Zero Address is not allowed"); } - function _onlyContract(address contractAddress) private view { - require(Address.isContract(contractAddress), "Invalid contract address"); - } - function _onlyApprovedContract(address contractAddress) internal view { require(approvedContracts[contractAddress], "Contract not approved"); } diff --git a/contracts/LockDealNFT/LockDealNFTState.sol b/contracts/LockDealNFT/LockDealNFTState.sol index 49e34ecd..774ed445 100644 --- a/contracts/LockDealNFT/LockDealNFTState.sol +++ b/contracts/LockDealNFT/LockDealNFTState.sol @@ -137,4 +137,8 @@ abstract contract LockDealNFTState is ERC721Enumerable, ILockDealNFTEvents, Owna } } } + + function _exists(uint256 poolId) internal view returns (bool) { + return _ownerOf(poolId) != address(0); + } } diff --git a/package-lock.json b/package-lock.json index f52ad9ee..500f3b20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,8 +10,8 @@ "license": "MIT", "dependencies": { "@ironblocks/firewall-consumer": "^1.0.13", - "@openzeppelin/contracts": "^4.8.3", - "@poolzfinance/poolz-helper-v2": "^2.3.5" + "@openzeppelin/contracts": "^5.0.2", + "@poolzfinance/poolz-helper-v2": "^3.0.0" }, "devDependencies": { "@ethersproject/bignumber": "^5.7.0", @@ -71,11 +71,11 @@ } }, "node_modules/@aws-sdk/types": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.577.0.tgz", - "integrity": "sha512-FT2JZES3wBKN/alfmhlo+3ZOq/XJ0C7QOZcDNrpKjB0kqYoKjhVKZ/Hx6ArR0czkKfHzBBEs6y40ebIHx2nSmA==", + "version": "3.598.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.598.0.tgz", + "integrity": "sha512-742uRl6z7u0LFmZwDrFP6r1wlZcgVPw+/TilluDJmCAR8BgRw3IR+743kUXKBGd8QZDRW2n6v/PYsi/AWCDDMQ==", "dependencies": { - "@smithy/types": "^3.0.0", + "@smithy/types": "^3.1.0", "tslib": "^2.6.2" }, "engines": { @@ -1259,6 +1259,7 @@ "version": "0.11.14", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", + "deprecated": "Use @eslint/config-array instead", "peer": true, "dependencies": { "@humanwhocodes/object-schema": "^2.0.2", @@ -1286,6 +1287,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "deprecated": "Use @eslint/object-schema instead", "peer": true }, "node_modules/@ironblocks/firewall-consumer": { @@ -1299,6 +1301,11 @@ "@openzeppelin/hardhat-upgrades": "^1.21.0" } }, + "node_modules/@ironblocks/firewall-consumer/node_modules/@openzeppelin/contracts": { + "version": "4.9.6", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.9.6.tgz", + "integrity": "sha512-xSmezSupL+y9VkHZJGDoCBpmnB2ogM13ccaYDWqJTfS3dbuHkgjuwDFUmaFauBCboQMGB/S5UqUl2y54X99BmA==" + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -1895,9 +1902,9 @@ } }, "node_modules/@openzeppelin/contracts": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.9.6.tgz", - "integrity": "sha512-xSmezSupL+y9VkHZJGDoCBpmnB2ogM13ccaYDWqJTfS3dbuHkgjuwDFUmaFauBCboQMGB/S5UqUl2y54X99BmA==" + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-5.0.2.tgz", + "integrity": "sha512-ytPc6eLGcHHnapAZ9S+5qsdomhjo6QBHTDRRBFfTxXIpsicMhVPouPgmUPebZZZGX7vt9USA+Z+0M0dSVtSUEA==" }, "node_modules/@openzeppelin/contracts-upgradeable": { "version": "4.9.6", @@ -2069,9 +2076,9 @@ } }, "node_modules/@openzeppelin/upgrades-core": { - "version": "1.33.1", - "resolved": "https://registry.npmjs.org/@openzeppelin/upgrades-core/-/upgrades-core-1.33.1.tgz", - "integrity": "sha512-YRxIRhTY1b+j7+NUUu8Uuem5ugxKexEMVd8dBRWNgWeoN1gS1OCrhgUg0ytL+54vzQ+SGWZDfNnzjVuI1Cj1Zw==", + "version": "1.34.1", + "resolved": "https://registry.npmjs.org/@openzeppelin/upgrades-core/-/upgrades-core-1.34.1.tgz", + "integrity": "sha512-LV3hHm60htmP3HJjn2VoGqXNPn1RLFSSInRyXNbm15Z2oWKGxOfAWSC4+okRckum0yVB5g3k4/SEyqjsJRB07A==", "dependencies": { "cbor": "^9.0.0", "chalk": "^4.1.0", @@ -2172,9 +2179,9 @@ } }, "node_modules/@poolzfinance/poolz-helper-v2": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/@poolzfinance/poolz-helper-v2/-/poolz-helper-v2-2.4.2.tgz", - "integrity": "sha512-q5fOtp38/Hxe4AVBBHBP3EgOVtYWzj5jWrFy0/+3LLfg2LLT2GNEfJFYMQGDXyPbDE1HJA4Jj6HwzSbp9lqSFQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@poolzfinance/poolz-helper-v2/-/poolz-helper-v2-3.0.1.tgz", + "integrity": "sha512-Jka+6Dz1duqltxkkcshM4NexAebnc1yxv7QMJAigaToRKQCsKn6WnZIUyUKP82akh9DFUlwCsd3rfHKHkS+4ZA==", "dependencies": { "@ethersproject/bignumber": "^5.7.0", "@ironblocks/firewall-consumer": "^1.0.4", @@ -2183,7 +2190,7 @@ "@nomicfoundation/hardhat-toolbox": "^2.0.0", "@nomiclabs/hardhat-ethers": "^2.2.1", "@nomiclabs/hardhat-etherscan": "^3.1.2", - "@openzeppelin/contracts": "^4.8.3", + "@openzeppelin/contracts": "^5.0.2", "@openzeppelin/test-helpers": "^0.5.16", "@trivago/prettier-plugin-sort-imports": "^4.0.0", "@typechain/ethers-v5": "^10.1.1", @@ -2237,9 +2244,9 @@ } }, "node_modules/@poolzfinance/poolz-helper-v2/node_modules/@types/node": { - "version": "20.14.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.2.tgz", - "integrity": "sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==", + "version": "20.14.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.5.tgz", + "integrity": "sha512-aoRR+fJkZT2l0aGOJhuA8frnCSoNX6W7U2mpNq63+BxBIj5BQFt8rHy627kijCmm63ijdSdwvGgpUsU6MBsZZA==", "dependencies": { "undici-types": "~5.26.4" } @@ -2258,9 +2265,9 @@ } }, "node_modules/@scure/base": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.6.tgz", - "integrity": "sha512-ok9AWwhcgYuGG3Zfhyqg+zwl+Wn5uE+dwC0NV/2qQkx4dABbb/bx96vWu8NSj+BNjjSjno+JRYRjle1jV08k3g==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.7.tgz", + "integrity": "sha512-PPNYBslrLNNUQ/Yad37MHYsNQtK67EhWb6WtSvNLLPo7SdVZgkUjD6Dg+5On7zNwmskf8OX7I7Nx5oN+MIWE0g==", "funding": { "url": "https://paulmillr.com/funding/" } @@ -2397,9 +2404,9 @@ } }, "node_modules/@smithy/types": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@smithy/types/-/types-3.0.0.tgz", - "integrity": "sha512-VvWuQk2RKFuOr98gFhjca7fkBS+xLLURT8bUjk5XQoV0ZLm7WPwWPPY3/AwzTLuUBDeoKDCthfe1AsTUWaSEhw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-3.2.0.tgz", + "integrity": "sha512-cKyeKAPazZRVqm7QPvcPD2jEIt2wqDPAL1KJKb0f/5I7uhollvsWZuZKLclmyP6a+Jwmr3OV3t+X0pZUUHS9BA==", "dependencies": { "tslib": "^2.6.2" }, @@ -4548,9 +4555,9 @@ "integrity": "sha512-dJvrYWxP/UcXm36Qn36fxhUKu8A/xMRXVT2cliFF1Z7UA9liG5Psj3ezNSZw+5puH2czDXRLcXQxf8JbJt0ejg==" }, "node_modules/@types/node": { - "version": "18.19.34", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.34.tgz", - "integrity": "sha512-eXF4pfBNV5DAMKGbI02NnDtWrQ40hAN558/2vvS4gMpMIxaf6JmD7YjnZbq0Q9TDSSkKBamime8ewRoomHdt4g==", + "version": "18.19.36", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.36.tgz", + "integrity": "sha512-tX1BNmYSWEvViftB26VLNxT6mEr37M7+ldUtq7rlKnv4/2fKYsJIOmqJAjT6h1DNuwQjIKgw3VJ/Dtw3yiTIQw==", "dependencies": { "undici-types": "~5.26.4" } @@ -4844,9 +4851,9 @@ } }, "node_modules/acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.0.tgz", + "integrity": "sha512-RTvkC4w+KNXrM39/lWCUaG0IbRkWdCv7W/IOW9oU6SawyxulvkQy5HQPVTKxEjczcUvapcrw3cFx/60VN/NRNw==", "bin": { "acorn": "bin/acorn" }, @@ -4864,9 +4871,12 @@ } }, "node_modules/acorn-walk": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", - "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", + "version": "8.3.3", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.3.tgz", + "integrity": "sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw==", + "dependencies": { + "acorn": "^8.11.0" + }, "engines": { "node": ">=0.4.0" } @@ -5406,6 +5416,20 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/body-parser/node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -8075,6 +8099,20 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/express/node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/ext": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", @@ -8313,9 +8351,9 @@ } }, "node_modules/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==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.1.tgz", + "integrity": "sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==", "dev": true, "dependencies": { "cross-spawn": "^7.0.0", @@ -8418,19 +8456,6 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -8950,15 +8975,16 @@ } }, "node_modules/hardhat-gas-reporter/node_modules/glob": { - "version": "10.4.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.1.tgz", - "integrity": "sha512-2jelhlq3E4ho74ZyVLN03oKdAZVUa6UDZzFLVH1H7dnoax+y9qyaq8zBkfDIggjniU19z0wU18y16jMB2eyVIw==", + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.2.tgz", + "integrity": "sha512-GwMlUF6PkPo3Gk21UxkCohOv0PLcIXVtKyLlpEI28R/cO/4eNOdmLk3CMW1wROV/WR/EsZOWAfBbBOqYvs88/w==", "dev": true, "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { @@ -9017,9 +9043,9 @@ } }, "node_modules/hardhat-gas-reporter/node_modules/typescript": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.2.tgz", + "integrity": "sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==", "dev": true, "optional": true, "peer": true, @@ -11500,6 +11526,12 @@ "node": ">=6" } }, + "node_modules/package-json-from-dist": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", + "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", + "dev": true + }, "node_modules/param-case": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/param-case/-/param-case-2.1.1.tgz", @@ -11801,9 +11833,9 @@ } }, "node_modules/prettier": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.1.tgz", - "integrity": "sha512-7CAwy5dRsxs8PHXT3twixW9/OEll8MLE0VRPCJyl7CkS6VHGPSlsVaWTiASPTyGyYRyApxlaWTzwUxVNrhcwDg==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.2.tgz", + "integrity": "sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==", "peer": true, "bin": { "prettier": "bin/prettier.cjs" @@ -11909,11 +11941,11 @@ ] }, "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "version": "6.12.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.12.1.tgz", + "integrity": "sha512-zWmv4RSuB9r2mYQw3zxQuHWeU+42aKi1wWig/j4ele4ygELZ7PEO6MM7rim9oAQH2A5MWfsAVf/jPvTPgCbvUQ==", "dependencies": { - "side-channel": "^1.0.4" + "side-channel": "^1.0.6" }, "engines": { "node": ">=0.6" diff --git a/package.json b/package.json index 0eb6d398..bb665e59 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ "main": "index.js", "dependencies": { "@ironblocks/firewall-consumer": "^1.0.13", - "@openzeppelin/contracts": "^4.8.3", - "@poolzfinance/poolz-helper-v2": "^2.3.5" + "@openzeppelin/contracts": "^5.0.2", + "@poolzfinance/poolz-helper-v2": "^3.0.0" }, "devDependencies": { "@ethersproject/bignumber": "^5.7.0", diff --git a/test/LockDealNFT.ts b/test/LockDealNFT.ts index 9fdc568a..fcd29fa9 100644 --- a/test/LockDealNFT.ts +++ b/test/LockDealNFT.ts @@ -100,8 +100,9 @@ describe('LockDealNFT', function () { it("should revert transferOwnership from not owner's address", async () => { const lockDealNFT: LockDealNFT = await deployed('LockDealNFT', mockVaultManager.address, ''); - await expect(lockDealNFT.connect(notOwner).transferOwnership(notOwner.address)).to.be.revertedWith( - 'Ownable: caller is not the owner', + await expect(lockDealNFT.connect(notOwner).transferOwnership(notOwner.address)).to.be.revertedWithCustomError( + lockDealNFT, + "OwnableUnauthorizedAccount" ); }); @@ -113,8 +114,9 @@ describe('LockDealNFT', function () { it("should revert renounceOwnership from not owner's address", async () => { const lockDealNFT: LockDealNFT = await deployed('LockDealNFT', mockVaultManager.address, ''); - await expect(lockDealNFT.connect(notOwner).renounceOwnership()).to.be.revertedWith( - 'Ownable: caller is not the owner', + await expect(lockDealNFT.connect(notOwner).renounceOwnership()).to.be.revertedWithCustomError( + lockDealNFT, + "OwnableUnauthorizedAccount" ); }); @@ -187,7 +189,7 @@ describe('LockDealNFT', function () { // Try to transfer the token without any approval. This should fail. await expect( lockDealNFT.connect(anotherAddress).transferFrom(initialOwner.address, newOwner.address, tokenId), - ).to.be.revertedWith('ERC721: transfer caller is not owner nor approved'); + ).to.be.revertedWith('Pool transfer not approved by user'); }); it('should set provider', async () => { @@ -251,8 +253,9 @@ describe('LockDealNFT', function () { it('should revert set baseURI for not owner', async () => { const baseURI = 'https://notOwner.finance/'; - await expect(lockDealNFT.connect(notOwner).setBaseURI(baseURI)).to.be.revertedWith( - 'Ownable: caller is not the owner', + await expect(lockDealNFT.connect(notOwner).setBaseURI(baseURI)).to.be.revertedWithCustomError( + lockDealNFT, + "OwnableUnauthorizedAccount" ); }); @@ -282,7 +285,7 @@ describe('LockDealNFT', function () { lockDealNFT .connect(notOwner) ['safeTransferFrom(address,address,uint256,bytes)'](receiver.address, lockDealNFT.address, poolId, packedData), - ).to.be.revertedWith('ERC721: caller is not token owner or approved'); + ).to.be.revertedWithCustomError(lockDealNFT, "ERC721InsufficientApproval"); }); it('should refresh all metadata', async () => {