@etherisc/gif-next 0.0.2-b9e43cf-870 → 0.0.2-bad4d33-850
Sign up to get free protection for your applications and to get access to all the features.
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/components/{IBaseComponent.sol/IBaseComponent.json → Component.sol/Component.json} +273 -14
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +184 -10
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/components/{BaseComponent.sol/BaseComponent.json → IComponent.sol/IComponent.json} +61 -88
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +496 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +512 -74
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +596 -5
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +165 -93
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +189 -15
- 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/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +38 -62
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +179 -13
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +21 -5
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +111 -74
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +47 -60
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +41 -82
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +168 -92
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +37 -24
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -32
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/instance/base/{ComponentServiceBase.sol/ComponentServiceBase.json → ComponentService.sol/ComponentService.json} +102 -31
- 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 +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +131 -60
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +31 -18
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +126 -47
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +31 -14
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +0 -5
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +0 -5
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +0 -5
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +0 -5
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +0 -5
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +152 -81
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +44 -31
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +126 -47
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +31 -14
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +126 -47
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +31 -14
- 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 +83 -3
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +33 -28
- 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 +96 -24
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +18 -18
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +61 -56
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +28 -15
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +70 -53
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +23 -26
- 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/IRegisterable.sol/IRegisterable.json +0 -5
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +0 -5
- 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 +19 -6
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +19 -6
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +19 -11
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +13 -5
- 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 +19 -11
- 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 +29 -21
- 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/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/Component.sol +216 -0
- package/contracts/components/Distribution.sol +40 -51
- package/contracts/components/IComponent.sol +43 -0
- package/contracts/components/IDistributionComponent.sol +5 -2
- package/contracts/components/IPoolComponent.sol +6 -21
- package/contracts/components/IProductComponent.sol +7 -3
- package/contracts/components/Pool.sol +44 -108
- package/contracts/components/Product.sol +51 -86
- package/contracts/instance/BundleManager.sol +7 -11
- package/contracts/instance/IInstance.sol +20 -10
- package/contracts/instance/IInstanceService.sol +2 -1
- package/contracts/instance/Instance.sol +28 -31
- package/contracts/instance/InstanceAccessManager.sol +6 -11
- package/contracts/instance/InstanceReader.sol +3 -25
- package/contracts/instance/InstanceService.sol +112 -22
- package/contracts/instance/ObjectManager.sol +7 -24
- package/contracts/instance/base/ComponentService.sol +134 -0
- package/contracts/instance/service/BundleService.sol +2 -3
- package/contracts/instance/service/DistributionService.sol +23 -37
- package/contracts/instance/service/PolicyService.sol +2 -3
- package/contracts/instance/service/PoolService.sol +20 -55
- package/contracts/instance/service/ProductService.sol +50 -30
- package/contracts/registry/IRegistry.sol +13 -6
- package/contracts/registry/IRegistryService.sol +16 -9
- package/contracts/registry/Registry.sol +100 -44
- package/contracts/registry/RegistryAccessManager.sol +31 -25
- package/contracts/registry/RegistryService.sol +27 -85
- package/contracts/registry/ReleaseManager.sol +72 -82
- package/contracts/registry/TokenRegistry.sol +5 -3
- package/contracts/shared/IRegisterable.sol +1 -3
- package/contracts/shared/NftOwnable.sol +5 -0
- package/contracts/shared/Registerable.sol +10 -14
- package/contracts/shared/Service.sol +4 -2
- package/contracts/types/RoleId.sol +2 -2
- package/package.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +0 -1206
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +0 -448
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +0 -763
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -113
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -814
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +0 -466
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.json +0 -442
- package/contracts/components/BaseComponent.sol +0 -159
- package/contracts/components/IBaseComponent.sol +0 -34
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +0 -23
- package/contracts/instance/IInstanceBase.sol +0 -26
- package/contracts/instance/InstanceBase.sol +0 -41
- package/contracts/instance/base/ComponentServiceBase.sol +0 -76
- package/contracts/instance/base/IInstanceBase.sol +0 -23
- package/contracts/instance/service/ComponentOwnerService.sol +0 -315
- package/contracts/instance/service/IComponentOwnerService.sol +0 -20
- package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -24,17 +24,16 @@ import {TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
|
|
24
24
|
import {IService} from "../../shared/IService.sol";
|
25
25
|
import {Service} from "../../shared/Service.sol";
|
26
26
|
import {BundleManager} from "../BundleManager.sol";
|
27
|
-
import {
|
27
|
+
import {ComponentService} from "../base/ComponentService.sol";
|
28
28
|
import {IBundleService} from "./IBundleService.sol";
|
29
29
|
import {IRegistryService} from "../../registry/IRegistryService.sol";
|
30
30
|
import {InstanceService} from "../InstanceService.sol";
|
31
31
|
import {InstanceReader} from "../InstanceReader.sol";
|
32
|
-
import {IBaseComponent} from "../../components/IBaseComponent.sol";
|
33
32
|
|
34
33
|
string constant BUNDLE_SERVICE_NAME = "BundleService";
|
35
34
|
|
36
35
|
contract BundleService is
|
37
|
-
|
36
|
+
ComponentService,
|
38
37
|
IBundleService
|
39
38
|
{
|
40
39
|
using NftIdLib for NftId;
|
@@ -19,14 +19,14 @@ import {Versionable} from "../../shared/Versionable.sol";
|
|
19
19
|
|
20
20
|
import {IService} from "../../shared/IService.sol";
|
21
21
|
import {Service} from "../../shared/Service.sol";
|
22
|
-
import {
|
22
|
+
import {ComponentService} from "../base/ComponentService.sol";
|
23
23
|
import {InstanceService} from "../InstanceService.sol";
|
24
|
+
import {IComponent} from "../../components/IComponent.sol";
|
25
|
+
import {IDistributionComponent} from "../../components/IDistributionComponent.sol";
|
24
26
|
import {IDistributionService} from "./IDistributionService.sol";
|
25
|
-
import {IBaseComponent} from "../../components/IBaseComponent.sol";
|
26
|
-
|
27
27
|
|
28
28
|
contract DistributionService is
|
29
|
-
|
29
|
+
ComponentService,
|
30
30
|
IDistributionService
|
31
31
|
{
|
32
32
|
using NftIdLib for NftId;
|
@@ -59,45 +59,31 @@ contract DistributionService is
|
|
59
59
|
external
|
60
60
|
returns(NftId distributionNftId)
|
61
61
|
{
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
distributionOwner,
|
75
|
-
DISTRIBUTION_OWNER_ROLE(),
|
76
|
-
address(instance));
|
77
|
-
|
78
|
-
if(!hasRole) {
|
79
|
-
revert ExpectedRoleMissing(DISTRIBUTION_OWNER_ROLE(), distributionOwner);
|
80
|
-
}
|
81
|
-
|
82
|
-
distributionNftId = info.nftId;
|
83
|
-
string memory distributionName;
|
84
|
-
ISetup.DistributionSetupInfo memory initialSetup;
|
85
|
-
(distributionName, initialSetup) = _decodeAndVerifyDistributionData(data);
|
86
|
-
instance.createDistributionSetup(distributionNftId, initialSetup);
|
87
|
-
|
88
|
-
instanceService.createTarget(instanceNftId, distributionAddress, distributionName);
|
89
|
-
|
62
|
+
(
|
63
|
+
IComponent component,
|
64
|
+
address owner,
|
65
|
+
IInstance instance,
|
66
|
+
NftId instanceNftId
|
67
|
+
) = _checkComponentForRegistration(
|
68
|
+
distributionAddress,
|
69
|
+
DISTRIBUTION(),
|
70
|
+
DISTRIBUTION_OWNER_ROLE());
|
71
|
+
|
72
|
+
IRegistry.ObjectInfo memory distributionInfo = getRegistryService().registerDistribution(component, owner);
|
73
|
+
IDistributionComponent distribution = IDistributionComponent(distributionAddress);
|
90
74
|
distribution.linkToRegisteredNftId();
|
75
|
+
distributionNftId = distributionInfo.nftId;
|
76
|
+
|
77
|
+
instance.createDistributionSetup(distributionNftId, distribution.getSetupInfo());
|
78
|
+
getInstanceService().createGifTarget(instanceNftId, distributionAddress, distribution.getName());
|
79
|
+
getInstanceService().grantDistributionDefaultPermissions(instanceNftId, distributionAddress, distribution.getName());
|
91
80
|
}
|
92
81
|
|
93
82
|
function _decodeAndVerifyDistributionData(bytes memory data)
|
94
83
|
internal
|
95
|
-
returns(string memory name
|
84
|
+
returns(string memory name)
|
96
85
|
{
|
97
|
-
(name
|
98
|
-
data,
|
99
|
-
(string, ISetup.DistributionSetupInfo)
|
100
|
-
);
|
86
|
+
(name) = abi.decode(data, (string));
|
101
87
|
|
102
88
|
// TODO add checks if applicable
|
103
89
|
}
|
@@ -4,7 +4,6 @@ pragma solidity ^0.8.19;
|
|
4
4
|
import {IRegistry} from "../../registry/IRegistry.sol";
|
5
5
|
import {IProductComponent} from "../../components/IProductComponent.sol";
|
6
6
|
import {Product} from "../../components/Product.sol";
|
7
|
-
import {IBaseComponent} from "../../components/IBaseComponent.sol";
|
8
7
|
import {IPoolComponent} from "../../components/IPoolComponent.sol";
|
9
8
|
import {IDistributionComponent} from "../../components/IDistributionComponent.sol";
|
10
9
|
import {IInstance} from "../IInstance.sol";
|
@@ -35,14 +34,14 @@ import {Version, VersionLib} from "../../types/Version.sol";
|
|
35
34
|
|
36
35
|
import {IService} from "../../shared/IService.sol";
|
37
36
|
import {Service} from "../../shared/Service.sol";
|
38
|
-
import {
|
37
|
+
import {ComponentService} from "../base/ComponentService.sol";
|
39
38
|
import {IPolicyService} from "./IPolicyService.sol";
|
40
39
|
import {InstanceReader} from "../InstanceReader.sol";
|
41
40
|
import {IPoolService} from "./IPoolService.sol";
|
42
41
|
import {IBundleService} from "./IBundleService.sol";
|
43
42
|
|
44
43
|
|
45
|
-
contract PolicyService is
|
44
|
+
contract PolicyService is ComponentService, IPolicyService {
|
46
45
|
using NftIdLib for NftId;
|
47
46
|
using TimestampLib for Timestamp;
|
48
47
|
|
@@ -24,17 +24,18 @@ import {TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
|
|
24
24
|
import {IService} from "../../shared/IService.sol";
|
25
25
|
import {Service} from "../../shared/Service.sol";
|
26
26
|
import {BundleManager} from "../BundleManager.sol";
|
27
|
-
import {
|
27
|
+
import {ComponentService} from "../base/ComponentService.sol";
|
28
28
|
import {IPoolService} from "./IPoolService.sol";
|
29
29
|
import {IRegistryService} from "../../registry/IRegistryService.sol";
|
30
30
|
import {InstanceService} from "../InstanceService.sol";
|
31
31
|
import {InstanceReader} from "../InstanceReader.sol";
|
32
|
-
import {
|
32
|
+
import {IComponent} from "../../components/IComponent.sol";
|
33
|
+
import {IPoolComponent} from "../../components/IPoolComponent.sol";
|
33
34
|
|
34
35
|
string constant POOL_SERVICE_NAME = "PoolService";
|
35
36
|
|
36
37
|
contract PoolService is
|
37
|
-
|
38
|
+
ComponentService,
|
38
39
|
IPoolService
|
39
40
|
{
|
40
41
|
using NftIdLib for NftId;
|
@@ -67,60 +68,24 @@ contract PoolService is
|
|
67
68
|
external
|
68
69
|
returns(NftId poolNftId)
|
69
70
|
{
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
address(instance));
|
83
|
-
|
84
|
-
if(!hasRole) {
|
85
|
-
revert ExpectedRoleMissing(POOL_OWNER_ROLE(), poolOwner);
|
86
|
-
}
|
87
|
-
|
88
|
-
poolNftId = info.nftId;
|
89
|
-
string memory poolName;
|
90
|
-
ISetup.PoolSetupInfo memory initialSetup;
|
91
|
-
(poolName, initialSetup) = _decodeAndVerifyPoolData(data);
|
92
|
-
instance.createPoolSetup(poolNftId, initialSetup);
|
93
|
-
|
94
|
-
getInstanceService().createTarget(instanceNftId, poolAddress, poolName);
|
95
|
-
|
71
|
+
(
|
72
|
+
IComponent component,
|
73
|
+
address owner,
|
74
|
+
IInstance instance,
|
75
|
+
NftId instanceNftId
|
76
|
+
) = _checkComponentForRegistration(
|
77
|
+
poolAddress,
|
78
|
+
POOL(),
|
79
|
+
POOL_OWNER_ROLE());
|
80
|
+
|
81
|
+
IPoolComponent pool = IPoolComponent(poolAddress);
|
82
|
+
IRegistry.ObjectInfo memory poolInfo = getRegistryService().registerPool(pool, owner);
|
96
83
|
pool.linkToRegisteredNftId();
|
97
|
-
|
98
|
-
|
99
|
-
function _decodeAndVerifyPoolData(bytes memory data)
|
100
|
-
internal
|
101
|
-
returns(string memory name, ISetup.PoolSetupInfo memory setup)
|
102
|
-
{
|
103
|
-
(name, setup) = abi.decode(
|
104
|
-
data,
|
105
|
-
(string, ISetup.PoolSetupInfo)
|
106
|
-
);
|
107
|
-
|
108
|
-
// TODO add checks
|
109
|
-
/*IRegistry _registry = getRegistry();
|
110
|
-
|
111
|
-
if(wallet == address(0)) {
|
112
|
-
revert WalletIsZero();
|
113
|
-
}
|
114
|
-
|
115
|
-
ObjectType tokenType = _registry.getObjectInfo(address(token)).objectType;
|
116
|
-
|
117
|
-
if(tokenType != TOKEN()) {
|
118
|
-
revert InvalidToken();
|
119
|
-
}
|
84
|
+
poolNftId = poolInfo.nftId;
|
120
85
|
|
121
|
-
|
122
|
-
|
123
|
-
|
86
|
+
instance.createPoolSetup(poolNftId, pool.getSetupInfo());
|
87
|
+
getInstanceService().createGifTarget(instanceNftId, poolAddress, pool.getName());
|
88
|
+
getInstanceService().grantPoolDefaultPermissions(instanceNftId, poolAddress, pool.getName());
|
124
89
|
}
|
125
90
|
|
126
91
|
function setFees(
|
@@ -4,7 +4,7 @@ pragma solidity ^0.8.19;
|
|
4
4
|
import {IRegistry} from "../../registry/IRegistry.sol";
|
5
5
|
import {IProductComponent} from "../../components/IProductComponent.sol";
|
6
6
|
import {Product} from "../../components/Product.sol";
|
7
|
-
import {
|
7
|
+
import {IComponent} from "../../components/IComponent.sol";
|
8
8
|
import {IPoolComponent} from "../../components/IPoolComponent.sol";
|
9
9
|
import {IDistributionComponent} from "../../components/IDistributionComponent.sol";
|
10
10
|
import {IInstance} from "../IInstance.sol";
|
@@ -35,13 +35,13 @@ import {RoleId, PRODUCT_OWNER_ROLE} from "../../types/RoleId.sol";
|
|
35
35
|
|
36
36
|
import {IService} from "../../shared/IService.sol";
|
37
37
|
import {Service} from "../../shared/Service.sol";
|
38
|
-
import {
|
38
|
+
import {ComponentService} from "../base/ComponentService.sol";
|
39
39
|
import {IProductService} from "./IProductService.sol";
|
40
40
|
import {InstanceReader} from "../InstanceReader.sol";
|
41
41
|
import {IPoolService} from "./PoolService.sol";
|
42
42
|
|
43
43
|
// TODO or name this ProtectionService to have Product be something more generic (loan, savings account, ...)
|
44
|
-
contract ProductService is
|
44
|
+
contract ProductService is ComponentService, IProductService {
|
45
45
|
using NftIdLib for NftId;
|
46
46
|
|
47
47
|
IPoolService internal _poolService;
|
@@ -68,44 +68,64 @@ contract ProductService is ComponentServiceBase, IProductService {
|
|
68
68
|
}
|
69
69
|
|
70
70
|
|
71
|
-
function getDomain() public pure override(IService, Service) returns(ObjectType) {
|
72
|
-
return PRODUCT();
|
73
|
-
}
|
74
|
-
|
75
71
|
function register(address productAddress)
|
76
72
|
external
|
77
73
|
returns(NftId productNftId)
|
78
74
|
{
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
75
|
+
(
|
76
|
+
IComponent component,
|
77
|
+
address owner,
|
78
|
+
IInstance instance,
|
79
|
+
NftId instanceNftId
|
80
|
+
) = _checkComponentForRegistration(
|
81
|
+
productAddress,
|
82
|
+
PRODUCT(),
|
83
|
+
PRODUCT_OWNER_ROLE());
|
84
|
+
|
85
|
+
IProductComponent product = IProductComponent(productAddress);
|
86
|
+
IRegistry.ObjectInfo memory productInfo = getRegistryService().registerProduct(product, owner);
|
87
|
+
productNftId = productInfo.nftId;
|
88
|
+
_createProductSetup(
|
89
|
+
instance,
|
90
|
+
product,
|
91
|
+
productNftId);
|
92
|
+
}
|
92
93
|
|
93
|
-
if(!hasRole) {
|
94
|
-
revert ExpectedRoleMissing(PRODUCT_OWNER_ROLE(), productOwner);
|
95
|
-
}
|
96
94
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
95
|
+
function _createProductSetup(
|
96
|
+
IInstance instance,
|
97
|
+
IProductComponent product,
|
98
|
+
NftId productNftId
|
99
|
+
)
|
100
|
+
internal
|
101
|
+
returns (string memory name)
|
102
|
+
{
|
103
|
+
// wire distribution and pool components to product component
|
104
|
+
ISetup.ProductSetupInfo memory setup = product.getSetupInfo();
|
105
|
+
IComponent distribution = IComponent(_registry.getObjectInfo(setup.distributionNftId).objectAddress);
|
106
|
+
IComponent pool = IComponent(_registry.getObjectInfo(setup.poolNftId).objectAddress);
|
107
|
+
|
108
|
+
distribution.setProductNftId(productNftId);
|
109
|
+
pool.setProductNftId(productNftId);
|
110
|
+
product.setProductNftId(productNftId);
|
111
|
+
product.linkToRegisteredNftId();
|
101
112
|
|
102
|
-
instance
|
113
|
+
// create product setup in instance
|
114
|
+
instance.createProductSetup(productNftId, product.getSetupInfo());
|
103
115
|
|
104
|
-
|
116
|
+
// create target for instane access manager
|
117
|
+
getInstanceService().createGifTarget(
|
118
|
+
_registry.getNftId(address(instance)),
|
119
|
+
address(product),
|
120
|
+
product.getName());
|
121
|
+
getInstanceService().grantProductDefaultPermissions(instance.getNftId(), address(product), product.getName());
|
122
|
+
}
|
105
123
|
|
106
|
-
|
124
|
+
function getDomain() public pure override(IService, Service) returns(ObjectType) {
|
125
|
+
return PRODUCT();
|
107
126
|
}
|
108
127
|
|
128
|
+
|
109
129
|
function _decodeAndVerifyProductData(bytes memory data)
|
110
130
|
internal
|
111
131
|
returns(string memory name, ISetup.ProductSetupInfo memory setup)
|
@@ -14,13 +14,16 @@ interface IRegistry is IERC165 {
|
|
14
14
|
event LogRegistration(NftId nftId, NftId parentNftId, ObjectType objectType, bool isInterceptor, address objectAddress, address initialOwner);
|
15
15
|
event LogServiceRegistration(VersionPart majorVersion, ObjectType domain);
|
16
16
|
|
17
|
+
// registerService()
|
18
|
+
error CallerNotReleaseManager();
|
19
|
+
error ServiceAlreadyRegistered(address service);
|
20
|
+
|
17
21
|
// register()
|
18
22
|
error CallerNotRegistryService();
|
19
23
|
error ServiceRegistration();
|
20
24
|
|
21
|
-
//
|
22
|
-
error
|
23
|
-
error ServiceAlreadyRegistered(address service);
|
25
|
+
// registerWithCustomTypes()
|
26
|
+
error CoreTypeRegistration();
|
24
27
|
|
25
28
|
// _register()
|
26
29
|
error ZeroParentAddress();
|
@@ -52,11 +55,13 @@ interface IRegistry is IERC165 {
|
|
52
55
|
|
53
56
|
function register(ObjectInfo memory info) external returns (NftId nftId);
|
54
57
|
|
55
|
-
function
|
58
|
+
function registerWithCustomType(ObjectInfo memory info) external returns (NftId nftId);
|
56
59
|
|
57
|
-
function
|
60
|
+
function getInitialVersion() external view returns (VersionPart);
|
58
61
|
|
59
|
-
function
|
62
|
+
function getNextVersion() external view returns (VersionPart);
|
63
|
+
|
64
|
+
function getLatestVersion() external view returns (VersionPart);
|
60
65
|
|
61
66
|
function getReleaseInfo(VersionPart version) external view returns (ReleaseInfo memory);
|
62
67
|
|
@@ -80,6 +85,8 @@ interface IRegistry is IERC165 {
|
|
80
85
|
|
81
86
|
function isRegisteredService(address contractAddress) external view returns (bool);
|
82
87
|
|
88
|
+
function isValidRelease(VersionPart version) external view returns (bool);
|
89
|
+
|
83
90
|
function getServiceAddress(
|
84
91
|
ObjectType serviceDomain,
|
85
92
|
VersionPart releaseVersion
|
@@ -10,7 +10,7 @@ import {IService} from "../shared/IService.sol";
|
|
10
10
|
import {IRegistry} from "./IRegistry.sol";
|
11
11
|
|
12
12
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
13
|
-
import {
|
13
|
+
import {IComponent} from "../components/IComponent.sol";
|
14
14
|
|
15
15
|
interface IRegistryService is
|
16
16
|
IService,
|
@@ -38,18 +38,25 @@ interface IRegistryService is
|
|
38
38
|
bytes4 selector;
|
39
39
|
}
|
40
40
|
|
41
|
+
function getFunctionConfigs()
|
42
|
+
external
|
43
|
+
pure
|
44
|
+
returns(
|
45
|
+
FunctionConfig[] memory config
|
46
|
+
);
|
47
|
+
|
41
48
|
// TODO used by service -> add owner arg
|
42
|
-
|
43
|
-
external returns(IRegistry.ObjectInfo memory info
|
49
|
+
function registerInstance(IRegisterable instance, address owner)
|
50
|
+
external returns(IRegistry.ObjectInfo memory info);
|
44
51
|
|
45
|
-
function registerProduct(
|
46
|
-
external returns(IRegistry.ObjectInfo memory info
|
52
|
+
function registerProduct(IComponent product, address owner)
|
53
|
+
external returns(IRegistry.ObjectInfo memory info);
|
47
54
|
|
48
|
-
function registerPool(
|
49
|
-
external returns(IRegistry.ObjectInfo memory info
|
55
|
+
function registerPool(IComponent pool, address owner)
|
56
|
+
external returns(IRegistry.ObjectInfo memory info);
|
50
57
|
|
51
|
-
function registerDistribution(
|
52
|
-
external returns(IRegistry.ObjectInfo memory info
|
58
|
+
function registerDistribution(IComponent distribution, address owner)
|
59
|
+
external returns(IRegistry.ObjectInfo memory info);
|
53
60
|
|
54
61
|
function registerPolicy(IRegistry.ObjectInfo memory info) external returns(NftId nftId);
|
55
62
|
|