@lukso/lsp-smart-contracts 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +31 -0
- package/README.md +73 -20
- package/artifacts/Create2Factory.json +2 -2
- package/artifacts/LSP0ERC725Account.json +194 -15
- package/artifacts/LSP0ERC725AccountInit.json +194 -15
- package/artifacts/LSP11BasicSocialRecovery.json +493 -0
- package/artifacts/LSP11BasicSocialRecoveryInit.json +513 -0
- package/artifacts/LSP16UniversalFactory.json +236 -0
- package/artifacts/LSP1UniversalReceiverDelegateUP.json +134 -15
- package/artifacts/LSP1UniversalReceiverDelegateVault.json +80 -15
- package/artifacts/LSP4Compatibility.json +16 -0
- package/artifacts/LSP4DigitalAssetMetadata.json +16 -0
- package/artifacts/LSP4DigitalAssetMetadataInitAbstract.json +16 -0
- package/artifacts/LSP6KeyManager.json +177 -33
- package/artifacts/LSP6KeyManagerInit.json +177 -33
- package/artifacts/LSP7CappedSupply.json +21 -5
- package/artifacts/LSP7CappedSupplyInitAbstract.json +21 -5
- package/artifacts/LSP7CompatibleERC20.json +21 -5
- package/artifacts/LSP7CompatibleERC20InitAbstract.json +23 -7
- package/artifacts/LSP7CompatibleERC20Mintable.json +24 -8
- package/artifacts/LSP7CompatibleERC20MintableInit.json +24 -8
- package/artifacts/LSP7DigitalAsset.json +21 -5
- package/artifacts/LSP7DigitalAssetInitAbstract.json +21 -5
- package/artifacts/LSP7Mintable.json +24 -8
- package/artifacts/LSP7MintableInit.json +24 -8
- package/artifacts/LSP8CappedSupply.json +22 -6
- package/artifacts/LSP8CappedSupplyInitAbstract.json +22 -6
- package/artifacts/LSP8CompatibleERC721.json +23 -7
- package/artifacts/LSP8CompatibleERC721InitAbstract.json +25 -9
- package/artifacts/LSP8CompatibleERC721Mintable.json +26 -10
- package/artifacts/LSP8CompatibleERC721MintableInit.json +26 -10
- package/artifacts/LSP8IdentifiableDigitalAsset.json +22 -6
- package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +22 -6
- package/artifacts/LSP8Mintable.json +25 -9
- package/artifacts/LSP8MintableInit.json +25 -9
- package/artifacts/LSP9Vault.json +202 -17
- package/artifacts/LSP9VaultInit.json +202 -17
- package/artifacts/UniversalProfile.json +194 -15
- package/artifacts/UniversalProfileInit.json +194 -15
- package/artifacts/UniversalReceiverAddressStore.json +3 -3
- package/constants.js +377 -115
- package/contracts/Custom/EIP191Signer.sol +12 -0
- package/contracts/Factories/Create2Factory.sol +1 -3
- package/contracts/LSP0ERC725Account/LSP0Constants.sol +13 -2
- package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +2 -1
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +261 -63
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +2 -2
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +2 -1
- package/contracts/LSP10ReceivedVaults/LSP10Constants.sol +2 -2
- package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +214 -0
- package/contracts/LSP11BasicSocialRecovery/ILSP11BasicSocialRecovery.sol +177 -0
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol +23 -0
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryCore.sol +258 -0
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryInit.sol +26 -0
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryInitAbstract.sol +19 -0
- package/contracts/LSP11BasicSocialRecovery/LSP11Constants.sol +6 -0
- package/contracts/LSP11BasicSocialRecovery/LSP11Errors.sol +60 -0
- package/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +53 -0
- package/contracts/LSP14Ownable2Step/LSP14Constants.sol +15 -0
- package/contracts/LSP14Ownable2Step/LSP14Errors.sol +12 -0
- package/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +212 -0
- package/contracts/LSP16UniversalFactory/LSP16UniversalFactory.sol +246 -0
- package/contracts/LSP17ContractExtension/LSP17Constants.sol +17 -0
- package/contracts/LSP17ContractExtension/LSP17Errors.sol +7 -0
- package/contracts/LSP17ContractExtension/LSP17Extendable.sol +104 -0
- package/contracts/LSP17ContractExtension/LSP17Extension.sol +45 -0
- package/contracts/LSP17ContractExtension/LSP17Utils.sol +20 -0
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +5 -5
- package/contracts/LSP1UniversalReceiver/LSP1Constants.sol +5 -3
- package/contracts/LSP1UniversalReceiver/LSP1Errors.sol +21 -0
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +157 -37
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +64 -31
- package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +53 -40
- package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +45 -23
- package/contracts/LSP3UniversalProfile/LSP3Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/ILSP4Compatibility.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4Compatibility.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +2 -2
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +2 -2
- package/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol +3 -3
- package/contracts/LSP5ReceivedAssets/LSP5Constants.sol +2 -2
- package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +102 -114
- package/contracts/LSP6KeyManager/ILSP6KeyManager.sol +25 -7
- package/contracts/LSP6KeyManager/LSP6Constants.sol +43 -38
- package/contracts/LSP6KeyManager/LSP6Errors.sol +90 -21
- package/contracts/LSP6KeyManager/LSP6KeyManager.sol +2 -1
- package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +772 -364
- package/contracts/LSP6KeyManager/LSP6KeyManagerInit.sol +1 -1
- package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +3 -2
- package/contracts/LSP6KeyManager/LSP6Utils.sol +125 -34
- package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +8 -8
- package/contracts/LSP7DigitalAsset/LSP7Constants.sol +6 -6
- package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +1 -1
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +38 -34
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +1 -1
- package/contracts/LSP7DigitalAsset/LSP7Errors.sol +28 -1
- package/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibleERC20.sol +1 -1
- package/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +24 -0
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +28 -8
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +28 -11
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +87 -20
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +97 -19
- package/contracts/LSP7DigitalAsset/presets/ILSP7Mintable.sol +3 -3
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +3 -4
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +2 -2
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +3 -3
- package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +3 -5
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +2 -2
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +7 -7
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +7 -7
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +40 -2
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +2 -2
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +53 -50
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +5 -2
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +20 -0
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +27 -7
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +27 -10
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +236 -30
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +240 -30
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +32 -4
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +35 -8
- package/contracts/LSP8IdentifiableDigitalAsset/presets/ILSP8Mintable.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +3 -4
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +3 -4
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +2 -2
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +3 -3
- package/contracts/LSP9Vault/LSP9Constants.sol +10 -10
- package/contracts/LSP9Vault/LSP9Errors.sol +8 -0
- package/contracts/LSP9Vault/LSP9Vault.sol +6 -4
- package/contracts/LSP9Vault/LSP9VaultCore.sol +289 -126
- package/contracts/LSP9Vault/LSP9VaultInit.sol +2 -2
- package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +4 -3
- package/contracts/Legacy/Registries/AddressRegistry.sol +1 -1
- package/contracts/Legacy/Registries/AddressRegistryRequiresERC725.sol +1 -1
- package/contracts/Legacy/UniversalReceiverAddressStore.sol +4 -14
- package/contracts/UniversalProfile.sol +2 -2
- package/contracts/UniversalProfileInit.sol +2 -2
- package/contracts/UniversalProfileInitAbstract.sol +1 -1
- package/contracts/Utils/GasLib.sol +1 -1
- package/package.json +17 -9
- package/artifacts/UniversalFactory.json +0 -127
- package/contracts/Custom/ClaimOwnership.sol +0 -96
- package/contracts/Custom/ERC165Checker.sol +0 -130
- package/contracts/Custom/IClaimOwnership.sol +0 -12
- package/contracts/Factories/UniversalFactory.sol +0 -159
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol +0 -24
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/Handling/TokenAndVaultHandling.sol +0 -82
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/Handling/TokenHandling.sol +0 -73
- package/contracts/LSP2ERC725YJSONSchema/LSP2Errors.sol +0 -9
- package/contracts/LSP7DigitalAsset/extensions/ILSP7CappedSupply.sol +0 -17
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyCore.sol +0 -57
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20Core.sol +0 -111
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CappedSupply.sol +0 -17
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8Enumerable.sol +0 -17
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyCore.sol +0 -58
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleConstants.sol +0 -6
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721Core.sol +0 -211
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableCore.sol +0 -50
- package/contracts/Utils/UtilsLib.sol +0 -31
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
pragma solidity ^0.8.
|
|
2
|
+
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
5
|
import {UniversalProfileInitAbstract} from "./UniversalProfileInitAbstract.sol";
|
|
@@ -21,7 +21,7 @@ contract UniversalProfileInit is UniversalProfileInitAbstract {
|
|
|
21
21
|
* @notice Sets the owner of the contract and sets the SupportedStandards:LSP3UniversalProfile key
|
|
22
22
|
* @param newOwner the owner of the contract
|
|
23
23
|
*/
|
|
24
|
-
function initialize(address newOwner)
|
|
24
|
+
function initialize(address newOwner) external payable virtual initializer {
|
|
25
25
|
UniversalProfileInitAbstract._initialize(newOwner);
|
|
26
26
|
}
|
|
27
27
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lukso/lsp-smart-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "The reference implementation for universal profiles smart contracts",
|
|
5
5
|
"directories": {
|
|
6
6
|
"test": "test"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
9
|
"contracts/**/*.sol",
|
|
10
|
-
"!contracts/
|
|
10
|
+
"!contracts/Mocks/**/*.sol",
|
|
11
11
|
"artifacts/*.json",
|
|
12
12
|
"constants.js",
|
|
13
13
|
"README.md",
|
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
18
|
"test": "hardhat test",
|
|
19
|
+
"test:benchmark": "hardhat test --no-compile tests/Benchmark.test.ts",
|
|
19
20
|
"test:coverage": "hardhat coverage",
|
|
20
|
-
"test:parallel": "run-p test:
|
|
21
|
-
"test:
|
|
21
|
+
"test:parallel": "run-p test:mocks test:up test:lsp1 test:lsp2 test:lsp4 test:lsp6 test:lsp7 test:lsp8 test:lsp9 test:lsp11 test:universalfactory",
|
|
22
|
+
"test:mocks": "hardhat test --no-compile tests/Mocks/*.test.ts ",
|
|
22
23
|
"test:up": "hardhat test --no-compile tests/UniversalProfile.test.ts",
|
|
23
24
|
"test:lsp1": "hardhat test --no-compile tests/LSP1UniversalReceiver/*.test.ts",
|
|
24
25
|
"test:lsp2": "hardhat test --no-compile tests/LSP2ERC725YJSONSchema/LSP2UtilsLibrary.test.ts",
|
|
@@ -27,7 +28,9 @@
|
|
|
27
28
|
"test:lsp7": "hardhat test --no-compile tests/LSP7DigitalAsset/*.test.ts tests/LSP7DigitalAsset/extensions/*.test.ts",
|
|
28
29
|
"test:lsp8": "hardhat test --no-compile tests/LSP8IdentifiableDigitalAsset/*.test.ts tests/LSP8IdentifiableDigitalAsset/extensions/*.test.ts",
|
|
29
30
|
"test:lsp9": "hardhat test --no-compile tests/LSP9Vault/*.test.ts",
|
|
30
|
-
"test:
|
|
31
|
+
"test:lsp11": "hardhat test --no-compile tests/LSP11BasicSocialRecovery/*.test.ts",
|
|
32
|
+
"test:universalfactory": "hardhat test --no-compile tests/LSP16UniversalFactory/LSP16UniversalFactory.test.ts",
|
|
33
|
+
"test:foundry": "forge test --no-match-test Skip -vvv --gas-report > gasreport.ansi",
|
|
31
34
|
"build": "hardhat compile",
|
|
32
35
|
"package": "hardhat prepare-package",
|
|
33
36
|
"release": "run-s clean build package && standard-version",
|
|
@@ -36,7 +39,8 @@
|
|
|
36
39
|
"generate-types:web3": "typechain --target=web3-v1 'artifacts/**/*.json'",
|
|
37
40
|
"generate-types:ethers": "typechain --target=ethers-v5 'artifacts/**/*.json'",
|
|
38
41
|
"remixd": "remixd -s . --remix-ide",
|
|
39
|
-
"linter": "solhint 'contracts/**/*.sol'"
|
|
42
|
+
"linter": "solhint 'contracts/**/*.sol'",
|
|
43
|
+
"prettier": "prettier --write ."
|
|
40
44
|
},
|
|
41
45
|
"repository": {
|
|
42
46
|
"type": "git",
|
|
@@ -57,13 +61,14 @@
|
|
|
57
61
|
},
|
|
58
62
|
"homepage": "https://github.com/lukso-network/lsp-smart-contracts#readme",
|
|
59
63
|
"dependencies": {
|
|
60
|
-
"@erc725/smart-contracts": "^
|
|
61
|
-
"@openzeppelin/contracts": "^4.
|
|
62
|
-
"@openzeppelin/contracts-upgradeable": "^4.
|
|
64
|
+
"@erc725/smart-contracts": "^4.1.1",
|
|
65
|
+
"@openzeppelin/contracts": "^4.8.0",
|
|
66
|
+
"@openzeppelin/contracts-upgradeable": "^4.8.0",
|
|
63
67
|
"solidity-bytes-utils": "0.8.0"
|
|
64
68
|
},
|
|
65
69
|
"devDependencies": {
|
|
66
70
|
"@erc725/erc725.js": "0.8.0",
|
|
71
|
+
"@lukso/eip191-signer.js": "^0.2.0",
|
|
67
72
|
"@nomicfoundation/hardhat-toolbox": "^1.0.2",
|
|
68
73
|
"@nomiclabs/hardhat-web3": "^2.0.0",
|
|
69
74
|
"@primitivefi/hardhat-dodoc": "^0.1.1",
|
|
@@ -71,7 +76,9 @@
|
|
|
71
76
|
"@typechain/ethers-v5": "^10.0.0",
|
|
72
77
|
"@typechain/web3-v1": "^6.0.0",
|
|
73
78
|
"@types/node": "^16.7.4",
|
|
79
|
+
"all-contributors-cli": "^6.24.0",
|
|
74
80
|
"chai": "^4.3.6",
|
|
81
|
+
"dotenv": "^16.0.2",
|
|
75
82
|
"esbuild": "^0.12.24",
|
|
76
83
|
"eth-create2-calculator": "^1.1.5",
|
|
77
84
|
"ethers": "^5.6.9",
|
|
@@ -81,6 +88,7 @@
|
|
|
81
88
|
"hardhat-deploy-ethers": "^0.3.0-beta.11",
|
|
82
89
|
"hardhat-packager": "^1.1.0",
|
|
83
90
|
"keccak256": "1.0.3",
|
|
91
|
+
"markdown-table-ts": "^1.0.3",
|
|
84
92
|
"merkletreejs": "0.2.24",
|
|
85
93
|
"npm-run-all": "^4.1.5",
|
|
86
94
|
"prettier": "^2.4.1",
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"_format": "hh-sol-artifact-1",
|
|
3
|
-
"contractName": "UniversalFactory",
|
|
4
|
-
"sourceName": "contracts/Factories/UniversalFactory.sol",
|
|
5
|
-
"abi": [
|
|
6
|
-
{
|
|
7
|
-
"inputs": [
|
|
8
|
-
{
|
|
9
|
-
"internalType": "bytes32",
|
|
10
|
-
"name": "byteCodeHash",
|
|
11
|
-
"type": "bytes32"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"internalType": "bytes32",
|
|
15
|
-
"name": "salt",
|
|
16
|
-
"type": "bytes32"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"internalType": "bytes",
|
|
20
|
-
"name": "initializeCallData",
|
|
21
|
-
"type": "bytes"
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
"name": "calculateAddress",
|
|
25
|
-
"outputs": [
|
|
26
|
-
{
|
|
27
|
-
"internalType": "address",
|
|
28
|
-
"name": "",
|
|
29
|
-
"type": "address"
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
"stateMutability": "view",
|
|
33
|
-
"type": "function"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"inputs": [
|
|
37
|
-
{
|
|
38
|
-
"internalType": "address",
|
|
39
|
-
"name": "baseContract",
|
|
40
|
-
"type": "address"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"internalType": "bytes32",
|
|
44
|
-
"name": "salt",
|
|
45
|
-
"type": "bytes32"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"internalType": "bytes",
|
|
49
|
-
"name": "initializeCallData",
|
|
50
|
-
"type": "bytes"
|
|
51
|
-
}
|
|
52
|
-
],
|
|
53
|
-
"name": "calculateProxyAddress",
|
|
54
|
-
"outputs": [
|
|
55
|
-
{
|
|
56
|
-
"internalType": "address",
|
|
57
|
-
"name": "",
|
|
58
|
-
"type": "address"
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
"stateMutability": "view",
|
|
62
|
-
"type": "function"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"inputs": [
|
|
66
|
-
{
|
|
67
|
-
"internalType": "bytes",
|
|
68
|
-
"name": "byteCode",
|
|
69
|
-
"type": "bytes"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"internalType": "bytes32",
|
|
73
|
-
"name": "salt",
|
|
74
|
-
"type": "bytes32"
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
"internalType": "bytes",
|
|
78
|
-
"name": "initializeCallData",
|
|
79
|
-
"type": "bytes"
|
|
80
|
-
}
|
|
81
|
-
],
|
|
82
|
-
"name": "deployCreate2",
|
|
83
|
-
"outputs": [
|
|
84
|
-
{
|
|
85
|
-
"internalType": "address",
|
|
86
|
-
"name": "contractCreated",
|
|
87
|
-
"type": "address"
|
|
88
|
-
}
|
|
89
|
-
],
|
|
90
|
-
"stateMutability": "payable",
|
|
91
|
-
"type": "function"
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
"inputs": [
|
|
95
|
-
{
|
|
96
|
-
"internalType": "address",
|
|
97
|
-
"name": "baseContract",
|
|
98
|
-
"type": "address"
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"internalType": "bytes32",
|
|
102
|
-
"name": "salt",
|
|
103
|
-
"type": "bytes32"
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
"internalType": "bytes",
|
|
107
|
-
"name": "initializeCallData",
|
|
108
|
-
"type": "bytes"
|
|
109
|
-
}
|
|
110
|
-
],
|
|
111
|
-
"name": "deployCreate2Proxy",
|
|
112
|
-
"outputs": [
|
|
113
|
-
{
|
|
114
|
-
"internalType": "address",
|
|
115
|
-
"name": "proxy",
|
|
116
|
-
"type": "address"
|
|
117
|
-
}
|
|
118
|
-
],
|
|
119
|
-
"stateMutability": "payable",
|
|
120
|
-
"type": "function"
|
|
121
|
-
}
|
|
122
|
-
],
|
|
123
|
-
"bytecode": "0x608060405234801561001057600080fd5b50610b63806100206000396000f3fe60806040526004361061003f5760003560e01c806321d7987d146100445780633de7bd0b14610080578063b58941e114610093578063fcf5dcf3146100a6575b600080fd5b34801561005057600080fd5b5061006461005f366004610919565b6100c6565b6040516001600160a01b03909116815260200160405180910390f35b61006461008e36600461097e565b6100ea565b6100646100a1366004610919565b610299565b3480156100b257600080fd5b506100646100c13660046109e1565b6103ed565b6000806100d38385610475565b90506100df85826104d8565b9150505b9392505050565b6000838051603714156101e3577f72307939328b75c6e301a012c75e0a4e690a99036b95f6e6f4f1b5aba02a9ce46101258260006014610554565b8051906020012014801561016b57507f11a195f66c9175f46895bae2006d40848a680c7068b9fc4af248ff9a54a47e45610162826028600f610554565b80519060200120145b156101e35760405162461bcd60e51b815260206004820152602660248201527f4d696e696d616c2050726f78696573206465706c6f796d656e74206e6f74206160448201527f6c6c6f776564000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60006101ef8486610475565b90506101fc34828861067c565b9250835160001461029057600080846001600160a01b0316866040516102229190610a4b565b6000604051808303816000865af19150503d806000811461025f576040519150601f19603f3d011682016040523d82523d6000602084013e610264565b606091505b509150915061028c82826040518060600160405280603b8152602001610af3603b9139610786565b5050505b50509392505050565b6000806102a68385610475565b90506102b285826107bf565b9150825160001461034b57600080836001600160a01b031634866040516102d99190610a4b565b60006040518083038185875af1925050503d8060008114610316576040519150601f19603f3d011682016040523d82523d6000602084013e61031b565b606091505b509150915061034382826040518060600160405280603b8152602001610af3603b9139610786565b5050506103e5565b34156103e55760405162461bcd60e51b815260206004820152605460248201527f556e6976657273616c466163746f72793a2076616c75652063616e6e6f74206260448201527f652073656e7420746f2074686520666163746f727920696620696e697469616c60648201527f697a6543616c6c4461746120697320656d707479000000000000000000000000608482015260a4016101da565b509392505050565b6000806103fa8385610475565b90506100df8186604080517fff000000000000000000000000000000000000000000000000000000000000006020808301919091523060601b6bffffffffffffffffffffffff1916602183015260358201859052605580830185905283518084039091018152607590920190925280519101206000906100e3565b8151600090158015906104b55780848460405160200161049793929190610a67565b604051602081830303815290604052805190602001209150506104d2565b60405181151560f81b602082015260218101849052604101610497565b92915050565b60006100e38383306040517f3d602d80600a3d3981f3363d3d373d3d3d363d730000000000000000000000008152606093841b60148201527f5af43d82803e903d91602b57fd5bf3ff000000000000000000000000000000006028820152921b6038830152604c8201526037808220606c830152605591012090565b60608161056281601f610a99565b10156105b05760405162461bcd60e51b815260206004820152600e60248201527f736c6963655f6f766572666c6f7700000000000000000000000000000000000060448201526064016101da565b6105ba8284610a99565b8451101561060a5760405162461bcd60e51b815260206004820152601160248201527f736c6963655f6f75744f66426f756e647300000000000000000000000000000060448201526064016101da565b6060821580156106295760405191506000825260208201604052610673565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561066257805183526020928301920161064a565b5050858452601f01601f1916604052505b50949350505050565b600080844710156106cf5760405162461bcd60e51b815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e636500000060448201526064016101da565b825161071d5760405162461bcd60e51b815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f60448201526064016101da565b8383516020850187f590506001600160a01b03811661077e5760405162461bcd60e51b815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f790000000000000060448201526064016101da565b949350505050565b606083156107955750816100e3565b8251156107a55782518084602001fd5b8160405162461bcd60e51b81526004016101da9190610abf565b60006040517f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000081528360601b60148201527f5af43d82803e903d91602b57fd5bf300000000000000000000000000000000006028820152826037826000f59150506001600160a01b0381166104d25760405162461bcd60e51b815260206004820152601760248201527f455243313136373a2063726561746532206661696c656400000000000000000060448201526064016101da565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261089d57600080fd5b813567ffffffffffffffff808211156108b8576108b8610876565b604051601f8301601f19908116603f011681019082821181831017156108e0576108e0610876565b816040528381528660208588010111156108f957600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561092e57600080fd5b83356001600160a01b038116811461094557600080fd5b925060208401359150604084013567ffffffffffffffff81111561096857600080fd5b6109748682870161088c565b9150509250925092565b60008060006060848603121561099357600080fd5b833567ffffffffffffffff808211156109ab57600080fd5b6109b78783880161088c565b94506020860135935060408601359150808211156109d457600080fd5b506109748682870161088c565b6000806000606084860312156109f657600080fd5b8335925060208401359150604084013567ffffffffffffffff81111561096857600080fd5b60005b83811015610a36578181015183820152602001610a1e565b83811115610a45576000848401525b50505050565b60008251610a5d818460208701610a1b565b9190910192915050565b83151560f81b815260008351610a84816001850160208801610a1b565b60019201918201929092526021019392505050565b60008219821115610aba57634e487b7160e01b600052601160045260246000fd5b500190565b6020815260008251806020840152610ade816040850160208701610a1b565b601f01601f1916919091016040019291505056fe556e6976657273616c466163746f72793a20636f756c64206e6f7420696e697469616c697a6520746865206372656174656420636f6e7472616374a26469706673582212207f7a7abe0175d4425696541404b4e23fcc9a554a31c0e5284a5ad4e18942fb6364736f6c634300080a0033",
|
|
124
|
-
"deployedBytecode": "0x60806040526004361061003f5760003560e01c806321d7987d146100445780633de7bd0b14610080578063b58941e114610093578063fcf5dcf3146100a6575b600080fd5b34801561005057600080fd5b5061006461005f366004610919565b6100c6565b6040516001600160a01b03909116815260200160405180910390f35b61006461008e36600461097e565b6100ea565b6100646100a1366004610919565b610299565b3480156100b257600080fd5b506100646100c13660046109e1565b6103ed565b6000806100d38385610475565b90506100df85826104d8565b9150505b9392505050565b6000838051603714156101e3577f72307939328b75c6e301a012c75e0a4e690a99036b95f6e6f4f1b5aba02a9ce46101258260006014610554565b8051906020012014801561016b57507f11a195f66c9175f46895bae2006d40848a680c7068b9fc4af248ff9a54a47e45610162826028600f610554565b80519060200120145b156101e35760405162461bcd60e51b815260206004820152602660248201527f4d696e696d616c2050726f78696573206465706c6f796d656e74206e6f74206160448201527f6c6c6f776564000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60006101ef8486610475565b90506101fc34828861067c565b9250835160001461029057600080846001600160a01b0316866040516102229190610a4b565b6000604051808303816000865af19150503d806000811461025f576040519150601f19603f3d011682016040523d82523d6000602084013e610264565b606091505b509150915061028c82826040518060600160405280603b8152602001610af3603b9139610786565b5050505b50509392505050565b6000806102a68385610475565b90506102b285826107bf565b9150825160001461034b57600080836001600160a01b031634866040516102d99190610a4b565b60006040518083038185875af1925050503d8060008114610316576040519150601f19603f3d011682016040523d82523d6000602084013e61031b565b606091505b509150915061034382826040518060600160405280603b8152602001610af3603b9139610786565b5050506103e5565b34156103e55760405162461bcd60e51b815260206004820152605460248201527f556e6976657273616c466163746f72793a2076616c75652063616e6e6f74206260448201527f652073656e7420746f2074686520666163746f727920696620696e697469616c60648201527f697a6543616c6c4461746120697320656d707479000000000000000000000000608482015260a4016101da565b509392505050565b6000806103fa8385610475565b90506100df8186604080517fff000000000000000000000000000000000000000000000000000000000000006020808301919091523060601b6bffffffffffffffffffffffff1916602183015260358201859052605580830185905283518084039091018152607590920190925280519101206000906100e3565b8151600090158015906104b55780848460405160200161049793929190610a67565b604051602081830303815290604052805190602001209150506104d2565b60405181151560f81b602082015260218101849052604101610497565b92915050565b60006100e38383306040517f3d602d80600a3d3981f3363d3d373d3d3d363d730000000000000000000000008152606093841b60148201527f5af43d82803e903d91602b57fd5bf3ff000000000000000000000000000000006028820152921b6038830152604c8201526037808220606c830152605591012090565b60608161056281601f610a99565b10156105b05760405162461bcd60e51b815260206004820152600e60248201527f736c6963655f6f766572666c6f7700000000000000000000000000000000000060448201526064016101da565b6105ba8284610a99565b8451101561060a5760405162461bcd60e51b815260206004820152601160248201527f736c6963655f6f75744f66426f756e647300000000000000000000000000000060448201526064016101da565b6060821580156106295760405191506000825260208201604052610673565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561066257805183526020928301920161064a565b5050858452601f01601f1916604052505b50949350505050565b600080844710156106cf5760405162461bcd60e51b815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e636500000060448201526064016101da565b825161071d5760405162461bcd60e51b815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f60448201526064016101da565b8383516020850187f590506001600160a01b03811661077e5760405162461bcd60e51b815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f790000000000000060448201526064016101da565b949350505050565b606083156107955750816100e3565b8251156107a55782518084602001fd5b8160405162461bcd60e51b81526004016101da9190610abf565b60006040517f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000081528360601b60148201527f5af43d82803e903d91602b57fd5bf300000000000000000000000000000000006028820152826037826000f59150506001600160a01b0381166104d25760405162461bcd60e51b815260206004820152601760248201527f455243313136373a2063726561746532206661696c656400000000000000000060448201526064016101da565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261089d57600080fd5b813567ffffffffffffffff808211156108b8576108b8610876565b604051601f8301601f19908116603f011681019082821181831017156108e0576108e0610876565b816040528381528660208588010111156108f957600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561092e57600080fd5b83356001600160a01b038116811461094557600080fd5b925060208401359150604084013567ffffffffffffffff81111561096857600080fd5b6109748682870161088c565b9150509250925092565b60008060006060848603121561099357600080fd5b833567ffffffffffffffff808211156109ab57600080fd5b6109b78783880161088c565b94506020860135935060408601359150808211156109d457600080fd5b506109748682870161088c565b6000806000606084860312156109f657600080fd5b8335925060208401359150604084013567ffffffffffffffff81111561096857600080fd5b60005b83811015610a36578181015183820152602001610a1e565b83811115610a45576000848401525b50505050565b60008251610a5d818460208701610a1b565b9190910192915050565b83151560f81b815260008351610a84816001850160208801610a1b565b60019201918201929092526021019392505050565b60008219821115610aba57634e487b7160e01b600052601160045260246000fd5b500190565b6020815260008251806020840152610ade816040850160208701610a1b565b601f01601f1916919091016040019291505056fe556e6976657273616c466163746f72793a20636f756c64206e6f7420696e697469616c697a6520746865206372656174656420636f6e7472616374a26469706673582212207f7a7abe0175d4425696541404b4e23fcc9a554a31c0e5284a5ad4e18942fb6364736f6c634300080a0033",
|
|
125
|
-
"linkReferences": {},
|
|
126
|
-
"deployedLinkReferences": {}
|
|
127
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity ^0.8.0;
|
|
3
|
-
|
|
4
|
-
// interfaces
|
|
5
|
-
import {IClaimOwnership} from "./IClaimOwnership.sol";
|
|
6
|
-
|
|
7
|
-
// modules
|
|
8
|
-
import {OwnableUnset} from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @dev reverts when trying to renounce ownership before the initial confirmation delay
|
|
12
|
-
*/
|
|
13
|
-
error NotInRenounceOwnershipInterval(uint256 renounceOwnershipStart, uint256 renounceOwnershipEnd);
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @dev reverts when trying to transfer ownership to the address(this)
|
|
17
|
-
*/
|
|
18
|
-
error CannotTransferOwnershipToSelf();
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @title ClaimOwnership
|
|
22
|
-
* @author Fabian Vogelsteller <fabian@lukso.network>, Jean Cavallera (CJ42), Yamen Merhi (YamenMerhi), Daniel Afteni (B00ste)
|
|
23
|
-
* @dev This contract is a modified version of the OwnableUnset implementation, where transferring and renouncing ownership
|
|
24
|
-
* works as a 2 steps process. This can be used as a confirmation mechanism to prevent potential mistakes when
|
|
25
|
-
* transferring ownership of the contract, where the control of the contract could be lost forever.
|
|
26
|
-
*/
|
|
27
|
-
abstract contract ClaimOwnership is IClaimOwnership, OwnableUnset {
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @dev The number of block that need to pass before one is able to
|
|
31
|
-
* confirm renouncing ownership
|
|
32
|
-
*/
|
|
33
|
-
uint256 private constant _RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY = 100;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @dev The number of blocks during which one can renounce ownership
|
|
37
|
-
*/
|
|
38
|
-
uint256 private constant _RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD = 100;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @dev The block number saved when initiating the process of
|
|
42
|
-
* renouncing ownerhsip
|
|
43
|
-
*/
|
|
44
|
-
uint256 private _renounceOwnershipStartedAt;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @dev The address that may use `claimOwnership()`
|
|
48
|
-
*/
|
|
49
|
-
address public override pendingOwner;
|
|
50
|
-
|
|
51
|
-
function claimOwnership() public virtual override {
|
|
52
|
-
_claimOwnership();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function transferOwnership(address newOwner) public virtual override onlyOwner {
|
|
56
|
-
_transferOwnership(newOwner);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function renounceOwnership() public virtual override onlyOwner {
|
|
60
|
-
_renounceOwnership();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function _claimOwnership() internal virtual {
|
|
64
|
-
require(msg.sender == pendingOwner, "ClaimOwnership: caller is not the pendingOwner");
|
|
65
|
-
_setOwner(pendingOwner);
|
|
66
|
-
pendingOwner = address(0);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function _transferOwnership(address newOwner) internal virtual {
|
|
70
|
-
if (newOwner == address(this)) revert CannotTransferOwnershipToSelf();
|
|
71
|
-
pendingOwner = newOwner;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* @dev This method is used to initiate or confirm the process of
|
|
76
|
-
* renouncing ownership.
|
|
77
|
-
*/
|
|
78
|
-
function _renounceOwnership() internal virtual {
|
|
79
|
-
uint256 currentBlock = block.number;
|
|
80
|
-
uint256 confirmationPeriodStart = _renounceOwnershipStartedAt + _RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY;
|
|
81
|
-
uint256 confirmationPeriodEnd = confirmationPeriodStart + _RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD;
|
|
82
|
-
|
|
83
|
-
if (currentBlock > confirmationPeriodEnd) {
|
|
84
|
-
_renounceOwnershipStartedAt = currentBlock;
|
|
85
|
-
emit RenounceOwnershipInitiated();
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (currentBlock < confirmationPeriodStart) {
|
|
90
|
-
revert NotInRenounceOwnershipInterval(confirmationPeriodStart, confirmationPeriodEnd);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
_setOwner(address(0));
|
|
94
|
-
delete _renounceOwnershipStartedAt;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Checker.sol)
|
|
3
|
-
|
|
4
|
-
pragma solidity ^0.8.0;
|
|
5
|
-
|
|
6
|
-
// This contract is a modified version of OpenZeppelin implementation, where we modify the visibility of
|
|
7
|
-
// `supportsERC165Interface`, which check the given interfaceId, to internal and to be used in contract implementations,
|
|
8
|
-
// instead of `supportsInterface` to save gas, as the latter check for 3 interfaceIds; InterfaceId of ERC165, 0xffffffff
|
|
9
|
-
// and the given interfaceId.
|
|
10
|
-
|
|
11
|
-
// interfaces
|
|
12
|
-
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @dev Library used to query support of an interface declared via {IERC165}.
|
|
16
|
-
*
|
|
17
|
-
* Note that these functions return the actual result of the query: they do not
|
|
18
|
-
* `revert` if an interface is not supported. It is up to the caller to decide
|
|
19
|
-
* what to do in these cases.
|
|
20
|
-
*/
|
|
21
|
-
library ERC165Checker {
|
|
22
|
-
// As per the EIP-165 spec, no interface should ever match 0xffffffff
|
|
23
|
-
bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @dev Returns true if `account` supports the {IERC165} interface,
|
|
27
|
-
*/
|
|
28
|
-
function supportsERC165(address account) internal view returns (bool) {
|
|
29
|
-
// Any contract that implements ERC165 must explicitly indicate support of
|
|
30
|
-
// InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
|
|
31
|
-
return
|
|
32
|
-
supportsERC165Interface(account, type(IERC165).interfaceId) &&
|
|
33
|
-
!supportsERC165Interface(account, _INTERFACE_ID_INVALID);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @dev Returns true if `account` supports the interface defined by
|
|
38
|
-
* `interfaceId`. Support for {IERC165} itself is queried automatically.
|
|
39
|
-
*
|
|
40
|
-
* See {IERC165-supportsInterface}.
|
|
41
|
-
*/
|
|
42
|
-
function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
|
|
43
|
-
// query support of both ERC165 as per the spec and support of _interfaceId
|
|
44
|
-
return supportsERC165(account) && supportsERC165Interface(account, interfaceId);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @dev Returns a boolean array where each value corresponds to the
|
|
49
|
-
* interfaces passed in and whether they're supported or not. This allows
|
|
50
|
-
* you to batch check interfaces for a contract where your expectation
|
|
51
|
-
* is that some interfaces may not be supported.
|
|
52
|
-
*
|
|
53
|
-
* See {IERC165-supportsInterface}.
|
|
54
|
-
*
|
|
55
|
-
* _Available since v3.4._
|
|
56
|
-
*/
|
|
57
|
-
function getSupportedInterfaces(address account, bytes4[] memory interfaceIds)
|
|
58
|
-
internal
|
|
59
|
-
view
|
|
60
|
-
returns (bool[] memory)
|
|
61
|
-
{
|
|
62
|
-
// an array of booleans corresponding to interfaceIds and whether they're supported or not
|
|
63
|
-
bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);
|
|
64
|
-
|
|
65
|
-
// query support of ERC165 itself
|
|
66
|
-
if (supportsERC165(account)) {
|
|
67
|
-
// query support of each interface in interfaceIds
|
|
68
|
-
for (uint256 i = 0; i < interfaceIds.length; i++) {
|
|
69
|
-
interfaceIdsSupported[i] = supportsERC165Interface(account, interfaceIds[i]);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return interfaceIdsSupported;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* @dev Returns true if `account` supports all the interfaces defined in
|
|
78
|
-
* `interfaceIds`. Support for {IERC165} itself is queried automatically.
|
|
79
|
-
*
|
|
80
|
-
* Batch-querying can lead to gas savings by skipping repeated checks for
|
|
81
|
-
* {IERC165} support.
|
|
82
|
-
*
|
|
83
|
-
* See {IERC165-supportsInterface}.
|
|
84
|
-
*/
|
|
85
|
-
function supportsAllInterfaces(address account, bytes4[] memory interfaceIds)
|
|
86
|
-
internal
|
|
87
|
-
view
|
|
88
|
-
returns (bool)
|
|
89
|
-
{
|
|
90
|
-
// query support of ERC165 itself
|
|
91
|
-
if (!supportsERC165(account)) {
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// query support of each interface in _interfaceIds
|
|
96
|
-
for (uint256 i = 0; i < interfaceIds.length; i++) {
|
|
97
|
-
if (!supportsERC165Interface(account, interfaceIds[i])) {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// all interfaces supported
|
|
103
|
-
return true;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* @notice Query if a contract implements an interface, does not check ERC165 support
|
|
108
|
-
* @param account The address of the contract to query for support of an interface
|
|
109
|
-
* @param interfaceId The interface identifier, as specified in ERC-165
|
|
110
|
-
* @return true if the contract at account indicates support of the interface with
|
|
111
|
-
* identifier interfaceId, false otherwise
|
|
112
|
-
* @dev Assumes that account contains a contract that supports ERC165, otherwise
|
|
113
|
-
* the behavior of this method is undefined. This precondition can be checked
|
|
114
|
-
* with {supportsERC165}.
|
|
115
|
-
* Interface identification is specified in ERC-165.
|
|
116
|
-
*/
|
|
117
|
-
function supportsERC165Interface(address account, bytes4 interfaceId)
|
|
118
|
-
internal
|
|
119
|
-
view
|
|
120
|
-
returns (bool)
|
|
121
|
-
{
|
|
122
|
-
bytes memory encodedParams = abi.encodeWithSelector(
|
|
123
|
-
IERC165.supportsInterface.selector,
|
|
124
|
-
interfaceId
|
|
125
|
-
);
|
|
126
|
-
(bool success, bytes memory result) = account.staticcall{gas: 30000}(encodedParams);
|
|
127
|
-
if (result.length < 32) return false;
|
|
128
|
-
return success && abi.decode(result, (uint256)) > 0;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity ^0.8.0;
|
|
3
|
-
|
|
4
|
-
bytes4 constant _INTERFACEID_CLAIM_OWNERSHIP = 0xa375e9c6;
|
|
5
|
-
|
|
6
|
-
interface IClaimOwnership {
|
|
7
|
-
event RenounceOwnershipInitiated();
|
|
8
|
-
|
|
9
|
-
function pendingOwner() external view returns (address);
|
|
10
|
-
|
|
11
|
-
function claimOwnership() external;
|
|
12
|
-
}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity ^0.8.0;
|
|
3
|
-
|
|
4
|
-
// libraries
|
|
5
|
-
import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";
|
|
6
|
-
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
|
|
7
|
-
import {BytesLib} from "solidity-bytes-utils/contracts/BytesLib.sol";
|
|
8
|
-
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @dev UniversalFactory contract can be used to deploy CREATE2 contracts; normal contracts and minimal
|
|
12
|
-
* proxies (EIP-1167) with the ability to deploy the same contract at the same address on different chains.
|
|
13
|
-
* If the contract has a constructor, the arguments will be part of the byteCode
|
|
14
|
-
* If the contract has an `initialize` function, the parameters of this function will be included in
|
|
15
|
-
* the salt to ensure that the parameters of the contract should be the same on each chain.
|
|
16
|
-
*
|
|
17
|
-
* Security measures were taken to avoid deploying proxies from the `deployCreate2(..)` function
|
|
18
|
-
* to prevent the problem mentioned above.
|
|
19
|
-
*
|
|
20
|
-
* This contract should be deployed using Nick's Method.
|
|
21
|
-
* More information: https://weka.medium.com/how-to-send-ether-to-11-440-people-187e332566b7
|
|
22
|
-
*/
|
|
23
|
-
contract UniversalFactory {
|
|
24
|
-
using BytesLib for bytes;
|
|
25
|
-
|
|
26
|
-
// The bytecode hash of EIP-1167 Minimal Proxy
|
|
27
|
-
bytes32 private constant _MINIMAL_PROXY_BYTECODE_HASH_PT1 =
|
|
28
|
-
0x72307939328b75c6e301a012c75e0a4e690a99036b95f6e6f4f1b5aba02a9ce4;
|
|
29
|
-
|
|
30
|
-
bytes32 private constant _MINIMAL_PROXY_BYTECODE_HASH_PT2 =
|
|
31
|
-
0x11a195f66c9175f46895bae2006d40848a680c7068b9fc4af248ff9a54a47e45;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @dev Throws if the `byteCode` passed to the function is the EIP-1167 Minimal Proxy bytecode
|
|
35
|
-
*/
|
|
36
|
-
modifier notMinimalProxy(bytes memory byteCode) virtual {
|
|
37
|
-
if (byteCode.length == 55) {
|
|
38
|
-
if (
|
|
39
|
-
keccak256(byteCode.slice(0, 20)) == _MINIMAL_PROXY_BYTECODE_HASH_PT1 &&
|
|
40
|
-
keccak256(byteCode.slice(40, 15)) == _MINIMAL_PROXY_BYTECODE_HASH_PT2
|
|
41
|
-
) {
|
|
42
|
-
revert("Minimal Proxies deployment not allowed");
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
_;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @dev Returns the address where a contract will be stored if deployed via `CREATE2`. The address is
|
|
50
|
-
* constructed using the parameters below. Any change in one of them will result in a new destination address.
|
|
51
|
-
*/
|
|
52
|
-
function calculateAddress(
|
|
53
|
-
bytes32 byteCodeHash,
|
|
54
|
-
bytes32 salt,
|
|
55
|
-
bytes memory initializeCallData
|
|
56
|
-
) public view returns (address) {
|
|
57
|
-
bytes32 generatedSalt = _generateSalt(initializeCallData, salt);
|
|
58
|
-
return Create2.computeAddress(generatedSalt, byteCodeHash);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* @dev Returns the address of an EIP1167 proxy contract. The address is constructed using
|
|
63
|
-
* the parameters below. Any change in one of them will result in a new destination address.
|
|
64
|
-
*/
|
|
65
|
-
function calculateProxyAddress(
|
|
66
|
-
address baseContract,
|
|
67
|
-
bytes32 salt,
|
|
68
|
-
bytes memory initializeCallData
|
|
69
|
-
) public view returns (address) {
|
|
70
|
-
bytes32 generatedSalt = _generateSalt(initializeCallData, salt);
|
|
71
|
-
return Clones.predictDeterministicAddress(baseContract, generatedSalt);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* @dev Deploys a contract using `CREATE2`. The address where the contract will be deployed
|
|
76
|
-
* can be known in advance via {calculateAddress}. The salt is a combination between an initializable
|
|
77
|
-
* boolean, `salt` and the `initializeCallData` if the contract is initializable. This method allow users
|
|
78
|
-
* to have the same contracts at the same address across different chains with the same parameters.
|
|
79
|
-
*
|
|
80
|
-
* Using the same `byteCode` and salt multiple time will revert, since
|
|
81
|
-
* the contract cannot be deployed twice at the same address.
|
|
82
|
-
*
|
|
83
|
-
* Deploying a minimal proxy from this function will revert.
|
|
84
|
-
*/
|
|
85
|
-
function deployCreate2(
|
|
86
|
-
bytes memory byteCode,
|
|
87
|
-
bytes32 salt,
|
|
88
|
-
bytes memory initializeCallData
|
|
89
|
-
) public payable notMinimalProxy(byteCode) returns (address contractCreated) {
|
|
90
|
-
bytes32 generatedSalt = _generateSalt(initializeCallData, salt);
|
|
91
|
-
contractCreated = Create2.deploy(msg.value, generatedSalt, byteCode);
|
|
92
|
-
|
|
93
|
-
if (initializeCallData.length != 0) {
|
|
94
|
-
// solhint-disable avoid-low-level-calls
|
|
95
|
-
(bool success, bytes memory returnData) = contractCreated.call(initializeCallData);
|
|
96
|
-
Address.verifyCallResult(
|
|
97
|
-
success,
|
|
98
|
-
returnData,
|
|
99
|
-
"UniversalFactory: could not initialize the created contract"
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* @dev Deploys and returns the address of a clone that mimics the behaviour of `baseContract`.
|
|
106
|
-
* The address where the contract will be deployed can be known in advance via {calculateProxyAddress}.
|
|
107
|
-
*
|
|
108
|
-
* This function uses the CREATE2 opcode and a salt to deterministically deploy
|
|
109
|
-
* the clone. The salt is a combination between an initializable boolean, `salt`
|
|
110
|
-
* and the `initializeCallData` if the contract is initializable. This method allow users
|
|
111
|
-
* to have the same contracts at the same address across different chains with the same parameters.
|
|
112
|
-
*
|
|
113
|
-
* Using the same `baseContract` and salt multiple time will revert, since
|
|
114
|
-
* the clones cannot be deployed twice at the same address.
|
|
115
|
-
*/
|
|
116
|
-
function deployCreate2Proxy(
|
|
117
|
-
address baseContract,
|
|
118
|
-
bytes32 salt,
|
|
119
|
-
bytes memory initializeCallData
|
|
120
|
-
) public payable returns (address proxy) {
|
|
121
|
-
bytes32 generatedSalt = _generateSalt(initializeCallData, salt);
|
|
122
|
-
proxy = Clones.cloneDeterministic(baseContract, generatedSalt);
|
|
123
|
-
|
|
124
|
-
if (initializeCallData.length != 0) {
|
|
125
|
-
// solhint-disable avoid-low-level-calls
|
|
126
|
-
(bool success, bytes memory returnData) = proxy.call{value: msg.value}(
|
|
127
|
-
initializeCallData
|
|
128
|
-
);
|
|
129
|
-
Address.verifyCallResult(
|
|
130
|
-
success,
|
|
131
|
-
returnData,
|
|
132
|
-
"UniversalFactory: could not initialize the created contract"
|
|
133
|
-
);
|
|
134
|
-
} else {
|
|
135
|
-
require(
|
|
136
|
-
msg.value == 0,
|
|
137
|
-
"UniversalFactory: value cannot be sent to the factory if initializeCallData is empty"
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/** internal functions */
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* @dev Calculates the salt including the initializeCallData, or without but hashing it with a zero bytes padding.
|
|
146
|
-
*/
|
|
147
|
-
function _generateSalt(bytes memory initializeCallData, bytes32 salt)
|
|
148
|
-
internal
|
|
149
|
-
pure
|
|
150
|
-
returns (bytes32)
|
|
151
|
-
{
|
|
152
|
-
bool initializable = initializeCallData.length != 0;
|
|
153
|
-
if (initializable) {
|
|
154
|
-
return keccak256(abi.encodePacked(initializable, initializeCallData, salt));
|
|
155
|
-
} else {
|
|
156
|
-
return keccak256(abi.encodePacked(initializable, salt));
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|