@etherisc/gif-next 0.0.2-fbe8e04-715 → 0.0.2-fca9315-260
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} +300 -12
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +199 -94
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/components/{BaseComponent.sol/BaseComponent.json → IComponent.sol/IComponent.json} +86 -84
- 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 +522 -28
- 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 +190 -159
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +204 -110
- 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 +269 -13
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +120 -19
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +105 -615
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +208 -114
- 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 +250 -265
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +41 -120
- 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} +124 -42
- 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/IAccess.sol/IAccess.json +59 -16
- 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 +245 -66
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +35 -26
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +153 -65
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +32 -23
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +64 -18
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +13 -18
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +120 -18
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +13 -18
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +13 -18
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +334 -91
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +66 -25
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +153 -65
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +32 -23
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +159 -71
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +32 -15
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +212 -133
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +127 -93
- 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 +224 -234
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +68 -161
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +51 -104
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +547 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +13 -29
- 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 +13 -18
- 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 +26 -18
- 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 +44 -36
- 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 +38 -51
- package/contracts/components/IComponent.sol +43 -0
- package/contracts/components/IDistributionComponent.sol +5 -2
- package/contracts/components/IPoolComponent.sol +6 -12
- package/contracts/components/IProductComponent.sol +7 -3
- package/contracts/components/Pool.sol +42 -86
- package/contracts/components/Product.sol +58 -85
- package/contracts/instance/BundleManager.sol +7 -11
- package/contracts/instance/IInstance.sol +21 -9
- package/contracts/instance/IInstanceService.sol +12 -3
- package/contracts/instance/Instance.sol +37 -233
- package/contracts/instance/InstanceAccessManager.sol +88 -78
- package/contracts/instance/InstanceReader.sol +3 -25
- package/contracts/instance/InstanceService.sol +291 -120
- package/contracts/instance/InstanceServiceManager.sol +5 -8
- package/contracts/instance/ObjectManager.sol +7 -24
- package/contracts/instance/base/ComponentService.sol +134 -0
- package/contracts/instance/module/IAccess.sol +27 -17
- package/contracts/instance/service/BundleService.sol +41 -8
- package/contracts/instance/service/BundleServiceManager.sol +5 -8
- package/contracts/instance/service/DistributionService.sol +31 -43
- package/contracts/instance/service/DistributionServiceManager.sol +6 -9
- package/contracts/instance/service/IBundleService.sol +5 -6
- package/contracts/instance/service/IPolicyService.sol +7 -0
- package/contracts/instance/service/PolicyService.sol +67 -37
- package/contracts/instance/service/PoolService.sol +25 -39
- package/contracts/instance/service/PoolServiceManager.sol +5 -8
- package/contracts/instance/service/ProductService.sol +99 -38
- package/contracts/registry/ChainNft.sol +1 -1
- package/contracts/registry/IRegistry.sol +34 -17
- package/contracts/registry/IRegistryService.sol +28 -13
- package/contracts/registry/Registry.sol +214 -210
- package/contracts/registry/RegistryAccessManager.sol +216 -0
- package/contracts/registry/RegistryService.sol +61 -157
- package/contracts/registry/RegistryServiceManager.sol +18 -36
- package/contracts/registry/ReleaseManager.sol +332 -0
- package/contracts/registry/TokenRegistry.sol +8 -7
- package/contracts/shared/IRegisterable.sol +1 -3
- package/contracts/shared/IService.sol +2 -1
- package/contracts/shared/NftOwnable.sol +5 -0
- package/contracts/shared/ProxyManager.sol +1 -1
- package/contracts/shared/Registerable.sol +10 -14
- package/contracts/shared/Service.sol +13 -8
- package/contracts/test/TestService.sol +3 -2
- package/contracts/types/RoleId.sol +10 -12
- 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/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.json +0 -1082
- 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 -827
- 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 -132
- package/contracts/components/IBaseComponent.sol +0 -31
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +0 -23
- package/contracts/instance/IAccessManagerSimple.sol +0 -391
- package/contracts/instance/IInstanceBase.sol +0 -26
- package/contracts/instance/InstanceBase.sol +0 -41
- package/contracts/instance/base/ComponentServiceBase.sol +0 -72
- package/contracts/instance/base/IInstanceBase.sol +0 -23
- package/contracts/instance/service/ComponentOwnerService.sol +0 -317
- package/contracts/instance/service/IComponentOwnerService.sol +0 -20
- package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -14,49 +14,32 @@ contract ObjectManager is
|
|
14
14
|
Cloneable
|
15
15
|
{
|
16
16
|
|
17
|
-
event LogObjectManagerInitialized(
|
17
|
+
event LogObjectManagerInitialized(address instance);
|
18
18
|
|
19
19
|
error ErrorObjectManagerNftIdInvalid(NftId instanceNftId);
|
20
20
|
error ErrorObjectManagerAlreadyAdded(NftId componentNftId, NftId objectNftId);
|
21
21
|
|
22
22
|
mapping(NftId compnentNftId => LibNftIdSet.Set objects) internal _activeObjects;
|
23
23
|
mapping(NftId compnentNftId => LibNftIdSet.Set objects) internal _allObjects;
|
24
|
-
|
25
|
-
InstanceReader internal _instanceReader;
|
26
|
-
|
27
|
-
constructor() Cloneable() {
|
28
|
-
_instanceReader = InstanceReader(address(0));
|
29
|
-
}
|
24
|
+
IInstance internal _instance; // store instance address -> more flexible, instance may not be registered during ObjectManager initialization
|
30
25
|
|
31
26
|
/// @dev call to initialize MUST be made in the same transaction as cloning of the contract
|
32
27
|
function initialize(
|
33
28
|
address authority,
|
34
29
|
address registry,
|
35
|
-
|
30
|
+
address instance
|
36
31
|
)
|
37
32
|
external
|
38
33
|
{
|
39
34
|
initialize(authority, registry);
|
40
35
|
|
41
|
-
|
42
|
-
IRegistry.ObjectInfo memory instanceInfo = _registry.getObjectInfo(instanceNftId);
|
43
|
-
if (instanceInfo.objectType != INSTANCE()) {
|
44
|
-
revert ErrorObjectManagerNftIdInvalid(instanceNftId);
|
45
|
-
}
|
46
|
-
|
47
|
-
IInstance instance = IInstance(instanceInfo.objectAddress);
|
48
|
-
_instanceReader = instance.getInstanceReader();
|
49
|
-
_instanceNftId = instanceNftId;
|
36
|
+
_instance = IInstance(instance);
|
50
37
|
|
51
|
-
emit LogObjectManagerInitialized(
|
52
|
-
}
|
53
|
-
|
54
|
-
function getInstanceReader() external view returns (InstanceReader) {
|
55
|
-
return _instanceReader;
|
38
|
+
emit LogObjectManagerInitialized(instance);
|
56
39
|
}
|
57
40
|
|
58
|
-
function
|
59
|
-
return
|
41
|
+
function getInstance() external view returns (IInstance) {
|
42
|
+
return _instance;
|
60
43
|
}
|
61
44
|
|
62
45
|
function _add(NftId componentNftId, NftId objectNftId) internal {
|
@@ -0,0 +1,134 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {IComponent} from "../../components/IComponent.sol";
|
5
|
+
import {IRegistry} from "../../registry/IRegistry.sol";
|
6
|
+
import {IRegistryService} from "../../registry/IRegistryService.sol";
|
7
|
+
import {IInstance} from "../../instance/IInstance.sol";
|
8
|
+
import {IAccess} from "../module/IAccess.sol";
|
9
|
+
import {ObjectType, INSTANCE, REGISTRY} from "../../types/ObjectType.sol";
|
10
|
+
import {NftId} from "../../types/NftId.sol";
|
11
|
+
import {RoleId} from "../../types/RoleId.sol";
|
12
|
+
|
13
|
+
import {Service} from "../../shared/Service.sol";
|
14
|
+
import {InstanceService} from "../InstanceService.sol";
|
15
|
+
import {InstanceAccessManager} from "../InstanceAccessManager.sol";
|
16
|
+
|
17
|
+
abstract contract ComponentService is Service {
|
18
|
+
|
19
|
+
error ErrorComponentServiceAlreadyRegistered(address component, NftId nftId);
|
20
|
+
error ErrorComponentServiceNotComponent(address component);
|
21
|
+
error ErrorComponentServiceInvalidType(address component, ObjectType requiredType, ObjectType componentType);
|
22
|
+
error ErrorComponentServiceSenderNotOwner(address component, address initialOwner, address sender);
|
23
|
+
error ErrorComponentServiceExpectedRoleMissing(NftId instanceNftId, RoleId requiredRole, address sender);
|
24
|
+
error ErrorComponentServiceComponentLocked(address component);
|
25
|
+
|
26
|
+
/// @dev modifier to check if caller is a registered service
|
27
|
+
modifier onlyService() {
|
28
|
+
address caller = msg.sender;
|
29
|
+
require(getRegistry().isRegisteredService(caller), "ERROR_NOT_SERVICE");
|
30
|
+
_;
|
31
|
+
}
|
32
|
+
|
33
|
+
// view functions
|
34
|
+
|
35
|
+
function getRegistryService() public view virtual returns (IRegistryService) {
|
36
|
+
address service = getRegistry().getServiceAddress(REGISTRY(), getMajorVersion());
|
37
|
+
return IRegistryService(service);
|
38
|
+
}
|
39
|
+
|
40
|
+
function getInstanceService() public view returns (InstanceService) {
|
41
|
+
address service = getRegistry().getServiceAddress(INSTANCE(), getMajorVersion());
|
42
|
+
return InstanceService(service);
|
43
|
+
}
|
44
|
+
|
45
|
+
// internal functions
|
46
|
+
function _checkComponentForRegistration(
|
47
|
+
address componentAddress,
|
48
|
+
ObjectType requiredType,
|
49
|
+
RoleId requiredRole
|
50
|
+
)
|
51
|
+
internal
|
52
|
+
view
|
53
|
+
returns (
|
54
|
+
IComponent component,
|
55
|
+
address owner,
|
56
|
+
IInstance instance,
|
57
|
+
NftId instanceNftId
|
58
|
+
)
|
59
|
+
{
|
60
|
+
// component may only be registerd by initial owner of component
|
61
|
+
owner = msg.sender;
|
62
|
+
|
63
|
+
// check component has not already been registerd
|
64
|
+
NftId compoentNftId = _registry.getNftId(componentAddress);
|
65
|
+
if(compoentNftId.gtz()) {
|
66
|
+
revert ErrorComponentServiceAlreadyRegistered(componentAddress, compoentNftId);
|
67
|
+
}
|
68
|
+
|
69
|
+
// check this is a component
|
70
|
+
component = IComponent(componentAddress);
|
71
|
+
if(!component.supportsInterface(type(IComponent).interfaceId)) {
|
72
|
+
revert ErrorComponentServiceNotComponent(componentAddress);
|
73
|
+
}
|
74
|
+
|
75
|
+
// check component is of required type
|
76
|
+
IRegistry.ObjectInfo memory componentInfo = component.getInitialInfo();
|
77
|
+
if(componentInfo.objectType != requiredType) {
|
78
|
+
revert ErrorComponentServiceInvalidType(componentAddress, requiredType, componentInfo.objectType);
|
79
|
+
}
|
80
|
+
|
81
|
+
// check msg.sender is component owner
|
82
|
+
address initialOwner = componentInfo.initialOwner;
|
83
|
+
if(owner != initialOwner) {
|
84
|
+
revert ErrorComponentServiceSenderNotOwner(componentAddress, componentInfo.initialOwner, owner);
|
85
|
+
}
|
86
|
+
|
87
|
+
// check instance has assigned required role to owner
|
88
|
+
instanceNftId = componentInfo.parentNftId;
|
89
|
+
instance = _getInstance(instanceNftId);
|
90
|
+
bool hasRole = getInstanceService().hasRole(
|
91
|
+
owner,
|
92
|
+
requiredRole,
|
93
|
+
address(instance));
|
94
|
+
|
95
|
+
if(!hasRole) {
|
96
|
+
revert ErrorComponentServiceExpectedRoleMissing(instanceNftId, requiredRole, owner);
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
// internal view functions
|
101
|
+
|
102
|
+
function _getInstance(NftId instanceNftId) internal view returns (IInstance) {
|
103
|
+
IRegistry.ObjectInfo memory instanceInfo = getRegistry().getObjectInfo(instanceNftId);
|
104
|
+
return IInstance(instanceInfo.objectAddress);
|
105
|
+
}
|
106
|
+
|
107
|
+
function _getAndVerifyComponentInfoAndInstance(
|
108
|
+
//address component,
|
109
|
+
ObjectType expectedType
|
110
|
+
)
|
111
|
+
internal
|
112
|
+
view
|
113
|
+
returns(
|
114
|
+
IRegistry.ObjectInfo memory info,
|
115
|
+
IInstance instance
|
116
|
+
)
|
117
|
+
{
|
118
|
+
IRegistry registry = getRegistry();
|
119
|
+
//TODO redundant check -> just check type
|
120
|
+
//NftId componentNftId = registry.getNftId(component);
|
121
|
+
//require(componentNftId.gtz(), "ERROR_COMPONENT_UNKNOWN");
|
122
|
+
|
123
|
+
info = registry.getObjectInfo(msg.sender);
|
124
|
+
require(info.objectType == expectedType, "OBJECT_TYPE_INVALID");
|
125
|
+
|
126
|
+
address instanceAddress = registry.getObjectInfo(info.parentNftId).objectAddress;
|
127
|
+
instance = IInstance(instanceAddress);
|
128
|
+
|
129
|
+
InstanceAccessManager accessManager = InstanceAccessManager(instance.authority());
|
130
|
+
if (accessManager.isTargetLocked(info.objectAddress)) {
|
131
|
+
revert IAccess.ErrorIAccessTargetLocked(info.objectAddress);
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
@@ -5,34 +5,44 @@ import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet
|
|
5
5
|
import {ShortString, ShortStrings} from "@openzeppelin/contracts/utils/ShortStrings.sol";
|
6
6
|
|
7
7
|
import {RoleId} from "../../types/RoleId.sol";
|
8
|
+
import {Timestamp} from "../../types/Timestamp.sol";
|
8
9
|
|
9
10
|
interface IAccess {
|
11
|
+
|
10
12
|
struct RoleInfo {
|
11
13
|
ShortString name;
|
12
14
|
bool isCustom;
|
15
|
+
bool isLocked;
|
16
|
+
Timestamp createdAt;
|
17
|
+
Timestamp updatedAt;
|
13
18
|
}
|
14
19
|
|
15
20
|
struct TargetInfo {
|
16
21
|
ShortString name;
|
17
22
|
bool isCustom;
|
23
|
+
bool isLocked;
|
24
|
+
Timestamp createdAt;
|
25
|
+
Timestamp updatedAt;
|
18
26
|
}
|
19
27
|
|
20
|
-
error
|
21
|
-
error
|
22
|
-
error
|
23
|
-
error
|
24
|
-
error
|
25
|
-
|
26
|
-
error
|
27
|
-
error
|
28
|
-
error
|
29
|
-
error
|
30
|
-
error
|
31
|
-
error
|
32
|
-
error
|
33
|
-
error ErrorRoleInvalidUpdate(RoleId roleId, bool isCustom);
|
34
|
-
error ErrorGrantNonexstentRole(RoleId roleId);
|
35
|
-
error ErrorRevokeNonexstentRole(RoleId roleId);
|
36
|
-
error ErrorRenounceNonexstentRole(RoleId roleId);
|
28
|
+
error ErrorIAccessRoleIdInvalid(RoleId roleId);
|
29
|
+
error ErrorIAccessRoleIdTooBig(RoleId roleId);
|
30
|
+
error ErrorIAccessRoleIdTooSmall(RoleId roleId);
|
31
|
+
error ErrorIAccessRoleIdAlreadyExists(RoleId roleId, ShortString name);
|
32
|
+
error ErrorIAccessRoleIdNotActive(RoleId roleId);
|
33
|
+
error ErrorIAccessRoleNameEmpty(RoleId roleId);
|
34
|
+
error ErrorIAccessRoleNameNotUnique(RoleId roleId, ShortString name);
|
35
|
+
error ErrorIAccessRoleInvalidUpdate(RoleId roleId, bool isCustom);
|
36
|
+
error ErrorIAccessRoleIsCustomIsImmutable(RoleId roleId, bool isCustom, bool isCustomExisting);
|
37
|
+
error ErrorIAccessSetLockedForNonexstentRole(RoleId roleId);
|
38
|
+
error ErrorIAccessGrantNonexstentRole(RoleId roleId);
|
39
|
+
error ErrorIAccessRevokeNonexstentRole(RoleId roleId);
|
40
|
+
error ErrorIAccessRenounceNonexstentRole(RoleId roleId);
|
37
41
|
|
42
|
+
error ErrorIAccessTargetAddressZero();
|
43
|
+
error ErrorIAccessTargetAlreadyExists(address target, ShortString name);
|
44
|
+
error ErrorIAccessTargetNameEmpty(address target);
|
45
|
+
error ErrorIAccessTargetNameExists(address target, address existingTarget, ShortString name);
|
46
|
+
error ErrorIAccessSetLockedForNonexstentTarget(address target);
|
47
|
+
error ErrorIAccessTargetLocked(address target);
|
38
48
|
}
|
@@ -14,7 +14,7 @@ import {Versionable} from "../../shared/Versionable.sol";
|
|
14
14
|
import {INftOwnable} from "../../shared/INftOwnable.sol";
|
15
15
|
|
16
16
|
import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
|
17
|
-
import {POOL, BUNDLE} from "../../types/ObjectType.sol";
|
17
|
+
import {ObjectType, POOL, BUNDLE} from "../../types/ObjectType.sol";
|
18
18
|
import {POOL_OWNER_ROLE, RoleId} from "../../types/RoleId.sol";
|
19
19
|
import {Fee, FeeLib} from "../../types/Fee.sol";
|
20
20
|
import {Version, VersionLib} from "../../types/Version.sol";
|
@@ -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;
|
@@ -61,8 +60,8 @@ contract BundleService is
|
|
61
60
|
_registerInterface(type(IBundleService).interfaceId);
|
62
61
|
}
|
63
62
|
|
64
|
-
function
|
65
|
-
return
|
63
|
+
function getDomain() public pure override(Service, IService) returns(ObjectType) {
|
64
|
+
return BUNDLE();
|
66
65
|
}
|
67
66
|
|
68
67
|
function createBundle(
|
@@ -186,6 +185,40 @@ contract BundleService is
|
|
186
185
|
linkPolicy(instance, policyNftId);
|
187
186
|
}
|
188
187
|
|
188
|
+
function increaseBalance(IInstance instance,
|
189
|
+
NftId bundleNftId,
|
190
|
+
uint256 amount
|
191
|
+
)
|
192
|
+
external
|
193
|
+
onlyService
|
194
|
+
{
|
195
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
196
|
+
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
197
|
+
|
198
|
+
bundleInfo.balanceAmount += amount;
|
199
|
+
|
200
|
+
instance.updateBundle(bundleNftId, bundleInfo, KEEP_STATE());
|
201
|
+
}
|
202
|
+
|
203
|
+
function closePolicy(IInstance instance,
|
204
|
+
NftId policyNftId,
|
205
|
+
NftId bundleNftId,
|
206
|
+
uint256 collateralAmount
|
207
|
+
)
|
208
|
+
external
|
209
|
+
onlyService
|
210
|
+
{
|
211
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
212
|
+
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
213
|
+
|
214
|
+
// lock collateral
|
215
|
+
bundleInfo.lockedAmount -= collateralAmount;
|
216
|
+
|
217
|
+
instance.updateBundle(bundleNftId, bundleInfo, KEEP_STATE());
|
218
|
+
|
219
|
+
unlinkPolicy(instance, policyNftId);
|
220
|
+
}
|
221
|
+
|
189
222
|
/// @dev links policy to bundle
|
190
223
|
function linkPolicy(IInstance instance, NftId policyNftId)
|
191
224
|
internal
|
@@ -219,8 +252,8 @@ contract BundleService is
|
|
219
252
|
}
|
220
253
|
|
221
254
|
// ensure policy is closeable
|
222
|
-
if (
|
223
|
-
|
255
|
+
if ( TimestampLib.blockTimestamp() < policyInfo.expiredAt
|
256
|
+
&& policyInfo.payoutAmount < policyInfo.sumInsuredAmount)
|
224
257
|
{
|
225
258
|
revert BundleManager.ErrorBundleManagerPolicyNotCloseable(policyNftId);
|
226
259
|
}
|
@@ -6,7 +6,7 @@ import {ProxyManager} from "../../shared/ProxyManager.sol";
|
|
6
6
|
import {BundleService} from "./BundleService.sol";
|
7
7
|
import {Registry} from "../../registry/Registry.sol";
|
8
8
|
import {RegistryService} from "../../registry/RegistryService.sol";
|
9
|
-
import {
|
9
|
+
import {ObjectType, REGISTRY} from "../../types/ObjectType.sol";
|
10
10
|
|
11
11
|
contract BundleServiceManager is ProxyManager {
|
12
12
|
|
@@ -26,10 +26,10 @@ contract BundleServiceManager is ProxyManager {
|
|
26
26
|
|
27
27
|
_bundleService = BundleService(address(versionable));
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
//
|
29
|
+
// TODO `this` must have a role or own nft to register service
|
30
|
+
//Registry registry = Registry(registryAddress);
|
31
|
+
//address registryServiceAddress = registry.getServiceAddress(REGISTRY(), _bundleService.getMajorVersion());
|
32
|
+
//RegistryService registryService = RegistryService(registryServiceAddress);
|
33
33
|
//registryService.registerService(_poolService);
|
34
34
|
|
35
35
|
// TODO no nft to link yet
|
@@ -37,9 +37,6 @@ contract BundleServiceManager is ProxyManager {
|
|
37
37
|
//_linkToNftOwnable(
|
38
38
|
// address(registryAddress),
|
39
39
|
// address(_poolService));
|
40
|
-
|
41
|
-
// implies that after this constructor call only upgrade functionality is available
|
42
|
-
_isDeployed = true;
|
43
40
|
}
|
44
41
|
|
45
42
|
//--- view functions ----------------------------------------------------//
|
@@ -2,17 +2,16 @@
|
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
4
|
import {IRegistry} from "../../registry/IRegistry.sol";
|
5
|
-
import {IRegistryService} from "../../registry/IRegistryService.sol";
|
6
5
|
import {IInstance} from "../../instance/IInstance.sol";
|
6
|
+
import {InstanceAccessManager} from "../InstanceAccessManager.sol";
|
7
7
|
import {InstanceReader} from "../../instance/InstanceReader.sol";
|
8
8
|
import {ISetup} from "../../instance/module/ISetup.sol";
|
9
|
-
import {ITreasury} from "../../instance/module/ITreasury.sol";
|
10
9
|
|
11
10
|
import {NftId, NftIdLib} from "../../types/NftId.sol";
|
12
11
|
import {Fee} from "../../types/Fee.sol";
|
13
12
|
import {DISTRIBUTION_OWNER_ROLE} from "../../types/RoleId.sol";
|
14
13
|
import {KEEP_STATE} from "../../types/StateId.sol";
|
15
|
-
import {DISTRIBUTION} from "../../types/ObjectType.sol";
|
14
|
+
import {ObjectType, DISTRIBUTION} from "../../types/ObjectType.sol";
|
16
15
|
import {Version, VersionLib} from "../../types/Version.sol";
|
17
16
|
|
18
17
|
import {IVersionable} from "../../shared/IVersionable.sol";
|
@@ -20,24 +19,18 @@ import {Versionable} from "../../shared/Versionable.sol";
|
|
20
19
|
|
21
20
|
import {IService} from "../../shared/IService.sol";
|
22
21
|
import {Service} from "../../shared/Service.sol";
|
23
|
-
import {
|
24
|
-
import {IDistributionService} from "./IDistributionService.sol";
|
25
|
-
import {Distribution} from "../../components/Distribution.sol";
|
22
|
+
import {ComponentService} from "../base/ComponentService.sol";
|
26
23
|
import {InstanceService} from "../InstanceService.sol";
|
27
|
-
import {
|
28
|
-
import {
|
29
|
-
import {
|
30
|
-
|
31
|
-
string constant DISTRIBUTION_SERVICE_NAME = "DistributionService";
|
24
|
+
import {IComponent} from "../../components/IComponent.sol";
|
25
|
+
import {IDistributionComponent} from "../../components/IDistributionComponent.sol";
|
26
|
+
import {IDistributionService} from "./IDistributionService.sol";
|
32
27
|
|
33
28
|
contract DistributionService is
|
34
|
-
|
29
|
+
ComponentService,
|
35
30
|
IDistributionService
|
36
31
|
{
|
37
32
|
using NftIdLib for NftId;
|
38
33
|
|
39
|
-
string public constant NAME = "DistributionService";
|
40
|
-
|
41
34
|
address internal _registryAddress;
|
42
35
|
|
43
36
|
function _initialize(
|
@@ -58,44 +51,39 @@ contract DistributionService is
|
|
58
51
|
_registerInterface(type(IDistributionService).interfaceId);
|
59
52
|
}
|
60
53
|
|
61
|
-
|
62
|
-
|
63
|
-
return NAME;
|
54
|
+
function getDomain() public pure override(Service, IService) returns(ObjectType) {
|
55
|
+
return DISTRIBUTION();
|
64
56
|
}
|
65
57
|
|
66
58
|
function register(address distributionAddress)
|
67
59
|
external
|
68
60
|
returns(NftId distributionNftId)
|
69
61
|
{
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
distributionNftId = info.nftId;
|
89
|
-
ISetup.DistributionSetupInfo memory initialSetup = _decodeAndVerifyDistributionSetup(data);
|
90
|
-
instance.createDistributionSetup(distributionNftId, initialSetup);
|
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);
|
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, distribution);
|
91
80
|
}
|
92
81
|
|
93
|
-
function
|
82
|
+
function _decodeAndVerifyDistributionData(bytes memory data)
|
83
|
+
internal
|
84
|
+
returns(string memory name)
|
94
85
|
{
|
95
|
-
|
96
|
-
data,
|
97
|
-
(ISetup.DistributionSetupInfo)
|
98
|
-
);
|
86
|
+
(name) = abi.decode(data, (string));
|
99
87
|
|
100
88
|
// TODO add checks if applicable
|
101
89
|
}
|
@@ -6,7 +6,7 @@ import {ProxyManager} from "../../shared/ProxyManager.sol";
|
|
6
6
|
import {DistributionService} from "./DistributionService.sol";
|
7
7
|
import {Registry} from "../../registry/Registry.sol";
|
8
8
|
import {RegistryService} from "../../registry/RegistryService.sol";
|
9
|
-
import {
|
9
|
+
import {REGISTRY} from "../../types/ObjectType.sol";
|
10
10
|
|
11
11
|
contract DistributionServiceManager is ProxyManager {
|
12
12
|
|
@@ -25,11 +25,11 @@ contract DistributionServiceManager is ProxyManager {
|
|
25
25
|
data);
|
26
26
|
|
27
27
|
_distributionService = DistributionService(address(versionable));
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
//
|
28
|
+
|
29
|
+
// TODO `thi` must have a role or own nft to register service
|
30
|
+
//Registry registry = Registry(registryAddress);
|
31
|
+
//address registryServiceAddress = registry.getServiceAddress(REGISTRY(), _distributionService.getMajorVersion());
|
32
|
+
//RegistryService registryService = RegistryService(registryServiceAddress);
|
33
33
|
//registryService.registerService(_distributionService);
|
34
34
|
|
35
35
|
// TODO no nft to link yet
|
@@ -37,9 +37,6 @@ contract DistributionServiceManager is ProxyManager {
|
|
37
37
|
//_linkToNftOwnable(
|
38
38
|
// address(registryAddress),
|
39
39
|
// address(_distributionService));
|
40
|
-
|
41
|
-
// implies that after this constructor call only upgrade functionality is available
|
42
|
-
_isDeployed = true;
|
43
40
|
}
|
44
41
|
|
45
42
|
//--- view functions ----------------------------------------------------//
|
@@ -26,12 +26,11 @@ interface IBundleService is IService {
|
|
26
26
|
|
27
27
|
function updateBundle(NftId instanceNftId, NftId bundleNftId, IBundle.BundleInfo memory bundleInfo, StateId state) external;
|
28
28
|
|
29
|
-
function underwritePolicy(IInstance instanceNftId,
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
) external;
|
29
|
+
function underwritePolicy(IInstance instanceNftId, NftId policyNftId, NftId bundleNftId, uint256 collateralAmount, uint256 netPremium) external;
|
30
|
+
|
31
|
+
function increaseBalance(IInstance instance, NftId bundleNftId, uint256 amount) external;
|
32
|
+
|
33
|
+
function closePolicy(IInstance instance, NftId policyNftId, NftId bundleNftId, uint256 collateralAmount) external;
|
35
34
|
|
36
35
|
// function fundBundle(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
37
36
|
|
@@ -15,6 +15,13 @@ import {Fee} from "../../types/Fee.sol";
|
|
15
15
|
interface IPolicyService is IService {
|
16
16
|
|
17
17
|
error ErrorIPolicyServiceInsufficientAllowance(address customer, address tokenHandlerAddress, uint256 amount);
|
18
|
+
error ErrorIPolicyServicePremiumAlreadyPaid(NftId policyNftId, uint256 premiumPaidAmount);
|
19
|
+
error ErrorIPolicyServicePolicyNotActivated(NftId policyNftId);
|
20
|
+
error ErrorIPolicyServicePolicyAlreadyClosed(NftId policyNftId);
|
21
|
+
error ErrorIPolicyServicePolicyNotActive(NftId policyNftId, StateId state);
|
22
|
+
error ErrorIPolicyServicePremiumNotFullyPaid(NftId policyNftId, uint256 premiumAmount, uint256 premiumPaidAmount);
|
23
|
+
error ErrorIPolicyServiceOpenClaims(NftId policyNftId, uint16 openClaimsCount);
|
24
|
+
error ErrorIPolicyServicePolicyHasNotExpired(NftId policyNftId, Timestamp expiredAt);
|
18
25
|
|
19
26
|
function calculatePremium(
|
20
27
|
RiskId riskId,
|