@etherisc/gif-next 0.0.2-743affe-003 → 0.0.2-7878646-744
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/README.md +11 -0
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +90 -2
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +118 -6
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +80 -3
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +0 -166
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +0 -166
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +0 -166
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +120 -6
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +118 -6
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.json +66 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.json +24 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.json +42 -0
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +54 -286
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +154 -399
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +90 -2
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IService.sol/IService.json +80 -3
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.json +90 -2
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.json +90 -2
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.json +2 -2
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.json +0 -13
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.json +0 -13
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +1 -1
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.json +2 -2
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.json +2 -2
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +177 -40
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +120 -16
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +80 -3
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +80 -3
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +80 -3
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +80 -3
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +122 -18
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +146 -42
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +40 -167
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +214 -10
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +66 -188
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +415 -31
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +496 -0
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.json +107 -0
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +4 -0
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +127 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +80 -3
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +4 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +158 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +121 -82
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +120 -6
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.dbg.json +1 -1
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.json +118 -6
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +4 -4
- package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +1 -1
- package/artifacts/contracts/test/TestPool.sol/TestPool.json +120 -6
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +1 -1
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +120 -8
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +120 -6
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +126 -14
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +91 -53
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/test/Usdc.sol/USDC.json +91 -53
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +4 -4
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +4 -0
- package/artifacts/contracts/types/UFixed.sol/MathLib.json +10 -0
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +4 -0
- package/artifacts/contracts/types/UFixed.sol/{UFixedMathLib.json → UFixedLib.json} +3 -3
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/contracts/components/BaseComponent.sol +1 -1
- package/contracts/components/IBaseComponent.sol +1 -1
- package/contracts/components/IDistributionComponent.sol +1 -2
- package/contracts/components/IPoolComponent.sol +1 -2
- package/contracts/components/IProductComponent.sol +1 -3
- package/contracts/components/Product.sol +4 -4
- package/contracts/experiment/cloning/Cloner.sol +47 -0
- package/contracts/instance/IInstance.sol +5 -7
- package/contracts/instance/Instance.sol +4 -6
- package/contracts/instance/base/ServiceBase.sol +1 -0
- package/contracts/instance/module/component/ComponentModule.sol +1 -1
- package/contracts/instance/module/component/IComponent.sol +1 -1
- package/contracts/instance/module/policy/IPolicy.sol +1 -1
- package/contracts/instance/module/treasury/ITreasury.sol +1 -1
- package/contracts/instance/module/treasury/TokenHandler.sol +1 -1
- package/contracts/instance/module/treasury/TreasuryModule.sol +4 -4
- package/contracts/instance/service/ComponentOwnerService.sol +73 -30
- package/contracts/instance/service/ProductService.sol +7 -6
- package/contracts/registry/ChainNft.sol +2 -2
- package/contracts/registry/IChainNft.sol +1 -1
- package/contracts/registry/IRegistry.sol +7 -25
- package/contracts/registry/IRegistryService.sol +9 -3
- package/contracts/registry/Registry.sol +78 -157
- package/contracts/registry/RegistryService.sol +179 -121
- package/contracts/registry/RegistryServiceManager.sol +64 -0
- package/contracts/shared/ContractDeployerLib.sol +72 -0
- package/contracts/shared/ERC165.sol +1 -1
- package/contracts/shared/INftOwnable.sol +22 -0
- package/contracts/shared/IRegisterable.sol +3 -8
- package/contracts/shared/NftOwnable.sol +136 -0
- package/contracts/shared/ProxyManager.sol +16 -37
- package/contracts/shared/Registerable.sol +14 -42
- package/contracts/shared/UpgradableProxyWithAdmin.sol +2 -2
- package/contracts/shared/Versionable.sol +1 -1
- package/contracts/test/TestFee.sol +2 -2
- package/contracts/types/Fee.sol +3 -3
- package/contracts/types/RoleId.sol +7 -0
- package/contracts/types/UFixed.sol +128 -12
- package/package.json +4 -3
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.json +0 -333
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.json +0 -10
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.json +0 -333
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.json +0 -24
- package/artifacts/contracts/registry/RegistryInstaller.sol/RegistryInstaller.dbg.json +0 -4
- package/artifacts/contracts/registry/RegistryInstaller.sol/RegistryInstaller.json +0 -344
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.dbg.json +0 -4
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.json +0 -24
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +0 -4
- package/contracts/instance/module/access/Access.sol +0 -149
- package/contracts/instance/module/access/IAccess.sol +0 -53
- package/contracts/registry/IRegistryLinked.sol +0 -8
- package/contracts/registry/RegistryInstaller.sol +0 -100
- package/contracts/shared/IOwnable.sol +0 -6
@@ -12,7 +12,6 @@ import {Version, VersionPart, VersionLib} from "../types/Version.sol";
|
|
12
12
|
import {ObjectType, PROTOCOL, REGISTRY, TOKEN, SERVICE, INSTANCE, STAKE, PRODUCT, DISTRIBUTION, ORACLE, POOL, POLICY, BUNDLE} from "../types/ObjectType.sol";
|
13
13
|
import {ITransferInterceptor} from "./ITransferInterceptor.sol";
|
14
14
|
|
15
|
-
import {IOwnable} from "../shared/IOwnable.sol";
|
16
15
|
import {ERC165} from "../shared/ERC165.sol";
|
17
16
|
|
18
17
|
|
@@ -44,11 +43,10 @@ contract Registry is
|
|
44
43
|
error InvalidTypesCombination(ObjectType objectType, ObjectType parentType);
|
45
44
|
|
46
45
|
uint256 public constant MAJOR_VERSION_MIN = 3;
|
47
|
-
|
46
|
+
address public constant NFT_LOCK_ADDRESS = address(0x1);
|
47
|
+
uint256 public constant REGISTRY_SERVICE_TOKEN_SEQUENCE_ID = 3;
|
48
48
|
string public constant EMPTY_URI = "";
|
49
49
|
|
50
|
-
address constant public NFT_LOCK_ADDRESS = address(0x1);
|
51
|
-
|
52
50
|
mapping(NftId nftId => ObjectInfo info) _info;
|
53
51
|
mapping(address object => NftId nftId) _nftIdByAddress;
|
54
52
|
|
@@ -70,19 +68,6 @@ contract Registry is
|
|
70
68
|
IChainNft _chainNft;
|
71
69
|
ChainNft _chainNftInternal;
|
72
70
|
|
73
|
-
/// @dev will own protocol, global registry, registry and registry service nfts minted during creation
|
74
|
-
// TODO registry nft can be transfered while protocol, global registry and registry service nfts are not transferable
|
75
|
-
// TODO get owner from one place -> nft contract
|
76
|
-
address _protocolOwner;
|
77
|
-
|
78
|
-
/*
|
79
|
-
modifier onlyInitialOwner() {
|
80
|
-
if(
|
81
|
-
msg.sender != getOwner() ||
|
82
|
-
msg.sender != _info[_registryNftId].initialOwner) {
|
83
|
-
revert NotInitialOwner();
|
84
|
-
}
|
85
|
-
}*/
|
86
71
|
|
87
72
|
modifier onlyOwner() {
|
88
73
|
if(msg.sender != getOwner()) {
|
@@ -99,36 +84,29 @@ contract Registry is
|
|
99
84
|
_;
|
100
85
|
}
|
101
86
|
|
102
|
-
constructor(address
|
87
|
+
constructor(address registryOwner, VersionPart majorVersion)
|
103
88
|
{
|
104
|
-
require(
|
89
|
+
require(registryOwner > address(0), "Registry: registry owner is 0");
|
105
90
|
require(majorVersion.toInt() == MAJOR_VERSION_MIN, "Registry: initial major version of registry service is not MAJOR_VERSION_MIN");
|
106
91
|
|
107
|
-
// TODO registry owner can change, while protocol is not?
|
108
|
-
_protocolOwner = protocolOwner;
|
109
|
-
|
110
92
|
// deploy NFT
|
111
93
|
_chainNftInternal = new ChainNft(address(this));// adds 10kb to deployment size
|
112
94
|
_chainNft = IChainNft(_chainNftInternal);
|
113
95
|
|
114
96
|
// initial registry setup
|
115
97
|
_registerProtocol();
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
_registerRegistryService();
|
98
|
+
_registerRegistry(registryOwner);
|
99
|
+
_registerRegistryService(registryOwner);
|
120
100
|
|
121
101
|
// set object parent relations
|
122
102
|
_setupValidObjectParentCombinations();
|
123
103
|
|
124
104
|
_registerInterface(type(IRegistry).interfaceId);
|
125
|
-
_registerInterface(type(IOwnable).interfaceId);
|
126
105
|
}
|
127
106
|
|
128
|
-
/// @dev registry protects only
|
129
|
-
// IMPORTANT: rare case when parentNftId is not registered and == next nftId -> technincally this is ZeroParentAddress error
|
130
|
-
// to catch this check parent address before minting !!!!
|
107
|
+
/// @dev registry protects only against tampering existing records, registering with invalid types pairs and 0 parent address
|
131
108
|
// TODO service registration means its approval for some type?
|
109
|
+
// TODO registration of precompile addresses
|
132
110
|
function register(ObjectInfo memory info)
|
133
111
|
external
|
134
112
|
onlyRegistryService
|
@@ -150,6 +128,7 @@ contract Registry is
|
|
150
128
|
|
151
129
|
address interceptor = _getInterceptor(info.isInterceptor, info.objectAddress, parentInfo.isInterceptor, parentAddress);
|
152
130
|
|
131
|
+
// TODO does external call
|
153
132
|
uint256 mintedTokenId = _chainNft.mint(
|
154
133
|
info.initialOwner,
|
155
134
|
interceptor,
|
@@ -179,33 +158,8 @@ contract Registry is
|
|
179
158
|
_nftIdByAddress[contractAddress] = nftId;
|
180
159
|
|
181
160
|
// special case
|
182
|
-
if(objectType == SERVICE())
|
183
|
-
|
184
|
-
(
|
185
|
-
string memory serviceName,
|
186
|
-
VersionPart majorVersion
|
187
|
-
) = abi.decode(info.data, (string, VersionPart));
|
188
|
-
bytes32 serviceNameHash = keccak256(abi.encode(serviceName));
|
189
|
-
|
190
|
-
// TODO MUST guarantee consistency of registerable.getVersion() and majorVersion here
|
191
|
-
// TODO update _serviceNftId when registryService with new major version is registered? -> it is fixed in current setup
|
192
|
-
// TODO do not use names -> each object type is registered by corresponding service -> conflicting with approve()
|
193
|
-
if(
|
194
|
-
majorVersion.toInt() < MAJOR_VERSION_MIN ||
|
195
|
-
(majorVersion.toInt() > MAJOR_VERSION_MIN &&
|
196
|
-
_service[serviceNameHash][VersionLib.toVersionPart(majorVersion.toInt() - 1)] == address(0) )
|
197
|
-
) {
|
198
|
-
revert InvalidServiceVersion(majorVersion);
|
199
|
-
}
|
200
|
-
|
201
|
-
if(_service[serviceNameHash][majorVersion] != address(0)) {
|
202
|
-
revert ServiceNameAlreadyRegistered(serviceName, majorVersion);
|
203
|
-
}
|
204
|
-
|
205
|
-
_string[nftId] = serviceName;
|
206
|
-
_service[serviceNameHash][majorVersion] = contractAddress;
|
207
|
-
|
208
|
-
emit LogServiceNameRegistration(serviceName, majorVersion);
|
161
|
+
if(objectType == SERVICE()) {
|
162
|
+
_registerService(info);
|
209
163
|
}
|
210
164
|
}
|
211
165
|
else
|
@@ -215,67 +169,7 @@ contract Registry is
|
|
215
169
|
}
|
216
170
|
}
|
217
171
|
|
218
|
-
emit LogRegistration(
|
219
|
-
}
|
220
|
-
|
221
|
-
function registerFrom(
|
222
|
-
address from,
|
223
|
-
ObjectInfo memory info
|
224
|
-
) external returns (NftId nftId)
|
225
|
-
{
|
226
|
-
revert();
|
227
|
-
}
|
228
|
-
|
229
|
-
|
230
|
-
/// @dev
|
231
|
-
// msg.sender - registry owner
|
232
|
-
// CAN approve only registered service contract
|
233
|
-
// CAN approve any combination specified in _isValidCombination
|
234
|
-
// CAN NOT approve itself
|
235
|
-
// TODO in case where exists exactly one registered service per objectType (and major version):
|
236
|
-
// - registration and approve is a single operation, no need for separate approve() function
|
237
|
-
// - then approve can be used to adding new valid object-parent combinations???
|
238
|
-
function approve(
|
239
|
-
NftId serviceNftId,
|
240
|
-
ObjectType objectType,
|
241
|
-
ObjectType parentType
|
242
|
-
)
|
243
|
-
public
|
244
|
-
onlyOwner()
|
245
|
-
{
|
246
|
-
address serviceAddress = _info[serviceNftId].objectAddress;
|
247
|
-
|
248
|
-
if(_nftIdByAddress[serviceAddress].eqz()) {
|
249
|
-
revert NotRegisteredContract(serviceNftId);
|
250
|
-
}
|
251
|
-
|
252
|
-
if(_info[serviceNftId].objectType != SERVICE()) {
|
253
|
-
revert NotService(serviceNftId);
|
254
|
-
}
|
255
|
-
|
256
|
-
if(
|
257
|
-
_isValidContractCombination[objectType][parentType] == false &&
|
258
|
-
_isValidObjectCombination[objectType][parentType] == false) {
|
259
|
-
revert InvalidTypesCombination(objectType, parentType);
|
260
|
-
}
|
261
|
-
|
262
|
-
_isApproved[serviceNftId][objectType] = true;
|
263
|
-
|
264
|
-
emit LogApproval(serviceNftId, objectType);
|
265
|
-
}
|
266
|
-
|
267
|
-
/// @dev returns false for registry owner nft
|
268
|
-
// TODO allowance by address?
|
269
|
-
// TODO checked by registry service -> but registry owner can upgrade registry service not to check allowance....
|
270
|
-
function allowance(
|
271
|
-
NftId nftId,
|
272
|
-
ObjectType object
|
273
|
-
)
|
274
|
-
public
|
275
|
-
view
|
276
|
-
returns (bool)
|
277
|
-
{
|
278
|
-
return _isApproved[nftId][object];
|
172
|
+
emit LogRegistration(info);
|
279
173
|
}
|
280
174
|
|
281
175
|
// from IRegistry
|
@@ -328,20 +222,73 @@ contract Registry is
|
|
328
222
|
return _service[serviceNameHash][majorVersion];
|
329
223
|
}
|
330
224
|
|
331
|
-
function getProtocolOwner() external view override returns (address) {
|
332
|
-
return _protocolOwner;
|
333
|
-
}
|
334
|
-
|
335
225
|
function getChainNft() external view override returns (IChainNft) {
|
336
226
|
return _chainNft;
|
337
227
|
}
|
338
228
|
|
339
|
-
// from IOwnable
|
340
229
|
function getOwner() public view returns (address owner) {
|
341
230
|
return ownerOf(address(this));
|
342
231
|
}
|
343
232
|
|
344
|
-
// Internals
|
233
|
+
// Internals
|
234
|
+
|
235
|
+
function _registerService(ObjectInfo memory info)
|
236
|
+
internal
|
237
|
+
{
|
238
|
+
(
|
239
|
+
string memory serviceName,
|
240
|
+
VersionPart majorVersion
|
241
|
+
) = abi.decode(info.data, (string, VersionPart));
|
242
|
+
bytes32 serviceNameHash = keccak256(abi.encode(serviceName));
|
243
|
+
|
244
|
+
// TODO MUST guarantee consistency of service.getVersion() and majorVersion here
|
245
|
+
// TODO update _serviceNftId when registryService with new major version is registered? -> it is fixed in current setup -> can lock up
|
246
|
+
// TODO do not use names -> each object type is registered by corresponding service -> conflicting with approve()
|
247
|
+
if(
|
248
|
+
majorVersion.toInt() < MAJOR_VERSION_MIN ||
|
249
|
+
(majorVersion.toInt() > MAJOR_VERSION_MIN &&
|
250
|
+
_service[serviceNameHash][VersionLib.toVersionPart(majorVersion.toInt() - 1)] == address(0) )
|
251
|
+
) {
|
252
|
+
revert InvalidServiceVersion(majorVersion);
|
253
|
+
}
|
254
|
+
|
255
|
+
if(_service[serviceNameHash][majorVersion] != address(0)) {
|
256
|
+
revert ServiceNameAlreadyRegistered(serviceName, majorVersion);
|
257
|
+
}
|
258
|
+
|
259
|
+
_string[info.nftId] = serviceName;
|
260
|
+
_service[serviceNameHash][majorVersion] = info.objectAddress;
|
261
|
+
|
262
|
+
emit LogServiceNameRegistration(serviceName, majorVersion);
|
263
|
+
}
|
264
|
+
|
265
|
+
/// @dev obtain interceptor address for this nft if applicable, address(0) otherwise
|
266
|
+
function _getInterceptor(
|
267
|
+
bool isInterceptor,
|
268
|
+
address objectAddress,
|
269
|
+
bool parentIsInterceptor,
|
270
|
+
address parentObjectAddress
|
271
|
+
)
|
272
|
+
internal
|
273
|
+
view
|
274
|
+
returns (address interceptor)
|
275
|
+
{
|
276
|
+
if (objectAddress == address(0)) {
|
277
|
+
if (parentIsInterceptor) {
|
278
|
+
return parentObjectAddress;
|
279
|
+
} else {
|
280
|
+
return address(0);
|
281
|
+
}
|
282
|
+
}
|
283
|
+
|
284
|
+
if (isInterceptor) {
|
285
|
+
return objectAddress;
|
286
|
+
}
|
287
|
+
|
288
|
+
return address(0);
|
289
|
+
}
|
290
|
+
|
291
|
+
// Internals called only in constructor
|
345
292
|
|
346
293
|
/// @dev protocol registration used to anchor the dip ecosystem relations
|
347
294
|
function _registerProtocol()
|
@@ -365,7 +312,7 @@ contract Registry is
|
|
365
312
|
|
366
313
|
/// @dev registry registration
|
367
314
|
/// might also register the global registry when not on mainnet
|
368
|
-
function _registerRegistry()
|
315
|
+
function _registerRegistry(address registryOwner)
|
369
316
|
internal
|
370
317
|
{
|
371
318
|
uint256 registryId = _chainNftInternal.calculateTokenId(2);
|
@@ -383,7 +330,7 @@ contract Registry is
|
|
383
330
|
parentNftId = toNftId(_chainNftInternal.PROTOCOL_NFT_ID());
|
384
331
|
}
|
385
332
|
|
386
|
-
_chainNftInternal.mint(
|
333
|
+
_chainNftInternal.mint(registryOwner, registryId);
|
387
334
|
|
388
335
|
_info[registryNftId] = ObjectInfo(
|
389
336
|
registryNftId,
|
@@ -391,7 +338,7 @@ contract Registry is
|
|
391
338
|
REGISTRY(),
|
392
339
|
false, // isInterceptor
|
393
340
|
address(this),
|
394
|
-
|
341
|
+
registryOwner,
|
395
342
|
""
|
396
343
|
);
|
397
344
|
_nftIdByAddress[address(this)] = registryNftId;
|
@@ -420,13 +367,13 @@ contract Registry is
|
|
420
367
|
);
|
421
368
|
}
|
422
369
|
|
423
|
-
function _registerRegistryService()
|
370
|
+
function _registerRegistryService(address registryOwner)
|
424
371
|
internal
|
425
372
|
{
|
426
|
-
uint256 serviceId = _chainNftInternal.calculateTokenId(
|
373
|
+
uint256 serviceId = _chainNftInternal.calculateTokenId(REGISTRY_SERVICE_TOKEN_SEQUENCE_ID);
|
427
374
|
NftId serviceNftId = toNftId(serviceId);
|
428
375
|
|
429
|
-
_chainNftInternal.mint(
|
376
|
+
_chainNftInternal.mint(registryOwner, serviceId);
|
430
377
|
|
431
378
|
_info[serviceNftId] = ObjectInfo(
|
432
379
|
serviceNftId,
|
@@ -434,7 +381,7 @@ contract Registry is
|
|
434
381
|
SERVICE(),
|
435
382
|
false, // isInterceptor
|
436
383
|
msg.sender, // service deploys registry
|
437
|
-
|
384
|
+
registryOwner, // initialOwner,
|
438
385
|
""
|
439
386
|
);
|
440
387
|
|
@@ -447,32 +394,6 @@ contract Registry is
|
|
447
394
|
_serviceNftId = serviceNftId;
|
448
395
|
}
|
449
396
|
|
450
|
-
/// @dev obtain interceptor address for this nft if applicable, address(0) otherwise
|
451
|
-
function _getInterceptor(
|
452
|
-
bool isInterceptor,
|
453
|
-
address objectAddress,
|
454
|
-
bool parentIsInterceptor,
|
455
|
-
address parentObjectAddress
|
456
|
-
)
|
457
|
-
internal
|
458
|
-
view
|
459
|
-
returns (address interceptor)
|
460
|
-
{
|
461
|
-
if (objectAddress == address(0)) {
|
462
|
-
if (parentIsInterceptor) {
|
463
|
-
return parentObjectAddress;
|
464
|
-
} else {
|
465
|
-
return address(0);
|
466
|
-
}
|
467
|
-
}
|
468
|
-
|
469
|
-
if (isInterceptor) {
|
470
|
-
return objectAddress;
|
471
|
-
}
|
472
|
-
|
473
|
-
return address(0);
|
474
|
-
}
|
475
|
-
|
476
397
|
/// @dev defines which object - parent types relations are allowed to register
|
477
398
|
// IMPORTANT:
|
478
399
|
// 1) EACH object type MUST have only one parent type across ALL mappings
|