diff --git a/.github/workflows/solidity-release.yml b/.github/workflows/solidity-release.yml index fc113b40e..7ed867ccd 100644 --- a/.github/workflows/solidity-release.yml +++ b/.github/workflows/solidity-release.yml @@ -39,7 +39,7 @@ jobs: run: pnpm install - name: Compile - run: pnpm run compile:upgradeable + run: pnpm run compile:modularized - name: Publish run: pnpm --filter=./typechain publish --no-git-checks @@ -97,3 +97,28 @@ jobs: run: pnpm publish --no-git-checks env: NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} + publish-contracts-modularized: + runs-on: ubuntu-latest + defaults: + run: + working-directory: contracts-modularized + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install pnpm + uses: pnpm/action-setup@v2.2.4 + with: + version: 7 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: 18.x + registry-url: https://npm.pkg.github.com/ + cache: 'pnpm' + + - name: Publish + run: pnpm publish --no-git-checks + env: + NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.versionrc b/.versionrc index ed5345d75..8d6b8f6aa 100644 --- a/.versionrc +++ b/.versionrc @@ -15,6 +15,10 @@ { "filename": "contracts-upgradeable/package.json", "type": "json" + }, + { + "filename": "contracts-modularized/package.json", + "type": "json" } ] } diff --git a/CHANGELOG.md b/CHANGELOG.md index 46053be73..af45427b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,80 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.3.2-beta.2](https://github.com/desoul-labs/soulhub-contracts/compare/v0.3.2-beta.1...v0.3.2-beta.2) (2023-05-17) + + +### Features + +* update core contract ([1c31f16](https://github.com/desoul-labs/soulhub-contracts/commit/1c31f16d3793ef1aa1d5876036124f68df140fbe)) + +### [0.3.2-beta.1](https://github.com/desoul-labs/soulhub-contracts/compare/v0.3.2...v0.3.2-beta.1) (2023-05-15) + +### Features + +- add ERC5727SlotSettable ([fd1b945](https://github.com/desoul-labs/soulhub-contracts/commit/fd1b945e8619ede4a2ae37e4b4e508988926829e)) + +### Bug Fixes + +- fix deploy script ([e2ac68d](https://github.com/desoul-labs/soulhub-contracts/commit/e2ac68d7032bf4ca8bcde186dc57532bd320b38e)) + +### [0.3.2](https://github.com/desoul-labs/soulhub-contracts/compare/v0.3.1...v0.3.2) (2023-05-15) + +### Bug Fixes + +- fix init contract ([ee8694b](https://github.com/desoul-labs/soulhub-contracts/commit/ee8694b0b2ced6b2ddd837a9fe8229454e1eb5ab)) + +### [0.3.1](https://github.com/desoul-labs/soulhub-contracts/compare/v0.3.0...v0.3.1) (2023-05-15) + +## [0.3.0](https://github.com/desoul-labs/soulhub-contracts/compare/v0.2.0-alpha.1...v0.3.0) (2023-05-15) + +### Features + +- add modularized contract ([#223](https://github.com/desoul-labs/soulhub-contracts/issues/223)) ([d5bc3d1](https://github.com/desoul-labs/soulhub-contracts/commit/d5bc3d160eef785ed771beb3ec1f1d4832f0187b)) +- add unit test & fix bugs ([#220](https://github.com/desoul-labs/soulhub-contracts/issues/220)) ([85ed7af](https://github.com/desoul-labs/soulhub-contracts/commit/85ed7af800df20d2d57b886cb8a72ee7b4aed7ff)) +- update soulhub contract ([dd42270](https://github.com/desoul-labs/soulhub-contracts/commit/dd422701f3c5b3803bbe56c9efa5487805d60ce1)) + +### Bug Fixes + +- fix typechain package ([2e519e7](https://github.com/desoul-labs/soulhub-contracts/commit/2e519e79a49ff8844543f41b45ddb81e432954ab)) +- merge dev ([06aeebf](https://github.com/desoul-labs/soulhub-contracts/commit/06aeebfe2a1a709504f3d901a30b6b47f3aa9a5e)) +- package.json ([f74a398](https://github.com/desoul-labs/soulhub-contracts/commit/f74a39821a87fc65a3bb9163dd30884139086268)) +- remove files ([487ba64](https://github.com/desoul-labs/soulhub-contracts/commit/487ba64686bb1f3ec81acf1899545c08ed158686)) + +## [0.3.0](https://github.com/desoul-labs/soulhub-contracts/compare/v0.2.0-alpha.1...v0.3.0) (2023-05-14) + +### Features + +- add modularized contract ([#223](https://github.com/desoul-labs/soulhub-contracts/issues/223)) ([d5bc3d1](https://github.com/desoul-labs/soulhub-contracts/commit/d5bc3d160eef785ed771beb3ec1f1d4832f0187b)) +- add unit test & fix bugs ([#220](https://github.com/desoul-labs/soulhub-contracts/issues/220)) ([85ed7af](https://github.com/desoul-labs/soulhub-contracts/commit/85ed7af800df20d2d57b886cb8a72ee7b4aed7ff)) +- update soulhub contract ([dd42270](https://github.com/desoul-labs/soulhub-contracts/commit/dd422701f3c5b3803bbe56c9efa5487805d60ce1)) + +### Bug Fixes + +- merge dev ([06aeebf](https://github.com/desoul-labs/soulhub-contracts/commit/06aeebfe2a1a709504f3d901a30b6b47f3aa9a5e)) +- package.json ([f74a398](https://github.com/desoul-labs/soulhub-contracts/commit/f74a39821a87fc65a3bb9163dd30884139086268)) +- remove files ([487ba64](https://github.com/desoul-labs/soulhub-contracts/commit/487ba64686bb1f3ec81acf1899545c08ed158686)) + +## [3.0.0](https://github.com/desoul-labs/soulhub-contracts/compare/v0.2.2...v3.0.0) (2023-05-14) + +## [3.0.0](https://github.com/desoul-labs/soulhub-contracts/compare/v0.2.2...v3.0.0) (2023-05-14) + +### [0.2.2](https://github.com/desoul-labs/soulhub-contracts/compare/v0.2.1...v0.2.2) (2023-05-14) + +### [0.2.1](https://github.com/desoul-labs/soulhub-contracts/compare/v0.2.0-alpha.1...v0.2.1) (2023-05-14) + +### Features + +- add modularized contract ([#223](https://github.com/desoul-labs/soulhub-contracts/issues/223)) ([d5bc3d1](https://github.com/desoul-labs/soulhub-contracts/commit/d5bc3d160eef785ed771beb3ec1f1d4832f0187b)) +- add unit test & fix bugs ([#220](https://github.com/desoul-labs/soulhub-contracts/issues/220)) ([85ed7af](https://github.com/desoul-labs/soulhub-contracts/commit/85ed7af800df20d2d57b886cb8a72ee7b4aed7ff)) +- update soulhub contract ([dd42270](https://github.com/desoul-labs/soulhub-contracts/commit/dd422701f3c5b3803bbe56c9efa5487805d60ce1)) + +### Bug Fixes + +- merge dev ([06aeebf](https://github.com/desoul-labs/soulhub-contracts/commit/06aeebfe2a1a709504f3d901a30b6b47f3aa9a5e)) +- package.json ([f74a398](https://github.com/desoul-labs/soulhub-contracts/commit/f74a39821a87fc65a3bb9163dd30884139086268)) +- remove files ([487ba64](https://github.com/desoul-labs/soulhub-contracts/commit/487ba64686bb1f3ec81acf1899545c08ed158686)) + ### [0.2.1-alpha.1](https://github.com/desoul-labs/soulhub-contracts/compare/v0.2.0-alpha.1...v0.2.1-alpha.1) (2023-03-29) ### Features diff --git a/constants/networks.ts b/constants/networks.ts index ace5aedd7..63d1b3dc8 100644 --- a/constants/networks.ts +++ b/constants/networks.ts @@ -89,4 +89,8 @@ export const networks: NetworksUserConfig = { url: 'https://rpc.tenderly.co/fork/fdc07e58-3d7e-4a61-b91f-0bf903e50439', accounts: [process.env.PRIVATE_KEY ?? ''], }, + astar: { + url: 'https://evm.astar.network/', + accounts: [process.env.PRIVATE_KEY ?? ''], + }, }; diff --git a/contracts-modularized/ERC5727/ERC5727DelegateUpgradeableDS.sol b/contracts-modularized/ERC5727/ERC5727DelegateUpgradeableDS.sol index cfe37d57c..3f9d2a404 100644 --- a/contracts-modularized/ERC5727/ERC5727DelegateUpgradeableDS.sol +++ b/contracts-modularized/ERC5727/ERC5727DelegateUpgradeableDS.sol @@ -2,12 +2,12 @@ pragma solidity ^0.8.0; import "./interfaces/IERC5727DelegateUpgradeable.sol"; -import "./ERC5727Core.sol"; +import "./ERC5727SlotSettableCore.sol"; import "./ERC5727Storage.sol"; contract ERC5727DelegateUpgradeableDS is IERC5727DelegateUpgradeable, - ERC5727Core + ERC5727SlotSettableCore { function __ERC5727Delegate_init() internal onlyInitializing { __ERC5727Delegate_init_unchained(); diff --git a/contracts-modularized/ERC5727/ERC5727EnumerableCore.sol b/contracts-modularized/ERC5727/ERC5727EnumerableCore.sol index 1f4049cab..995e2fdf2 100644 --- a/contracts-modularized/ERC5727/ERC5727EnumerableCore.sol +++ b/contracts-modularized/ERC5727/ERC5727EnumerableCore.sol @@ -11,12 +11,6 @@ contract ERC5727EnumerableCore is ERC5727Core, ERC3525SlotEnumerableCore { using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; using EnumerableMapUpgradeable for EnumerableMapUpgradeable.AddressToUintMap; - function __ERC5727Enumerable_init() internal onlyInitializing { - __ERC5727Enumerable_init_unchained(); - } - - function __ERC5727Enumerable_init_unchained() internal onlyInitializing {} - function slotCountOfOwner(address owner) internal view returns (uint256) { if (owner == address(0)) revert NullValue(); @@ -110,7 +104,16 @@ contract ERC5727EnumerableCore is ERC5727Core, ERC3525SlotEnumerableCore { uint256 slot, uint256 value ) internal virtual override(ERC3525SlotEnumerableCore, ERC5727Core) { - super._beforeValueTransfer( + ERC3525SlotEnumerableCore._beforeValueTransfer( + from, + to, + fromTokenId, + toTokenId, + slot, + value + ); + + ERC5727Core._beforeValueTransfer( from, to, fromTokenId, @@ -136,7 +139,7 @@ contract ERC5727EnumerableCore is ERC5727Core, ERC3525SlotEnumerableCore { uint256 slot, uint256 value ) internal virtual override(ERC3525SlotEnumerableCore, ERC3525Core) { - super._afterValueTransfer( + ERC3525SlotEnumerableCore._afterValueTransfer( from, to, fromTokenId, diff --git a/contracts-modularized/ERC5727/ERC5727EnumerableUpgradeableDS.sol b/contracts-modularized/ERC5727/ERC5727EnumerableUpgradeableDS.sol index 4570aac9a..56a6d490f 100644 --- a/contracts-modularized/ERC5727/ERC5727EnumerableUpgradeableDS.sol +++ b/contracts-modularized/ERC5727/ERC5727EnumerableUpgradeableDS.sol @@ -1,26 +1,53 @@ //SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; -import "./ERC5727Core.sol"; +import "./ERC5727UpgradeableDS.sol"; import "./interfaces/IERC5727EnumerableUpgradeable.sol"; -import "../ERC3525/ERC3525SlotEnumerableCore.sol"; +import "../ERC3525/ERC3525SlotEnumerableUpgradeableDS.sol"; import "./ERC5727EnumerableStorage.sol"; contract ERC5727EnumerableUpgradeableDS is - ERC5727Core, - ERC3525SlotEnumerableCore + IERC5727EnumerableUpgradeable, + ERC5727UpgradeableDS, + ERC3525SlotEnumerableUpgradeableDS { using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet; using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; using EnumerableMapUpgradeable for EnumerableMapUpgradeable.AddressToUintMap; - function __ERC5727Enumerable_init() internal onlyInitializing { + function init( + string memory name_, + string memory symbol_, + address admin_, + string memory baseUri_, + string memory version_ + ) external virtual override initializer { + __EIP712_init_unchained(name_, version_); + __ERC721_init_unchained(name_, symbol_, baseUri_); + __ERC3525_init_unchained(18); + __ERC5727_init_unchained(admin_); __ERC5727Enumerable_init_unchained(); } function __ERC5727Enumerable_init_unchained() internal onlyInitializing {} - function slotCountOfOwner(address owner) external view returns (uint256) { + function supportsInterface( + bytes4 interfaceId + ) + public + view + virtual + override(IERC165Upgradeable, ERC3525UpgradeableDS, ERC5727UpgradeableDS) + returns (bool) + { + return + interfaceId == type(IERC5727EnumerableUpgradeable).interfaceId || + super.supportsInterface(interfaceId); + } + + function slotCountOfOwner( + address owner + ) external view override returns (uint256) { if (owner == address(0)) revert NullValue(); return LibERC5727EnumerableStorage.s()._slotsOfOwner[owner].length(); @@ -29,7 +56,7 @@ contract ERC5727EnumerableUpgradeableDS is function slotOfOwnerByIndex( address owner, uint256 index - ) external view returns (uint256) { + ) external view override returns (uint256) { if (owner == address(0)) revert NullValue(); uint256 slotCountByOwner = LibERC5727EnumerableStorage .s() @@ -44,7 +71,7 @@ contract ERC5727EnumerableUpgradeableDS is function ownerBalanceInSlot( address owner, uint256 slot - ) public view returns (uint256) { + ) public view override returns (uint256) { if (owner == address(0)) revert NullValue(); if (!_slotExists(slot)) revert NotFound(slot); @@ -95,16 +122,14 @@ contract ERC5727EnumerableUpgradeableDS is address to, uint256 firstTokenId, uint256 batchSize - ) internal virtual override(ERC721EnumerableCore, ERC5727Core) { + ) + internal + virtual + override(ERC721EnumerableUpgradeable, ERC5727UpgradeableDS) + { super._beforeTokenTransfer(from, to, firstTokenId, batchSize); } - function _burn( - uint256 tokenId - ) internal virtual override(ERC3525Core, ERC5727Core) { - ERC5727Core._burn(tokenId); - } - function _beforeValueTransfer( address from, address to, @@ -112,8 +137,21 @@ contract ERC5727EnumerableUpgradeableDS is uint256 toTokenId, uint256 slot, uint256 value - ) internal virtual override(ERC3525SlotEnumerableCore, ERC5727Core) { - super._beforeValueTransfer( + ) + internal + virtual + override(ERC3525SlotEnumerableUpgradeableDS, ERC5727UpgradeableDS) + { + ERC3525SlotEnumerableUpgradeableDS._beforeValueTransfer( + from, + to, + fromTokenId, + toTokenId, + slot, + value + ); + + ERC5727UpgradeableDS._beforeValueTransfer( from, to, fromTokenId, @@ -138,8 +176,12 @@ contract ERC5727EnumerableUpgradeableDS is uint256 toTokenId, uint256 slot, uint256 value - ) internal virtual override(ERC3525SlotEnumerableCore, ERC3525Core) { - super._afterValueTransfer( + ) + internal + virtual + override(ERC3525SlotEnumerableUpgradeableDS, ERC3525UpgradeableDS) + { + ERC3525SlotEnumerableUpgradeableDS._afterValueTransfer( from, to, fromTokenId, diff --git a/contracts-modularized/ERC5727/ERC5727ExpirableUpgradeableDS.sol b/contracts-modularized/ERC5727/ERC5727ExpirableUpgradeableDS.sol index b5f51e8d4..c1455159b 100644 --- a/contracts-modularized/ERC5727/ERC5727ExpirableUpgradeableDS.sol +++ b/contracts-modularized/ERC5727/ERC5727ExpirableUpgradeableDS.sol @@ -1,14 +1,14 @@ //SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; -import "./ERC5727Core.sol"; +import "./ERC5727SlotSettableCore.sol"; import "./interfaces/IERC5727ExpirableUpgradeable.sol"; import "./ERC5727Storage.sol"; import "./ERC5727ExpirableUpgradeableStorage.sol"; contract ERC5727ExpirableUpgradeableDS is IERC5727ExpirableUpgradeable, - ERC5727Core + ERC5727SlotSettableCore { modifier onlyManager(uint256 tokenId) { if ( diff --git a/contracts-modularized/ERC5727/ERC5727GovernanceUpgradeableDS.sol b/contracts-modularized/ERC5727/ERC5727GovernanceUpgradeableDS.sol index d18d9eb53..da4f43f17 100644 --- a/contracts-modularized/ERC5727/ERC5727GovernanceUpgradeableDS.sol +++ b/contracts-modularized/ERC5727/ERC5727GovernanceUpgradeableDS.sol @@ -1,13 +1,13 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; -import "./ERC5727Core.sol"; +import "./ERC5727SlotSettableCore.sol"; import "./interfaces/IERC5727GovernanceUpgradeable.sol"; import "./ERC5727GovernanceStorage.sol"; contract ERC5727GovernanceUpgradeableDS is IERC5727GovernanceUpgradeable, - ERC5727Core + ERC5727SlotSettableCore { using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet; diff --git a/contracts-modularized/ERC5727/ERC5727RecoveryUpgradeableDS.sol b/contracts-modularized/ERC5727/ERC5727RecoveryUpgradeableDS.sol index 3169f76b6..4907894b9 100644 --- a/contracts-modularized/ERC5727/ERC5727RecoveryUpgradeableDS.sol +++ b/contracts-modularized/ERC5727/ERC5727RecoveryUpgradeableDS.sol @@ -3,11 +3,11 @@ pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol"; -import "./ERC5727EnumerableCore.sol"; +import "./ERC5727SlotSettableCore.sol"; import "./interfaces/IERC5727RecoveryUpgradeable.sol"; import "./ERC5727Storage.sol"; -contract ERC5727RecoveryUpgradeableDS is ERC5727EnumerableCore { +contract ERC5727RecoveryUpgradeableDS is ERC5727SlotSettableCore { event Recovered(address indexed from, address indexed to); using ECDSAUpgradeable for bytes32; diff --git a/contracts-modularized/ERC5727/ERC5727SlotSettableCore.sol b/contracts-modularized/ERC5727/ERC5727SlotSettableCore.sol new file mode 100644 index 000000000..e3bc21163 --- /dev/null +++ b/contracts-modularized/ERC5727/ERC5727SlotSettableCore.sol @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.0; + +import "./ERC5727EnumerableCore.sol"; +import "../ERC5484/interfaces/IERC5484Upgradeable.sol"; +import "./ERC5727SlotSettableStorage.sol"; +import "../ERC3525/ERC3525Storage.sol"; + +contract ERC5727SlotSettableCore is ERC5727EnumerableCore { + using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet; + + function _beforeTokenTransfer( + address from, + address to, + uint256 firstTokenId, + uint256 batchSize + ) internal virtual override(ERC5727EnumerableCore) { + super._beforeTokenTransfer(from, to, firstTokenId, batchSize); + } + + function _beforeValueTransfer( + address from, + address to, + uint256 fromTokenId, + uint256 toTokenId, + uint256 slot, + uint256 value + ) internal virtual override(ERC5727EnumerableCore) { + ERC5727EnumerableCore._beforeValueTransfer( + from, + to, + fromTokenId, + toTokenId, + slot, + value + ); + if (from == address(0)) { + if ( + LibERC5727SlotSettableStorage.s()._maxSupply[slot] != 0 && + tokenSupplyInSlot(slot) + 1 > + LibERC5727SlotSettableStorage.s()._maxSupply[slot] + ) + revert ExceedsMaxSupply( + LibERC5727SlotSettableStorage.s()._maxSupply[slot] + ); + } + } + + function _afterValueTransfer( + address from, + address to, + uint256 fromTokenId, + uint256 toTokenId, + uint256 slot, + uint256 value + ) internal virtual override(ERC5727EnumerableCore) { + ERC5727EnumerableCore._afterValueTransfer( + from, + to, + fromTokenId, + toTokenId, + slot, + value + ); + } +} diff --git a/contracts-modularized/ERC5727/ERC5727SlotSettableStorage.sol b/contracts-modularized/ERC5727/ERC5727SlotSettableStorage.sol new file mode 100644 index 000000000..287a74b7c --- /dev/null +++ b/contracts-modularized/ERC5727/ERC5727SlotSettableStorage.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol"; +import "../ERC5484/interfaces/IERC5484Upgradeable.sol"; + +library LibERC5727SlotSettableStorage { + using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet; + bytes32 constant DIAMOND_STORAGE_POSITION = + keccak256("diamond.erc5727SlotSettable.storage"); + + struct ERC5727SlotSettableStorage { + mapping(uint256 => uint256) _maxSupply; + // slot -> period + mapping(uint256 => uint64) _expiration; + // slot -> burnAuth + mapping(uint256 => IERC5484Upgradeable.BurnAuth) _burnAuth; + } + + function s() internal pure returns (ERC5727SlotSettableStorage storage ds) { + bytes32 position = DIAMOND_STORAGE_POSITION; + assembly { + ds.slot := position + } + } +} diff --git a/contracts-modularized/ERC5727/ERC5727SlotSettableUpgradeableDS.sol b/contracts-modularized/ERC5727/ERC5727SlotSettableUpgradeableDS.sol new file mode 100644 index 000000000..6aa356962 --- /dev/null +++ b/contracts-modularized/ERC5727/ERC5727SlotSettableUpgradeableDS.sol @@ -0,0 +1,118 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.0; + +import "./ERC5727EnumerableUpgradeableDS.sol"; +import "../ERC5484/interfaces/IERC5484Upgradeable.sol"; +import "./ERC5727SlotSettableStorage.sol"; +import "../ERC3525/ERC3525Storage.sol"; + +contract ERC5727SlotSettableUpgradeableDS is ERC5727EnumerableUpgradeableDS { + using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet; + + function init( + string memory name_, + string memory symbol_, + address admin_, + string memory baseUri_, + string memory version_ + ) external virtual override initializer { + __EIP712_init_unchained(name_, version_); + __ERC721_init_unchained(name_, symbol_, baseUri_); + __ERC3525_init_unchained(18); + __ERC5727_init_unchained(admin_); + __ERC5727Enumerable_init_unchained(); + __ERC5727SlotSettable_init_unchained(); + } + + function __ERC5727SlotSettable_init_unchained() internal onlyInitializing {} + + function _beforeTokenTransfer( + address from, + address to, + uint256 firstTokenId, + uint256 batchSize + ) internal virtual override(ERC5727EnumerableUpgradeableDS) { + super._beforeTokenTransfer(from, to, firstTokenId, batchSize); + } + + function _beforeValueTransfer( + address from, + address to, + uint256 fromTokenId, + uint256 toTokenId, + uint256 slot, + uint256 value + ) internal virtual override(ERC5727EnumerableUpgradeableDS) { + ERC5727EnumerableUpgradeableDS._beforeValueTransfer( + from, + to, + fromTokenId, + toTokenId, + slot, + value + ); + if (from == address(0)) { + if ( + LibERC5727SlotSettableStorage.s()._maxSupply[slot] != 0 && + tokenSupplyInSlot(slot) + 1 > + LibERC5727SlotSettableStorage.s()._maxSupply[slot] + ) + revert ExceedsMaxSupply( + LibERC5727SlotSettableStorage.s()._maxSupply[slot] + ); + } + } + + function _afterValueTransfer( + address from, + address to, + uint256 fromTokenId, + uint256 toTokenId, + uint256 slot, + uint256 value + ) internal virtual override(ERC5727EnumerableUpgradeableDS) { + ERC5727EnumerableUpgradeableDS._afterValueTransfer( + from, + to, + fromTokenId, + toTokenId, + slot, + value + ); + } + + function setupSlot( + IERC5484Upgradeable.BurnAuth burnAuth, + uint256 maxSupply + ) external onlyAdmin { + uint256 slot = slotCount() + 1; + LibERC5727SlotSettableStorage.s()._maxSupply[slot] = maxSupply; + LibERC5727SlotSettableStorage.s()._burnAuth[slot] = burnAuth; + + LibERC3525SlotEnumerableStorage.s()._allSlots.add(slot); + } + + function getMaxSupply(uint256 slot) external view returns (uint256) { + return LibERC5727SlotSettableStorage.s()._maxSupply[slot]; + } + + function batchIssue( + address[] calldata to, + uint256 slot, + string calldata uri, + bytes calldata data + ) external virtual onlyAdmin { + uint256 next = totalSupply() + 1; + for (uint256 i = 0; i < to.length; i++) { + issue( + to[i], + next + i, + slot, + LibERC5727SlotSettableStorage.s()._burnAuth[slot], + address(this), + data + ); + _setTokenURI(next + i, uri); + } + } +} diff --git a/contracts-modularized/ERC5727/ERC5727UpgradeableDS.sol b/contracts-modularized/ERC5727/ERC5727UpgradeableDS.sol index f2abb3a3c..b121c97b3 100644 --- a/contracts-modularized/ERC5727/ERC5727UpgradeableDS.sol +++ b/contracts-modularized/ERC5727/ERC5727UpgradeableDS.sol @@ -55,16 +55,19 @@ contract ERC5727UpgradeableDS is function init( string memory name_, string memory symbol_, + address admin_, string memory baseUri_, string memory version_ - ) external initializer { + ) external virtual initializer { __EIP712_init_unchained(name_, version_); __ERC721_init_unchained(name_, symbol_, baseUri_); __ERC3525_init_unchained(18); - __ERC5727_init_unchained(); + __ERC5727_init_unchained(admin_); } - function __ERC5727_init_unchained() internal onlyInitializing {} + function __ERC5727_init_unchained( + address admin_ + ) internal onlyInitializing {} function verifierOf( uint256 tokenId diff --git a/contracts-modularized/core/SoulHubModularized.sol b/contracts-modularized/core/SoulHubUpgradeable.sol similarity index 63% rename from contracts-modularized/core/SoulHubModularized.sol rename to contracts-modularized/core/SoulHubUpgradeable.sol index b9002046f..ed1d6b30a 100644 --- a/contracts-modularized/core/SoulHubModularized.sol +++ b/contracts-modularized/core/SoulHubUpgradeable.sol @@ -5,9 +5,10 @@ import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol" import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableMapUpgradeable.sol"; import "../../contracts-upgradeable/ERC721/ERC721EnumerableUpgradeable.sol"; +import "../diamond/interfaces/IDiamond.sol"; import "../diamond/Diamond.sol"; -contract SoulHubModularized is ERC721EnumerableUpgradeable { +contract SoulHubUpgradeable is ERC721EnumerableUpgradeable { using EnumerableMapUpgradeable for EnumerableMapUpgradeable.AddressToUintMap; event OrganizationCreated( @@ -20,13 +21,43 @@ contract SoulHubModularized is ERC721EnumerableUpgradeable { mapping(uint256 => address) private _organizations; mapping(address => EnumerableMapUpgradeable.AddressToUintMap) private _members; - - function __SoulHub_init() public initializer { + IDiamondCut.FacetCut[] private _initDiamondCut; + address private _initAddress; + + function __SoulHub_init( + uint256 index, + address[] memory facetAddress, + IDiamond.FacetCutAction[] memory action, + bytes4[][] memory selectors, + address initAddress_ + ) public initializer { __ERC721_init_unchained("SoulHub", "SOUL"); - __SoulHub_init_unchained(); + __SoulHub_init_unchained( + index, + facetAddress, + action, + selectors, + initAddress_ + ); } - function __SoulHub_init_unchained() internal onlyInitializing {} + function __SoulHub_init_unchained( + uint256 index, + address[] memory facetAddress, + IDiamond.FacetCutAction[] memory action, + bytes4[][] memory selectors, + address initAddress_ + ) internal onlyInitializing { + for (uint i = 0; i < index; i++) { + IDiamond.FacetCut memory tmp = IDiamond.FacetCut( + facetAddress[i], + action[i], + selectors[i] + ); + _initDiamondCut.push(tmp); + } + _initAddress = initAddress_; + } function _baseURI() internal view virtual override returns (string memory) { return "https://soulhub.dev/"; @@ -48,10 +79,37 @@ contract SoulHubModularized is ERC721EnumerableUpgradeable { } function createOrganization( - IDiamondCut.FacetCut[] memory _diamondCut, - DiamondArgs memory _args + string memory name ) external payable returns (address) { - Diamond diamond = new Diamond(_diamondCut, _args); + bytes memory coreInitData = abi.encodeWithSignature( + "init(string,string,address,string,string)", + name, + name, + _msgSender(), + _baseURI(), + "v1" + ); + bytes memory governanceInitData = abi.encodeWithSignature( + "init(address)", + _msgSender() + ); + address[] memory facetAddress = new address[](2); + bytes[] memory facetData = new bytes[](2); + facetAddress[0] = _initDiamondCut[2].facetAddress; + facetAddress[1] = _initDiamondCut[4].facetAddress; + facetData[0] = coreInitData; + facetData[1] = governanceInitData; + bytes memory multiInitData = abi.encodeWithSignature( + "multiInit(address[],bytes[])", + facetAddress, + facetData + ); + DiamondArgs memory _args = DiamondArgs({ + owner: _msgSender(), + init: _initAddress, + initCalldata: multiInitData + }); + Diamond diamond = new Diamond(_initDiamondCut, _args); emit OrganizationCreated(_msgSender(), address(diamond)); uint256 nextId = totalSupply() + 1; diff --git a/contracts-modularized/diamond/initializers/DiamondMultiInit.sol b/contracts-modularized/diamond/initializers/DiamondMultiInit.sol index e290878b6..e04ae7703 100644 --- a/contracts-modularized/diamond/initializers/DiamondMultiInit.sol +++ b/contracts-modularized/diamond/initializers/DiamondMultiInit.sol @@ -9,6 +9,10 @@ pragma solidity ^0.8.0; /******************************************************************************/ import {LibDiamond} from "../libraries/LibDiamond.sol"; +import {IDiamondLoupe} from "../interfaces/IDiamondLoupe.sol"; +import {IDiamondCut} from "../interfaces/IDiamondCut.sol"; +import {IERC173} from "../../ERC173/interfaces/IERC173.sol"; +import {IERC165Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol"; error AddressAndCalldataLengthDoNotMatch( uint256 _addressesLength, @@ -29,6 +33,11 @@ library DiamondMultiInit { address[] calldata _addresses, bytes[] calldata _calldata ) external { + LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage(); + ds.supportedInterfaces[type(IERC165Upgradeable).interfaceId] = true; + ds.supportedInterfaces[type(IDiamondCut).interfaceId] = true; + ds.supportedInterfaces[type(IDiamondLoupe).interfaceId] = true; + ds.supportedInterfaces[type(IERC173).interfaceId] = true; if (_addresses.length != _calldata.length) { revert AddressAndCalldataLengthDoNotMatch( _addresses.length, diff --git a/contracts-modularized/package.json b/contracts-modularized/package.json index 4dfcbf6b3..f176900f9 100644 --- a/contracts-modularized/package.json +++ b/contracts-modularized/package.json @@ -1,6 +1,6 @@ { - "name": "@desoul-labs/soulhub-contracts-upgradeable", - "version": "0.2.1-alpha.1", + "name": "@desoul-labs/soulhub-contracts-modularized", + "version": "0.3.2-beta.2", "description": "SoulHub Contracts", "homepage": "https://github.com/desoul-labs/soulhub-contracts#readme", "bugs": { diff --git a/contracts-modularized/proxy/BeaconProxy.sol b/contracts-modularized/proxy/BeaconProxy.sol deleted file mode 100644 index 23d0a2be6..000000000 --- a/contracts-modularized/proxy/BeaconProxy.sol +++ /dev/null @@ -1,65 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.0; - -import "@openzeppelin/contracts/proxy/beacon/IBeacon.sol"; -import "@openzeppelin/contracts/proxy/Proxy.sol"; -import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol"; - -/** - * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}. - * - * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't - * conflict with the storage layout of the implementation behind the proxy. - * - * _Available since v3.4._ - */ -contract BeaconProxy is Proxy, ERC1967Upgrade { - /** - * @dev Initializes the proxy with `beacon`. - * - * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This - * will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity - * constructor. - * - * Requirements: - * - * - `beacon` must be a contract with the interface {IBeacon}. - */ - constructor(address beacon, bytes memory data) payable { - _upgradeBeaconToAndCall(beacon, data, false); - } - - /** - * @dev Returns the current beacon address. - */ - function _beacon() internal view virtual returns (address) { - return _getBeacon(); - } - - /** - * @dev Returns the current implementation address of the associated beacon. - */ - function _implementation() - internal - view - virtual - override - returns (address) - { - return IBeacon(_getBeacon()).implementation(); - } - - /** - * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}. - * - * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. - * - * Requirements: - * - * - `beacon` must be a contract. - * - The implementation returned by `beacon` must be a contract. - */ - function _setBeacon(address beacon, bytes memory data) internal virtual { - _upgradeBeaconToAndCall(beacon, data, false); - } -} diff --git a/contracts-modularized/proxy/DiamondProxy.sol b/contracts-modularized/proxy/DiamondProxy.sol deleted file mode 100644 index e99d74c0c..000000000 --- a/contracts-modularized/proxy/DiamondProxy.sol +++ /dev/null @@ -1,368 +0,0 @@ -//SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.0; - -import "./interfaces/IDiamondCut.sol"; -import "./interfaces/IDiamondLoupe.sol"; -import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; -import "@openzeppelin/contracts/access/Ownable.sol"; - -contract DiamondProxy is Ownable, IDiamond { - // more arguments are added to this struct - // this avoids stack too deep errors - struct DiamondArgs { - address owner; - } - - constructor( - IDiamondCut.FacetCut[] memory _diamondCuts, - DiamondArgs memory _args - ) payable { - _diamondCut(_diamondCuts, address(0), new bytes(0)); - transferOwnership(_args.owner); - - DiamondStorage storage ds = _diamondStorage(); - - // adding ERC165 data - ds.supportedInterfaces[type(IERC165).interfaceId] = true; - ds.supportedInterfaces[type(IDiamondCut).interfaceId] = true; - ds.supportedInterfaces[type(IDiamondLoupe).interfaceId] = true; - ds.supportedInterfaces[type(Ownable).interfaceId] = true; - } - - // Find facet for function that is called and execute the - // function if a facet is found and return any value. - fallback() external payable { - DiamondStorage storage ds; - bytes32 position = DIAMOND_STORAGE_POSITION; - assembly { - ds.slot := position - } - address facet = ds.selectorToFacetAndPosition[msg.sig].facetAddress; - require(facet != address(0), "Diamond: Function does not exist"); - assembly { - calldatacopy(0, 0, calldatasize()) - let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0) - returndatacopy(0, 0, returndatasize()) - switch result - case 0 { - revert(0, returndatasize()) - } - default { - return(0, returndatasize()) - } - } - } - - receive() external payable {} - - bytes32 constant DIAMOND_STORAGE_POSITION = - keccak256("diamond.standard.diamond.storage"); - - struct FacetAddressAndPosition { - address facetAddress; - uint16 functionSelectorPosition; // position in facetFunctionSelectors.functionSelectors array - } - - struct FacetFunctionSelectors { - bytes4[] functionSelectors; - uint16 facetAddressPosition; // position of facetAddress in facetAddresses array - } - - struct DiamondStorage { - // maps function selector to the facet address and - // the position of the selector in the facetFunctionSelectors.selectors array - mapping(bytes4 => FacetAddressAndPosition) selectorToFacetAndPosition; - // maps facet addresses to function selectors - mapping(address => FacetFunctionSelectors) facetFunctionSelectors; - // facet addresses - address[] facetAddresses; - // Used to query if a contract implements an interface. - // Used to implement ERC-165. - mapping(bytes4 => bool) supportedInterfaces; - // owner of the contract - address contractOwner; - } - - function _diamondStorage() - internal - pure - returns (DiamondStorage storage ds) - { - bytes32 position = DIAMOND_STORAGE_POSITION; - assembly { - ds.slot := position - } - } - - // Internal function version of diamondCut - function _diamondCut( - IDiamondCut.FacetCut[] memory _diamondCut, - address _init, - bytes memory _calldata - ) internal { - for ( - uint256 facetIndex; - facetIndex < _diamondCut.length; - facetIndex++ - ) { - IDiamond.FacetCutAction action = _diamondCut[facetIndex].action; - if (action == IDiamond.FacetCutAction.Add) { - _addFunctions( - _diamondCut[facetIndex].facetAddress, - _diamondCut[facetIndex].functionSelectors - ); - } else if (action == IDiamond.FacetCutAction.Replace) { - _replaceFunctions( - _diamondCut[facetIndex].facetAddress, - _diamondCut[facetIndex].functionSelectors - ); - } else if (action == IDiamond.FacetCutAction.Remove) { - _removeFunctions( - _diamondCut[facetIndex].facetAddress, - _diamondCut[facetIndex].functionSelectors - ); - } else { - revert("DiamondProxy: Incorrect FacetCutAction"); - } - } - emit DiamondCut(_diamondCut, _init, _calldata); - _initializeDiamondCut(_init, _calldata); - } - - function _addFunctions( - address _facetAddress, - bytes4[] memory _functionSelectors - ) internal { - require( - _functionSelectors.length > 0, - "DiamondProxy: No selectors in facet to cut" - ); - DiamondStorage storage ds = _diamondStorage(); - // uint16 selectorCount = uint16(diamondStorage().selectors.length); - require( - _facetAddress != address(0), - "DiamondProxy: Add facet can't be address(0)" - ); - uint16 selectorPosition = uint16( - ds.facetFunctionSelectors[_facetAddress].functionSelectors.length - ); - // add new facet address if it does not exist - if (selectorPosition == 0) { - _enforceHasContractCode( - _facetAddress, - "DiamondProxy: New facet has no code" - ); - ds - .facetFunctionSelectors[_facetAddress] - .facetAddressPosition = uint16(ds.facetAddresses.length); - ds.facetAddresses.push(_facetAddress); - } - for ( - uint256 selectorIndex; - selectorIndex < _functionSelectors.length; - selectorIndex++ - ) { - bytes4 selector = _functionSelectors[selectorIndex]; - address oldFacetAddress = ds - .selectorToFacetAndPosition[selector] - .facetAddress; - require( - oldFacetAddress == address(0), - "DiamondProxy: Can't add function that already exists" - ); - ds.facetFunctionSelectors[_facetAddress].functionSelectors.push( - selector - ); - ds - .selectorToFacetAndPosition[selector] - .facetAddress = _facetAddress; - ds - .selectorToFacetAndPosition[selector] - .functionSelectorPosition = selectorPosition; - selectorPosition++; - } - } - - function _replaceFunctions( - address _facetAddress, - bytes4[] memory _functionSelectors - ) internal { - require( - _functionSelectors.length > 0, - "DiamondProxy: No selectors in facet to cut" - ); - DiamondStorage storage ds = _diamondStorage(); - require( - _facetAddress != address(0), - "DiamondProxy: Add facet can't be address(0)" - ); - uint16 selectorPosition = uint16( - ds.facetFunctionSelectors[_facetAddress].functionSelectors.length - ); - // add new facet address if it does not exist - if (selectorPosition == 0) { - _enforceHasContractCode( - _facetAddress, - "DiamondProxy: New facet has no code" - ); - ds - .facetFunctionSelectors[_facetAddress] - .facetAddressPosition = uint16(ds.facetAddresses.length); - ds.facetAddresses.push(_facetAddress); - } - for ( - uint256 selectorIndex; - selectorIndex < _functionSelectors.length; - selectorIndex++ - ) { - bytes4 selector = _functionSelectors[selectorIndex]; - address oldFacetAddress = ds - .selectorToFacetAndPosition[selector] - .facetAddress; - require( - oldFacetAddress != _facetAddress, - "DiamondProxy: Can't replace function with same function" - ); - _removeFunction(oldFacetAddress, selector); - // add function - ds - .selectorToFacetAndPosition[selector] - .functionSelectorPosition = selectorPosition; - ds.facetFunctionSelectors[_facetAddress].functionSelectors.push( - selector - ); - ds - .selectorToFacetAndPosition[selector] - .facetAddress = _facetAddress; - selectorPosition++; - } - } - - function _removeFunctions( - address _facetAddress, - bytes4[] memory _functionSelectors - ) internal { - require( - _functionSelectors.length > 0, - "DiamondProxy: No selectors in facet to cut" - ); - DiamondStorage storage ds = _diamondStorage(); - // if function does not exist then do nothing and return - require( - _facetAddress == address(0), - "DiamondProxy: Remove facet address must be address(0)" - ); - for ( - uint256 selectorIndex; - selectorIndex < _functionSelectors.length; - selectorIndex++ - ) { - bytes4 selector = _functionSelectors[selectorIndex]; - address oldFacetAddress = ds - .selectorToFacetAndPosition[selector] - .facetAddress; - _removeFunction(oldFacetAddress, selector); - } - } - - function _removeFunction(address _facetAddress, bytes4 _selector) internal { - DiamondStorage storage ds = _diamondStorage(); - require( - _facetAddress != address(0), - "DiamondProxy: Can't remove function that doesn't exist" - ); - // an immutable function is a function defined directly in a diamond - require( - _facetAddress != address(this), - "DiamondProxy: Can't remove immutable function" - ); - // replace selector with last selector, then delete last selector - uint256 selectorPosition = ds - .selectorToFacetAndPosition[_selector] - .functionSelectorPosition; - uint256 lastSelectorPosition = ds - .facetFunctionSelectors[_facetAddress] - .functionSelectors - .length - 1; - // if not the same then replace _selector with lastSelector - if (selectorPosition != lastSelectorPosition) { - bytes4 lastSelector = ds - .facetFunctionSelectors[_facetAddress] - .functionSelectors[lastSelectorPosition]; - ds.facetFunctionSelectors[_facetAddress].functionSelectors[ - selectorPosition - ] = lastSelector; - ds - .selectorToFacetAndPosition[lastSelector] - .functionSelectorPosition = uint16(selectorPosition); - } - // delete the last selector - ds.facetFunctionSelectors[_facetAddress].functionSelectors.pop(); - delete ds.selectorToFacetAndPosition[_selector]; - - // if no more selectors for facet address then delete the facet address - if (lastSelectorPosition == 0) { - // replace facet address with last facet address and delete last facet address - uint256 lastFacetAddressPosition = ds.facetAddresses.length - 1; - uint256 facetAddressPosition = ds - .facetFunctionSelectors[_facetAddress] - .facetAddressPosition; - if (facetAddressPosition != lastFacetAddressPosition) { - address lastFacetAddress = ds.facetAddresses[ - lastFacetAddressPosition - ]; - ds.facetAddresses[facetAddressPosition] = lastFacetAddress; - ds - .facetFunctionSelectors[lastFacetAddress] - .facetAddressPosition = uint16(facetAddressPosition); - } - ds.facetAddresses.pop(); - delete ds - .facetFunctionSelectors[_facetAddress] - .facetAddressPosition; - } - } - - function _initializeDiamondCut( - address _init, - bytes memory _calldata - ) internal { - if (_init == address(0)) { - require( - _calldata.length == 0, - "DiamondProxy: _init is address(0) but_calldata is not empty" - ); - } else { - require( - _calldata.length > 0, - "DiamondProxy: _calldata is empty but _init is not address(0)" - ); - if (_init != address(this)) { - _enforceHasContractCode( - _init, - "DiamondProxy: _init address has no code" - ); - } - (bool success, bytes memory error) = _init.delegatecall(_calldata); - if (!success) { - if (error.length > 0) { - // bubble up the error - revert(string(error)); - } else { - revert("DiamondProxy: _init function reverted"); - } - } - } - } - - function _enforceHasContractCode( - address _contract, - string memory _errorMessage - ) internal view { - uint256 contractSize; - assembly { - contractSize := extcodesize(_contract) - } - require(contractSize > 0, _errorMessage); - } -} diff --git a/contracts-modularized/proxy/MinimalProxyFactory.sol b/contracts-modularized/proxy/MinimalProxyFactory.sol deleted file mode 100644 index dfbaf526d..000000000 --- a/contracts-modularized/proxy/MinimalProxyFactory.sol +++ /dev/null @@ -1,49 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.11; - -import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; -import "@openzeppelin/contracts/metatx/ERC2771Context.sol"; -import "@openzeppelin/contracts/utils/Create2.sol"; -import "@openzeppelin/contracts/utils/Multicall.sol"; -import "@openzeppelin/contracts/proxy/Clones.sol"; - -contract MinimalProxyFactory is Multicall, ERC2771Context { - /// @dev Emitted when a proxy is deployed. - event ProxyDeployed( - address indexed implementation, - address proxy, - address indexed deployer - ); - - /// @dev mapping of proxy address to deployer address - mapping(address => address) public deployer; - - constructor(address _trustedForwarder) ERC2771Context(_trustedForwarder) {} - - /// @dev Deploys a proxy that points to the given implementation. - function deployProxyByImplementation( - address _implementation, - bytes memory _data, - bytes32 _salt - ) external returns (address deployedProxy) { - bytes32 salthash = keccak256(abi.encodePacked(_msgSender(), _salt)); - deployedProxy = Clones.cloneDeterministic(_implementation, salthash); - - deployer[deployedProxy] = _msgSender(); - - emit ProxyDeployed(_implementation, deployedProxy, _msgSender()); - - if (_data.length > 0) { - // slither-disable-next-line unused-return - Address.functionCall(deployedProxy, _data); - } - } - - function calculateProxyAddressByImplementation( - address _implementation, - bytes32 _salt - ) external view returns (address) { - bytes32 salthash = keccak256(abi.encodePacked(_msgSender(), _salt)); - return Clones.predictDeterministicAddress(_implementation, salthash); - } -} diff --git a/contracts-modularized/proxy/TransparentUpgradeableProxy.sol b/contracts-modularized/proxy/TransparentUpgradeableProxy.sol deleted file mode 100644 index ef49f8731..000000000 --- a/contracts-modularized/proxy/TransparentUpgradeableProxy.sol +++ /dev/null @@ -1,145 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.0; - -import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; - -/** - * @dev This contract implements a proxy that is upgradeable by an admin. - * - * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector - * clashing], which can potentially be used in an attack, this contract uses the - * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two - * things that go hand in hand: - * - * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if - * that call matches one of the admin functions exposed by the proxy itself. - * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the - * implementation. If the admin tries to call a function on the implementation it will fail with an error that says - * "admin cannot fallback to proxy target". - * - * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing - * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due - * to sudden errors when trying to call a function from the proxy implementation. - * - * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, - * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy. - */ -contract TransparentUpgradeableProxy is ERC1967Proxy { - /** - * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and - * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}. - */ - constructor( - address _logic, - address admin_, - bytes memory _data - ) payable ERC1967Proxy(_logic, _data) { - _changeAdmin(admin_); - } - - /** - * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin. - */ - modifier ifAdmin() { - if (msg.sender == _getAdmin()) { - _; - } else { - _fallback(); - } - } - - /** - * @dev Returns the current admin. - * - * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. - * - * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the - * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. - * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` - */ - function admin() external payable ifAdmin returns (address admin_) { - _requireZeroValue(); - admin_ = _getAdmin(); - } - - /** - * @dev Returns the current implementation. - * - * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. - * - * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the - * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. - * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` - */ - function implementation() - external - payable - ifAdmin - returns (address implementation_) - { - _requireZeroValue(); - implementation_ = _implementation(); - } - - /** - * @dev Changes the admin of the proxy. - * - * Emits an {AdminChanged} event. - * - * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}. - */ - function changeAdmin(address newAdmin) external payable virtual ifAdmin { - _requireZeroValue(); - _changeAdmin(newAdmin); - } - - /** - * @dev Upgrade the implementation of the proxy. - * - * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}. - */ - function upgradeTo(address newImplementation) external payable ifAdmin { - _requireZeroValue(); - _upgradeToAndCall(newImplementation, bytes(""), false); - } - - /** - * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified - * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the - * proxied contract. - * - * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}. - */ - function upgradeToAndCall( - address newImplementation, - bytes calldata data - ) external payable ifAdmin { - _upgradeToAndCall(newImplementation, data, true); - } - - /** - * @dev Returns the current admin. - */ - function _admin() internal view virtual returns (address) { - return _getAdmin(); - } - - /** - * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}. - */ - function _beforeFallback() internal virtual override { - require( - msg.sender != _getAdmin(), - "TransparentUpgradeableProxy: admin cannot fallback to proxy target" - ); - super._beforeFallback(); - } - - /** - * @dev To keep this contract fully transparent, all `ifAdmin` functions must be payable. This helper is here to - * emulate some proxy functions being non-payable while still allowing value to pass through. - */ - function _requireZeroValue() private { - require(msg.value == 0); - } -} diff --git a/contracts-modularized/proxy/UpgradeableBeacon.sol b/contracts-modularized/proxy/UpgradeableBeacon.sol deleted file mode 100644 index 688c2654d..000000000 --- a/contracts-modularized/proxy/UpgradeableBeacon.sol +++ /dev/null @@ -1,66 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.0; - -import "@openzeppelin/contracts/proxy/beacon/IBeacon.sol"; -import "@openzeppelin/contracts/access/Ownable.sol"; -import "@openzeppelin/contracts/utils/Address.sol"; - -/** - * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their - * implementation contract, which is where they will delegate all function calls. - * - * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon. - */ -contract UpgradeableBeacon is IBeacon, Ownable { - address private _implementation; - - /** - * @dev Emitted when the implementation returned by the beacon is changed. - */ - event Upgraded(address indexed implementation); - - /** - * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the - * beacon. - */ - constructor(address implementation_) { - _setImplementation(implementation_); - } - - /** - * @dev Returns the current implementation address. - */ - function implementation() public view virtual override returns (address) { - return _implementation; - } - - /** - * @dev Upgrades the beacon to a new implementation. - * - * Emits an {Upgraded} event. - * - * Requirements: - * - * - msg.sender must be the owner of the contract. - * - `newImplementation` must be a contract. - */ - function upgradeTo(address newImplementation) public virtual onlyOwner { - _setImplementation(newImplementation); - emit Upgraded(newImplementation); - } - - /** - * @dev Sets the implementation contract address for this beacon - * - * Requirements: - * - * - `newImplementation` must be a contract. - */ - function _setImplementation(address newImplementation) private { - require( - Address.isContract(newImplementation), - "UpgradeableBeacon: implementation is not a contract" - ); - _implementation = newImplementation; - } -} diff --git a/contracts-modularized/proxy/interfaces/IDiamond.sol b/contracts-modularized/proxy/interfaces/IDiamond.sol deleted file mode 100644 index 3030e2daf..000000000 --- a/contracts-modularized/proxy/interfaces/IDiamond.sol +++ /dev/null @@ -1,19 +0,0 @@ -//SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.0; - -interface IDiamond { - enum FacetCutAction { - Add, - Replace, - Remove - } - // Add=0, Replace=1, Remove=2 - - struct FacetCut { - address facetAddress; - FacetCutAction action; - bytes4[] functionSelectors; - } - - event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata); -} diff --git a/contracts-modularized/proxy/interfaces/IDiamondCut.sol b/contracts-modularized/proxy/interfaces/IDiamondCut.sol deleted file mode 100644 index faeb63a32..000000000 --- a/contracts-modularized/proxy/interfaces/IDiamondCut.sol +++ /dev/null @@ -1,18 +0,0 @@ -//SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.0; - -import "./IDiamond.sol"; - -interface IDiamondCut is IDiamond { - /// @notice Add/replace/remove any number of functions and optionally execute - /// a function with delegatecall - /// @param _diamondCut Contains the facet addresses and function selectors - /// @param _init The address of the contract or facet to execute _calldata - /// @param _calldata A function call, including function selector and arguments - /// _calldata is executed with delegatecall on _init - function diamondCut( - FacetCut[] calldata _diamondCut, - address _init, - bytes calldata _calldata - ) external; -} diff --git a/contracts-modularized/proxy/interfaces/IDiamondLoupe.sol b/contracts-modularized/proxy/interfaces/IDiamondLoupe.sol deleted file mode 100644 index a01dcce60..000000000 --- a/contracts-modularized/proxy/interfaces/IDiamondLoupe.sol +++ /dev/null @@ -1,37 +0,0 @@ -//SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.0; - -// A loupe is a small magnifying glass used to look at diamonds. -// These functions look at diamonds -interface IDiamondLoupe { - struct Facet { - address facetAddress; - bytes4[] functionSelectors; - } - - /// @notice Gets all facet addresses and their four byte function selectors. - /// @return facets_ Facet - function facets() external view returns (Facet[] memory facets_); - - /// @notice Gets all the function selectors supported by a specific facet. - /// @param _facet The facet address. - /// @return facetFunctionSelectors_ - function facetFunctionSelectors( - address _facet - ) external view returns (bytes4[] memory facetFunctionSelectors_); - - /// @notice Get all the facet addresses used by a diamond. - /// @return facetAddresses_ - function facetAddresses() - external - view - returns (address[] memory facetAddresses_); - - /// @notice Gets the facet that supports the given selector. - /// @dev If facet is not found return address(0). - /// @param _functionSelector The function selector. - /// @return facetAddress_ The facet address. - function facetAddress( - bytes4 _functionSelector - ) external view returns (address facetAddress_); -} diff --git a/contracts-upgradeable/package.json b/contracts-upgradeable/package.json index 4dfcbf6b3..ea9d0c98b 100644 --- a/contracts-upgradeable/package.json +++ b/contracts-upgradeable/package.json @@ -1,6 +1,6 @@ { "name": "@desoul-labs/soulhub-contracts-upgradeable", - "version": "0.2.1-alpha.1", + "version": "0.3.2-beta.2", "description": "SoulHub Contracts", "homepage": "https://github.com/desoul-labs/soulhub-contracts#readme", "bugs": { diff --git a/contracts/package.json b/contracts/package.json index 1ea23882c..811455586 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -1,6 +1,6 @@ { "name": "@desoul-labs/soulhub-contracts", - "version": "0.2.1-alpha.1", + "version": "0.3.2-beta.2", "description": "SoulHub Contracts", "homepage": "https://github.com/desoul-labs/soulhub-contracts#readme", "bugs": { diff --git a/contracts/proxy/BeaconProxy.sol b/contracts/proxy/BeaconProxy.sol deleted file mode 100644 index 23d0a2be6..000000000 --- a/contracts/proxy/BeaconProxy.sol +++ /dev/null @@ -1,65 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.0; - -import "@openzeppelin/contracts/proxy/beacon/IBeacon.sol"; -import "@openzeppelin/contracts/proxy/Proxy.sol"; -import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol"; - -/** - * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}. - * - * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't - * conflict with the storage layout of the implementation behind the proxy. - * - * _Available since v3.4._ - */ -contract BeaconProxy is Proxy, ERC1967Upgrade { - /** - * @dev Initializes the proxy with `beacon`. - * - * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This - * will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity - * constructor. - * - * Requirements: - * - * - `beacon` must be a contract with the interface {IBeacon}. - */ - constructor(address beacon, bytes memory data) payable { - _upgradeBeaconToAndCall(beacon, data, false); - } - - /** - * @dev Returns the current beacon address. - */ - function _beacon() internal view virtual returns (address) { - return _getBeacon(); - } - - /** - * @dev Returns the current implementation address of the associated beacon. - */ - function _implementation() - internal - view - virtual - override - returns (address) - { - return IBeacon(_getBeacon()).implementation(); - } - - /** - * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}. - * - * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. - * - * Requirements: - * - * - `beacon` must be a contract. - * - The implementation returned by `beacon` must be a contract. - */ - function _setBeacon(address beacon, bytes memory data) internal virtual { - _upgradeBeaconToAndCall(beacon, data, false); - } -} diff --git a/contracts/proxy/DiamondProxy.sol b/contracts/proxy/DiamondProxy.sol deleted file mode 100644 index e99d74c0c..000000000 --- a/contracts/proxy/DiamondProxy.sol +++ /dev/null @@ -1,368 +0,0 @@ -//SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.0; - -import "./interfaces/IDiamondCut.sol"; -import "./interfaces/IDiamondLoupe.sol"; -import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; -import "@openzeppelin/contracts/access/Ownable.sol"; - -contract DiamondProxy is Ownable, IDiamond { - // more arguments are added to this struct - // this avoids stack too deep errors - struct DiamondArgs { - address owner; - } - - constructor( - IDiamondCut.FacetCut[] memory _diamondCuts, - DiamondArgs memory _args - ) payable { - _diamondCut(_diamondCuts, address(0), new bytes(0)); - transferOwnership(_args.owner); - - DiamondStorage storage ds = _diamondStorage(); - - // adding ERC165 data - ds.supportedInterfaces[type(IERC165).interfaceId] = true; - ds.supportedInterfaces[type(IDiamondCut).interfaceId] = true; - ds.supportedInterfaces[type(IDiamondLoupe).interfaceId] = true; - ds.supportedInterfaces[type(Ownable).interfaceId] = true; - } - - // Find facet for function that is called and execute the - // function if a facet is found and return any value. - fallback() external payable { - DiamondStorage storage ds; - bytes32 position = DIAMOND_STORAGE_POSITION; - assembly { - ds.slot := position - } - address facet = ds.selectorToFacetAndPosition[msg.sig].facetAddress; - require(facet != address(0), "Diamond: Function does not exist"); - assembly { - calldatacopy(0, 0, calldatasize()) - let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0) - returndatacopy(0, 0, returndatasize()) - switch result - case 0 { - revert(0, returndatasize()) - } - default { - return(0, returndatasize()) - } - } - } - - receive() external payable {} - - bytes32 constant DIAMOND_STORAGE_POSITION = - keccak256("diamond.standard.diamond.storage"); - - struct FacetAddressAndPosition { - address facetAddress; - uint16 functionSelectorPosition; // position in facetFunctionSelectors.functionSelectors array - } - - struct FacetFunctionSelectors { - bytes4[] functionSelectors; - uint16 facetAddressPosition; // position of facetAddress in facetAddresses array - } - - struct DiamondStorage { - // maps function selector to the facet address and - // the position of the selector in the facetFunctionSelectors.selectors array - mapping(bytes4 => FacetAddressAndPosition) selectorToFacetAndPosition; - // maps facet addresses to function selectors - mapping(address => FacetFunctionSelectors) facetFunctionSelectors; - // facet addresses - address[] facetAddresses; - // Used to query if a contract implements an interface. - // Used to implement ERC-165. - mapping(bytes4 => bool) supportedInterfaces; - // owner of the contract - address contractOwner; - } - - function _diamondStorage() - internal - pure - returns (DiamondStorage storage ds) - { - bytes32 position = DIAMOND_STORAGE_POSITION; - assembly { - ds.slot := position - } - } - - // Internal function version of diamondCut - function _diamondCut( - IDiamondCut.FacetCut[] memory _diamondCut, - address _init, - bytes memory _calldata - ) internal { - for ( - uint256 facetIndex; - facetIndex < _diamondCut.length; - facetIndex++ - ) { - IDiamond.FacetCutAction action = _diamondCut[facetIndex].action; - if (action == IDiamond.FacetCutAction.Add) { - _addFunctions( - _diamondCut[facetIndex].facetAddress, - _diamondCut[facetIndex].functionSelectors - ); - } else if (action == IDiamond.FacetCutAction.Replace) { - _replaceFunctions( - _diamondCut[facetIndex].facetAddress, - _diamondCut[facetIndex].functionSelectors - ); - } else if (action == IDiamond.FacetCutAction.Remove) { - _removeFunctions( - _diamondCut[facetIndex].facetAddress, - _diamondCut[facetIndex].functionSelectors - ); - } else { - revert("DiamondProxy: Incorrect FacetCutAction"); - } - } - emit DiamondCut(_diamondCut, _init, _calldata); - _initializeDiamondCut(_init, _calldata); - } - - function _addFunctions( - address _facetAddress, - bytes4[] memory _functionSelectors - ) internal { - require( - _functionSelectors.length > 0, - "DiamondProxy: No selectors in facet to cut" - ); - DiamondStorage storage ds = _diamondStorage(); - // uint16 selectorCount = uint16(diamondStorage().selectors.length); - require( - _facetAddress != address(0), - "DiamondProxy: Add facet can't be address(0)" - ); - uint16 selectorPosition = uint16( - ds.facetFunctionSelectors[_facetAddress].functionSelectors.length - ); - // add new facet address if it does not exist - if (selectorPosition == 0) { - _enforceHasContractCode( - _facetAddress, - "DiamondProxy: New facet has no code" - ); - ds - .facetFunctionSelectors[_facetAddress] - .facetAddressPosition = uint16(ds.facetAddresses.length); - ds.facetAddresses.push(_facetAddress); - } - for ( - uint256 selectorIndex; - selectorIndex < _functionSelectors.length; - selectorIndex++ - ) { - bytes4 selector = _functionSelectors[selectorIndex]; - address oldFacetAddress = ds - .selectorToFacetAndPosition[selector] - .facetAddress; - require( - oldFacetAddress == address(0), - "DiamondProxy: Can't add function that already exists" - ); - ds.facetFunctionSelectors[_facetAddress].functionSelectors.push( - selector - ); - ds - .selectorToFacetAndPosition[selector] - .facetAddress = _facetAddress; - ds - .selectorToFacetAndPosition[selector] - .functionSelectorPosition = selectorPosition; - selectorPosition++; - } - } - - function _replaceFunctions( - address _facetAddress, - bytes4[] memory _functionSelectors - ) internal { - require( - _functionSelectors.length > 0, - "DiamondProxy: No selectors in facet to cut" - ); - DiamondStorage storage ds = _diamondStorage(); - require( - _facetAddress != address(0), - "DiamondProxy: Add facet can't be address(0)" - ); - uint16 selectorPosition = uint16( - ds.facetFunctionSelectors[_facetAddress].functionSelectors.length - ); - // add new facet address if it does not exist - if (selectorPosition == 0) { - _enforceHasContractCode( - _facetAddress, - "DiamondProxy: New facet has no code" - ); - ds - .facetFunctionSelectors[_facetAddress] - .facetAddressPosition = uint16(ds.facetAddresses.length); - ds.facetAddresses.push(_facetAddress); - } - for ( - uint256 selectorIndex; - selectorIndex < _functionSelectors.length; - selectorIndex++ - ) { - bytes4 selector = _functionSelectors[selectorIndex]; - address oldFacetAddress = ds - .selectorToFacetAndPosition[selector] - .facetAddress; - require( - oldFacetAddress != _facetAddress, - "DiamondProxy: Can't replace function with same function" - ); - _removeFunction(oldFacetAddress, selector); - // add function - ds - .selectorToFacetAndPosition[selector] - .functionSelectorPosition = selectorPosition; - ds.facetFunctionSelectors[_facetAddress].functionSelectors.push( - selector - ); - ds - .selectorToFacetAndPosition[selector] - .facetAddress = _facetAddress; - selectorPosition++; - } - } - - function _removeFunctions( - address _facetAddress, - bytes4[] memory _functionSelectors - ) internal { - require( - _functionSelectors.length > 0, - "DiamondProxy: No selectors in facet to cut" - ); - DiamondStorage storage ds = _diamondStorage(); - // if function does not exist then do nothing and return - require( - _facetAddress == address(0), - "DiamondProxy: Remove facet address must be address(0)" - ); - for ( - uint256 selectorIndex; - selectorIndex < _functionSelectors.length; - selectorIndex++ - ) { - bytes4 selector = _functionSelectors[selectorIndex]; - address oldFacetAddress = ds - .selectorToFacetAndPosition[selector] - .facetAddress; - _removeFunction(oldFacetAddress, selector); - } - } - - function _removeFunction(address _facetAddress, bytes4 _selector) internal { - DiamondStorage storage ds = _diamondStorage(); - require( - _facetAddress != address(0), - "DiamondProxy: Can't remove function that doesn't exist" - ); - // an immutable function is a function defined directly in a diamond - require( - _facetAddress != address(this), - "DiamondProxy: Can't remove immutable function" - ); - // replace selector with last selector, then delete last selector - uint256 selectorPosition = ds - .selectorToFacetAndPosition[_selector] - .functionSelectorPosition; - uint256 lastSelectorPosition = ds - .facetFunctionSelectors[_facetAddress] - .functionSelectors - .length - 1; - // if not the same then replace _selector with lastSelector - if (selectorPosition != lastSelectorPosition) { - bytes4 lastSelector = ds - .facetFunctionSelectors[_facetAddress] - .functionSelectors[lastSelectorPosition]; - ds.facetFunctionSelectors[_facetAddress].functionSelectors[ - selectorPosition - ] = lastSelector; - ds - .selectorToFacetAndPosition[lastSelector] - .functionSelectorPosition = uint16(selectorPosition); - } - // delete the last selector - ds.facetFunctionSelectors[_facetAddress].functionSelectors.pop(); - delete ds.selectorToFacetAndPosition[_selector]; - - // if no more selectors for facet address then delete the facet address - if (lastSelectorPosition == 0) { - // replace facet address with last facet address and delete last facet address - uint256 lastFacetAddressPosition = ds.facetAddresses.length - 1; - uint256 facetAddressPosition = ds - .facetFunctionSelectors[_facetAddress] - .facetAddressPosition; - if (facetAddressPosition != lastFacetAddressPosition) { - address lastFacetAddress = ds.facetAddresses[ - lastFacetAddressPosition - ]; - ds.facetAddresses[facetAddressPosition] = lastFacetAddress; - ds - .facetFunctionSelectors[lastFacetAddress] - .facetAddressPosition = uint16(facetAddressPosition); - } - ds.facetAddresses.pop(); - delete ds - .facetFunctionSelectors[_facetAddress] - .facetAddressPosition; - } - } - - function _initializeDiamondCut( - address _init, - bytes memory _calldata - ) internal { - if (_init == address(0)) { - require( - _calldata.length == 0, - "DiamondProxy: _init is address(0) but_calldata is not empty" - ); - } else { - require( - _calldata.length > 0, - "DiamondProxy: _calldata is empty but _init is not address(0)" - ); - if (_init != address(this)) { - _enforceHasContractCode( - _init, - "DiamondProxy: _init address has no code" - ); - } - (bool success, bytes memory error) = _init.delegatecall(_calldata); - if (!success) { - if (error.length > 0) { - // bubble up the error - revert(string(error)); - } else { - revert("DiamondProxy: _init function reverted"); - } - } - } - } - - function _enforceHasContractCode( - address _contract, - string memory _errorMessage - ) internal view { - uint256 contractSize; - assembly { - contractSize := extcodesize(_contract) - } - require(contractSize > 0, _errorMessage); - } -} diff --git a/contracts/proxy/MinimalProxyFactory.sol b/contracts/proxy/MinimalProxyFactory.sol deleted file mode 100644 index dfbaf526d..000000000 --- a/contracts/proxy/MinimalProxyFactory.sol +++ /dev/null @@ -1,49 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.11; - -import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; -import "@openzeppelin/contracts/metatx/ERC2771Context.sol"; -import "@openzeppelin/contracts/utils/Create2.sol"; -import "@openzeppelin/contracts/utils/Multicall.sol"; -import "@openzeppelin/contracts/proxy/Clones.sol"; - -contract MinimalProxyFactory is Multicall, ERC2771Context { - /// @dev Emitted when a proxy is deployed. - event ProxyDeployed( - address indexed implementation, - address proxy, - address indexed deployer - ); - - /// @dev mapping of proxy address to deployer address - mapping(address => address) public deployer; - - constructor(address _trustedForwarder) ERC2771Context(_trustedForwarder) {} - - /// @dev Deploys a proxy that points to the given implementation. - function deployProxyByImplementation( - address _implementation, - bytes memory _data, - bytes32 _salt - ) external returns (address deployedProxy) { - bytes32 salthash = keccak256(abi.encodePacked(_msgSender(), _salt)); - deployedProxy = Clones.cloneDeterministic(_implementation, salthash); - - deployer[deployedProxy] = _msgSender(); - - emit ProxyDeployed(_implementation, deployedProxy, _msgSender()); - - if (_data.length > 0) { - // slither-disable-next-line unused-return - Address.functionCall(deployedProxy, _data); - } - } - - function calculateProxyAddressByImplementation( - address _implementation, - bytes32 _salt - ) external view returns (address) { - bytes32 salthash = keccak256(abi.encodePacked(_msgSender(), _salt)); - return Clones.predictDeterministicAddress(_implementation, salthash); - } -} diff --git a/contracts/proxy/TransparentUpgradeableProxy.sol b/contracts/proxy/TransparentUpgradeableProxy.sol deleted file mode 100644 index ef49f8731..000000000 --- a/contracts/proxy/TransparentUpgradeableProxy.sol +++ /dev/null @@ -1,145 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.0; - -import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; - -/** - * @dev This contract implements a proxy that is upgradeable by an admin. - * - * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector - * clashing], which can potentially be used in an attack, this contract uses the - * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two - * things that go hand in hand: - * - * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if - * that call matches one of the admin functions exposed by the proxy itself. - * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the - * implementation. If the admin tries to call a function on the implementation it will fail with an error that says - * "admin cannot fallback to proxy target". - * - * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing - * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due - * to sudden errors when trying to call a function from the proxy implementation. - * - * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, - * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy. - */ -contract TransparentUpgradeableProxy is ERC1967Proxy { - /** - * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and - * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}. - */ - constructor( - address _logic, - address admin_, - bytes memory _data - ) payable ERC1967Proxy(_logic, _data) { - _changeAdmin(admin_); - } - - /** - * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin. - */ - modifier ifAdmin() { - if (msg.sender == _getAdmin()) { - _; - } else { - _fallback(); - } - } - - /** - * @dev Returns the current admin. - * - * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. - * - * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the - * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. - * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` - */ - function admin() external payable ifAdmin returns (address admin_) { - _requireZeroValue(); - admin_ = _getAdmin(); - } - - /** - * @dev Returns the current implementation. - * - * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. - * - * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the - * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. - * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` - */ - function implementation() - external - payable - ifAdmin - returns (address implementation_) - { - _requireZeroValue(); - implementation_ = _implementation(); - } - - /** - * @dev Changes the admin of the proxy. - * - * Emits an {AdminChanged} event. - * - * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}. - */ - function changeAdmin(address newAdmin) external payable virtual ifAdmin { - _requireZeroValue(); - _changeAdmin(newAdmin); - } - - /** - * @dev Upgrade the implementation of the proxy. - * - * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}. - */ - function upgradeTo(address newImplementation) external payable ifAdmin { - _requireZeroValue(); - _upgradeToAndCall(newImplementation, bytes(""), false); - } - - /** - * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified - * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the - * proxied contract. - * - * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}. - */ - function upgradeToAndCall( - address newImplementation, - bytes calldata data - ) external payable ifAdmin { - _upgradeToAndCall(newImplementation, data, true); - } - - /** - * @dev Returns the current admin. - */ - function _admin() internal view virtual returns (address) { - return _getAdmin(); - } - - /** - * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}. - */ - function _beforeFallback() internal virtual override { - require( - msg.sender != _getAdmin(), - "TransparentUpgradeableProxy: admin cannot fallback to proxy target" - ); - super._beforeFallback(); - } - - /** - * @dev To keep this contract fully transparent, all `ifAdmin` functions must be payable. This helper is here to - * emulate some proxy functions being non-payable while still allowing value to pass through. - */ - function _requireZeroValue() private { - require(msg.value == 0); - } -} diff --git a/contracts/proxy/UpgradeableBeacon.sol b/contracts/proxy/UpgradeableBeacon.sol deleted file mode 100644 index 688c2654d..000000000 --- a/contracts/proxy/UpgradeableBeacon.sol +++ /dev/null @@ -1,66 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.0; - -import "@openzeppelin/contracts/proxy/beacon/IBeacon.sol"; -import "@openzeppelin/contracts/access/Ownable.sol"; -import "@openzeppelin/contracts/utils/Address.sol"; - -/** - * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their - * implementation contract, which is where they will delegate all function calls. - * - * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon. - */ -contract UpgradeableBeacon is IBeacon, Ownable { - address private _implementation; - - /** - * @dev Emitted when the implementation returned by the beacon is changed. - */ - event Upgraded(address indexed implementation); - - /** - * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the - * beacon. - */ - constructor(address implementation_) { - _setImplementation(implementation_); - } - - /** - * @dev Returns the current implementation address. - */ - function implementation() public view virtual override returns (address) { - return _implementation; - } - - /** - * @dev Upgrades the beacon to a new implementation. - * - * Emits an {Upgraded} event. - * - * Requirements: - * - * - msg.sender must be the owner of the contract. - * - `newImplementation` must be a contract. - */ - function upgradeTo(address newImplementation) public virtual onlyOwner { - _setImplementation(newImplementation); - emit Upgraded(newImplementation); - } - - /** - * @dev Sets the implementation contract address for this beacon - * - * Requirements: - * - * - `newImplementation` must be a contract. - */ - function _setImplementation(address newImplementation) private { - require( - Address.isContract(newImplementation), - "UpgradeableBeacon: implementation is not a contract" - ); - _implementation = newImplementation; - } -} diff --git a/contracts/proxy/interfaces/IDiamond.sol b/contracts/proxy/interfaces/IDiamond.sol deleted file mode 100644 index 3030e2daf..000000000 --- a/contracts/proxy/interfaces/IDiamond.sol +++ /dev/null @@ -1,19 +0,0 @@ -//SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.0; - -interface IDiamond { - enum FacetCutAction { - Add, - Replace, - Remove - } - // Add=0, Replace=1, Remove=2 - - struct FacetCut { - address facetAddress; - FacetCutAction action; - bytes4[] functionSelectors; - } - - event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata); -} diff --git a/contracts/proxy/interfaces/IDiamondCut.sol b/contracts/proxy/interfaces/IDiamondCut.sol deleted file mode 100644 index faeb63a32..000000000 --- a/contracts/proxy/interfaces/IDiamondCut.sol +++ /dev/null @@ -1,18 +0,0 @@ -//SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.0; - -import "./IDiamond.sol"; - -interface IDiamondCut is IDiamond { - /// @notice Add/replace/remove any number of functions and optionally execute - /// a function with delegatecall - /// @param _diamondCut Contains the facet addresses and function selectors - /// @param _init The address of the contract or facet to execute _calldata - /// @param _calldata A function call, including function selector and arguments - /// _calldata is executed with delegatecall on _init - function diamondCut( - FacetCut[] calldata _diamondCut, - address _init, - bytes calldata _calldata - ) external; -} diff --git a/contracts/proxy/interfaces/IDiamondLoupe.sol b/contracts/proxy/interfaces/IDiamondLoupe.sol deleted file mode 100644 index a01dcce60..000000000 --- a/contracts/proxy/interfaces/IDiamondLoupe.sol +++ /dev/null @@ -1,37 +0,0 @@ -//SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.0; - -// A loupe is a small magnifying glass used to look at diamonds. -// These functions look at diamonds -interface IDiamondLoupe { - struct Facet { - address facetAddress; - bytes4[] functionSelectors; - } - - /// @notice Gets all facet addresses and their four byte function selectors. - /// @return facets_ Facet - function facets() external view returns (Facet[] memory facets_); - - /// @notice Gets all the function selectors supported by a specific facet. - /// @param _facet The facet address. - /// @return facetFunctionSelectors_ - function facetFunctionSelectors( - address _facet - ) external view returns (bytes4[] memory facetFunctionSelectors_); - - /// @notice Get all the facet addresses used by a diamond. - /// @return facetAddresses_ - function facetAddresses() - external - view - returns (address[] memory facetAddresses_); - - /// @notice Gets the facet that supports the given selector. - /// @dev If facet is not found return address(0). - /// @param _functionSelector The function selector. - /// @return facetAddress_ The facet address. - function facetAddress( - bytes4 _functionSelector - ) external view returns (address facetAddress_); -} diff --git a/package.json b/package.json index 8e8114634..e796c256c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "soulhub-contracts", - "version": "0.2.1-alpha.1", + "version": "0.3.2-beta.2", "description": "SoulHub Contracts", "homepage": "https://github.com/desoul-labs/soulhub-contracts#readme", "bugs": { @@ -19,8 +19,9 @@ "deploy:goerli": "hardhat run scripts/deploy.ts --network goerli", "deploy:hardhat": "hardhat run scripts/deploy.ts --network hardhat", "deploy:mainnet": "hardhat run scripts/deploy.ts --network mainnet", - "deploy:mumbai": "hardhat run scripts/deploy.ts --network mumbai", + "deploy:mumbai": "hardhat run scripts/deployModularized.ts --network mumbai", "deploy:optimism-goerli": "hardhat run scripts/deploy.ts --network optimismGoerli", + "deploy:astar": "hardhat run scripts/deployModularized.ts --network astar", "deploy:polygon": "hardhat run scripts/deploy.ts --network polygon", "deploy:sepolia": "hardhat run scripts/deploy.ts --network sepolia", "doc": "NODE_ENV=development hardhat dodoc", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 20dc802e0..6b1a69c2f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -128,6 +128,19 @@ importers: contracts-upgradeable: {} + typechain: + dependencies: + '@nomiclabs/hardhat-ethers': + specifier: 2.2.1 + version: 2.2.1(ethers@5.7.2)(hardhat@2.13.0) + ethers: + specifier: 5.7.2 + version: 5.7.2 + devDependencies: + typescript: + specifier: 4.9.4 + version: 4.9.4 + packages: /@babel/code-frame@7.21.4: resolution: @@ -396,7 +409,6 @@ packages: engines: { node: '>=12' } dependencies: '@jridgewell/trace-mapping': 0.3.9 - dev: true /@eslint-community/eslint-utils@4.4.0(eslint@8.36.0): resolution: @@ -462,7 +474,6 @@ packages: '@ethersproject/logger': 5.7.0 '@ethersproject/properties': 5.7.0 '@ethersproject/strings': 5.7.0 - dev: true /@ethersproject/abstract-provider@5.7.0: resolution: @@ -477,7 +488,6 @@ packages: '@ethersproject/properties': 5.7.0 '@ethersproject/transactions': 5.7.0 '@ethersproject/web': 5.7.1 - dev: true /@ethersproject/abstract-signer@5.7.0: resolution: @@ -490,7 +500,6 @@ packages: '@ethersproject/bytes': 5.7.0 '@ethersproject/logger': 5.7.0 '@ethersproject/properties': 5.7.0 - dev: true /@ethersproject/address@5.7.0: resolution: @@ -503,7 +512,6 @@ packages: '@ethersproject/keccak256': 5.7.0 '@ethersproject/logger': 5.7.0 '@ethersproject/rlp': 5.7.0 - dev: true /@ethersproject/base64@5.7.0: resolution: @@ -512,7 +520,6 @@ packages: } dependencies: '@ethersproject/bytes': 5.7.0 - dev: true /@ethersproject/basex@5.7.0: resolution: @@ -522,7 +529,6 @@ packages: dependencies: '@ethersproject/bytes': 5.7.0 '@ethersproject/properties': 5.7.0 - dev: true /@ethersproject/bignumber@5.7.0: resolution: @@ -533,7 +539,6 @@ packages: '@ethersproject/bytes': 5.7.0 '@ethersproject/logger': 5.7.0 bn.js: 5.2.1 - dev: true /@ethersproject/bytes@5.7.0: resolution: @@ -542,7 +547,6 @@ packages: } dependencies: '@ethersproject/logger': 5.7.0 - dev: true /@ethersproject/constants@5.7.0: resolution: @@ -551,7 +555,6 @@ packages: } dependencies: '@ethersproject/bignumber': 5.7.0 - dev: true /@ethersproject/contracts@5.7.0: resolution: @@ -569,7 +572,6 @@ packages: '@ethersproject/logger': 5.7.0 '@ethersproject/properties': 5.7.0 '@ethersproject/transactions': 5.7.0 - dev: true /@ethersproject/hash@5.7.0: resolution: @@ -586,7 +588,6 @@ packages: '@ethersproject/logger': 5.7.0 '@ethersproject/properties': 5.7.0 '@ethersproject/strings': 5.7.0 - dev: true /@ethersproject/hdnode@5.7.0: resolution: @@ -606,7 +607,6 @@ packages: '@ethersproject/strings': 5.7.0 '@ethersproject/transactions': 5.7.0 '@ethersproject/wordlists': 5.7.0 - dev: true /@ethersproject/json-wallets@5.7.0: resolution: @@ -627,7 +627,6 @@ packages: '@ethersproject/transactions': 5.7.0 aes-js: 3.0.0 scrypt-js: 3.0.1 - dev: true /@ethersproject/keccak256@5.7.0: resolution: @@ -637,14 +636,12 @@ packages: dependencies: '@ethersproject/bytes': 5.7.0 js-sha3: 0.8.0 - dev: true /@ethersproject/logger@5.7.0: resolution: { integrity: sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==, } - dev: true /@ethersproject/networks@5.7.1: resolution: @@ -653,7 +650,6 @@ packages: } dependencies: '@ethersproject/logger': 5.7.0 - dev: true /@ethersproject/pbkdf2@5.7.0: resolution: @@ -663,7 +659,6 @@ packages: dependencies: '@ethersproject/bytes': 5.7.0 '@ethersproject/sha2': 5.7.0 - dev: true /@ethersproject/properties@5.7.0: resolution: @@ -672,7 +667,6 @@ packages: } dependencies: '@ethersproject/logger': 5.7.0 - dev: true /@ethersproject/providers@5.7.2: resolution: @@ -703,7 +697,6 @@ packages: transitivePeerDependencies: - bufferutil - utf-8-validate - dev: true /@ethersproject/random@5.7.0: resolution: @@ -713,7 +706,6 @@ packages: dependencies: '@ethersproject/bytes': 5.7.0 '@ethersproject/logger': 5.7.0 - dev: true /@ethersproject/rlp@5.7.0: resolution: @@ -723,7 +715,6 @@ packages: dependencies: '@ethersproject/bytes': 5.7.0 '@ethersproject/logger': 5.7.0 - dev: true /@ethersproject/sha2@5.7.0: resolution: @@ -734,7 +725,6 @@ packages: '@ethersproject/bytes': 5.7.0 '@ethersproject/logger': 5.7.0 hash.js: 1.1.7 - dev: true /@ethersproject/signing-key@5.7.0: resolution: @@ -748,7 +738,6 @@ packages: bn.js: 5.2.1 elliptic: 6.5.4 hash.js: 1.1.7 - dev: true /@ethersproject/solidity@5.7.0: resolution: @@ -762,7 +751,6 @@ packages: '@ethersproject/logger': 5.7.0 '@ethersproject/sha2': 5.7.0 '@ethersproject/strings': 5.7.0 - dev: true /@ethersproject/strings@5.7.0: resolution: @@ -773,7 +761,6 @@ packages: '@ethersproject/bytes': 5.7.0 '@ethersproject/constants': 5.7.0 '@ethersproject/logger': 5.7.0 - dev: true /@ethersproject/transactions@5.7.0: resolution: @@ -790,7 +777,6 @@ packages: '@ethersproject/properties': 5.7.0 '@ethersproject/rlp': 5.7.0 '@ethersproject/signing-key': 5.7.0 - dev: true /@ethersproject/units@5.7.0: resolution: @@ -801,7 +787,6 @@ packages: '@ethersproject/bignumber': 5.7.0 '@ethersproject/constants': 5.7.0 '@ethersproject/logger': 5.7.0 - dev: true /@ethersproject/wallet@5.7.0: resolution: @@ -824,7 +809,6 @@ packages: '@ethersproject/signing-key': 5.7.0 '@ethersproject/transactions': 5.7.0 '@ethersproject/wordlists': 5.7.0 - dev: true /@ethersproject/web@5.7.1: resolution: @@ -837,7 +821,6 @@ packages: '@ethersproject/logger': 5.7.0 '@ethersproject/properties': 5.7.0 '@ethersproject/strings': 5.7.0 - dev: true /@ethersproject/wordlists@5.7.0: resolution: @@ -850,7 +833,6 @@ packages: '@ethersproject/logger': 5.7.0 '@ethersproject/properties': 5.7.0 '@ethersproject/strings': 5.7.0 - dev: true /@humanwhocodes/config-array@0.11.8: resolution: @@ -895,14 +877,12 @@ packages: integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==, } engines: { node: '>=6.0.0' } - dev: true /@jridgewell/sourcemap-codec@1.4.15: resolution: { integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==, } - dev: true /@jridgewell/trace-mapping@0.3.9: resolution: @@ -912,7 +892,6 @@ packages: dependencies: '@jridgewell/resolve-uri': 3.1.1 '@jridgewell/sourcemap-codec': 1.4.15 - dev: true /@metamask/eth-sig-util@4.0.1: resolution: @@ -926,7 +905,6 @@ packages: ethjs-util: 0.1.6 tweetnacl: 1.0.3 tweetnacl-util: 0.15.1 - dev: true /@morgan-stanley/ts-mocking-bird@0.6.4(typescript@5.0.2): resolution: @@ -953,14 +931,12 @@ packages: { integrity: sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ==, } - dev: true /@noble/secp256k1@1.7.1: resolution: { integrity: sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==, } - dev: true /@nodelib/fs.scandir@2.1.5: resolution: @@ -1005,7 +981,6 @@ packages: '@nomicfoundation/ethereumjs-tx': 4.1.2 '@nomicfoundation/ethereumjs-util': 8.0.6 ethereum-cryptography: 0.1.3 - dev: true /@nomicfoundation/ethereumjs-blockchain@6.2.2: resolution: @@ -1028,7 +1003,6 @@ packages: memory-level: 1.0.0 transitivePeerDependencies: - supports-color - dev: true /@nomicfoundation/ethereumjs-common@3.1.2: resolution: @@ -1038,7 +1012,6 @@ packages: dependencies: '@nomicfoundation/ethereumjs-util': 8.0.6 crc-32: 1.2.2 - dev: true /@nomicfoundation/ethereumjs-ethash@2.0.5: resolution: @@ -1053,7 +1026,6 @@ packages: abstract-level: 1.0.3 bigint-crypto-utils: 3.1.8 ethereum-cryptography: 0.1.3 - dev: true /@nomicfoundation/ethereumjs-evm@1.3.2: resolution: @@ -1072,7 +1044,6 @@ packages: rustbn.js: 0.2.0 transitivePeerDependencies: - supports-color - dev: true /@nomicfoundation/ethereumjs-rlp@4.0.3: resolution: @@ -1081,7 +1052,6 @@ packages: } engines: { node: '>=14' } hasBin: true - dev: true /@nomicfoundation/ethereumjs-statemanager@1.0.5: resolution: @@ -1098,7 +1068,6 @@ packages: functional-red-black-tree: 1.0.1 transitivePeerDependencies: - supports-color - dev: true /@nomicfoundation/ethereumjs-trie@5.0.5: resolution: @@ -1111,7 +1080,6 @@ packages: '@nomicfoundation/ethereumjs-util': 8.0.6 ethereum-cryptography: 0.1.3 readable-stream: 3.6.2 - dev: true /@nomicfoundation/ethereumjs-tx@4.1.2: resolution: @@ -1124,7 +1092,6 @@ packages: '@nomicfoundation/ethereumjs-rlp': 4.0.3 '@nomicfoundation/ethereumjs-util': 8.0.6 ethereum-cryptography: 0.1.3 - dev: true /@nomicfoundation/ethereumjs-util@8.0.6: resolution: @@ -1135,7 +1102,6 @@ packages: dependencies: '@nomicfoundation/ethereumjs-rlp': 4.0.3 ethereum-cryptography: 0.1.3 - dev: true /@nomicfoundation/ethereumjs-vm@6.4.2: resolution: @@ -1162,7 +1128,6 @@ packages: rustbn.js: 0.2.0 transitivePeerDependencies: - supports-color - dev: true /@nomicfoundation/hardhat-chai-matchers@1.0.6(@nomiclabs/hardhat-ethers@2.2.2)(chai@4.3.7)(ethers@5.7.2)(hardhat@2.13.0): resolution: @@ -1254,7 +1219,6 @@ packages: cpu: [arm64] os: [darwin] requiresBuild: true - dev: true optional: true /@nomicfoundation/solidity-analyzer-darwin-x64@0.1.1: @@ -1266,7 +1230,6 @@ packages: cpu: [x64] os: [darwin] requiresBuild: true - dev: true optional: true /@nomicfoundation/solidity-analyzer-freebsd-x64@0.1.1: @@ -1278,7 +1241,6 @@ packages: cpu: [x64] os: [freebsd] requiresBuild: true - dev: true optional: true /@nomicfoundation/solidity-analyzer-linux-arm64-gnu@0.1.1: @@ -1290,7 +1252,6 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true optional: true /@nomicfoundation/solidity-analyzer-linux-arm64-musl@0.1.1: @@ -1302,7 +1263,6 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true optional: true /@nomicfoundation/solidity-analyzer-linux-x64-gnu@0.1.1: @@ -1314,7 +1274,6 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true optional: true /@nomicfoundation/solidity-analyzer-linux-x64-musl@0.1.1: @@ -1326,7 +1285,6 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true optional: true /@nomicfoundation/solidity-analyzer-win32-arm64-msvc@0.1.1: @@ -1338,7 +1296,6 @@ packages: cpu: [arm64] os: [win32] requiresBuild: true - dev: true optional: true /@nomicfoundation/solidity-analyzer-win32-ia32-msvc@0.1.1: @@ -1350,7 +1307,6 @@ packages: cpu: [ia32] os: [win32] requiresBuild: true - dev: true optional: true /@nomicfoundation/solidity-analyzer-win32-x64-msvc@0.1.1: @@ -1362,7 +1318,6 @@ packages: cpu: [x64] os: [win32] requiresBuild: true - dev: true optional: true /@nomicfoundation/solidity-analyzer@0.1.1: @@ -1382,7 +1337,19 @@ packages: '@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 - dev: true + + /@nomiclabs/hardhat-ethers@2.2.1(ethers@5.7.2)(hardhat@2.13.0): + resolution: + { + integrity: sha512-RHWYwnxryWR8hzRmU4Jm/q4gzvXpetUOJ4OPlwH2YARcDB+j79+yAYCwO0lN1SUOb4++oOTJEe6AWLEc42LIvg==, + } + peerDependencies: + ethers: ^5.0.0 + hardhat: ^2.0.0 + dependencies: + ethers: 5.7.2 + hardhat: 2.13.0(ts-node@10.9.1)(typescript@4.9.4) + dev: false /@nomiclabs/hardhat-ethers@2.2.2(ethers@5.7.2)(hardhat@2.13.0): resolution: @@ -1509,7 +1476,6 @@ packages: { integrity: sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==, } - dev: true /@scure/bip32@1.1.5: resolution: @@ -1520,7 +1486,6 @@ packages: '@noble/hashes': 1.2.0 '@noble/secp256k1': 1.7.1 '@scure/base': 1.1.1 - dev: true /@scure/bip39@1.1.1: resolution: @@ -1530,7 +1495,6 @@ packages: dependencies: '@noble/hashes': 1.2.0 '@scure/base': 1.1.1 - dev: true /@sentry/core@5.30.0: resolution: @@ -1544,7 +1508,6 @@ packages: '@sentry/types': 5.30.0 '@sentry/utils': 5.30.0 tslib: 1.14.1 - dev: true /@sentry/hub@5.30.0: resolution: @@ -1556,7 +1519,6 @@ packages: '@sentry/types': 5.30.0 '@sentry/utils': 5.30.0 tslib: 1.14.1 - dev: true /@sentry/minimal@5.30.0: resolution: @@ -1568,7 +1530,6 @@ packages: '@sentry/hub': 5.30.0 '@sentry/types': 5.30.0 tslib: 1.14.1 - dev: true /@sentry/node@5.30.0: resolution: @@ -1588,7 +1549,6 @@ packages: tslib: 1.14.1 transitivePeerDependencies: - supports-color - dev: true /@sentry/tracing@5.30.0: resolution: @@ -1602,7 +1562,6 @@ packages: '@sentry/types': 5.30.0 '@sentry/utils': 5.30.0 tslib: 1.14.1 - dev: true /@sentry/types@5.30.0: resolution: @@ -1610,7 +1569,6 @@ packages: integrity: sha512-R8xOqlSTZ+htqrfteCWU5Nk0CDN5ApUTvrlvBuiH1DyP6czDZ4ktbZB0hAgBlVcK0U+qpD3ag3Tqqpa5Q67rPw==, } engines: { node: '>=6' } - dev: true /@sentry/utils@5.30.0: resolution: @@ -1621,7 +1579,6 @@ packages: dependencies: '@sentry/types': 5.30.0 tslib: 1.14.1 - dev: true /@solidity-parser/parser@0.14.5: resolution: @@ -1672,28 +1629,24 @@ packages: { integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==, } - dev: true /@tsconfig/node12@1.0.11: resolution: { integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==, } - dev: true /@tsconfig/node14@1.0.3: resolution: { integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==, } - dev: true /@tsconfig/node16@1.0.3: resolution: { integrity: sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==, } - dev: true /@typechain/ethers-v5@10.2.0(@ethersproject/abi@5.7.0)(@ethersproject/bytes@5.7.0)(@ethersproject/providers@5.7.2)(ethers@5.7.2)(typechain@8.1.1)(typescript@5.0.2): resolution: @@ -1745,7 +1698,6 @@ packages: { integrity: sha512-M2P4Ng26QbAeITiH7w1d7OxtldgfAe0wobpyJzVK/XOb0cUGKU2R4pfAhqcJBXAe2ife5ZOhSv4wk7p+ffURtg==, } - dev: true /@types/bn.js@4.11.6: resolution: @@ -1754,7 +1706,6 @@ packages: } dependencies: '@types/node': 18.15.10 - dev: true /@types/bn.js@5.1.1: resolution: @@ -1763,7 +1714,6 @@ packages: } dependencies: '@types/node': 18.15.10 - dev: true /@types/chai-as-promised@7.1.5: resolution: @@ -1828,7 +1778,6 @@ packages: { integrity: sha512-ssE3Vlrys7sdIzs5LOxCzTVMsU7i9oa/IaW92wF32JFb3CVczqOkru2xspuKczHEbG3nvmPY7IFqVmGGHdNbYw==, } - dev: true /@types/minimatch@5.1.2: resolution: @@ -1863,7 +1812,6 @@ packages: { integrity: sha512-9avDaQJczATcXgfmMAW3MIWArOO7A+m90vuCFLr8AotWf8igO/mRoYukrk2cqZVtv38tHs33retzHEilM7FpeQ==, } - dev: true /@types/node@8.10.66: resolution: @@ -1886,7 +1834,6 @@ packages: } dependencies: '@types/node': 18.15.10 - dev: true /@types/prettier@2.7.2: resolution: @@ -1909,7 +1856,6 @@ packages: } dependencies: '@types/node': 18.15.10 - dev: true /@types/semver@7.3.13: resolution: @@ -2152,7 +2098,6 @@ packages: engines: { node: '>=6.5' } dependencies: event-target-shim: 5.0.1 - dev: true /abstract-level@1.0.3: resolution: @@ -2168,7 +2113,6 @@ packages: level-transcoder: 1.0.1 module-error: 1.0.2 queue-microtask: 1.2.3 - dev: true /accepts@1.3.8: resolution: @@ -2198,7 +2142,6 @@ packages: integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==, } engines: { node: '>=0.4.0' } - dev: true /acorn@8.8.2: resolution: @@ -2207,7 +2150,6 @@ packages: } engines: { node: '>=0.4.0' } hasBin: true - dev: true /add-stream@1.0.0: resolution: @@ -2230,14 +2172,12 @@ packages: integrity: sha512-TFi4HBKSGfIKsK5YCkKaaFG2m4PEDyViZmEwof3MTIgzimHLto6muaHVpbrljdIvIrFZzEq/p4nafOeLcYegrg==, } engines: { node: '>=0.3.0' } - dev: true /aes-js@3.0.0: resolution: { integrity: sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==, } - dev: true /agent-base@6.0.2: resolution: @@ -2249,7 +2189,6 @@ packages: debug: 4.3.4(supports-color@8.1.1) transitivePeerDependencies: - supports-color - dev: true /aggregate-error@3.1.0: resolution: @@ -2260,7 +2199,6 @@ packages: dependencies: clean-stack: 2.2.0 indent-string: 4.0.0 - dev: true /ajv@6.12.6: resolution: @@ -2309,7 +2247,6 @@ packages: integrity: sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==, } engines: { node: '>=6' } - dev: true /ansi-colors@4.1.3: resolution: @@ -2317,7 +2254,6 @@ packages: integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==, } engines: { node: '>=6' } - dev: true /ansi-escapes@4.3.2: resolution: @@ -2327,7 +2263,6 @@ packages: engines: { node: '>=8' } dependencies: type-fest: 0.21.3 - dev: true /ansi-regex@3.0.1: resolution: @@ -2351,7 +2286,6 @@ packages: integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==, } engines: { node: '>=8' } - dev: true /ansi-regex@6.0.1: resolution: @@ -2369,7 +2303,6 @@ packages: engines: { node: '>=4' } dependencies: color-convert: 1.9.3 - dev: true /ansi-styles@4.3.0: resolution: @@ -2379,7 +2312,6 @@ packages: engines: { node: '>=8' } dependencies: color-convert: 2.0.1 - dev: true /ansi-styles@6.2.1: resolution: @@ -2413,14 +2345,12 @@ packages: dependencies: normalize-path: 3.0.0 picomatch: 2.3.1 - dev: true /arg@4.1.3: resolution: { integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==, } - dev: true /argparse@1.0.10: resolution: @@ -2436,7 +2366,6 @@ packages: { integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==, } - dev: true /array-back@3.1.0: resolution: @@ -2609,7 +2538,6 @@ packages: } dependencies: async: 2.6.4 - dev: true /async@1.5.2: resolution: @@ -2625,7 +2553,6 @@ packages: } dependencies: lodash: 4.17.21 - dev: true /asynckit@0.4.0: resolution: @@ -2692,7 +2619,6 @@ packages: { integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==, } - dev: true /base-x@3.0.9: resolution: @@ -2701,14 +2627,12 @@ packages: } dependencies: safe-buffer: 5.2.1 - dev: true /base64-js@1.5.1: resolution: { integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==, } - dev: true /bcrypt-pbkdf@1.0.2: resolution: @@ -2724,7 +2648,6 @@ packages: { integrity: sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==, } - dev: true /bigint-crypto-utils@3.1.8: resolution: @@ -2734,7 +2657,6 @@ packages: engines: { node: '>=10.4.0' } dependencies: bigint-mod-arith: 3.2.0 - dev: true /bigint-mod-arith@3.2.0: resolution: @@ -2742,7 +2664,6 @@ packages: integrity: sha512-Khb+sLGLqbe/2NOLVMOpCSgsC3lz8r3VIRZGc41hccudLPnvks7RYZNOnGukQZV8scn5+bA6MABga3Ueq6z3+w==, } engines: { node: '>=10.4.0' } - dev: true /bignumber.js@9.1.1: resolution: @@ -2757,14 +2678,12 @@ packages: integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==, } engines: { node: '>=8' } - dev: true /blakejs@1.2.1: resolution: { integrity: sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==, } - dev: true /bn.js@4.11.6: resolution: @@ -2778,14 +2697,12 @@ packages: { integrity: sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==, } - dev: true /bn.js@5.2.1: resolution: { integrity: sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==, } - dev: true /body-parser@1.20.1: resolution: @@ -2818,7 +2735,6 @@ packages: dependencies: balanced-match: 1.0.2 concat-map: 0.0.1 - dev: true /brace-expansion@2.0.1: resolution: @@ -2827,7 +2743,6 @@ packages: } dependencies: balanced-match: 1.0.2 - dev: true /braces@3.0.2: resolution: @@ -2837,14 +2752,12 @@ packages: engines: { node: '>=8' } dependencies: fill-range: 7.0.1 - dev: true /brorand@1.1.0: resolution: { integrity: sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==, } - dev: true /browser-level@1.0.1: resolution: @@ -2856,14 +2769,12 @@ packages: catering: 2.1.1 module-error: 1.0.2 run-parallel-limit: 1.1.0 - dev: true /browser-stdout@1.3.1: resolution: { integrity: sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==, } - dev: true /browserify-aes@1.2.0: resolution: @@ -2877,7 +2788,6 @@ packages: evp_bytestokey: 1.0.3 inherits: 2.0.4 safe-buffer: 5.2.1 - dev: true /bs58@4.0.1: resolution: @@ -2886,7 +2796,6 @@ packages: } dependencies: base-x: 3.0.9 - dev: true /bs58check@2.1.2: resolution: @@ -2897,14 +2806,12 @@ packages: bs58: 4.0.1 create-hash: 1.2.0 safe-buffer: 5.2.1 - dev: true /buffer-from@1.1.2: resolution: { integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==, } - dev: true /buffer-reverse@1.0.1: resolution: @@ -2918,7 +2825,6 @@ packages: { integrity: sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==, } - dev: true /buffer@6.0.3: resolution: @@ -2928,7 +2834,6 @@ packages: dependencies: base64-js: 1.5.1 ieee754: 1.2.1 - dev: true /builtins@5.0.1: resolution: @@ -2947,7 +2852,6 @@ packages: engines: { node: '>=10.16.0' } dependencies: streamsearch: 1.1.0 - dev: true /bytes@3.1.2: resolution: @@ -2955,7 +2859,6 @@ packages: integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==, } engines: { node: '>= 0.8' } - dev: true /call-bind@1.0.2: resolution: @@ -2965,7 +2868,6 @@ packages: dependencies: function-bind: 1.1.1 get-intrinsic: 1.2.0 - dev: true /callsites@3.1.0: resolution: @@ -3001,7 +2903,6 @@ packages: integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==, } engines: { node: '>=10' } - dev: true /caseless@0.12.0: resolution: @@ -3016,7 +2917,6 @@ packages: integrity: sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w==, } engines: { node: '>=6' } - dev: true /cbor@8.1.0: resolution: @@ -3066,7 +2966,6 @@ packages: ansi-styles: 3.2.1 escape-string-regexp: 1.0.5 supports-color: 5.5.0 - dev: true /chalk@4.1.2: resolution: @@ -3077,7 +2976,6 @@ packages: dependencies: ansi-styles: 4.3.0 supports-color: 7.2.0 - dev: true /chalk@5.2.0: resolution: @@ -3135,14 +3033,12 @@ packages: readdirp: 3.6.0 optionalDependencies: fsevents: 2.3.2 - dev: true /ci-info@2.0.0: resolution: { integrity: sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==, } - dev: true /cipher-base@1.0.4: resolution: @@ -3152,7 +3048,6 @@ packages: dependencies: inherits: 2.0.4 safe-buffer: 5.2.1 - dev: true /classic-level@1.3.0: resolution: @@ -3167,7 +3062,6 @@ packages: module-error: 1.0.2 napi-macros: 2.2.2 node-gyp-build: 4.6.0 - dev: true /clean-stack@2.2.0: resolution: @@ -3175,7 +3069,6 @@ packages: integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==, } engines: { node: '>=6' } - dev: true /cli-cursor@3.1.0: resolution: @@ -3254,7 +3147,6 @@ packages: string-width: 4.2.3 strip-ansi: 6.0.1 wrap-ansi: 7.0.0 - dev: true /cliui@8.0.1: resolution: @@ -3275,7 +3167,6 @@ packages: } dependencies: color-name: 1.1.3 - dev: true /color-convert@2.0.1: resolution: @@ -3285,21 +3176,18 @@ packages: engines: { node: '>=7.0.0' } dependencies: color-name: 1.1.4 - dev: true /color-name@1.1.3: resolution: { integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==, } - dev: true /color-name@1.1.4: resolution: { integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==, } - dev: true /colorette@2.0.19: resolution: @@ -3331,7 +3219,6 @@ packages: { integrity: sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==, } - dev: true /command-line-args@5.2.1: resolution: @@ -3372,7 +3259,6 @@ packages: { integrity: sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==, } - dev: true /commander@9.5.0: resolution: @@ -3404,7 +3290,6 @@ packages: { integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==, } - dev: true /concat-stream@1.6.2: resolution: @@ -3691,7 +3576,6 @@ packages: integrity: sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==, } engines: { node: '>= 0.6' } - dev: true /cookie@0.5.0: resolution: @@ -3753,7 +3637,6 @@ packages: } engines: { node: '>=0.8' } hasBin: true - dev: true /create-hash@1.2.0: resolution: @@ -3766,7 +3649,6 @@ packages: md5.js: 1.3.5 ripemd160: 2.0.2 sha.js: 2.4.11 - dev: true /create-hmac@1.1.7: resolution: @@ -3780,14 +3662,12 @@ packages: ripemd160: 2.0.2 safe-buffer: 5.2.1 sha.js: 2.4.11 - dev: true /create-require@1.1.1: resolution: { integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==, } - dev: true /cross-spawn@7.0.3: resolution: @@ -3905,7 +3785,6 @@ packages: dependencies: ms: 2.1.2 supports-color: 8.1.1 - dev: true /decamelize-keys@1.1.1: resolution: @@ -3932,7 +3811,6 @@ packages: integrity: sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==, } engines: { node: '>=10' } - dev: true /deep-eql@4.1.3: resolution: @@ -3992,7 +3870,6 @@ packages: integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==, } engines: { node: '>= 0.8' } - dev: true /destroy@1.2.0: resolution: @@ -4045,7 +3922,6 @@ packages: integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==, } engines: { node: '>=0.3.1' } - dev: true /diff@5.0.0: resolution: @@ -4053,7 +3929,6 @@ packages: integrity: sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==, } engines: { node: '>=0.3.1' } - dev: true /difflib@0.2.4: resolution: @@ -4152,7 +4027,6 @@ packages: inherits: 2.0.4 minimalistic-assert: 1.0.1 minimalistic-crypto-utils: 1.0.1 - dev: true /emoji-regex@7.0.3: resolution: @@ -4166,7 +4040,6 @@ packages: { integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==, } - dev: true /emoji-regex@9.2.2: resolution: @@ -4198,7 +4071,6 @@ packages: engines: { node: '>=8.6' } dependencies: ansi-colors: 4.1.3 - dev: true /env-paths@2.2.1: resolution: @@ -4206,7 +4078,6 @@ packages: integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==, } engines: { node: '>=6' } - dev: true /error-ex@1.3.2: resolution: @@ -4306,7 +4177,6 @@ packages: integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==, } engines: { node: '>=6' } - dev: true /escape-html@1.0.3: resolution: @@ -4321,7 +4191,6 @@ packages: integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==, } engines: { node: '>=0.8.0' } - dev: true /escape-string-regexp@4.0.0: resolution: @@ -4329,7 +4198,6 @@ packages: integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==, } engines: { node: '>=10' } - dev: true /escodegen@1.8.1: resolution: @@ -4797,7 +4665,6 @@ packages: scrypt-js: 3.0.1 secp256k1: 4.0.3 setimmediate: 1.0.5 - dev: true /ethereum-cryptography@1.2.0: resolution: @@ -4809,7 +4676,6 @@ packages: '@noble/secp256k1': 1.7.1 '@scure/bip32': 1.1.5 '@scure/bip39': 1.1.1 - dev: true /ethereumjs-abi@0.6.8: resolution: @@ -4819,7 +4685,6 @@ packages: dependencies: bn.js: 4.12.0 ethereumjs-util: 6.2.1 - dev: true /ethereumjs-util@6.2.1: resolution: @@ -4834,7 +4699,6 @@ packages: ethereum-cryptography: 0.1.3 ethjs-util: 0.1.6 rlp: 2.2.7 - dev: true /ethereumjs-util@7.1.5: resolution: @@ -4906,7 +4770,6 @@ packages: transitivePeerDependencies: - bufferutil - utf-8-validate - dev: true /ethjs-unit@0.1.6: resolution: @@ -4928,7 +4791,6 @@ packages: dependencies: is-hex-prefixed: 1.0.0 strip-hex-prefix: 1.0.0 - dev: true /event-target-shim@5.0.1: resolution: @@ -4936,7 +4798,6 @@ packages: integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==, } engines: { node: '>=6' } - dev: true /evp_bytestokey@1.0.3: resolution: @@ -4946,7 +4807,6 @@ packages: dependencies: md5.js: 1.3.5 safe-buffer: 5.2.1 - dev: true /execa@5.1.1: resolution: @@ -5120,7 +4980,6 @@ packages: engines: { node: '>=8' } dependencies: to-regex-range: 5.0.1 - dev: true /finalhandler@1.2.0: resolution: @@ -5158,7 +5017,6 @@ packages: engines: { node: '>=4' } dependencies: locate-path: 2.0.0 - dev: true /find-up@3.0.0: resolution: @@ -5190,7 +5048,6 @@ packages: dependencies: locate-path: 6.0.0 path-exists: 4.0.0 - dev: true /flat-cache@3.0.4: resolution: @@ -5219,7 +5076,6 @@ packages: integrity: sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==, } hasBin: true - dev: true /flatted@3.2.7: resolution: @@ -5250,7 +5106,6 @@ packages: optional: true dependencies: debug: 4.3.4(supports-color@8.1.1) - dev: true /for-each@0.3.3: resolution: @@ -5317,7 +5172,6 @@ packages: { integrity: sha512-H5KQDspykdHuztLTg+ajGN0Z2qUjcEf3Ybxc6hLt0k7/zPkn29XnKnxlBPyW2XIddWrGaJBzBl4VLYOtk39yZg==, } - dev: true /fresh@0.5.2: resolution: @@ -5338,7 +5192,6 @@ packages: klaw: 1.3.1 path-is-absolute: 1.0.1 rimraf: 2.7.1 - dev: true /fs-extra@10.1.0: resolution: @@ -5374,7 +5227,6 @@ packages: graceful-fs: 4.2.11 jsonfile: 4.0.0 universalify: 0.1.2 - dev: true /fs-extra@8.1.0: resolution: @@ -5413,7 +5265,6 @@ packages: { integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==, } - dev: true /fsevents@2.1.3: resolution: @@ -5435,7 +5286,6 @@ packages: engines: { node: ^8.16.0 || ^10.6.0 || >=11.0.0 } os: [darwin] requiresBuild: true - dev: true optional: true /function-bind@1.1.1: @@ -5443,7 +5293,6 @@ packages: { integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==, } - dev: true /function.prototype.name@1.1.5: resolution: @@ -5463,7 +5312,6 @@ packages: { integrity: sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==, } - dev: true /functions-have-names@1.2.3: resolution: @@ -5478,7 +5326,6 @@ packages: integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==, } engines: { node: 6.* || 8.* || >= 10.* } - dev: true /get-func-name@2.0.0: resolution: @@ -5496,7 +5343,6 @@ packages: function-bind: 1.1.1 has: 1.0.3 has-symbols: 1.0.3 - dev: true /get-pkg-repo@4.2.1: resolution: @@ -5614,7 +5460,6 @@ packages: engines: { node: '>= 6' } dependencies: is-glob: 4.0.3 - dev: true /glob-parent@6.0.2: resolution: @@ -5679,7 +5524,6 @@ packages: minimatch: 3.1.2 once: 1.4.0 path-is-absolute: 1.0.1 - dev: true /glob@7.2.3: resolution: @@ -5807,7 +5651,6 @@ packages: { integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==, } - dev: true /grapheme-splitter@1.0.4: resolution: @@ -5920,6 +5763,80 @@ packages: - '@codechecks/client' dev: true + /hardhat@2.13.0(ts-node@10.9.1)(typescript@4.9.4): + resolution: + { + integrity: sha512-ZlzBOLML1QGlm6JWyVAG8lVTEAoOaVm1in/RU2zoGAnYEoD1Rp4T+ZMvrLNhHaaeS9hfjJ1gJUBfiDr4cx+htQ==, + } + engines: { node: '>=14.0.0' } + hasBin: true + peerDependencies: + ts-node: '*' + typescript: '*' + peerDependenciesMeta: + ts-node: + optional: true + typescript: + optional: true + dependencies: + '@ethersproject/abi': 5.7.0 + '@metamask/eth-sig-util': 4.0.1 + '@nomicfoundation/ethereumjs-block': 4.2.2 + '@nomicfoundation/ethereumjs-blockchain': 6.2.2 + '@nomicfoundation/ethereumjs-common': 3.1.2 + '@nomicfoundation/ethereumjs-evm': 1.3.2 + '@nomicfoundation/ethereumjs-rlp': 4.0.3 + '@nomicfoundation/ethereumjs-statemanager': 1.0.5 + '@nomicfoundation/ethereumjs-trie': 5.0.5 + '@nomicfoundation/ethereumjs-tx': 4.1.2 + '@nomicfoundation/ethereumjs-util': 8.0.6 + '@nomicfoundation/ethereumjs-vm': 6.4.2 + '@nomicfoundation/solidity-analyzer': 0.1.1 + '@sentry/node': 5.30.0 + '@types/bn.js': 5.1.1 + '@types/lru-cache': 5.1.1 + abort-controller: 3.0.0 + adm-zip: 0.4.16 + aggregate-error: 3.1.0 + ansi-escapes: 4.3.2 + chalk: 2.4.2 + chokidar: 3.5.3 + ci-info: 2.0.0 + debug: 4.3.4(supports-color@8.1.1) + enquirer: 2.3.6 + env-paths: 2.2.1 + ethereum-cryptography: 1.2.0 + 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.3.0 + io-ts: 1.10.4 + keccak: 3.0.3 + lodash: 4.17.21 + mnemonist: 0.38.5 + mocha: 10.2.0 + p-map: 4.0.0 + qs: 6.11.1 + raw-body: 2.5.2 + resolve: 1.17.0 + semver: 6.3.0 + solc: 0.7.3(debug@4.3.4) + source-map-support: 0.5.21 + stacktrace-parser: 0.1.10 + ts-node: 10.9.1(@types/node@18.15.10)(typescript@5.0.2) + tsort: 0.0.1 + typescript: 4.9.4 + undici: 5.21.2 + uuid: 8.3.2 + ws: 7.5.9 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + dev: false + /hardhat@2.13.0(ts-node@10.9.1)(typescript@5.0.2): resolution: { @@ -6015,7 +5932,6 @@ packages: integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==, } engines: { node: '>=4' } - dev: true /has-flag@4.0.0: resolution: @@ -6023,7 +5939,6 @@ packages: integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==, } engines: { node: '>=8' } - dev: true /has-property-descriptors@1.0.0: resolution: @@ -6048,7 +5963,6 @@ packages: integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==, } engines: { node: '>= 0.4' } - dev: true /has-tostringtag@1.0.0: resolution: @@ -6068,7 +5982,6 @@ packages: engines: { node: '>= 0.4.0' } dependencies: function-bind: 1.1.1 - dev: true /hash-base@3.1.0: resolution: @@ -6080,7 +5993,6 @@ packages: inherits: 2.0.4 readable-stream: 3.6.2 safe-buffer: 5.2.1 - dev: true /hash.js@1.1.3: resolution: @@ -6100,7 +6012,6 @@ packages: dependencies: inherits: 2.0.4 minimalistic-assert: 1.0.1 - dev: true /he@1.2.0: resolution: @@ -6108,7 +6019,6 @@ packages: integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==, } hasBin: true - dev: true /heap@0.2.7: resolution: @@ -6126,7 +6036,6 @@ packages: hash.js: 1.1.7 minimalistic-assert: 1.0.1 minimalistic-crypto-utils: 1.0.1 - dev: true /hosted-git-info@2.8.9: resolution: @@ -6170,7 +6079,6 @@ packages: setprototypeof: 1.2.0 statuses: 2.0.1 toidentifier: 1.0.1 - dev: true /http-response-object@3.0.2: resolution: @@ -6204,7 +6112,6 @@ packages: debug: 4.3.4(supports-color@8.1.1) transitivePeerDependencies: - supports-color - dev: true /human-signals@2.1.0: resolution: @@ -6247,14 +6154,12 @@ packages: engines: { node: '>=0.10.0' } dependencies: safer-buffer: 2.1.2 - dev: true /ieee754@1.2.1: resolution: { integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==, } - dev: true /ignore@5.2.4: resolution: @@ -6269,7 +6174,6 @@ packages: { integrity: sha512-0AOCmOip+xgJwEVTQj1EfiDDOkPmuyllDuTuEX+DDXUgapLAsBIfkg3sxCYyCEA8mQqZrrxPUGjcOQ2JS3WLkg==, } - dev: true /import-fresh@3.3.0: resolution: @@ -6304,7 +6208,6 @@ packages: integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==, } engines: { node: '>=8' } - dev: true /inflight@1.0.6: resolution: @@ -6314,14 +6217,12 @@ packages: dependencies: once: 1.4.0 wrappy: 1.0.2 - dev: true /inherits@2.0.4: resolution: { integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==, } - dev: true /ini@1.3.8: resolution: @@ -6357,7 +6258,6 @@ packages: } dependencies: fp-ts: 1.19.3 - dev: true /ipaddr.js@1.9.1: resolution: @@ -6402,7 +6302,6 @@ packages: engines: { node: '>=8' } dependencies: binary-extensions: 2.2.0 - dev: true /is-boolean-object@1.1.2: resolution: @@ -6421,7 +6320,6 @@ packages: integrity: sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==, } engines: { node: '>=4' } - dev: true /is-callable@1.2.7: resolution: @@ -6465,7 +6363,6 @@ packages: integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==, } engines: { node: '>=0.10.0' } - dev: true /is-fullwidth-code-point@2.0.0: resolution: @@ -6481,7 +6378,6 @@ packages: integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==, } engines: { node: '>=8' } - dev: true /is-fullwidth-code-point@4.0.0: resolution: @@ -6499,7 +6395,6 @@ packages: engines: { node: '>=0.10.0' } dependencies: is-extglob: 2.1.1 - dev: true /is-hex-prefixed@1.0.0: resolution: @@ -6507,7 +6402,6 @@ packages: integrity: sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA==, } engines: { node: '>=6.5.0', npm: '>=3' } - dev: true /is-negative-zero@2.0.2: resolution: @@ -6533,7 +6427,6 @@ packages: integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==, } engines: { node: '>=0.12.0' } - dev: true /is-obj@2.0.0: resolution: @@ -6565,7 +6458,6 @@ packages: integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==, } engines: { node: '>=8' } - dev: true /is-regex@1.1.4: resolution: @@ -6660,7 +6552,6 @@ packages: integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==, } engines: { node: '>=10' } - dev: true /is-weakref@1.0.2: resolution: @@ -6721,7 +6612,6 @@ packages: { integrity: sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==, } - dev: true /js-tokens@4.0.0: resolution: @@ -6760,7 +6650,6 @@ packages: hasBin: true dependencies: argparse: 2.0.1 - dev: true /jsbn@0.1.1: resolution: @@ -6835,7 +6724,6 @@ packages: } optionalDependencies: graceful-fs: 4.2.11 - dev: true /jsonfile@4.0.0: resolution: @@ -6844,7 +6732,6 @@ packages: } optionalDependencies: graceful-fs: 4.2.11 - dev: true /jsonfile@6.1.0: resolution: @@ -6896,7 +6783,6 @@ packages: node-addon-api: 2.0.2 node-gyp-build: 4.6.0 readable-stream: 3.6.2 - dev: true /kind-of@6.0.3: resolution: @@ -6913,7 +6799,6 @@ packages: } optionalDependencies: graceful-fs: 4.2.11 - dev: true /kleur@3.0.3: resolution: @@ -6929,7 +6814,6 @@ packages: integrity: sha512-PbXpve8rKeNcZ9C1mUicC9auIYFyGpkV9/i6g76tLgANwWhtG2v7I4xNBUlkn3lE2/dZF3Pi0ygYGtLc4RXXdA==, } engines: { node: '>=12' } - dev: true /level-transcoder@1.0.1: resolution: @@ -6940,7 +6824,6 @@ packages: dependencies: buffer: 6.0.3 module-error: 1.0.2 - dev: true /level@8.0.0: resolution: @@ -6951,7 +6834,6 @@ packages: dependencies: browser-level: 1.0.1 classic-level: 1.3.0 - dev: true /levn@0.3.0: resolution: @@ -7060,7 +6942,6 @@ packages: dependencies: p-locate: 2.0.0 path-exists: 3.0.0 - dev: true /locate-path@3.0.0: resolution: @@ -7091,7 +6972,6 @@ packages: engines: { node: '>=10' } dependencies: p-locate: 5.0.0 - dev: true /lodash.camelcase@4.3.0: resolution: @@ -7182,7 +7062,6 @@ packages: { integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==, } - dev: true /log-symbols@3.0.0: resolution: @@ -7203,7 +7082,6 @@ packages: dependencies: chalk: 4.1.2 is-unicode-supported: 0.1.0 - dev: true /log-update@4.0.0: resolution: @@ -7234,7 +7112,6 @@ packages: } dependencies: yallist: 3.1.1 - dev: true /lru-cache@6.0.0: resolution: @@ -7251,14 +7128,12 @@ packages: { integrity: sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ==, } - dev: true /make-error@1.3.6: resolution: { integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==, } - dev: true /map-obj@1.0.1: resolution: @@ -7296,7 +7171,6 @@ packages: integrity: sha512-iJIUcQWA88IJB/5L15GnJVnSQJmf/YaxxV6zRavv83HILHaJQb6y0iFyDMdDO0gN8X37tdxmAOrH/P8B6RB8sQ==, } engines: { node: '>=8.9.0' } - dev: true /md5.js@1.3.5: resolution: @@ -7307,7 +7181,6 @@ packages: hash-base: 3.1.0 inherits: 2.0.4 safe-buffer: 5.2.1 - dev: true /media-typer@0.3.0: resolution: @@ -7327,7 +7200,6 @@ packages: abstract-level: 1.0.3 functional-red-black-tree: 1.0.1 module-error: 1.0.2 - dev: true /memorystream@0.3.1: resolution: @@ -7335,7 +7207,6 @@ packages: integrity: sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==, } engines: { node: '>= 0.10.0' } - dev: true /meow@8.1.2: resolution: @@ -7468,14 +7339,12 @@ packages: { integrity: sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==, } - dev: true /minimalistic-crypto-utils@1.0.1: resolution: { integrity: sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==, } - dev: true /minimatch@3.0.4: resolution: @@ -7493,7 +7362,6 @@ packages: } dependencies: brace-expansion: 1.1.11 - dev: true /minimatch@5.0.1: resolution: @@ -7503,7 +7371,6 @@ packages: engines: { node: '>=10' } dependencies: brace-expansion: 2.0.1 - dev: true /minimatch@5.1.6: resolution: @@ -7570,7 +7437,6 @@ packages: } dependencies: obliterator: 2.0.4 - dev: true /mocha@10.2.0: resolution: @@ -7601,7 +7467,6 @@ packages: yargs: 16.2.0 yargs-parser: 20.2.4 yargs-unparser: 2.0.0 - dev: true /mocha@7.1.2: resolution: @@ -7685,7 +7550,6 @@ packages: integrity: sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA==, } engines: { node: '>=10' } - dev: true /ms@2.0.0: resolution: @@ -7706,14 +7570,12 @@ packages: { integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==, } - dev: true /ms@2.1.3: resolution: { integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==, } - dev: true /murmur-128@0.2.1: resolution: @@ -7733,14 +7595,12 @@ packages: } engines: { node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1 } hasBin: true - dev: true /napi-macros@2.2.2: resolution: { integrity: sha512-hmEVtAGYzVQpCKdbQea4skABsdXW4RUh5t5mJ2zzqowJS2OyXZTU1KhDVFhx+NlWZ4ap9mqR9TcDO3LTTttd+g==, } - dev: true /natural-compare-lite@1.4.0: resolution: @@ -7776,7 +7636,6 @@ packages: { integrity: sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==, } - dev: true /node-emoji@1.11.0: resolution: @@ -7803,7 +7662,6 @@ packages: integrity: sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==, } hasBin: true - dev: true /nofilter@3.1.0: resolution: @@ -7854,7 +7712,6 @@ packages: integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==, } engines: { node: '>=0.10.0' } - dev: true /npm-run-path@4.0.1: resolution: @@ -7907,7 +7764,6 @@ packages: { integrity: sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==, } - dev: true /object-keys@1.1.1: resolution: @@ -7973,7 +7829,6 @@ packages: { integrity: sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ==, } - dev: true /on-finished@2.4.1: resolution: @@ -7992,7 +7847,6 @@ packages: } dependencies: wrappy: 1.0.2 - dev: true /onetime@5.1.2: resolution: @@ -8069,7 +7923,6 @@ packages: integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==, } engines: { node: '>=0.10.0' } - dev: true /p-limit@1.3.0: resolution: @@ -8079,7 +7932,6 @@ packages: engines: { node: '>=4' } dependencies: p-try: 1.0.0 - dev: true /p-limit@2.3.0: resolution: @@ -8099,7 +7951,6 @@ packages: engines: { node: '>=10' } dependencies: yocto-queue: 0.1.0 - dev: true /p-locate@2.0.0: resolution: @@ -8109,7 +7960,6 @@ packages: engines: { node: '>=4' } dependencies: p-limit: 1.3.0 - dev: true /p-locate@3.0.0: resolution: @@ -8139,7 +7989,6 @@ packages: engines: { node: '>=10' } dependencies: p-limit: 3.1.0 - dev: true /p-map@4.0.0: resolution: @@ -8149,7 +7998,6 @@ packages: engines: { node: '>=10' } dependencies: aggregate-error: 3.1.0 - dev: true /p-try@1.0.0: resolution: @@ -8157,7 +8005,6 @@ packages: integrity: sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==, } engines: { node: '>=4' } - dev: true /p-try@2.2.0: resolution: @@ -8222,7 +8069,6 @@ packages: integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==, } engines: { node: '>=4' } - dev: true /path-exists@4.0.0: resolution: @@ -8230,7 +8076,6 @@ packages: integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==, } engines: { node: '>=8' } - dev: true /path-is-absolute@1.0.1: resolution: @@ -8238,7 +8083,6 @@ packages: integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==, } engines: { node: '>=0.10.0' } - dev: true /path-key@3.1.1: resolution: @@ -8261,7 +8105,6 @@ packages: { integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==, } - dev: true /path-to-regexp@0.1.7: resolution: @@ -8307,7 +8150,6 @@ packages: ripemd160: 2.0.2 safe-buffer: 5.2.1 sha.js: 2.4.11 - dev: true /performance-now@2.1.0: resolution: @@ -8322,7 +8164,6 @@ packages: integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==, } engines: { node: '>=8.6' } - dev: true /pidtree@0.6.0: resolution: @@ -8505,7 +8346,6 @@ packages: engines: { node: '>=0.6' } dependencies: side-channel: 1.0.4 - dev: true /qs@6.5.3: resolution: @@ -8520,7 +8360,6 @@ packages: { integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==, } - dev: true /quick-lru@4.0.1: resolution: @@ -8537,7 +8376,6 @@ packages: } dependencies: safe-buffer: 5.2.1 - dev: true /range-parser@1.2.1: resolution: @@ -8571,7 +8409,6 @@ packages: http-errors: 2.0.0 iconv-lite: 0.4.24 unpipe: 1.0.0 - dev: true /read-pkg-up@3.0.0: resolution: @@ -8646,7 +8483,6 @@ packages: inherits: 2.0.4 string_decoder: 1.3.0 util-deprecate: 1.0.2 - dev: true /readdirp@3.2.0: resolution: @@ -8666,7 +8502,6 @@ packages: engines: { node: '>=8.10.0' } dependencies: picomatch: 2.3.1 - dev: true /rechoir@0.6.2: resolution: @@ -8812,7 +8647,6 @@ packages: integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==, } engines: { node: '>=0.10.0' } - dev: true /require-from-string@2.0.2: resolution: @@ -8820,7 +8654,6 @@ packages: integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==, } engines: { node: '>=0.10.0' } - dev: true /require-main-filename@2.0.0: resolution: @@ -8877,7 +8710,6 @@ packages: } dependencies: path-parse: 1.0.7 - dev: true /resolve@1.22.2: resolution: @@ -8933,7 +8765,6 @@ packages: hasBin: true dependencies: glob: 7.2.0 - dev: true /rimraf@3.0.2: resolution: @@ -8953,7 +8784,6 @@ packages: dependencies: hash-base: 3.1.0 inherits: 2.0.4 - dev: true /rlp@2.2.7: resolution: @@ -8963,7 +8793,6 @@ packages: hasBin: true dependencies: bn.js: 5.2.1 - dev: true /run-parallel-limit@1.1.0: resolution: @@ -8972,7 +8801,6 @@ packages: } dependencies: queue-microtask: 1.2.3 - dev: true /run-parallel@1.2.0: resolution: @@ -8988,7 +8816,6 @@ packages: { integrity: sha512-4VlvkRUuCJvr2J6Y0ImW7NvTCriMi7ErOAqWk1y69vAdoNIzCF3yPmgeNzx+RQTLEDFq5sHfscn1MwHxP9hNfA==, } - dev: true /rxjs@7.8.0: resolution: @@ -9011,7 +8838,6 @@ packages: { integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==, } - dev: true /safe-regex-test@1.0.0: resolution: @@ -9029,7 +8855,6 @@ packages: { integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==, } - dev: true /sc-istanbul@0.4.6: resolution: @@ -9066,7 +8891,6 @@ packages: { integrity: sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==, } - dev: true /secp256k1@4.0.3: resolution: @@ -9079,7 +8903,6 @@ packages: elliptic: 6.5.4 node-addon-api: 2.0.2 node-gyp-build: 4.6.0 - dev: true /semver@5.7.1: resolution: @@ -9087,7 +8910,6 @@ packages: integrity: sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==, } hasBin: true - dev: true /semver@6.3.0: resolution: @@ -9095,7 +8917,6 @@ packages: integrity: sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==, } hasBin: true - dev: true /semver@7.3.8: resolution: @@ -9150,7 +8971,6 @@ packages: } dependencies: randombytes: 2.1.0 - dev: true /serve-static@1.15.0: resolution: @@ -9186,14 +9006,12 @@ packages: { integrity: sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==, } - dev: true /setprototypeof@1.2.0: resolution: { integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==, } - dev: true /sha.js@2.4.11: resolution: @@ -9204,7 +9022,6 @@ packages: dependencies: inherits: 2.0.4 safe-buffer: 5.2.1 - dev: true /sha1@1.1.1: resolution: @@ -9256,7 +9073,6 @@ packages: call-bind: 1.0.2 get-intrinsic: 1.2.0 object-inspect: 1.12.3 - dev: true /signal-exit@3.0.7: resolution: @@ -9334,7 +9150,6 @@ packages: tmp: 0.0.33 transitivePeerDependencies: - debug - dev: true /solhint-plugin-prettier@0.0.5(prettier-plugin-solidity@1.1.3)(prettier@2.8.7): resolution: @@ -9434,7 +9249,6 @@ packages: dependencies: buffer-from: 1.1.2 source-map: 0.6.1 - dev: true /source-map@0.2.0: resolution: @@ -9454,7 +9268,6 @@ packages: integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==, } engines: { node: '>=0.10.0' } - dev: true /spdx-correct@3.2.0: resolution: @@ -9550,7 +9363,6 @@ packages: engines: { node: '>=6' } dependencies: type-fest: 0.7.1 - dev: true /standard-version@9.5.0: resolution: @@ -9582,7 +9394,6 @@ packages: integrity: sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==, } engines: { node: '>= 0.8' } - dev: true /stealthy-require@1.1.1: resolution: @@ -9598,7 +9409,6 @@ packages: integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==, } engines: { node: '>=10.0.0' } - dev: true /string-argv@0.3.1: resolution: @@ -9648,7 +9458,6 @@ packages: emoji-regex: 8.0.0 is-fullwidth-code-point: 3.0.0 strip-ansi: 6.0.1 - dev: true /string-width@5.1.2: resolution: @@ -9712,7 +9521,6 @@ packages: } dependencies: safe-buffer: 5.2.1 - dev: true /stringify-package@1.0.1: resolution: @@ -9750,7 +9558,6 @@ packages: engines: { node: '>=8' } dependencies: ansi-regex: 5.0.1 - dev: true /strip-ansi@7.0.1: resolution: @@ -9794,7 +9601,6 @@ packages: engines: { node: '>=6.5.0', npm: '>=3' } dependencies: is-hex-prefixed: 1.0.0 - dev: true /strip-indent@3.0.0: resolution: @@ -9820,7 +9626,6 @@ packages: integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==, } engines: { node: '>=8' } - dev: true /supports-color@3.2.3: resolution: @@ -9840,7 +9645,6 @@ packages: engines: { node: '>=4' } dependencies: has-flag: 3.0.0 - dev: true /supports-color@6.0.0: resolution: @@ -9860,7 +9664,6 @@ packages: engines: { node: '>=8' } dependencies: has-flag: 4.0.0 - dev: true /supports-color@8.1.1: resolution: @@ -9870,7 +9673,6 @@ packages: engines: { node: '>=10' } dependencies: has-flag: 4.0.0 - dev: true /supports-preserve-symlinks-flag@1.0.0: resolution: @@ -10027,7 +9829,6 @@ packages: engines: { node: '>=0.6.0' } dependencies: os-tmpdir: 1.0.2 - dev: true /to-regex-range@5.0.1: resolution: @@ -10037,7 +9838,6 @@ packages: engines: { node: '>=8.0' } dependencies: is-number: 7.0.0 - dev: true /toidentifier@1.0.1: resolution: @@ -10045,7 +9845,6 @@ packages: integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==, } engines: { node: '>=0.6' } - dev: true /tough-cookie@2.5.0: resolution: @@ -10135,7 +9934,6 @@ packages: typescript: 5.0.2 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 - dev: true /tsconfig-paths@3.14.2: resolution: @@ -10154,7 +9952,6 @@ packages: { integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==, } - dev: true /tslib@2.5.0: resolution: @@ -10176,7 +9973,6 @@ packages: { integrity: sha512-Tyrf5mxF8Ofs1tNoxA13lFeZ2Zrbd6cKbuH3V+MQ5sb6DtBj5FjrXVsRWT8YvNAQTqNoz66dz1WsbigI22aEnw==, } - dev: true /tsutils@3.21.0(typescript@5.0.2): resolution: @@ -10205,7 +10001,6 @@ packages: { integrity: sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw==, } - dev: true /tweetnacl@0.14.5: resolution: @@ -10219,7 +10014,6 @@ packages: { integrity: sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==, } - dev: true /type-check@0.3.2: resolution: @@ -10271,7 +10065,6 @@ packages: integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==, } engines: { node: '>=10' } - dev: true /type-fest@0.6.0: resolution: @@ -10287,7 +10080,6 @@ packages: integrity: sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==, } engines: { node: '>=8' } - dev: true /type-fest@0.8.1: resolution: @@ -10352,6 +10144,14 @@ packages: } dev: true + /typescript@4.9.4: + resolution: + { + integrity: sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==, + } + engines: { node: '>=4.2.0' } + hasBin: true + /typescript@5.0.2: resolution: { @@ -10359,7 +10159,6 @@ packages: } engines: { node: '>=12.20' } hasBin: true - dev: true /typical@4.0.0: resolution: @@ -10408,7 +10207,6 @@ packages: engines: { node: '>=12.18' } dependencies: busboy: 1.6.0 - dev: true /universalify@0.1.2: resolution: @@ -10416,7 +10214,6 @@ packages: integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==, } engines: { node: '>= 4.0.0' } - dev: true /universalify@2.0.0: resolution: @@ -10432,7 +10229,6 @@ packages: integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==, } engines: { node: '>= 0.8' } - dev: true /uri-js@4.4.1: resolution: @@ -10455,7 +10251,6 @@ packages: { integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==, } - dev: true /utils-merge@1.0.1: resolution: @@ -10496,14 +10291,12 @@ packages: integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==, } hasBin: true - dev: true /v8-compile-cache-lib@3.0.1: resolution: { integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==, } - dev: true /validate-npm-package-license@3.0.4: resolution: @@ -10647,7 +10440,6 @@ packages: { integrity: sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==, } - dev: true /wrap-ansi@5.1.0: resolution: @@ -10683,14 +10475,12 @@ packages: ansi-styles: 4.3.0 string-width: 4.2.3 strip-ansi: 6.0.1 - dev: true /wrappy@1.0.2: resolution: { integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==, } - dev: true /ws@7.4.6: resolution: @@ -10706,7 +10496,6 @@ packages: optional: true utf-8-validate: optional: true - dev: true /ws@7.5.9: resolution: @@ -10722,7 +10511,6 @@ packages: optional: true utf-8-validate: optional: true - dev: true /xmlhttprequest@1.8.0: resolution: @@ -10753,14 +10541,12 @@ packages: integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==, } engines: { node: '>=10' } - dev: true /yallist@3.1.1: resolution: { integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==, } - dev: true /yallist@4.0.0: resolution: @@ -10793,7 +10579,6 @@ packages: integrity: sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==, } engines: { node: '>=10' } - dev: true /yargs-parser@20.2.9: resolution: @@ -10801,7 +10586,6 @@ packages: integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==, } engines: { node: '>=10' } - dev: true /yargs-parser@21.1.1: resolution: @@ -10834,7 +10618,6 @@ packages: decamelize: 4.0.0 flat: 5.0.2 is-plain-obj: 2.1.0 - dev: true /yargs@13.3.2: resolution: @@ -10868,7 +10651,6 @@ packages: string-width: 4.2.3 y18n: 5.0.8 yargs-parser: 20.2.9 - dev: true /yargs@17.7.1: resolution: @@ -10892,7 +10674,6 @@ packages: integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==, } engines: { node: '>=6' } - dev: true /yocto-queue@0.1.0: resolution: @@ -10900,7 +10681,6 @@ packages: integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==, } engines: { node: '>=10' } - dev: true /zksync-web3@0.14.3(ethers@5.7.2): resolution: diff --git a/scripts/deployModularized.ts b/scripts/deployModularized.ts index 15e7dfe83..d19be3f7a 100644 --- a/scripts/deployModularized.ts +++ b/scripts/deployModularized.ts @@ -1,10 +1,9 @@ import { ethers } from 'hardhat'; import { type DiamondMultiInit__factory, - type SoulHubModularized, type TransparentUpgradeableProxy, - ERC5727UpgradeableDS__factory, - ERC5727GovernanceUpgradeableDS__factory, + SoulHubUpgradeable__factory, + type SoulHubUpgradeable, } from '../typechain'; import { FacetCutAction, getSelectors, remove } from '../test/utils'; @@ -26,8 +25,8 @@ async function deployTransparentProxy( return transparentProxy; } -async function deploySoulHub(): Promise { - const soulHubContract = await ethers.getContractFactory('SoulHubModularized'); +async function deploySoulHub(): Promise { + const soulHubContract = await ethers.getContractFactory('SoulHubUpgradeable'); const soulHub = await soulHubContract.deploy(); await soulHub.deployed(); console.log('SoulHub contract deployed to:', soulHub.address); @@ -38,15 +37,15 @@ async function deployFacets(): Promise { const FacetNames = [ 'DiamondCutFacet', 'DiamondLoupeFacet', - 'ERC5727UpgradeableDS', + 'ERC5727SlotSettableUpgradeableDS', 'ERC5727ClaimableUpgradeableDS', 'ERC5727GovernanceUpgradeableDS', 'ERC5727RecoveryUpgradeableDS', 'ERC5727ExpirableUpgradeableDS', - 'ERC5727EnumerableUpgradeableDS', 'ERC5727DelegateUpgradeableDS', ]; // The `facetCuts` variable is the FacetCut[] that contains the functions to add during diamond deployment + let allSelectors: string[] = []; const facetCuts: FacetCuts[] = []; for (const FacetName of FacetNames) { const Facet = await ethers.getContractFactory(FacetName); @@ -59,21 +58,20 @@ async function deployFacets(): Promise { action: FacetCutAction.Add, functionSelectors: getSelectors(facet), }); + allSelectors = [...getSelectors(facet)]; } else { facetCuts.push({ facetAddress: facet.address, action: FacetCutAction.Add, - functionSelectors: remove( - getSelectors(facet), - facetCuts[facetCuts.length - 1].functionSelectors, - ), + functionSelectors: remove(getSelectors(facet), allSelectors), }); + allSelectors = [...allSelectors, ...facetCuts[facetCuts.length - 1].functionSelectors]; } } return facetCuts; } async function main(): Promise { - const [admin] = await ethers.getSigners(); + const [admin, owner] = await ethers.getSigners(); console.log('Deploying contracts with the account:', admin.address); console.log('Network:', (await ethers.provider.getNetwork()).name); const facetCuts = await deployFacets(); @@ -81,40 +79,25 @@ async function main(): Promise { 'DiamondMultiInit', ); const diamondMultiInit = await diamondMultiInitFactory.deploy(); + await diamondMultiInit.deployed(); console.log('diamondInit deployed: ', diamondMultiInit.address); - const IERC5727 = ERC5727UpgradeableDS__factory.createInterface(); - const IERC5727Governance = ERC5727GovernanceUpgradeableDS__factory.createInterface(); - const ERC5727InitCall = IERC5727.encodeFunctionData('init', [ - 'soulhub', - 'SOUL', - admin.address, - '1', - ]); - const ERC5727GovernanceInitCall = IERC5727Governance.encodeFunctionData('init', [admin.address]); - // Creating a function call - // This call gets executed during deployment and can also be executed in upgrades - // It is executed with delegatecall on the DiamondInit address. - const abi = [ - 'function multiInit(address[] calldata _addresses, bytes[] calldata _calldata) external', - ]; - const diamondMultiInitInterface = new ethers.utils.Interface(abi); - const functionCall = diamondMultiInitInterface.encodeFunctionData('multiInit', [ - [facetCuts[2].facetAddress, facetCuts[4].facetAddress], - [ERC5727InitCall, ERC5727GovernanceInitCall], - ]); - // Setting arguments that will be used in the diamond constructor - const diamondArgs = { - owner: admin.address, - init: diamondMultiInit.address, - initCalldata: functionCall, - }; - const Diamond = await ethers.getContractFactory('Diamond'); - const diamond = await Diamond.deploy(facetCuts, diamondArgs); - await diamond.deployed(); + const facetAddress = facetCuts.map((facet) => facet.facetAddress); + const action = facetCuts.map((facet) => facet.action); + const functionSelectors = facetCuts.map((facet) => facet.functionSelectors); + const initData = SoulHubUpgradeable__factory.createInterface().encodeFunctionData( + '__SoulHub_init', + [facetCuts.length, facetAddress, action, functionSelectors, diamondMultiInit.address], + ); const soulHubImpl = await deploySoulHub(); - const soulHubProxy = await deployTransparentProxy(soulHubImpl.address, admin.address, '0x'); + await soulHubImpl.deployed(); + console.log('soulHubImpl deployed', soulHubImpl.address); + const soulHubProxy = await deployTransparentProxy(soulHubImpl.address, admin.address, initData); + console.log('SoulHubProxy deployed: ', soulHubProxy.address); - console.log('Diamond deployed: ', diamond.address); + const soulHubProxyContract = SoulHubUpgradeable__factory.connect(soulHubProxy.address, owner); + const tx = await soulHubProxyContract.createOrganization('1q23'); + await tx.wait(); + console.log(tx); } // We recommend this pattern to be able to use async/await everywhere diff --git a/test/modularContract.test.ts b/test/modularContract.test.ts index 96d2588b0..a1722245e 100644 --- a/test/modularContract.test.ts +++ b/test/modularContract.test.ts @@ -12,12 +12,14 @@ import { type ERC5727DelegateUpgradeableDS, type ERC5727EnumerableUpgradeableDS, type ERC5727RecoveryUpgradeableDS, + type ERC5727SlotSettableUpgradeableDS, ERC5727UpgradeableDS__factory, ERC5727ClaimableUpgradeableDS__factory, ERC5727GovernanceUpgradeableDS__factory, ERC5727RecoveryUpgradeableDS__factory, ERC5727EnumerableUpgradeableDS__factory, ERC5727DelegateUpgradeableDS__factory, + ERC5727SlotSettableUpgradeableDS__factory, } from '../typechain'; import { FacetCutAction, getSelectors, remove } from './utils'; import { MerkleTree } from 'merkletreejs'; @@ -28,6 +30,7 @@ interface Fixture { getRecoveryContract: (signer: SignerWithAddress) => ERC5727RecoveryUpgradeableDS; getEnumerableContract: (signer: SignerWithAddress) => ERC5727EnumerableUpgradeableDS; getDelegateContract: (signer: SignerWithAddress) => ERC5727DelegateUpgradeableDS; + getSlotSettableContract: (signer: SignerWithAddress) => ERC5727SlotSettableUpgradeableDS; diamond: Diamond; admin: SignerWithAddress; tokenOwner1: SignerWithAddress; @@ -70,43 +73,42 @@ describe('ERC5727Modularized', function () { const FacetNames = [ 'DiamondCutFacet', 'DiamondLoupeFacet', - 'ERC5727UpgradeableDS', + 'ERC5727SlotSettableUpgradeableDS', 'ERC5727ClaimableUpgradeableDS', 'ERC5727GovernanceUpgradeableDS', 'ERC5727RecoveryUpgradeableDS', 'ERC5727ExpirableUpgradeableDS', - 'ERC5727EnumerableUpgradeableDS', 'ERC5727DelegateUpgradeableDS', ]; // The `facetCuts` variable is the FacetCut[] that contains the functions to add during diamond deployment const facetCuts: FacetCuts[] = []; + let allSelectors: string[] = []; for (const FacetName of FacetNames) { const Facet = await ethers.getContractFactory(FacetName); const facet = await Facet.deploy(); await facet.deployed(); - console.log(`${FacetName} deployed: ${facet.address}`); if (facetCuts.length === 0) { facetCuts.push({ facetAddress: facet.address, action: FacetCutAction.Add, functionSelectors: getSelectors(facet), }); + allSelectors = [...getSelectors(facet)]; } else { facetCuts.push({ facetAddress: facet.address, action: FacetCutAction.Add, - functionSelectors: remove( - getSelectors(facet), - facetCuts[facetCuts.length - 1].functionSelectors, - ), + functionSelectors: remove(getSelectors(facet), allSelectors), }); + allSelectors = [...allSelectors, ...facetCuts[facetCuts.length - 1].functionSelectors]; } } - const IERC5727 = ERC5727UpgradeableDS__factory.createInterface(); + const IERC5727 = ERC5727SlotSettableUpgradeableDS__factory.createInterface(); const IERC5727Governance = ERC5727GovernanceUpgradeableDS__factory.createInterface(); const ERC5727InitCall = IERC5727.encodeFunctionData('init', [ 'soulhub', 'SOUL', + admin.address, 'https://api.soularis.io/contracts/', '1', ]); @@ -149,6 +151,8 @@ describe('ERC5727Modularized', function () { ERC5727EnumerableUpgradeableDS__factory.connect(diamond.address, signer); const getDelegateContract = (signer: SignerWithAddress): ERC5727DelegateUpgradeableDS => ERC5727DelegateUpgradeableDS__factory.connect(diamond.address, signer); + const getSlotSettableContract = (signer: SignerWithAddress): ERC5727SlotSettableUpgradeableDS => + ERC5727SlotSettableUpgradeableDS__factory.connect(diamond.address, signer); return { getCoreContract, getClaimableContract, @@ -156,6 +160,7 @@ describe('ERC5727Modularized', function () { getRecoveryContract, getEnumerableContract, getDelegateContract, + getSlotSettableContract, diamond, admin, tokenOwner1, @@ -173,10 +178,11 @@ describe('ERC5727Modularized', function () { expect(await coreContract.owner()).to.equal(admin.address); }); it('only admin can issue', async function () { - const { getCoreContract, admin, tokenOwner1, tokenOwner2 } = await loadFixture( - deployDiamondFixture, - ); + const { getCoreContract, admin, tokenOwner1, tokenOwner2, getSlotSettableContract } = + await loadFixture(deployDiamondFixture); const coreContract = getCoreContract(admin); + const slotSettableContract = getSlotSettableContract(admin); + await slotSettableContract.setupSlot(1, 1000); await coreContract['issue(address,uint256,uint256,uint8,address,bytes)']( tokenOwner1.address, 1, @@ -972,7 +978,7 @@ describe('ERC5727Modularized', function () { await governanceContract.requestApproval(tokenOwner1.address, 1, 1, 1, 0, admin.address, []); await governanceContract.addVoter(voter1.address); await governanceContractVoter.voteApproval(0, true, []); - await governanceContract.voteApproval(0, true, []); + // await governanceContract.voteApproval(0, true, []); await expect(governanceContractOperator.voteApproval(0, true, [])).be.reverted; }); it('only creator can remove approval', async function () { @@ -1167,4 +1173,222 @@ describe('ERC5727Modularized', function () { await expect(delegateContract.undelegate(operator1.address, 1)).be.reverted; }); }); + describe('ERC5727SlotSettable', function () { + it('can issue in a slot after setting it', async function () { + const { getSlotSettableContract, admin, tokenOwner1 } = await loadFixture( + deployDiamondFixture, + ); + const slotSettableContract = getSlotSettableContract(admin); + await slotSettableContract.setupSlot(1, 100); + await slotSettableContract.setupSlot(1, 100); + await slotSettableContract.batchIssue([tokenOwner1.address], 1, '', []); + }); + it('should set right max supply for a slot', async function () { + const { getSlotSettableContract, admin } = await loadFixture(deployDiamondFixture); + const slotSettableContract = getSlotSettableContract(admin); + await slotSettableContract.setupSlot(1, 100); + expect(await slotSettableContract.getMaxSupply(1)).equal(100); + }); + }); + describe('ERC5727Enumerable', function () { + it('query slot count of owner', async function () { + const { getCoreContract, admin, tokenOwner1, getEnumerableContract } = await loadFixture( + deployDiamondFixture, + ); + const coreContract = getCoreContract(admin); + const enumerableContract = getEnumerableContract(admin); + await coreContract['issue(address,uint256,uint256,uint8,address,bytes)']( + tokenOwner1.address, + 1, + 1, + 0, + admin.address, + [], + ); + await coreContract['issue(address,uint256,uint256,uint8,address,bytes)']( + tokenOwner1.address, + 2, + 2, + 0, + admin.address, + [], + ); + await coreContract['issue(address,uint256,uint256,uint8,address,bytes)']( + tokenOwner1.address, + 3, + 3, + 0, + admin.address, + [], + ); + expect(await enumerableContract.slotCountOfOwner(tokenOwner1.address)).equal(3); + }); + it('query slot of owner by index', async function () { + const { getCoreContract, admin, tokenOwner1, getEnumerableContract } = await loadFixture( + deployDiamondFixture, + ); + const coreContract = getCoreContract(admin); + const enumerableContract = getEnumerableContract(admin); + await coreContract['issue(address,uint256,uint256,uint8,address,bytes)']( + tokenOwner1.address, + 1, + 1, + 0, + admin.address, + [], + ); + await coreContract['issue(address,uint256,uint256,uint8,address,bytes)']( + tokenOwner1.address, + 2, + 2, + 0, + admin.address, + [], + ); + await coreContract['issue(address,uint256,uint256,uint8,address,bytes)']( + tokenOwner1.address, + 3, + 3, + 0, + admin.address, + [], + ); + expect(await enumerableContract.slotOfOwnerByIndex(tokenOwner1.address, 0)).equal(1); + expect(await enumerableContract.slotOfOwnerByIndex(tokenOwner1.address, 1)).equal(2); + expect(await enumerableContract.slotOfOwnerByIndex(tokenOwner1.address, 2)).equal(3); + }); + it('query owner balance in slot', async function () { + const { getCoreContract, admin, tokenOwner1, getEnumerableContract } = await loadFixture( + deployDiamondFixture, + ); + const coreContract = getCoreContract(admin); + const enumerableContract = getEnumerableContract(admin); + await coreContract['issue(address,uint256,uint256,uint8,address,bytes)']( + tokenOwner1.address, + 1, + 1, + 0, + admin.address, + [], + ); + await coreContract['issue(address,uint256,uint256,uint8,address,bytes)']( + tokenOwner1.address, + 2, + 1, + 0, + admin.address, + [], + ); + await coreContract['issue(address,uint256,uint256,uint8,address,bytes)']( + tokenOwner1.address, + 3, + 1, + 0, + admin.address, + [], + ); + expect(await enumerableContract.ownerBalanceInSlot(tokenOwner1.address, 1)).equal(3); + }); + it('should revert on query slot of owner by index if index out of bounds', async function () { + const { getCoreContract, admin, tokenOwner1, getEnumerableContract } = await loadFixture( + deployDiamondFixture, + ); + const coreContract = getCoreContract(admin); + const enumerableContract = getEnumerableContract(admin); + await coreContract['issue(address,uint256,uint256,uint8,address,bytes)']( + tokenOwner1.address, + 1, + 1, + 0, + admin.address, + [], + ); + await coreContract['issue(address,uint256,uint256,uint8,address,bytes)']( + tokenOwner1.address, + 2, + 2, + 0, + admin.address, + [], + ); + await coreContract['issue(address,uint256,uint256,uint8,address,bytes)']( + tokenOwner1.address, + 3, + 3, + 0, + admin.address, + [], + ); + expect(await enumerableContract.slotOfOwnerByIndex(tokenOwner1.address, 0)).equal(1); + expect(await enumerableContract.slotOfOwnerByIndex(tokenOwner1.address, 1)).equal(2); + expect(await enumerableContract.slotOfOwnerByIndex(tokenOwner1.address, 2)).equal(3); + await expect(enumerableContract.slotOfOwnerByIndex(tokenOwner1.address, 3)).be.reverted; + }); + it('should revert on query slot count if owner is invaild', async function () { + const { getCoreContract, admin, tokenOwner1, getEnumerableContract } = await loadFixture( + deployDiamondFixture, + ); + const coreContract = getCoreContract(admin); + const enumerableContract = getEnumerableContract(admin); + await coreContract['issue(address,uint256,uint256,uint8,address,bytes)']( + tokenOwner1.address, + 1, + 1, + 0, + admin.address, + [], + ); + await expect(enumerableContract.slotCountOfOwner(ethers.constants.AddressZero)).be.reverted; + }); + it('should revert on query owner balance in slot if owner is invaild', async function () { + const { getCoreContract, admin, tokenOwner1, getEnumerableContract } = await loadFixture( + deployDiamondFixture, + ); + const coreContract = getCoreContract(admin); + const enumerableContract = getEnumerableContract(admin); + await coreContract['issue(address,uint256,uint256,uint8,address,bytes)']( + tokenOwner1.address, + 1, + 1, + 0, + admin.address, + [], + ); + await expect(enumerableContract.ownerBalanceInSlot(ethers.constants.AddressZero, 1)).be + .reverted; + }); + it('should revert on query owner balance in slot if slot is invaild', async function () { + const { getCoreContract, admin, tokenOwner1, getEnumerableContract } = await loadFixture( + deployDiamondFixture, + ); + const coreContract = getCoreContract(admin); + const enumerableContract = getEnumerableContract(admin); + await coreContract['issue(address,uint256,uint256,uint8,address,bytes)']( + tokenOwner1.address, + 1, + 1, + 0, + admin.address, + [], + ); + await expect(enumerableContract.ownerBalanceInSlot(tokenOwner1.address, 3)).be.reverted; + }); + it('should revert on query slot of owner by index if owner is invaild', async function () { + const { getCoreContract, admin, tokenOwner1, getEnumerableContract } = await loadFixture( + deployDiamondFixture, + ); + const coreContract = getCoreContract(admin); + const enumerableContract = getEnumerableContract(admin); + await coreContract['issue(address,uint256,uint256,uint8,address,bytes)']( + tokenOwner1.address, + 1, + 1, + 0, + admin.address, + [], + ); + await expect(enumerableContract.slotOfOwnerByIndex(ethers.constants.AddressZero, 1)).be + .reverted; + }); + }); }); diff --git a/test/utils.ts b/test/utils.ts index 71653875e..a39412eb7 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -11,9 +11,9 @@ function getSelectors(contract: Contract): string[] { } return acc; }, []); - selectors.contract = contract; - selectors.remove = remove; - selectors.get = get; + // selectors.contract = contract; + // selectors.remove = remove; + // selectors.get = get; return selectors; } @@ -42,20 +42,20 @@ function remove(_this: any, existSelectors: any): string[] { // used with getSelectors to get selectors from an array of selectors // functionNames argument is an array of function signatures -function get(this: any, functionNames: any): string[] { - const selectors = this.filter((v: string) => { - for (const functionName of functionNames) { - if (v === this.contract.interface.getSighash(functionName)) { - return true; - } - } - return false; - }); - selectors.contract = this.contract; - selectors.remove = this.remove; - selectors.get = this.get; - return selectors; -} +// function get(this: any, functionNames: any): string[] { +// const selectors = this.filter((v: string) => { +// for (const functionName of functionNames) { +// if (v === this.contract.interface.getSighash(functionName)) { +// return true; +// } +// } +// return false; +// }); +// selectors.contract = this.contract; +// selectors.remove = this.remove; +// selectors.get = this.get; +// return selectors; +// } // remove selectors using an array of signatures function removeSelectors(selectors: any[], signatures: any[]): string[] { diff --git a/typechain/README.md b/typechain/README.md new file mode 100644 index 000000000..d3b3af9db --- /dev/null +++ b/typechain/README.md @@ -0,0 +1 @@ +# soularis-typechain diff --git a/typechain/package.json b/typechain/package.json new file mode 100644 index 000000000..4384329d8 --- /dev/null +++ b/typechain/package.json @@ -0,0 +1,33 @@ +{ + "name": "@desoul-labs/soulhub-typechain", + "version": "0.3.2-beta.2", + "description": "SoulHub TypeChain", + "homepage": "https://github.com/desoul-labs/soulhub-contracts#readme", + "bugs": { + "url": "https://github.com/desoul-labs/soulhub-contracts/issues" + }, + "repository": { + "type": "git", + "url": "git+git@github.com:desoul-labs/soulhub-contracts.git" + }, + "author": "Austin Zhu", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "files": [ + "dist", + "README.md" + ], + "publishConfig": { + "@desoul-labs:registry": "https://npm.pkg.github.com" + }, + "scripts": { + "prepublishOnly": "tsc" + }, + "devDependencies": { + "typescript": "4.9.4" + }, + "dependencies": { + "ethers": "5.7.2", + "@nomiclabs/hardhat-ethers": "2.2.1" + } +} diff --git a/typechain/tsconfig.json b/typechain/tsconfig.json new file mode 100644 index 000000000..b0a13e39e --- /dev/null +++ b/typechain/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "target": "esnext", + "module": "commonjs", + "moduleResolution": "node", + "strict": true, + "skipLibCheck": true, + "declaration": true, + "pretty": true, + "newLine": "lf", + "outDir": "dist" + } +}