@etherisc/gif-next 0.0.2-e37834a-021 → 0.0.2-e46206a-486
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +104 -1
- 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/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- 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/Dummy.sol/LifeCycleModule.json +2 -2
- 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/SM.sol/SM.json +2 -2
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +2 -2
- 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 +171 -396
- 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/KeyValueStore.sol/KeyValueStore.json +22 -14
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
- 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 +194 -41
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +136 -16
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +81 -4
- 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 +138 -18
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +154 -42
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +47 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +42 -156
- 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 +62 -184
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +410 -34
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +86 -42
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- 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 +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +32 -6
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +21 -16
- 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 +14 -14
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +142 -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 +18 -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/DistributorType.sol/DistributorTypeLib.dbg.json +4 -0
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +104 -0
- 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/Key32.sol/Key32Lib.json +31 -17
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.json +100 -0
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +4 -0
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +123 -0
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +134 -8
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +15 -2
- 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/Distribution.sol +1 -1
- package/contracts/components/IBaseComponent.sol +1 -1
- package/contracts/components/IDistributionComponent.sol +1 -1
- package/contracts/components/IProductComponent.sol +1 -1
- package/contracts/components/Product.sol +2 -2
- package/contracts/experiment/cloning/Cloner.sol +47 -0
- package/contracts/instance/IInstance.sol +4 -6
- package/contracts/instance/Instance.sol +4 -6
- package/contracts/instance/base/KeyValueStore.sol +3 -2
- package/contracts/instance/base/ModuleBase.sol +1 -1
- package/contracts/instance/base/ServiceBase.sol +1 -0
- package/contracts/instance/module/bundle/BundleModule.sol +2 -2
- 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 +2 -2
- package/contracts/instance/module/policy/PolicyModule.sol +2 -2
- 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/IProductService.sol +1 -1
- package/contracts/instance/service/ProductService.sol +3 -3
- package/contracts/registry/ChainNft.sol +40 -25
- package/contracts/registry/IRegistry.sol +9 -25
- package/contracts/registry/IRegistryService.sol +9 -3
- package/contracts/registry/Registry.sol +90 -157
- package/contracts/registry/RegistryService.sol +167 -101
- package/contracts/registry/RegistryServiceManager.sol +22 -10
- 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 +83 -34
- package/contracts/shared/ProxyManager.sol +3 -12
- package/contracts/shared/Registerable.sol +14 -42
- package/contracts/shared/UpgradableProxyWithAdmin.sol +2 -2
- package/contracts/shared/Versionable.sol +3 -3
- package/contracts/test/TestFee.sol +2 -2
- package/contracts/test/TestProduct.sol +2 -2
- package/contracts/test/TestRoleId.sol +1 -1
- package/contracts/types/DistributorType.sol +55 -0
- package/contracts/types/Fee.sol +3 -3
- package/contracts/types/Key32.sol +8 -3
- package/contracts/types/NumberId.sol +52 -0
- package/contracts/types/ObjectType.sol +35 -14
- package/contracts/types/Referral.sol +85 -0
- package/contracts/types/RoleId.sol +53 -9
- package/contracts/types/StateId.sol +1 -1
- package/contracts/types/Timestamp.sol +7 -3
- 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/IChainNft.sol/IChainNft.dbg.json +0 -4
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.json +0 -457
- 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/ReferralId.sol/ReferralIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.json +0 -99
- 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/IChainNft.sol +0 -22
- package/contracts/shared/IOwnable.sol +0 -6
- package/contracts/types/ReferralId.sol +0 -48
@@ -4,7 +4,6 @@ pragma solidity ^0.8.20;
|
|
4
4
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
5
5
|
import {IService} from "../instance/base/IService.sol";
|
6
6
|
|
7
|
-
import {IChainNft} from "./IChainNft.sol";
|
8
7
|
import {ChainNft} from "./ChainNft.sol";
|
9
8
|
import {IRegistry} from "./IRegistry.sol";
|
10
9
|
import {NftId, toNftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
|
@@ -12,7 +11,6 @@ import {Version, VersionPart, VersionLib} from "../types/Version.sol";
|
|
12
11
|
import {ObjectType, PROTOCOL, REGISTRY, TOKEN, SERVICE, INSTANCE, STAKE, PRODUCT, DISTRIBUTION, ORACLE, POOL, POLICY, BUNDLE} from "../types/ObjectType.sol";
|
13
12
|
import {ITransferInterceptor} from "./ITransferInterceptor.sol";
|
14
13
|
|
15
|
-
import {IOwnable} from "../shared/IOwnable.sol";
|
16
14
|
import {ERC165} from "../shared/ERC165.sol";
|
17
15
|
|
18
16
|
|
@@ -48,35 +46,26 @@ contract Registry is
|
|
48
46
|
uint256 public constant REGISTRY_SERVICE_TOKEN_SEQUENCE_ID = 3;
|
49
47
|
string public constant EMPTY_URI = "";
|
50
48
|
|
51
|
-
mapping(NftId nftId => ObjectInfo info) _info;
|
52
|
-
mapping(address object => NftId nftId) _nftIdByAddress;
|
49
|
+
mapping(NftId nftId => ObjectInfo info) internal _info;
|
50
|
+
mapping(address object => NftId nftId) internal _nftIdByAddress;
|
53
51
|
|
54
52
|
mapping(NftId registrator => mapping(
|
55
|
-
ObjectType objectType => bool)) _isApproved;
|
53
|
+
ObjectType objectType => bool)) internal _isApproved;
|
56
54
|
|
57
55
|
mapping(ObjectType objectType => mapping(
|
58
|
-
ObjectType parentType => bool)) _isValidContractCombination;
|
56
|
+
ObjectType parentType => bool)) internal _isValidContractCombination;
|
59
57
|
|
60
58
|
mapping(ObjectType objectType => mapping(
|
61
|
-
ObjectType parentType => bool)) _isValidObjectCombination;
|
59
|
+
ObjectType parentType => bool)) internal _isValidObjectCombination;
|
62
60
|
|
63
|
-
mapping(NftId nftId => string name) _string;
|
61
|
+
mapping(NftId nftId => string name) internal _string;
|
64
62
|
mapping(bytes32 serviceNameHash => mapping(
|
65
|
-
VersionPart majorVersion => address service)) _service;
|
63
|
+
VersionPart majorVersion => address service)) internal _service;
|
66
64
|
|
67
|
-
NftId _registryNftId;
|
68
|
-
NftId _serviceNftId; // set in stone upon registry creation
|
69
|
-
|
70
|
-
ChainNft _chainNftInternal;
|
65
|
+
NftId internal _registryNftId;
|
66
|
+
NftId internal _serviceNftId; // set in stone upon registry creation
|
67
|
+
ChainNft internal _chainNft;
|
71
68
|
|
72
|
-
/*
|
73
|
-
modifier onlyInitialOwner() {
|
74
|
-
if(
|
75
|
-
msg.sender != getOwner() ||
|
76
|
-
msg.sender != _info[_registryNftId].initialOwner) {
|
77
|
-
revert NotInitialOwner();
|
78
|
-
}
|
79
|
-
}*/
|
80
69
|
|
81
70
|
modifier onlyOwner() {
|
82
71
|
if(msg.sender != getOwner()) {
|
@@ -95,12 +84,11 @@ contract Registry is
|
|
95
84
|
|
96
85
|
constructor(address registryOwner, VersionPart majorVersion)
|
97
86
|
{
|
98
|
-
require(registryOwner > address(0), "Registry:
|
87
|
+
require(registryOwner > address(0), "Registry: registry owner is 0");
|
99
88
|
require(majorVersion.toInt() == MAJOR_VERSION_MIN, "Registry: initial major version of registry service is not MAJOR_VERSION_MIN");
|
100
89
|
|
101
90
|
// deploy NFT
|
102
|
-
|
103
|
-
_chainNft = IChainNft(_chainNftInternal);
|
91
|
+
_chainNft = new ChainNft(address(this));// adds 10kb to deployment size
|
104
92
|
|
105
93
|
// initial registry setup
|
106
94
|
_registerProtocol();
|
@@ -111,13 +99,11 @@ contract Registry is
|
|
111
99
|
_setupValidObjectParentCombinations();
|
112
100
|
|
113
101
|
_registerInterface(type(IRegistry).interfaceId);
|
114
|
-
_registerInterface(type(IOwnable).interfaceId);
|
115
102
|
}
|
116
103
|
|
117
|
-
/// @dev registry protects only
|
118
|
-
// IMPORTANT: rare case when parentNftId is not registered and == next nftId -> technincally this is ZeroParentAddress error
|
119
|
-
// to catch this check parent address before minting !!!!
|
104
|
+
/// @dev registry protects only against tampering existing records, registering with invalid types pairs and 0 parent address
|
120
105
|
// TODO service registration means its approval for some type?
|
106
|
+
// TODO registration of precompile addresses
|
121
107
|
function register(ObjectInfo memory info)
|
122
108
|
external
|
123
109
|
onlyRegistryService
|
@@ -139,6 +125,7 @@ contract Registry is
|
|
139
125
|
|
140
126
|
address interceptor = _getInterceptor(info.isInterceptor, info.objectAddress, parentInfo.isInterceptor, parentAddress);
|
141
127
|
|
128
|
+
// TODO does external call
|
142
129
|
uint256 mintedTokenId = _chainNft.mint(
|
143
130
|
info.initialOwner,
|
144
131
|
interceptor,
|
@@ -168,33 +155,8 @@ contract Registry is
|
|
168
155
|
_nftIdByAddress[contractAddress] = nftId;
|
169
156
|
|
170
157
|
// special case
|
171
|
-
if(objectType == SERVICE())
|
172
|
-
|
173
|
-
(
|
174
|
-
string memory serviceName,
|
175
|
-
VersionPart majorVersion
|
176
|
-
) = abi.decode(info.data, (string, VersionPart));
|
177
|
-
bytes32 serviceNameHash = keccak256(abi.encode(serviceName));
|
178
|
-
|
179
|
-
// TODO MUST guarantee consistency of registerable.getVersion() and majorVersion here
|
180
|
-
// TODO update _serviceNftId when registryService with new major version is registered? -> it is fixed in current setup
|
181
|
-
// TODO do not use names -> each object type is registered by corresponding service -> conflicting with approve()
|
182
|
-
if(
|
183
|
-
majorVersion.toInt() < MAJOR_VERSION_MIN ||
|
184
|
-
(majorVersion.toInt() > MAJOR_VERSION_MIN &&
|
185
|
-
_service[serviceNameHash][VersionLib.toVersionPart(majorVersion.toInt() - 1)] == address(0) )
|
186
|
-
) {
|
187
|
-
revert InvalidServiceVersion(majorVersion);
|
188
|
-
}
|
189
|
-
|
190
|
-
if(_service[serviceNameHash][majorVersion] != address(0)) {
|
191
|
-
revert ServiceNameAlreadyRegistered(serviceName, majorVersion);
|
192
|
-
}
|
193
|
-
|
194
|
-
_string[nftId] = serviceName;
|
195
|
-
_service[serviceNameHash][majorVersion] = contractAddress;
|
196
|
-
|
197
|
-
emit LogServiceNameRegistration(serviceName, majorVersion);
|
158
|
+
if(objectType == SERVICE()) {
|
159
|
+
_registerService(info);
|
198
160
|
}
|
199
161
|
}
|
200
162
|
else
|
@@ -204,67 +166,7 @@ contract Registry is
|
|
204
166
|
}
|
205
167
|
}
|
206
168
|
|
207
|
-
emit LogRegistration(
|
208
|
-
}
|
209
|
-
|
210
|
-
function registerFrom(
|
211
|
-
address from,
|
212
|
-
ObjectInfo memory info
|
213
|
-
) external returns (NftId nftId)
|
214
|
-
{
|
215
|
-
revert();
|
216
|
-
}
|
217
|
-
|
218
|
-
|
219
|
-
/// @dev
|
220
|
-
// msg.sender - registry owner
|
221
|
-
// CAN approve only registered service contract
|
222
|
-
// CAN approve any combination specified in _isValidCombination
|
223
|
-
// CAN NOT approve itself
|
224
|
-
// TODO in case where exists exactly one registered service per objectType (and major version):
|
225
|
-
// - registration and approve is a single operation, no need for separate approve() function
|
226
|
-
// - then approve can be used to adding new valid object-parent combinations???
|
227
|
-
function approve(
|
228
|
-
NftId serviceNftId,
|
229
|
-
ObjectType objectType,
|
230
|
-
ObjectType parentType
|
231
|
-
)
|
232
|
-
public
|
233
|
-
onlyOwner()
|
234
|
-
{
|
235
|
-
address serviceAddress = _info[serviceNftId].objectAddress;
|
236
|
-
|
237
|
-
if(_nftIdByAddress[serviceAddress].eqz()) {
|
238
|
-
revert NotRegisteredContract(serviceNftId);
|
239
|
-
}
|
240
|
-
|
241
|
-
if(_info[serviceNftId].objectType != SERVICE()) {
|
242
|
-
revert NotService(serviceNftId);
|
243
|
-
}
|
244
|
-
|
245
|
-
if(
|
246
|
-
_isValidContractCombination[objectType][parentType] == false &&
|
247
|
-
_isValidObjectCombination[objectType][parentType] == false) {
|
248
|
-
revert InvalidTypesCombination(objectType, parentType);
|
249
|
-
}
|
250
|
-
|
251
|
-
_isApproved[serviceNftId][objectType] = true;
|
252
|
-
|
253
|
-
emit LogApproval(serviceNftId, objectType);
|
254
|
-
}
|
255
|
-
|
256
|
-
/// @dev returns false for registry owner nft
|
257
|
-
// TODO allowance by address?
|
258
|
-
// TODO checked by registry service -> but registry owner can upgrade registry service not to check allowance....
|
259
|
-
function allowance(
|
260
|
-
NftId nftId,
|
261
|
-
ObjectType object
|
262
|
-
)
|
263
|
-
public
|
264
|
-
view
|
265
|
-
returns (bool)
|
266
|
-
{
|
267
|
-
return _isApproved[nftId][object];
|
169
|
+
emit LogRegistration(info);
|
268
170
|
}
|
269
171
|
|
270
172
|
// from IRegistry
|
@@ -317,25 +219,82 @@ contract Registry is
|
|
317
219
|
return _service[serviceNameHash][majorVersion];
|
318
220
|
}
|
319
221
|
|
320
|
-
function getChainNft() external view override returns (
|
222
|
+
function getChainNft() external view override returns (ChainNft) {
|
321
223
|
return _chainNft;
|
322
224
|
}
|
323
225
|
|
324
|
-
// from IOwnable
|
325
226
|
function getOwner() public view returns (address owner) {
|
326
227
|
return ownerOf(address(this));
|
327
228
|
}
|
328
229
|
|
329
|
-
// Internals
|
230
|
+
// Internals
|
231
|
+
|
232
|
+
function _registerService(ObjectInfo memory info)
|
233
|
+
internal
|
234
|
+
{
|
235
|
+
(
|
236
|
+
string memory serviceName,
|
237
|
+
VersionPart majorVersion
|
238
|
+
) = abi.decode(info.data, (string, VersionPart));
|
239
|
+
bytes32 serviceNameHash = keccak256(abi.encode(serviceName));
|
240
|
+
|
241
|
+
// TODO MUST guarantee consistency of service.getVersion() and majorVersion here
|
242
|
+
// TODO update _serviceNftId when registryService with new major version is registered? -> it is fixed in current setup -> can lock up
|
243
|
+
// TODO do not use names -> each object type is registered by corresponding service -> conflicting with approve()
|
244
|
+
if(
|
245
|
+
majorVersion.toInt() < MAJOR_VERSION_MIN ||
|
246
|
+
(majorVersion.toInt() > MAJOR_VERSION_MIN &&
|
247
|
+
_service[serviceNameHash][VersionLib.toVersionPart(majorVersion.toInt() - 1)] == address(0) )
|
248
|
+
) {
|
249
|
+
revert InvalidServiceVersion(majorVersion);
|
250
|
+
}
|
251
|
+
|
252
|
+
if(_service[serviceNameHash][majorVersion] != address(0)) {
|
253
|
+
revert ServiceNameAlreadyRegistered(serviceName, majorVersion);
|
254
|
+
}
|
255
|
+
|
256
|
+
_string[info.nftId] = serviceName;
|
257
|
+
_service[serviceNameHash][majorVersion] = info.objectAddress;
|
258
|
+
|
259
|
+
emit LogServiceNameRegistration(serviceName, majorVersion);
|
260
|
+
}
|
261
|
+
|
262
|
+
/// @dev obtain interceptor address for this nft if applicable, address(0) otherwise
|
263
|
+
function _getInterceptor(
|
264
|
+
bool isInterceptor,
|
265
|
+
address objectAddress,
|
266
|
+
bool parentIsInterceptor,
|
267
|
+
address parentObjectAddress
|
268
|
+
)
|
269
|
+
internal
|
270
|
+
view
|
271
|
+
returns (address interceptor)
|
272
|
+
{
|
273
|
+
if (objectAddress == address(0)) {
|
274
|
+
if (parentIsInterceptor) {
|
275
|
+
return parentObjectAddress;
|
276
|
+
} else {
|
277
|
+
return address(0);
|
278
|
+
}
|
279
|
+
}
|
280
|
+
|
281
|
+
if (isInterceptor) {
|
282
|
+
return objectAddress;
|
283
|
+
}
|
284
|
+
|
285
|
+
return address(0);
|
286
|
+
}
|
287
|
+
|
288
|
+
// Internals called only in constructor
|
330
289
|
|
331
290
|
/// @dev protocol registration used to anchor the dip ecosystem relations
|
332
291
|
function _registerProtocol()
|
333
292
|
internal
|
334
293
|
{
|
335
|
-
uint256 protocolId =
|
294
|
+
uint256 protocolId = _chainNft.PROTOCOL_NFT_ID();
|
336
295
|
NftId protocolNftId = toNftId(protocolId);
|
337
296
|
|
338
|
-
|
297
|
+
_chainNft.mint(NFT_LOCK_ADDRESS, protocolId);
|
339
298
|
|
340
299
|
_info[protocolNftId] = ObjectInfo(
|
341
300
|
protocolNftId,
|
@@ -353,22 +312,22 @@ contract Registry is
|
|
353
312
|
function _registerRegistry(address registryOwner)
|
354
313
|
internal
|
355
314
|
{
|
356
|
-
uint256 registryId =
|
315
|
+
uint256 registryId = _chainNft.calculateTokenId(2);
|
357
316
|
NftId registryNftId = toNftId(registryId);
|
358
317
|
|
359
318
|
NftId parentNftId;
|
360
319
|
|
361
|
-
if(registryId !=
|
320
|
+
if(registryId != _chainNft.GLOBAL_REGISTRY_ID())
|
362
321
|
{// we're not the global registry
|
363
322
|
_registerGlobalRegistry();
|
364
|
-
parentNftId = toNftId(
|
323
|
+
parentNftId = toNftId(_chainNft.GLOBAL_REGISTRY_ID());
|
365
324
|
}
|
366
325
|
else
|
367
326
|
{// we are global registry
|
368
|
-
parentNftId = toNftId(
|
327
|
+
parentNftId = toNftId(_chainNft.PROTOCOL_NFT_ID());
|
369
328
|
}
|
370
329
|
|
371
|
-
|
330
|
+
_chainNft.mint(registryOwner, registryId);
|
372
331
|
|
373
332
|
_info[registryNftId] = ObjectInfo(
|
374
333
|
registryNftId,
|
@@ -388,15 +347,15 @@ contract Registry is
|
|
388
347
|
function _registerGlobalRegistry()
|
389
348
|
internal
|
390
349
|
{
|
391
|
-
uint256 globalRegistryId =
|
350
|
+
uint256 globalRegistryId = _chainNft.GLOBAL_REGISTRY_ID();
|
392
351
|
|
393
|
-
|
352
|
+
_chainNft.mint(NFT_LOCK_ADDRESS, globalRegistryId);
|
394
353
|
|
395
354
|
NftId globalRegistryNftId = toNftId(globalRegistryId);
|
396
355
|
|
397
356
|
_info[globalRegistryNftId] = ObjectInfo(
|
398
357
|
globalRegistryNftId,
|
399
|
-
toNftId(
|
358
|
+
toNftId(_chainNft.PROTOCOL_NFT_ID()), // parent
|
400
359
|
REGISTRY(),
|
401
360
|
false, // isInterceptor
|
402
361
|
address(0), // objectAddress
|
@@ -408,10 +367,10 @@ contract Registry is
|
|
408
367
|
function _registerRegistryService(address registryOwner)
|
409
368
|
internal
|
410
369
|
{
|
411
|
-
uint256 serviceId =
|
370
|
+
uint256 serviceId = _chainNft.calculateTokenId(REGISTRY_SERVICE_TOKEN_SEQUENCE_ID);
|
412
371
|
NftId serviceNftId = toNftId(serviceId);
|
413
372
|
|
414
|
-
|
373
|
+
_chainNft.mint(registryOwner, serviceId);
|
415
374
|
|
416
375
|
_info[serviceNftId] = ObjectInfo(
|
417
376
|
serviceNftId,
|
@@ -432,32 +391,6 @@ contract Registry is
|
|
432
391
|
_serviceNftId = serviceNftId;
|
433
392
|
}
|
434
393
|
|
435
|
-
/// @dev obtain interceptor address for this nft if applicable, address(0) otherwise
|
436
|
-
function _getInterceptor(
|
437
|
-
bool isInterceptor,
|
438
|
-
address objectAddress,
|
439
|
-
bool parentIsInterceptor,
|
440
|
-
address parentObjectAddress
|
441
|
-
)
|
442
|
-
internal
|
443
|
-
view
|
444
|
-
returns (address interceptor)
|
445
|
-
{
|
446
|
-
if (objectAddress == address(0)) {
|
447
|
-
if (parentIsInterceptor) {
|
448
|
-
return parentObjectAddress;
|
449
|
-
} else {
|
450
|
-
return address(0);
|
451
|
-
}
|
452
|
-
}
|
453
|
-
|
454
|
-
if (isInterceptor) {
|
455
|
-
return objectAddress;
|
456
|
-
}
|
457
|
-
|
458
|
-
return address(0);
|
459
|
-
}
|
460
|
-
|
461
394
|
/// @dev defines which object - parent types relations are allowed to register
|
462
395
|
// IMPORTANT:
|
463
396
|
// 1) EACH object type MUST have only one parent type across ALL mappings
|