@etherisc/gif-next 0.0.2-fb8d07b-779 → 0.0.2-fbe8e04-715
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +63 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +126 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +136 -10
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +88 -0
- 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/IPoolComponent.sol/IPoolComponent.json +28 -2
- 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 +168 -11
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +144 -64
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
- 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/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +4 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +788 -0
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
- package/artifacts/contracts/instance/{AccessManagedSimple.sol/AccessManagedSimple.json → Cloneable.sol/Cloneable.json} +86 -2
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +981 -10
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +448 -0
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +6 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +169 -139
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +55 -32
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +763 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +74 -40
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +223 -75
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +92 -32
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +285 -0
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +0 -19
- 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/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +923 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +440 -0
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +16 -16
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +16 -48
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +13 -33
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +669 -0
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +664 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +9 -71
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +17 -232
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +984 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +464 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +20 -157
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +13 -45
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +768 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +420 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +2 -110
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +94 -0
- 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 +35 -146
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +76 -20
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +26 -34
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +12 -12
- 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/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- 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 +2 -2
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +4 -4
- 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 +9 -9
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- 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/Usdc.sol/USDC.dbg.json +1 -1
- 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 +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- 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/NftIdSet.sol/LibNftIdSet.json +26 -3
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.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 +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- 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 +49 -8
- package/contracts/components/Distribution.sol +6 -3
- package/contracts/components/IBaseComponent.sol +6 -0
- package/contracts/components/IPoolComponent.sol +5 -1
- package/contracts/components/Pool.sol +40 -12
- package/contracts/components/Product.sol +41 -46
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +23 -0
- package/contracts/instance/BundleManager.sol +129 -0
- package/contracts/instance/Cloneable.sol +46 -0
- package/contracts/instance/IInstance.sol +25 -4
- package/contracts/instance/IInstanceBase.sol +26 -0
- package/contracts/instance/IInstanceService.sol +5 -3
- package/contracts/instance/Instance.sol +40 -18
- package/contracts/instance/InstanceAccessManager.sol +6 -6
- package/contracts/instance/InstanceBase.sol +41 -0
- package/contracts/instance/InstanceReader.sol +9 -0
- package/contracts/instance/InstanceService.sol +116 -37
- package/contracts/instance/InstanceServiceManager.sol +6 -5
- package/contracts/instance/ObjectManager.sol +101 -0
- package/contracts/instance/base/ComponentServiceBase.sol +22 -75
- package/contracts/instance/module/ISetup.sol +3 -1
- package/contracts/instance/service/BundleService.sol +260 -0
- package/contracts/instance/service/BundleServiceManager.sol +54 -0
- package/contracts/instance/service/DistributionService.sol +40 -9
- package/contracts/instance/service/DistributionServiceManager.sol +6 -5
- package/contracts/instance/service/IBundleService.sol +45 -0
- package/contracts/instance/service/IPolicyService.sol +87 -0
- package/contracts/instance/service/IPoolService.sol +6 -23
- package/contracts/instance/service/IProductService.sol +6 -73
- package/contracts/instance/service/PolicyService.sol +508 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +44 -113
- package/contracts/instance/service/PoolServiceManager.sol +6 -5
- package/contracts/instance/service/ProductService.sol +173 -0
- package/contracts/instance/service/ProductServiceManager.sol +54 -0
- package/contracts/registry/IRegistry.sol +5 -18
- package/contracts/registry/IRegistryService.sol +28 -11
- package/contracts/registry/Registry.sol +4 -45
- package/contracts/registry/RegistryService.sol +30 -71
- package/contracts/shared/NftOwnable.sol +2 -4
- package/contracts/types/NftIdSet.sol +26 -24
- package/contracts/types/RoleId.sol +3 -0
- package/package.json +1 -1
- package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.json +0 -1132
- package/contracts/instance/AccessManagedSimple.sol +0 -115
- package/contracts/instance/AccessManagerSimple.sol +0 -692
@@ -8,8 +8,6 @@ import {IRegistry} from "./IRegistry.sol";
|
|
8
8
|
import {IInstance} from "../instance/IInstance.sol";
|
9
9
|
|
10
10
|
import {ContractDeployerLib} from "../shared/ContractDeployerLib.sol";
|
11
|
-
// import {IComponent, IComponentModule} from "../../contracts/instance/module/component/IComponent.sol";
|
12
|
-
// import {IPool} from "../../contracts/instance/module/pool/IPoolModule.sol";
|
13
11
|
import {IBaseComponent} from "../../contracts/components/IBaseComponent.sol";
|
14
12
|
import {IPoolComponent} from "../../contracts/components/IPoolComponent.sol";
|
15
13
|
import {IProductComponent} from "../../contracts/components/IProductComponent.sol";
|
@@ -20,7 +18,7 @@ import {Versionable} from "../../contracts/shared/Versionable.sol";
|
|
20
18
|
import {IRegisterable} from "../../contracts/shared/IRegisterable.sol";
|
21
19
|
|
22
20
|
import {RoleId, PRODUCT_OWNER_ROLE, POOL_OWNER_ROLE, ORACLE_OWNER_ROLE} from "../../contracts/types/RoleId.sol";
|
23
|
-
import {ObjectType, REGISTRY, SERVICE, PRODUCT, ORACLE, POOL, INSTANCE, DISTRIBUTION, POLICY, BUNDLE} from "../../contracts/types/ObjectType.sol";
|
21
|
+
import {ObjectType, REGISTRY, SERVICE, PRODUCT, ORACLE, POOL, INSTANCE, DISTRIBUTION, POLICY, BUNDLE, STAKE} from "../../contracts/types/ObjectType.sol";
|
24
22
|
import {StateId, ACTIVE, PAUSED} from "../../contracts/types/StateId.sol";
|
25
23
|
import {NftId, NftIdLib, zeroNftId} from "../../contracts/types/NftId.sol";
|
26
24
|
import {Fee, FeeLib} from "../../contracts/types/Fee.sol";
|
@@ -30,7 +28,6 @@ import {Service} from "../shared/Service.sol";
|
|
30
28
|
import {IService} from "../shared/IService.sol";
|
31
29
|
import {IRegistryService} from "./IRegistryService.sol";
|
32
30
|
import {Registry} from "./Registry.sol";
|
33
|
-
import {ChainNft} from "./ChainNft.sol";
|
34
31
|
|
35
32
|
contract RegistryService is
|
36
33
|
AccessManagedUpgradeable,
|
@@ -39,22 +36,6 @@ contract RegistryService is
|
|
39
36
|
{
|
40
37
|
using NftIdLib for NftId;
|
41
38
|
|
42
|
-
// TODO move errors to interface contract
|
43
|
-
error SelfRegistration();
|
44
|
-
error NotRegistryOwner();
|
45
|
-
|
46
|
-
error NotService();
|
47
|
-
error NotInstance();
|
48
|
-
error NotProduct();
|
49
|
-
error NotPool();
|
50
|
-
error NotDistribution();
|
51
|
-
|
52
|
-
error UnexpectedRegisterableType(ObjectType expected, ObjectType found);
|
53
|
-
error NotRegisterableOwner(address expectedOwner);
|
54
|
-
error RegisterableOwnerIsZero();
|
55
|
-
error RegisterableOwnerIsRegistered();
|
56
|
-
error InvalidInitialOwner(address initialOwner);
|
57
|
-
error InvalidAddress(address registerableAddress);
|
58
39
|
|
59
40
|
// Initial value for constant variable has to be compile-time constant
|
60
41
|
// TODO define types as constants?
|
@@ -74,9 +55,7 @@ contract RegistryService is
|
|
74
55
|
// IMPORTANT: MUST NOT check owner before calling external contract
|
75
56
|
function registerService(IService service)
|
76
57
|
external
|
77
|
-
|
78
|
-
// services are not always owned by registry owner - actually only registry service is owned by registry owner
|
79
|
-
|
58
|
+
restricted
|
80
59
|
returns(
|
81
60
|
IRegistry.ObjectInfo memory info,
|
82
61
|
bytes memory data
|
@@ -95,17 +74,9 @@ contract RegistryService is
|
|
95
74
|
|
96
75
|
info.nftId = _registry.register(info);
|
97
76
|
service.linkToRegisteredNftId();
|
98
|
-
return (
|
99
|
-
info,
|
100
|
-
data
|
101
|
-
);
|
77
|
+
return (info, data);
|
102
78
|
}
|
103
79
|
|
104
|
-
// If msg.sender is approved service:
|
105
|
-
// 1) add owner arg (service MUST pass it's msg.sender as owner)
|
106
|
-
// 2) check service allowance
|
107
|
-
// 3) comment self registrstion check
|
108
|
-
//function registerInstance(IRegisterable instance, address owner)
|
109
80
|
function registerInstance(IRegisterable instance)
|
110
81
|
external
|
111
82
|
returns(
|
@@ -125,10 +96,7 @@ contract RegistryService is
|
|
125
96
|
info.nftId = _registry.register(info);
|
126
97
|
instance.linkToRegisteredNftId(); // asume safe
|
127
98
|
|
128
|
-
return (
|
129
|
-
info,
|
130
|
-
data
|
131
|
-
);
|
99
|
+
return (info, data);
|
132
100
|
}
|
133
101
|
|
134
102
|
function registerProduct(IBaseComponent product, address owner)
|
@@ -149,16 +117,11 @@ contract RegistryService is
|
|
149
117
|
data
|
150
118
|
) = _getAndVerifyContractInfo(product, PRODUCT(), owner);
|
151
119
|
|
152
|
-
NftId serviceNftId = _registry.getNftId(msg.sender);
|
153
|
-
|
154
120
|
info.nftId = _registry.register(info);
|
155
121
|
// TODO unsafe, let component or its owner derive nftId latter, when state assumptions and modifications of GIF contracts are finished
|
156
122
|
product.linkToRegisteredNftId();
|
157
123
|
|
158
|
-
return (
|
159
|
-
info,
|
160
|
-
data
|
161
|
-
);
|
124
|
+
return (info, data);
|
162
125
|
}
|
163
126
|
|
164
127
|
function registerPool(IBaseComponent pool, address owner)
|
@@ -178,15 +141,10 @@ contract RegistryService is
|
|
178
141
|
data
|
179
142
|
) = _getAndVerifyContractInfo(pool, POOL(), owner);
|
180
143
|
|
181
|
-
NftId serviceNftId = _registry.getNftId(msg.sender);
|
182
|
-
|
183
144
|
info.nftId = _registry.register(info);
|
184
145
|
pool.linkToRegisteredNftId();
|
185
146
|
|
186
|
-
return (
|
187
|
-
info,
|
188
|
-
data
|
189
|
-
);
|
147
|
+
return (info, data);
|
190
148
|
}
|
191
149
|
|
192
150
|
function registerDistribution(IBaseComponent distribution, address owner)
|
@@ -206,15 +164,10 @@ contract RegistryService is
|
|
206
164
|
data
|
207
165
|
) = _getAndVerifyContractInfo(distribution, DISTRIBUTION(), owner);
|
208
166
|
|
209
|
-
NftId serviceNftId = _registry.getNftId(msg.sender);
|
210
|
-
|
211
167
|
info.nftId = _registry.register(info);
|
212
168
|
distribution.linkToRegisteredNftId();
|
213
169
|
|
214
|
-
return (
|
215
|
-
info,
|
216
|
-
data
|
217
|
-
);
|
170
|
+
return (info, data);
|
218
171
|
}
|
219
172
|
|
220
173
|
function registerPolicy(IRegistry.ObjectInfo memory info)
|
@@ -222,8 +175,6 @@ contract RegistryService is
|
|
222
175
|
restricted
|
223
176
|
returns(NftId nftId)
|
224
177
|
{
|
225
|
-
NftId senderNftId = _registry.getNftId(msg.sender);
|
226
|
-
|
227
178
|
_verifyObjectInfo(info, POLICY());
|
228
179
|
|
229
180
|
nftId = _registry.register(info);
|
@@ -234,14 +185,20 @@ contract RegistryService is
|
|
234
185
|
restricted
|
235
186
|
returns(NftId nftId)
|
236
187
|
{
|
237
|
-
|
238
|
-
NftId senderNftId = _registry.getNftId(msg.sender);
|
239
|
-
|
240
188
|
_verifyObjectInfo(info, BUNDLE());
|
241
189
|
|
242
190
|
nftId = _registry.register(info);
|
243
191
|
}
|
244
192
|
|
193
|
+
function registerStake(IRegistry.ObjectInfo memory info)
|
194
|
+
external
|
195
|
+
restricted
|
196
|
+
returns(NftId nftId)
|
197
|
+
{
|
198
|
+
_verifyObjectInfo(info, STAKE());
|
199
|
+
|
200
|
+
nftId = _registry.register(info);
|
201
|
+
}
|
245
202
|
|
246
203
|
// From IService
|
247
204
|
function getName() public pure override(IService, Service) returns(string memory) {
|
@@ -296,7 +253,6 @@ contract RegistryService is
|
|
296
253
|
_registerInterface(type(IRegistryService).interfaceId);
|
297
254
|
}
|
298
255
|
|
299
|
-
// parent check done in registry because of approve()
|
300
256
|
function _getAndVerifyContractInfo(
|
301
257
|
IRegisterable registerable,
|
302
258
|
ObjectType expectedType, // assume can be valid only
|
@@ -355,25 +311,28 @@ contract RegistryService is
|
|
355
311
|
);
|
356
312
|
}
|
357
313
|
|
358
|
-
// parent checks done in registry because of approve()
|
359
314
|
function _verifyObjectInfo(
|
360
315
|
IRegistry.ObjectInfo memory info,
|
361
|
-
ObjectType
|
316
|
+
ObjectType expectedType
|
362
317
|
)
|
363
318
|
internal
|
364
319
|
view
|
365
320
|
{
|
366
|
-
|
367
|
-
|
321
|
+
// enforce instead of check
|
322
|
+
info.objectAddress = address(0);
|
323
|
+
|
324
|
+
if(info.objectType != expectedType) {// type is checked in registry anyway...but service logic may depend on expected value
|
325
|
+
revert UnexpectedRegisterableType(expectedType, info.objectType);
|
368
326
|
}
|
369
327
|
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
328
|
+
address owner = info.initialOwner;
|
329
|
+
|
330
|
+
if(owner == address(0)) {
|
331
|
+
revert RegisterableOwnerIsZero();
|
332
|
+
}
|
333
|
+
|
334
|
+
if(getRegistry().isRegistered(owner)) {
|
335
|
+
revert RegisterableOwnerIsRegistered();
|
377
336
|
}
|
378
337
|
|
379
338
|
// can catch all 3 if check that initialOwner is not registered
|
@@ -13,10 +13,7 @@ contract NftOwnable is INftOwnable {
|
|
13
13
|
|
14
14
|
/// @dev enforces msg.sender is owner of nft (or initial owner of nft ownable)
|
15
15
|
modifier onlyOwner() {
|
16
|
-
|
17
|
-
|
18
|
-
// owner == address(0) is eg uninitialized upgradable contract
|
19
|
-
if (owner != address(0) && msg.sender != owner) {
|
16
|
+
if (msg.sender != getOwner()) {
|
20
17
|
revert ErrorNotOwner(msg.sender);
|
21
18
|
}
|
22
19
|
_;
|
@@ -77,6 +74,7 @@ contract NftOwnable is INftOwnable {
|
|
77
74
|
internal
|
78
75
|
virtual
|
79
76
|
{
|
77
|
+
require(initialOwner > address(0), "NftOwnable: initial owner is 0");
|
80
78
|
_initialOwner = initialOwner;
|
81
79
|
_setRegistry(registryAddress);
|
82
80
|
}
|
@@ -11,35 +11,37 @@ library LibNftIdSet {
|
|
11
11
|
mapping(NftId nftid => uint256 index) at;
|
12
12
|
}
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
error ErrorNftIdSetAlreadyAdded(NftId nftId);
|
15
|
+
error ErrorNftIdSetNotInSet(NftId nftId);
|
16
|
+
|
17
|
+
|
18
|
+
function add(Set storage set, NftId nftId) external {
|
19
|
+
if (set.at[nftId] > 0) {
|
20
|
+
revert ErrorNftIdSetAlreadyAdded(nftId);
|
21
21
|
}
|
22
|
+
|
23
|
+
set.ids.push(nftId);
|
24
|
+
set.at[nftId] = set.ids.length;
|
22
25
|
}
|
23
26
|
|
24
|
-
function remove(Set storage set, NftId nftId) external
|
27
|
+
function remove(Set storage set, NftId nftId) external {
|
25
28
|
uint256 nftIdIndex = set.at[nftId];
|
26
29
|
|
27
|
-
if (nftIdIndex
|
28
|
-
|
29
|
-
uint256 lastIndex = set.ids.length - 1;
|
30
|
-
|
31
|
-
if (lastIndex != toDeleteIndex) {
|
32
|
-
NftId lastId = set.ids[lastIndex];
|
33
|
-
set.ids[toDeleteIndex] = lastId;
|
34
|
-
set.at[lastId] = nftIdIndex; // Replace lastValue's index to valueIndex
|
35
|
-
}
|
36
|
-
|
37
|
-
set.ids.pop();
|
38
|
-
delete set.at[nftId];
|
39
|
-
return true;
|
40
|
-
} else {
|
41
|
-
return false;
|
30
|
+
if (nftIdIndex == 0) {
|
31
|
+
revert ErrorNftIdSetNotInSet(nftId);
|
42
32
|
}
|
33
|
+
|
34
|
+
uint256 toDeleteIndex = nftIdIndex - 1;
|
35
|
+
uint256 lastIndex = set.ids.length - 1;
|
36
|
+
|
37
|
+
if (lastIndex != toDeleteIndex) {
|
38
|
+
NftId lastId = set.ids[lastIndex];
|
39
|
+
set.ids[toDeleteIndex] = lastId;
|
40
|
+
set.at[lastId] = nftIdIndex; // Replace lastValue's index to valueIndex
|
41
|
+
}
|
42
|
+
|
43
|
+
set.ids.pop();
|
44
|
+
delete set.at[nftId];
|
43
45
|
}
|
44
46
|
|
45
47
|
function isEmpty(Set storage set) external view returns(bool empty) {
|
@@ -50,7 +52,7 @@ library LibNftIdSet {
|
|
50
52
|
return set.at[nftId] > 0;
|
51
53
|
}
|
52
54
|
|
53
|
-
function
|
55
|
+
function size(Set storage set) external view returns(uint256 length) {
|
54
56
|
return set.ids.length;
|
55
57
|
}
|
56
58
|
|
@@ -38,6 +38,9 @@ function PRODUCT_REGISTRAR_ROLE() pure returns (RoleId) { return RoleIdLib.toRol
|
|
38
38
|
|
39
39
|
function DISTRIBUTION_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(10000); }
|
40
40
|
function POOL_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(10100); }
|
41
|
+
function PRODUCT_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(10200); }
|
42
|
+
function POLICY_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(10300); }
|
43
|
+
function BUNDLE_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(10400); }
|
41
44
|
|
42
45
|
function INSTANCE_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(11000); }
|
43
46
|
|
package/package.json
CHANGED