@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
@@ -7,6 +7,7 @@ import {IInstance} from "../../instance/IInstance.sol";
|
|
7
7
|
import {IBundle} from "../../instance/module/IBundle.sol";
|
8
8
|
import {TokenHandler} from "../../instance/module/ITreasury.sol";
|
9
9
|
import {ISetup} from "../module/ISetup.sol";
|
10
|
+
import {IPolicy} from "../module/IPolicy.sol";
|
10
11
|
|
11
12
|
import {IVersionable} from "../../shared/IVersionable.sol";
|
12
13
|
import {Versionable} from "../../shared/Versionable.sol";
|
@@ -17,17 +18,18 @@ import {POOL, BUNDLE} from "../../types/ObjectType.sol";
|
|
17
18
|
import {POOL_OWNER_ROLE, RoleId} from "../../types/RoleId.sol";
|
18
19
|
import {Fee, FeeLib} from "../../types/Fee.sol";
|
19
20
|
import {Version, VersionLib} from "../../types/Version.sol";
|
20
|
-
import {KEEP_STATE} from "../../types/StateId.sol";
|
21
|
-
import {zeroTimestamp} from "../../types/Timestamp.sol";
|
21
|
+
import {KEEP_STATE, StateId} from "../../types/StateId.sol";
|
22
|
+
import {TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
|
22
23
|
|
23
24
|
import {IService} from "../../shared/IService.sol";
|
24
25
|
import {Service} from "../../shared/Service.sol";
|
26
|
+
import {BundleManager} from "../BundleManager.sol";
|
25
27
|
import {ComponentServiceBase} from "../base/ComponentServiceBase.sol";
|
26
28
|
import {IPoolService} from "./IPoolService.sol";
|
27
29
|
import {IRegistryService} from "../../registry/IRegistryService.sol";
|
28
30
|
import {InstanceService} from "../InstanceService.sol";
|
29
31
|
import {InstanceReader} from "../InstanceReader.sol";
|
30
|
-
|
32
|
+
import {IBaseComponent} from "../../components/IBaseComponent.sol";
|
31
33
|
|
32
34
|
string constant POOL_SERVICE_NAME = "PoolService";
|
33
35
|
|
@@ -49,12 +51,13 @@ contract PoolService is
|
|
49
51
|
initializer
|
50
52
|
virtual override
|
51
53
|
{
|
52
|
-
address
|
53
|
-
|
54
|
-
|
55
|
-
|
54
|
+
address registryAddress;
|
55
|
+
address initialOwner;
|
56
|
+
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
57
|
+
// TODO while PoolService is not deployed in PoolServiceManager constructor
|
58
|
+
// owner is PoolServiceManager deployer
|
59
|
+
_initializeService(registryAddress, owner);
|
56
60
|
|
57
|
-
_registerInterface(type(IService).interfaceId);
|
58
61
|
_registerInterface(type(IPoolService).interfaceId);
|
59
62
|
}
|
60
63
|
|
@@ -62,12 +65,41 @@ contract PoolService is
|
|
62
65
|
return NAME;
|
63
66
|
}
|
64
67
|
|
65
|
-
function
|
66
|
-
|
67
|
-
|
68
|
+
function register(address poolAddress)
|
69
|
+
external
|
70
|
+
returns(NftId poolNftId)
|
71
|
+
{
|
72
|
+
address poolOwner = msg.sender;
|
73
|
+
IBaseComponent pool = IBaseComponent(poolAddress);
|
74
|
+
|
75
|
+
IRegistry.ObjectInfo memory info;
|
76
|
+
bytes memory data;
|
77
|
+
(info, data) = getRegistryService().registerPool(pool, poolOwner);
|
78
|
+
|
79
|
+
IInstance instance = _getInstance(info);
|
80
|
+
|
81
|
+
bool hasRole = getInstanceService().hasRole(
|
82
|
+
poolOwner,
|
83
|
+
POOL_OWNER_ROLE(),
|
84
|
+
address(instance));
|
85
|
+
|
86
|
+
if(!hasRole) {
|
87
|
+
revert ExpectedRoleMissing(POOL_OWNER_ROLE(), poolOwner);
|
88
|
+
}
|
89
|
+
|
90
|
+
poolNftId = info.nftId;
|
91
|
+
ISetup.PoolSetupInfo memory initialSetup = _decodeAndVerifyPoolSetup(data);
|
92
|
+
instance.createPoolSetup(poolNftId, initialSetup);
|
93
|
+
}
|
94
|
+
|
95
|
+
function _decodeAndVerifyPoolSetup(bytes memory data) internal returns(ISetup.PoolSetupInfo memory setup)
|
96
|
+
{
|
97
|
+
setup = abi.decode(
|
98
|
+
data,
|
68
99
|
(ISetup.PoolSetupInfo)
|
69
100
|
);
|
70
|
-
|
101
|
+
|
102
|
+
// TODO add checks if applicable
|
71
103
|
}
|
72
104
|
|
73
105
|
function setFees(
|
@@ -89,105 +121,4 @@ contract PoolService is
|
|
89
121
|
|
90
122
|
instance.updatePoolSetup(poolNftId, poolSetupInfo, KEEP_STATE());
|
91
123
|
}
|
92
|
-
|
93
|
-
function createBundle(
|
94
|
-
address owner,
|
95
|
-
Fee memory fee,
|
96
|
-
uint256 stakingAmount,
|
97
|
-
uint256 lifetime,
|
98
|
-
bytes calldata filter
|
99
|
-
)
|
100
|
-
external
|
101
|
-
override
|
102
|
-
returns(NftId bundleNftId)
|
103
|
-
{
|
104
|
-
(IRegistry.ObjectInfo memory info, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
105
|
-
InstanceReader instanceReader = instance.getInstanceReader();
|
106
|
-
NftId poolNftId = info.nftId;
|
107
|
-
|
108
|
-
IBundle.BundleInfo memory bundleInfo = IBundle.BundleInfo(
|
109
|
-
poolNftId,
|
110
|
-
FeeLib.zeroFee(),
|
111
|
-
filter,
|
112
|
-
stakingAmount,
|
113
|
-
0,
|
114
|
-
stakingAmount,
|
115
|
-
lifetime,
|
116
|
-
zeroTimestamp(),
|
117
|
-
zeroTimestamp()
|
118
|
-
);
|
119
|
-
|
120
|
-
// register bundle with registry
|
121
|
-
bundleNftId = getRegistryService().registerBundle(
|
122
|
-
IRegistry.ObjectInfo(
|
123
|
-
zeroNftId(),
|
124
|
-
poolNftId,
|
125
|
-
BUNDLE(),
|
126
|
-
false, // intercepting property for bundles is defined on pool
|
127
|
-
address(0),
|
128
|
-
owner,
|
129
|
-
abi.encode(bundleInfo)
|
130
|
-
)
|
131
|
-
);
|
132
|
-
|
133
|
-
// create bundle info in instance
|
134
|
-
instance.createBundle(bundleNftId, bundleInfo);
|
135
|
-
|
136
|
-
// TODO add bundle to pool in instance
|
137
|
-
|
138
|
-
// TODO collect capital
|
139
|
-
// _processStakingByTreasury(
|
140
|
-
// instanceReader,
|
141
|
-
// zeroNftId(),
|
142
|
-
// poolNftId,
|
143
|
-
// bundleNftId,
|
144
|
-
// stakingAmount);
|
145
|
-
|
146
|
-
// TODO add logging
|
147
|
-
}
|
148
|
-
|
149
|
-
function setBundleFee(
|
150
|
-
NftId bundleNftId,
|
151
|
-
Fee memory fee
|
152
|
-
)
|
153
|
-
external
|
154
|
-
override
|
155
|
-
{
|
156
|
-
(IRegistry.ObjectInfo memory info , IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
157
|
-
InstanceReader instanceReader = instance.getInstanceReader();
|
158
|
-
NftId poolNftId = info.nftId;
|
159
|
-
|
160
|
-
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
161
|
-
require(bundleInfo.poolNftId.gtz(), "ERROR:PLS-010:BUNDLE_UNKNOWN");
|
162
|
-
require(poolNftId == bundleInfo.poolNftId, "ERROR:PLS-011:BUNDLE_POOL_MISMATCH");
|
163
|
-
|
164
|
-
bundleInfo.fee = fee;
|
165
|
-
|
166
|
-
instance.updateBundle(bundleNftId, bundleInfo, KEEP_STATE());
|
167
|
-
}
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
function _processStakingByTreasury(
|
172
|
-
InstanceReader instanceReader,
|
173
|
-
NftId productNftId,
|
174
|
-
NftId poolNftId,
|
175
|
-
NftId bundleNftId,
|
176
|
-
uint256 stakingAmount
|
177
|
-
)
|
178
|
-
internal
|
179
|
-
{
|
180
|
-
// process token transfer(s)
|
181
|
-
if(stakingAmount > 0) {
|
182
|
-
TokenHandler tokenHandler = TokenHandler(instanceReader.getTokenHandler(productNftId));
|
183
|
-
address bundleOwner = getRegistry().ownerOf(bundleNftId);
|
184
|
-
ISetup.PoolSetupInfo memory poolInfo = instanceReader.getPoolSetupInfo(poolNftId);
|
185
|
-
|
186
|
-
tokenHandler.transfer(
|
187
|
-
bundleOwner,
|
188
|
-
poolInfo.wallet,
|
189
|
-
stakingAmount
|
190
|
-
);
|
191
|
-
}
|
192
|
-
}
|
193
124
|
}
|
@@ -29,13 +29,14 @@ contract PoolServiceManager is ProxyManager {
|
|
29
29
|
Registry registry = Registry(registryAddress);
|
30
30
|
address registryServiceAddress = registry.getServiceAddress("RegistryService", VersionLib.toVersion(3, 0, 0).toMajorPart());
|
31
31
|
RegistryService registryService = RegistryService(registryServiceAddress);
|
32
|
+
// TODO this must have a role or own nft to register service
|
33
|
+
//registryService.registerService(_poolService);
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
+
// TODO no nft to link yet
|
35
36
|
// link ownership of instance service manager ot nft owner of instance service
|
36
|
-
_linkToNftOwnable(
|
37
|
-
|
38
|
-
|
37
|
+
//_linkToNftOwnable(
|
38
|
+
// address(registryAddress),
|
39
|
+
// address(_poolService));
|
39
40
|
|
40
41
|
// implies that after this constructor call only upgrade functionality is available
|
41
42
|
_isDeployed = true;
|
@@ -0,0 +1,173 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {IRegistry} from "../../registry/IRegistry.sol";
|
5
|
+
import {IProductComponent} from "../../components/IProductComponent.sol";
|
6
|
+
import {Product} from "../../components/Product.sol";
|
7
|
+
import {IBaseComponent} from "../../components/IBaseComponent.sol";
|
8
|
+
import {IPoolComponent} from "../../components/IPoolComponent.sol";
|
9
|
+
import {IDistributionComponent} from "../../components/IDistributionComponent.sol";
|
10
|
+
import {IInstance} from "../IInstance.sol";
|
11
|
+
import {IPolicy} from "../module/IPolicy.sol";
|
12
|
+
import {IRisk} from "../module/IRisk.sol";
|
13
|
+
import {IBundle} from "../module/IBundle.sol";
|
14
|
+
import {IProductService} from "./IProductService.sol";
|
15
|
+
import {ITreasury} from "../module/ITreasury.sol";
|
16
|
+
import {ISetup} from "../module/ISetup.sol";
|
17
|
+
|
18
|
+
import {TokenHandler} from "../../shared/TokenHandler.sol";
|
19
|
+
|
20
|
+
import {IVersionable} from "../../shared/IVersionable.sol";
|
21
|
+
import {Versionable} from "../../shared/Versionable.sol";
|
22
|
+
|
23
|
+
import {Timestamp, zeroTimestamp} from "../../types/Timestamp.sol";
|
24
|
+
import {UFixed, UFixedLib} from "../../types/UFixed.sol";
|
25
|
+
import {Blocknumber, blockNumber} from "../../types/Blocknumber.sol";
|
26
|
+
import {ObjectType, INSTANCE, PRODUCT, POLICY} from "../../types/ObjectType.sol";
|
27
|
+
import {APPLIED, UNDERWRITTEN, ACTIVE, KEEP_STATE} from "../../types/StateId.sol";
|
28
|
+
import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
|
29
|
+
import {Fee, FeeLib} from "../../types/Fee.sol";
|
30
|
+
import {ReferralId} from "../../types/Referral.sol";
|
31
|
+
import {RiskId} from "../../types/RiskId.sol";
|
32
|
+
import {StateId} from "../../types/StateId.sol";
|
33
|
+
import {Version, VersionLib} from "../../types/Version.sol";
|
34
|
+
import {RoleId, PRODUCT_OWNER_ROLE} from "../../types/RoleId.sol";
|
35
|
+
|
36
|
+
import {IService} from "../../shared/IService.sol";
|
37
|
+
import {Service} from "../../shared/Service.sol";
|
38
|
+
import {ComponentServiceBase} from "../base/ComponentServiceBase.sol";
|
39
|
+
import {IProductService} from "./IProductService.sol";
|
40
|
+
import {InstanceReader} from "../InstanceReader.sol";
|
41
|
+
import {IPoolService} from "./PoolService.sol";
|
42
|
+
import {POOL_SERVICE_NAME} from "./PoolService.sol";
|
43
|
+
|
44
|
+
string constant PRODUCT_SERVICE_NAME = "ProductService";
|
45
|
+
|
46
|
+
// TODO or name this ProtectionService to have Product be something more generic (loan, savings account, ...)
|
47
|
+
contract ProductService is ComponentServiceBase, IProductService {
|
48
|
+
using NftIdLib for NftId;
|
49
|
+
|
50
|
+
string public constant NAME = "ProductService";
|
51
|
+
|
52
|
+
IPoolService internal _poolService;
|
53
|
+
|
54
|
+
event LogProductServiceSender(address sender);
|
55
|
+
|
56
|
+
function _initialize(
|
57
|
+
address owner,
|
58
|
+
bytes memory data
|
59
|
+
)
|
60
|
+
internal
|
61
|
+
initializer
|
62
|
+
virtual override
|
63
|
+
{
|
64
|
+
address registryAddress;
|
65
|
+
address initialOwner;
|
66
|
+
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
67
|
+
|
68
|
+
_initializeService(registryAddress, owner);
|
69
|
+
|
70
|
+
_poolService = IPoolService(_registry.getServiceAddress(POOL_SERVICE_NAME, getMajorVersion()));
|
71
|
+
|
72
|
+
_registerInterface(type(IProductService).interfaceId);
|
73
|
+
}
|
74
|
+
|
75
|
+
|
76
|
+
function getName() public pure override(IService, Service) returns(string memory name) {
|
77
|
+
return NAME;
|
78
|
+
}
|
79
|
+
|
80
|
+
function register(address productAddress)
|
81
|
+
external
|
82
|
+
returns(NftId productNftId)
|
83
|
+
{
|
84
|
+
address productOwner = msg.sender;
|
85
|
+
IBaseComponent product = IBaseComponent(productAddress);
|
86
|
+
|
87
|
+
IRegistry.ObjectInfo memory info;
|
88
|
+
bytes memory data;
|
89
|
+
(info, data) = getRegistryService().registerProduct(product, productOwner);
|
90
|
+
|
91
|
+
IInstance instance = _getInstance(info);
|
92
|
+
bool hasRole = getInstanceService().hasRole(
|
93
|
+
productOwner,
|
94
|
+
PRODUCT_OWNER_ROLE(),
|
95
|
+
address(instance));
|
96
|
+
|
97
|
+
if(!hasRole) {
|
98
|
+
revert ExpectedRoleMissing(PRODUCT_OWNER_ROLE(), productOwner);
|
99
|
+
}
|
100
|
+
|
101
|
+
productNftId = info.nftId;
|
102
|
+
ISetup.ProductSetupInfo memory initialSetup = _decodeAndVerifyProductSetup(data);
|
103
|
+
instance.createProductSetup(productNftId, initialSetup);
|
104
|
+
}
|
105
|
+
|
106
|
+
function _decodeAndVerifyProductSetup(bytes memory data) internal returns(ISetup.ProductSetupInfo memory setup)
|
107
|
+
{
|
108
|
+
setup = abi.decode(
|
109
|
+
data,
|
110
|
+
(ISetup.ProductSetupInfo)
|
111
|
+
);
|
112
|
+
|
113
|
+
// TODO add checks if applicable
|
114
|
+
}
|
115
|
+
|
116
|
+
function setFees(
|
117
|
+
Fee memory productFee,
|
118
|
+
Fee memory processingFee
|
119
|
+
)
|
120
|
+
external
|
121
|
+
{
|
122
|
+
// TODO check args
|
123
|
+
|
124
|
+
(
|
125
|
+
IRegistry.ObjectInfo memory productInfo,
|
126
|
+
IInstance instance
|
127
|
+
) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
128
|
+
|
129
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
130
|
+
NftId productNftId = productInfo.nftId;
|
131
|
+
ISetup.ProductSetupInfo memory productSetupInfo = instanceReader.getProductSetupInfo(productNftId);
|
132
|
+
|
133
|
+
productSetupInfo.productFee = productFee;
|
134
|
+
productSetupInfo.processingFee = processingFee;
|
135
|
+
|
136
|
+
instance.updateProductSetup(productNftId, productSetupInfo, KEEP_STATE());
|
137
|
+
}
|
138
|
+
|
139
|
+
function createRisk(
|
140
|
+
RiskId riskId,
|
141
|
+
bytes memory data
|
142
|
+
) external override {
|
143
|
+
(
|
144
|
+
IRegistry.ObjectInfo memory productInfo,
|
145
|
+
IInstance instance
|
146
|
+
) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
147
|
+
NftId productNftId = productInfo.nftId;
|
148
|
+
IRisk.RiskInfo memory riskInfo = IRisk.RiskInfo(productNftId, data);
|
149
|
+
instance.createRisk(
|
150
|
+
riskId,
|
151
|
+
riskInfo
|
152
|
+
);
|
153
|
+
}
|
154
|
+
|
155
|
+
function updateRisk(
|
156
|
+
RiskId riskId,
|
157
|
+
bytes memory data
|
158
|
+
) external {
|
159
|
+
(, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
160
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
161
|
+
IRisk.RiskInfo memory riskInfo = instanceReader.getRiskInfo(riskId);
|
162
|
+
riskInfo.data = data;
|
163
|
+
instance.updateRisk(riskId, riskInfo, KEEP_STATE());
|
164
|
+
}
|
165
|
+
|
166
|
+
function updateRiskState(
|
167
|
+
RiskId riskId,
|
168
|
+
StateId state
|
169
|
+
) external {
|
170
|
+
(, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
171
|
+
instance.updateRiskState(riskId, state);
|
172
|
+
}
|
173
|
+
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {IVersionable} from "../../shared/IVersionable.sol";
|
5
|
+
import {ProxyManager} from "../../shared/ProxyManager.sol";
|
6
|
+
import {ProductService} from "./ProductService.sol";
|
7
|
+
import {Registry} from "../../registry/Registry.sol";
|
8
|
+
import {RegistryService} from "../../registry/RegistryService.sol";
|
9
|
+
import {VersionLib} from "../../types/Version.sol";
|
10
|
+
|
11
|
+
contract ProductServiceManager is ProxyManager {
|
12
|
+
|
13
|
+
ProductService private _productService;
|
14
|
+
|
15
|
+
/// @dev initializes proxy manager with product service implementation
|
16
|
+
constructor(
|
17
|
+
address registryAddress
|
18
|
+
)
|
19
|
+
ProxyManager()
|
20
|
+
{
|
21
|
+
ProductService svc = new ProductService();
|
22
|
+
bytes memory data = abi.encode(registryAddress, address(this));
|
23
|
+
IVersionable versionable = deploy(
|
24
|
+
address(svc),
|
25
|
+
data);
|
26
|
+
|
27
|
+
_productService = ProductService(address(versionable));
|
28
|
+
|
29
|
+
// Registry registry = Registry(registryAddress);
|
30
|
+
// address registryServiceAddress = registry.getServiceAddress("RegistryService", VersionLib.toVersion(3, 0, 0).toMajorPart());
|
31
|
+
// RegistryService registryService = RegistryService(registryServiceAddress);
|
32
|
+
// TODO this must have a role or own nft to register service
|
33
|
+
//registryService.registerService(_productService);
|
34
|
+
|
35
|
+
// TODO no nft to link yet
|
36
|
+
// link ownership of instance service manager ot nft owner of instance service
|
37
|
+
//_linkToNftOwnable(
|
38
|
+
// address(registryAddress),
|
39
|
+
// address(_productService));
|
40
|
+
|
41
|
+
// implies that after this constructor call only upgrade functionality is available
|
42
|
+
_isDeployed = true;
|
43
|
+
}
|
44
|
+
|
45
|
+
//--- view functions ----------------------------------------------------//
|
46
|
+
function getProductService()
|
47
|
+
external
|
48
|
+
view
|
49
|
+
returns (ProductService productService)
|
50
|
+
{
|
51
|
+
return _productService;
|
52
|
+
}
|
53
|
+
|
54
|
+
}
|
@@ -13,30 +13,19 @@ interface IRegistry is IERC165 {
|
|
13
13
|
event LogInitialMajorVersionSet(VersionPart majorVersion);
|
14
14
|
event LogMajorVersionSet(VersionPart majorVersionMax);
|
15
15
|
event LogRegistration(ObjectInfo info);
|
16
|
-
event LogTokenStateSet(address token, VersionPart majorVersion, bool active);
|
17
16
|
event LogServiceNameRegistration(string serviceName, VersionPart majorVersion);
|
18
17
|
|
19
|
-
//
|
18
|
+
// setMajorVersion()
|
19
|
+
error NotOwner(address account);
|
20
20
|
error MajorVersionMaxIncreaseInvalid(VersionPart newMajorVersionMax, VersionPart existingMaxMajorVersion);
|
21
21
|
|
22
|
-
//
|
23
|
-
error TokenNotRegistered(address token);
|
24
|
-
error NotToken(address token);
|
25
|
-
error TokenMajorVersionInvalid(VersionPart majorVersion);
|
26
|
-
|
27
|
-
// register
|
22
|
+
// register()
|
28
23
|
error NotRegistryService();
|
29
24
|
error ZeroParentAddress();
|
25
|
+
error InvalidTypesCombination(ObjectType objectType, ObjectType parentType);
|
30
26
|
error ContractAlreadyRegistered(address objectAddress);
|
31
27
|
error InvalidServiceVersion(VersionPart majorVersion);
|
32
28
|
error ServiceNameAlreadyRegistered(string name, VersionPart majorVersion);
|
33
|
-
|
34
|
-
// approve
|
35
|
-
error NotOwner(address account);
|
36
|
-
error NotRegisteredContract(NftId registrarNftId);
|
37
|
-
error NotService(NftId registrarNftId);
|
38
|
-
error InvalidTypesCombination(ObjectType objectType, ObjectType parentType);
|
39
|
-
|
40
29
|
|
41
30
|
struct ObjectInfo {
|
42
31
|
NftId nftId;
|
@@ -53,8 +42,6 @@ interface IRegistry is IERC165 {
|
|
53
42
|
|
54
43
|
function register(ObjectInfo memory info) external returns (NftId nftId);
|
55
44
|
|
56
|
-
function setTokenActive(address token, VersionPart majorVersion, bool active) external;
|
57
|
-
|
58
45
|
function getMajorVersionMin() external view returns (VersionPart);
|
59
46
|
|
60
47
|
function getMajorVersionMax() external view returns (VersionPart);
|
@@ -79,7 +66,7 @@ interface IRegistry is IERC165 {
|
|
79
66
|
|
80
67
|
function isRegistered(address contractAddress) external view returns (bool);
|
81
68
|
|
82
|
-
function
|
69
|
+
function isRegisteredService(address contractAddress) external view returns (bool);
|
83
70
|
|
84
71
|
function getServiceName(NftId nftId) external view returns (string memory name);
|
85
72
|
|
@@ -12,22 +12,39 @@ import {IBaseComponent} from "../components/IBaseComponent.sol";
|
|
12
12
|
|
13
13
|
interface IRegistryService is IService {
|
14
14
|
|
15
|
-
|
15
|
+
error SelfRegistration();
|
16
|
+
error NotRegistryOwner();
|
16
17
|
|
17
|
-
|
18
|
-
|
18
|
+
error NotService();
|
19
|
+
error NotInstance();
|
20
|
+
error NotProduct();
|
21
|
+
error NotPool();
|
22
|
+
error NotDistribution();
|
19
23
|
|
20
|
-
|
21
|
-
|
24
|
+
error UnexpectedRegisterableType(ObjectType expected, ObjectType found);
|
25
|
+
error NotRegisterableOwner(address expectedOwner);
|
26
|
+
error RegisterableOwnerIsZero();
|
27
|
+
error RegisterableOwnerIsRegistered();
|
28
|
+
error InvalidInitialOwner(address initialOwner);
|
29
|
+
error InvalidAddress(address registerableAddress);
|
22
30
|
|
23
|
-
function registerPool(IBaseComponent pool, address owner)
|
24
|
-
external returns(IRegistry.ObjectInfo memory info, bytes memory data);
|
25
31
|
|
26
|
-
|
27
|
-
external returns(IRegistry.ObjectInfo memory info, bytes memory data);
|
32
|
+
function registerService(IService service) external returns(IRegistry.ObjectInfo memory info, bytes memory data);
|
28
33
|
|
29
|
-
|
34
|
+
function registerInstance(IRegisterable instance)
|
35
|
+
external returns(IRegistry.ObjectInfo memory info, bytes memory data);
|
30
36
|
|
31
|
-
|
37
|
+
function registerProduct(IBaseComponent product, address owner)
|
38
|
+
external returns(IRegistry.ObjectInfo memory info, bytes memory data);
|
39
|
+
|
40
|
+
function registerPool(IBaseComponent pool, address owner)
|
41
|
+
external returns(IRegistry.ObjectInfo memory info, bytes memory data);
|
42
|
+
|
43
|
+
function registerDistribution(IBaseComponent distribution, address owner)
|
44
|
+
external returns(IRegistry.ObjectInfo memory info, bytes memory data);
|
45
|
+
|
46
|
+
function registerPolicy(IRegistry.ObjectInfo memory info) external returns(NftId nftId); // -> easy to upgrade
|
47
|
+
|
48
|
+
function registerBundle(IRegistry.ObjectInfo memory info) external returns(NftId nftId);
|
32
49
|
}
|
33
50
|
|
@@ -30,6 +30,7 @@ contract Registry is
|
|
30
30
|
{
|
31
31
|
uint256 public constant GIF_MAJOR_VERSION_AT_DEPLOYMENT = 3;
|
32
32
|
address public constant NFT_LOCK_ADDRESS = address(0x1);
|
33
|
+
uint256 public constant REGISTRY_TOKEN_SEQUENCE_ID = 2;
|
33
34
|
uint256 public constant REGISTRY_SERVICE_TOKEN_SEQUENCE_ID = 3;
|
34
35
|
string public constant EMPTY_URI = "";
|
35
36
|
|
@@ -38,18 +39,12 @@ contract Registry is
|
|
38
39
|
mapping(NftId nftId => ObjectInfo info) internal _info;
|
39
40
|
mapping(address object => NftId nftId) internal _nftIdByAddress;
|
40
41
|
|
41
|
-
mapping(NftId registrator => mapping(
|
42
|
-
ObjectType objectType => bool)) internal _isApproved;
|
43
|
-
|
44
42
|
mapping(ObjectType objectType => mapping(
|
45
43
|
ObjectType parentType => bool)) internal _isValidContractCombination;
|
46
44
|
|
47
45
|
mapping(ObjectType objectType => mapping(
|
48
46
|
ObjectType parentType => bool)) internal _isValidObjectCombination;
|
49
47
|
|
50
|
-
mapping(address token => mapping(
|
51
|
-
VersionPart majorVersion => bool isActive)) internal _tokenIsActive;
|
52
|
-
|
53
48
|
mapping(NftId nftId => string name) internal _string;
|
54
49
|
mapping(bytes32 serviceNameHash => mapping(
|
55
50
|
VersionPart majorVersion => address service)) internal _service;
|
@@ -67,7 +62,6 @@ contract Registry is
|
|
67
62
|
}
|
68
63
|
|
69
64
|
modifier onlyRegistryService() {
|
70
|
-
|
71
65
|
if(msg.sender != _info[_serviceNftId].objectAddress) {
|
72
66
|
revert NotRegistryService();
|
73
67
|
}
|
@@ -181,38 +175,6 @@ contract Registry is
|
|
181
175
|
|
182
176
|
emit LogRegistration(info);
|
183
177
|
}
|
184
|
-
|
185
|
-
/// @dev token state is informative, registry have no clue about used tokens
|
186
|
-
// component owner is responsible for token selection and operations
|
187
|
-
// service MUST deny registration of component with inactive token
|
188
|
-
function setTokenActive(address token, VersionPart majorVersion, bool active)
|
189
|
-
external
|
190
|
-
onlyOwner
|
191
|
-
{
|
192
|
-
// verify that token is registered
|
193
|
-
ObjectInfo memory info = _info[_nftIdByAddress[token]];
|
194
|
-
if (info.nftId.eqz()) {
|
195
|
-
revert TokenNotRegistered(token);
|
196
|
-
}
|
197
|
-
|
198
|
-
// verify provided address is a registered token
|
199
|
-
if (info.objectType != TOKEN()) {
|
200
|
-
revert NotToken(token);
|
201
|
-
}
|
202
|
-
|
203
|
-
// verify valid major version
|
204
|
-
// ensure major version increments is one
|
205
|
-
uint256 version = majorVersion.toInt();
|
206
|
-
uint256 versionNow = _majorVersion.toInt();
|
207
|
-
if (version < GIF_MAJOR_VERSION_AT_DEPLOYMENT || version > versionNow) {
|
208
|
-
revert TokenMajorVersionInvalid(majorVersion);
|
209
|
-
}
|
210
|
-
|
211
|
-
_tokenIsActive[token][majorVersion] = active;
|
212
|
-
|
213
|
-
emit LogTokenStateSet(token, majorVersion, active);
|
214
|
-
}
|
215
|
-
|
216
178
|
/// @dev earliest GIF major version
|
217
179
|
function getMajorVersionMin() external view returns (VersionPart) {
|
218
180
|
return VersionLib.toVersionPart(GIF_MAJOR_VERSION_AT_DEPLOYMENT);
|
@@ -233,7 +195,6 @@ contract Registry is
|
|
233
195
|
function getMajorVersion() external view returns (VersionPart) {
|
234
196
|
return _majorVersion;
|
235
197
|
}
|
236
|
-
|
237
198
|
|
238
199
|
function getObjectCount() external view override returns (uint256) {
|
239
200
|
return _chainNft.totalSupply();
|
@@ -252,7 +213,6 @@ contract Registry is
|
|
252
213
|
}
|
253
214
|
|
254
215
|
function ownerOf(address contractAddress) public view returns (address) {
|
255
|
-
|
256
216
|
return _chainNft.ownerOf(_nftIdByAddress[contractAddress].toInt());
|
257
217
|
}
|
258
218
|
|
@@ -261,7 +221,6 @@ contract Registry is
|
|
261
221
|
}
|
262
222
|
|
263
223
|
function getObjectInfo(address object) external view override returns (ObjectInfo memory) {
|
264
|
-
|
265
224
|
return _info[_nftIdByAddress[object]];
|
266
225
|
}
|
267
226
|
|
@@ -273,8 +232,8 @@ contract Registry is
|
|
273
232
|
return _nftIdByAddress[object].gtz();
|
274
233
|
}
|
275
234
|
|
276
|
-
function
|
277
|
-
return
|
235
|
+
function isRegisteredService(address object) external view override returns (bool) {
|
236
|
+
return _nftIdByAddress[object].gtz() && _info[_nftIdByAddress[object]].objectType == SERVICE();
|
278
237
|
}
|
279
238
|
|
280
239
|
function getServiceName(NftId nftId) external view returns (string memory) {
|
@@ -378,7 +337,7 @@ contract Registry is
|
|
378
337
|
function _registerRegistry(address registryOwner)
|
379
338
|
internal
|
380
339
|
{
|
381
|
-
uint256 registryId = _chainNft.calculateTokenId(
|
340
|
+
uint256 registryId = _chainNft.calculateTokenId(REGISTRY_TOKEN_SEQUENCE_ID);
|
382
341
|
NftId registryNftId = toNftId(registryId);
|
383
342
|
|
384
343
|
NftId parentNftId;
|