@etherisc/gif-next 0.0.2-bf75dbb-287 → 0.0.2-c2a8d66-341
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 +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 +180 -205
- 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 +284 -2
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +115 -19
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +117 -601
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +416 -186
- 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 +253 -226
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +38 -97
- 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 -61
- 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 +65 -44
- 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 +1102 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +449 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +149 -93
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +29 -36
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/{IComponentOwnerService.sol/IComponentOwnerService.json → IBundleService.sol/IBundleService.json} +295 -46
- 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 +4 -0
- package/artifacts/contracts/{shared/RegisterableUpgradable.sol/RegisterableUpgradable.json → instance/service/IPolicyService.sol/IPolicyService.json} +372 -48
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +12 -246
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +17 -246
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +1227 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +505 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +126 -369
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +29 -56
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +137 -428
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +29 -80
- 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 +231 -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 +243 -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 +6 -6
- 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 +41 -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 +50 -109
- package/contracts/components/Product.sol +66 -89
- package/contracts/instance/BundleManager.sol +7 -11
- package/contracts/instance/IInstance.sol +25 -9
- package/contracts/instance/IInstanceService.sol +12 -4
- package/contracts/instance/Instance.sol +45 -230
- package/contracts/instance/InstanceAccessManager.sol +333 -166
- package/contracts/instance/InstanceReader.sol +3 -25
- package/contracts/instance/InstanceService.sol +352 -143
- 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 +36 -20
- package/contracts/instance/service/BundleService.sol +293 -0
- package/contracts/instance/service/BundleServiceManager.sol +51 -0
- package/contracts/instance/service/DistributionService.sol +43 -25
- package/contracts/instance/service/DistributionServiceManager.sol +6 -9
- package/contracts/instance/service/IBundleService.sol +44 -0
- package/contracts/instance/service/IPolicyService.sol +94 -0
- package/contracts/instance/service/IPoolService.sol +2 -33
- package/contracts/instance/service/IProductService.sol +2 -72
- package/contracts/instance/service/PolicyService.sol +538 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +33 -210
- package/contracts/instance/service/PoolServiceManager.sol +5 -8
- package/contracts/instance/service/ProductService.sol +122 -459
- package/contracts/registry/ChainNft.sol +1 -1
- package/contracts/registry/IRegistry.sol +36 -17
- package/contracts/registry/IRegistryService.sol +28 -13
- package/contracts/registry/Registry.sol +227 -218
- 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 +18 -15
- package/package.json +3 -3
- 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/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
- 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 -134
- 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
@@ -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,23 +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
|
-
|
30
|
-
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";
|
31
27
|
|
32
28
|
contract DistributionService is
|
33
|
-
|
29
|
+
ComponentService,
|
34
30
|
IDistributionService
|
35
31
|
{
|
36
32
|
using NftIdLib for NftId;
|
37
33
|
|
38
|
-
string public constant NAME = "DistributionService";
|
39
|
-
|
40
34
|
address internal _registryAddress;
|
41
35
|
|
42
36
|
function _initialize(
|
@@ -47,27 +41,51 @@ contract DistributionService is
|
|
47
41
|
initializer
|
48
42
|
virtual override
|
49
43
|
{
|
50
|
-
address initialOwner
|
51
|
-
|
44
|
+
address initialOwner;
|
45
|
+
address registryAddress;
|
46
|
+
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
52
47
|
// TODO while DistributionService is not deployed in DistributionServiceManager constructor
|
53
48
|
// owner is DistributionServiceManager deployer
|
54
|
-
_initializeService(
|
49
|
+
_initializeService(registryAddress, owner);
|
55
50
|
|
56
|
-
_registerInterface(type(IService).interfaceId);
|
57
51
|
_registerInterface(type(IDistributionService).interfaceId);
|
58
52
|
}
|
59
53
|
|
54
|
+
function getDomain() public pure override(Service, IService) returns(ObjectType) {
|
55
|
+
return DISTRIBUTION();
|
56
|
+
}
|
60
57
|
|
61
|
-
function
|
62
|
-
|
58
|
+
function register(address distributionAddress)
|
59
|
+
external
|
60
|
+
returns(NftId distributionNftId)
|
61
|
+
{
|
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, distributionAddress, distribution.getName());
|
63
80
|
}
|
64
81
|
|
65
|
-
function
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
);
|
70
|
-
|
82
|
+
function _decodeAndVerifyDistributionData(bytes memory data)
|
83
|
+
internal
|
84
|
+
returns(string memory name)
|
85
|
+
{
|
86
|
+
(name) = abi.decode(data, (string));
|
87
|
+
|
88
|
+
// TODO add checks if applicable
|
71
89
|
}
|
72
90
|
|
73
91
|
function setFees(
|
@@ -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 ----------------------------------------------------//
|
@@ -0,0 +1,44 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {NftId} from "../../types/NftId.sol";
|
5
|
+
import {Fee} from "../../types/Fee.sol";
|
6
|
+
import {StateId} from "../../types/StateId.sol";
|
7
|
+
import {IService} from "../../shared/IService.sol";
|
8
|
+
import {IBundle} from "../module/IBundle.sol";
|
9
|
+
import {IInstance} from "../../instance/IInstance.sol";
|
10
|
+
|
11
|
+
interface IBundleService is IService {
|
12
|
+
error ErrorIBundleServiceInsufficientAllowance(address bundleOwner, address tokenHandlerAddress, uint256 amount);
|
13
|
+
|
14
|
+
function createBundle(
|
15
|
+
address owner,
|
16
|
+
Fee memory fee,
|
17
|
+
uint256 amount,
|
18
|
+
uint256 lifetime,
|
19
|
+
bytes calldata filter
|
20
|
+
) external returns(NftId bundleNftId);
|
21
|
+
|
22
|
+
function setBundleFee(
|
23
|
+
NftId bundleNftId,
|
24
|
+
Fee memory fee
|
25
|
+
) external;
|
26
|
+
|
27
|
+
function updateBundle(NftId instanceNftId, NftId bundleNftId, IBundle.BundleInfo memory bundleInfo, StateId state) external;
|
28
|
+
|
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;
|
34
|
+
|
35
|
+
// function fundBundle(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
36
|
+
|
37
|
+
// function defundBundle(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
38
|
+
|
39
|
+
function lockBundle(NftId bundleNftId) external;
|
40
|
+
|
41
|
+
function unlockBundle(NftId bundleNftId) external;
|
42
|
+
|
43
|
+
// function closeBundle(NftId bundleNftId) external;
|
44
|
+
}
|
@@ -0,0 +1,94 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {IRisk} from "../module/IRisk.sol";
|
5
|
+
import {IService} from "../../shared/IService.sol";
|
6
|
+
|
7
|
+
import {NftId} from "../../types/NftId.sol";
|
8
|
+
import {ReferralId} from "../../types/Referral.sol";
|
9
|
+
import {RiskId} from "../../types/RiskId.sol";
|
10
|
+
import {StateId} from "../../types/StateId.sol";
|
11
|
+
import {Timestamp} from "../../types/Timestamp.sol";
|
12
|
+
import {UFixed} from "../../types/UFixed.sol";
|
13
|
+
import {Fee} from "../../types/Fee.sol";
|
14
|
+
|
15
|
+
interface IPolicyService is IService {
|
16
|
+
|
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);
|
25
|
+
|
26
|
+
function calculatePremium(
|
27
|
+
RiskId riskId,
|
28
|
+
uint256 sumInsuredAmount,
|
29
|
+
uint256 lifetime,
|
30
|
+
bytes memory applicationData,
|
31
|
+
NftId bundleNftId,
|
32
|
+
ReferralId referralId
|
33
|
+
)
|
34
|
+
external
|
35
|
+
view
|
36
|
+
returns (
|
37
|
+
uint256 premiumAmount,
|
38
|
+
uint256 productFeeAmount,
|
39
|
+
uint256 poolFeeAmount,
|
40
|
+
uint256 bundleFeeAmount,
|
41
|
+
uint256 distributionFeeAmount
|
42
|
+
);
|
43
|
+
|
44
|
+
|
45
|
+
function createApplication(
|
46
|
+
address applicationOwner,
|
47
|
+
RiskId riskId,
|
48
|
+
uint256 sumInsuredAmount,
|
49
|
+
uint256 lifetime,
|
50
|
+
bytes memory applicationData,
|
51
|
+
NftId bundleNftId,
|
52
|
+
ReferralId referralId
|
53
|
+
) external returns (NftId nftId);
|
54
|
+
|
55
|
+
/**
|
56
|
+
* @dev revokes the application represented by {policyNftId}.
|
57
|
+
* an application can only be revoked in applied state.
|
58
|
+
* only the application holder may revoke an application.
|
59
|
+
*/
|
60
|
+
function revoke(NftId policyNftId) external;
|
61
|
+
|
62
|
+
/**
|
63
|
+
* @dev underwrites the policy represented by {policyNftId}.
|
64
|
+
* optionally collects premiums and activates the policy.
|
65
|
+
* - premium payment is only attempted if requirePremiumPayment is set to true
|
66
|
+
* - activation is only done if activateAt is a non-zero timestamp
|
67
|
+
*/
|
68
|
+
function underwrite(
|
69
|
+
NftId policyNftId,
|
70
|
+
bool requirePremiumPayment,
|
71
|
+
Timestamp activateAt
|
72
|
+
) external;
|
73
|
+
|
74
|
+
// function decline(uint256 nftId) external;
|
75
|
+
// function expire(uint256 nftId) external;
|
76
|
+
|
77
|
+
function collectPremium(NftId policyNftId, Timestamp activateAt) external;
|
78
|
+
|
79
|
+
function activate(NftId policyNftId, Timestamp activateAt) external;
|
80
|
+
|
81
|
+
|
82
|
+
function close(NftId nftId) external;
|
83
|
+
|
84
|
+
// function createClaim(uint256 nftId, uint256 claimAmount) external;
|
85
|
+
// function confirmClaim(uint256 nftId, uint256 claimId, uint256 claimAmount) external;
|
86
|
+
// function declineClaim(uint256 nftId, uint256 claimId) external;
|
87
|
+
// function closeClaim(uint256 nftId, uint256 claimId) external; // TODO payoutClaim() -> implicit close when payed out in full
|
88
|
+
|
89
|
+
function calculateRequiredCollateral(
|
90
|
+
UFixed collateralizationLevel,
|
91
|
+
uint256 sumInsuredAmount
|
92
|
+
) external pure returns(uint256 collateralAmount);
|
93
|
+
|
94
|
+
}
|
@@ -9,43 +9,12 @@ import {IBundle} from "../module/IBundle.sol";
|
|
9
9
|
import {IInstance} from "../../instance/IInstance.sol";
|
10
10
|
|
11
11
|
interface IPoolService is IService {
|
12
|
-
|
12
|
+
|
13
|
+
function register(address poolAddress) external returns(NftId);
|
13
14
|
|
14
15
|
function setFees(
|
15
16
|
Fee memory poolFee,
|
16
17
|
Fee memory stakingFee,
|
17
18
|
Fee memory performanceFee
|
18
19
|
) external;
|
19
|
-
|
20
|
-
function createBundle(
|
21
|
-
address owner,
|
22
|
-
Fee memory fee,
|
23
|
-
uint256 amount,
|
24
|
-
uint256 lifetime,
|
25
|
-
bytes calldata filter
|
26
|
-
) external returns(NftId bundleNftId);
|
27
|
-
|
28
|
-
function setBundleFee(
|
29
|
-
NftId bundleNftId,
|
30
|
-
Fee memory fee
|
31
|
-
) external;
|
32
|
-
|
33
|
-
function updateBundle(NftId instanceNftId, NftId bundleNftId, IBundle.BundleInfo memory bundleInfo, StateId state) external;
|
34
|
-
|
35
|
-
function underwritePolicy(IInstance instanceNftId,
|
36
|
-
NftId policyNftId,
|
37
|
-
NftId bundleNftId,
|
38
|
-
uint256 collateralAmount,
|
39
|
-
uint256 netPremium
|
40
|
-
) external;
|
41
|
-
|
42
|
-
// function fundBundle(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
43
|
-
|
44
|
-
// function defundBundle(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
45
|
-
|
46
|
-
function lockBundle(NftId bundleNftId) external;
|
47
|
-
|
48
|
-
function unlockBundle(NftId bundleNftId) external;
|
49
|
-
|
50
|
-
// function closeBundle(NftId bundleNftId) external;
|
51
20
|
}
|
@@ -13,9 +13,9 @@ import {UFixed} from "../../types/UFixed.sol";
|
|
13
13
|
import {Fee} from "../../types/Fee.sol";
|
14
14
|
|
15
15
|
interface IProductService is IService {
|
16
|
-
|
17
|
-
error ErrorIProductServiceInsufficientAllowance(address customer, address tokenHandlerAddress, uint256 amount);
|
18
16
|
|
17
|
+
function register(address productAddress) external returns(NftId);
|
18
|
+
|
19
19
|
function setFees(
|
20
20
|
Fee memory productFee,
|
21
21
|
Fee memory processingFee
|
@@ -37,74 +37,4 @@ interface IProductService is IService {
|
|
37
37
|
RiskId riskId,
|
38
38
|
StateId newState
|
39
39
|
) external;
|
40
|
-
|
41
|
-
|
42
|
-
function calculatePremium(
|
43
|
-
RiskId riskId,
|
44
|
-
uint256 sumInsuredAmount,
|
45
|
-
uint256 lifetime,
|
46
|
-
bytes memory applicationData,
|
47
|
-
NftId bundleNftId,
|
48
|
-
ReferralId referralId
|
49
|
-
)
|
50
|
-
external
|
51
|
-
view
|
52
|
-
returns (
|
53
|
-
uint256 premiumAmount,
|
54
|
-
uint256 productFeeAmount,
|
55
|
-
uint256 poolFeeAmount,
|
56
|
-
uint256 bundleFeeAmount,
|
57
|
-
uint256 distributionFeeAmount
|
58
|
-
);
|
59
|
-
|
60
|
-
|
61
|
-
function createApplication(
|
62
|
-
address applicationOwner,
|
63
|
-
RiskId riskId,
|
64
|
-
uint256 sumInsuredAmount,
|
65
|
-
uint256 lifetime,
|
66
|
-
bytes memory applicationData,
|
67
|
-
NftId bundleNftId,
|
68
|
-
ReferralId referralId
|
69
|
-
) external returns (NftId nftId);
|
70
|
-
|
71
|
-
/**
|
72
|
-
* @dev revokes the application represented by {policyNftId}.
|
73
|
-
* an application can only be revoked in applied state.
|
74
|
-
* only the application holder may revoke an application.
|
75
|
-
*/
|
76
|
-
function revoke(NftId policyNftId) external;
|
77
|
-
|
78
|
-
/**
|
79
|
-
* @dev underwrites the policy represented by {policyNftId}.
|
80
|
-
* optionally collects premiums and activates the policy.
|
81
|
-
* - premium payment is only attempted if requirePremiumPayment is set to true
|
82
|
-
* - activation is only done if activateAt is a non-zero timestamp
|
83
|
-
*/
|
84
|
-
function underwrite(
|
85
|
-
NftId policyNftId,
|
86
|
-
bool requirePremiumPayment,
|
87
|
-
Timestamp activateAt
|
88
|
-
) external;
|
89
|
-
|
90
|
-
// function decline(uint256 nftId) external;
|
91
|
-
// function expire(uint256 nftId) external;
|
92
|
-
|
93
|
-
function collectPremium(NftId policyNftId, Timestamp activateAt) external;
|
94
|
-
|
95
|
-
function activate(NftId policyNftId, Timestamp activateAt) external;
|
96
|
-
|
97
|
-
|
98
|
-
function close(NftId nftId) external;
|
99
|
-
|
100
|
-
// function createClaim(uint256 nftId, uint256 claimAmount) external;
|
101
|
-
// function confirmClaim(uint256 nftId, uint256 claimId, uint256 claimAmount) external;
|
102
|
-
// function declineClaim(uint256 nftId, uint256 claimId) external;
|
103
|
-
// function closeClaim(uint256 nftId, uint256 claimId) external;
|
104
|
-
|
105
|
-
function calculateRequiredCollateral(
|
106
|
-
UFixed collateralizationLevel,
|
107
|
-
uint256 sumInsuredAmount
|
108
|
-
) external pure returns(uint256 collateralAmount);
|
109
|
-
|
110
40
|
}
|