@etherisc/gif-next 0.0.2-90f8ffc-398 → 0.0.2-9105e58-225
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -1
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +242 -34
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +592 -41
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +85 -27
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +327 -32
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +187 -43
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +85 -27
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +443 -54
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +342 -34
- 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/Dummy.sol/LifeCycleModule.json +2 -2
- 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 +2 -2
- 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 +673 -169
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +96 -34
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +762 -422
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +39 -89
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +58 -53
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +289 -104
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +163 -57
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +151 -52
- 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/KeyValueStore.sol/KeyValueStore.json +2 -2
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +13 -13
- 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/ApplicationService.sol/ApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +1047 -0
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +543 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +282 -118
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +149 -51
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +932 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +523 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +426 -74
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +174 -48
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +612 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +130 -73
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +548 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +220 -31
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +44 -88
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +23 -31
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +23 -31
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +212 -149
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +162 -64
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +173 -74
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +146 -48
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +173 -74
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +146 -48
- 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 +15 -2
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +82 -34
- 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 +28 -15
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +218 -63
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +142 -50
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +11 -11
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +141 -37
- 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/ERC165.sol/ERC165.json +41 -3
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +40 -29
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +129 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +21 -29
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.json +48 -0
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +23 -31
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +2 -2
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +113 -33
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +248 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +143 -39
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +126 -45
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +84 -0
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +143 -44
- 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/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +2 -2
- 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 +126 -45
- 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 +161 -62
- 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/TestVersionable.sol/TestVersionable.json +8 -8
- 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/ClaimId.sol/ClaimIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +100 -0
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
- 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/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
- 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/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +100 -0
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +2 -2
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
- 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 +46 -20
- package/contracts/components/Distribution.sol +188 -33
- package/contracts/components/IComponent.sol +15 -3
- package/contracts/components/IDistributionComponent.sol +54 -1
- package/contracts/components/IPoolComponent.sol +48 -17
- package/contracts/components/Pool.sol +134 -95
- package/contracts/components/Product.sol +76 -57
- package/contracts/instance/IInstance.sol +21 -1
- package/contracts/instance/IInstanceService.sol +18 -0
- package/contracts/instance/Instance.sol +58 -36
- package/contracts/instance/InstanceAccessManager.sol +12 -13
- package/contracts/instance/InstanceService.sol +76 -35
- package/contracts/instance/InstanceServiceManager.sol +1 -1
- package/contracts/instance/base/ComponentService.sol +1 -1
- package/contracts/instance/module/IAccess.sol +3 -4
- package/contracts/instance/module/IPolicy.sol +4 -2
- package/contracts/instance/module/ISetup.sol +5 -4
- package/contracts/instance/service/ApplicationService.sol +268 -0
- package/contracts/instance/service/ApplicationServiceManager.sol +35 -0
- package/contracts/instance/service/BundleService.sol +11 -6
- package/contracts/instance/service/BundleServiceManager.sol +1 -1
- package/contracts/instance/service/ClaimService.sol +151 -0
- package/contracts/instance/service/ClaimServiceManager.sol +35 -0
- package/contracts/instance/service/DistributionService.sol +185 -14
- package/contracts/instance/service/DistributionServiceManager.sol +1 -1
- package/contracts/instance/service/IApplicationService.sol +82 -0
- package/contracts/instance/service/IBundleService.sol +11 -1
- package/contracts/instance/service/IClaimService.sol +61 -0
- package/contracts/instance/service/IDistributionService.sol +53 -0
- package/contracts/instance/service/IPolicyService.sol +41 -46
- package/contracts/instance/service/PolicyService.sol +94 -158
- package/contracts/instance/service/PolicyServiceManager.sol +1 -1
- package/contracts/instance/service/PoolService.sol +2 -3
- package/contracts/instance/service/PoolServiceManager.sol +1 -1
- package/contracts/instance/service/ProductService.sol +9 -9
- package/contracts/instance/service/ProductServiceManager.sol +1 -1
- package/contracts/registry/IRegistry.sol +3 -2
- package/contracts/registry/IRegistryService.sol +10 -8
- package/contracts/registry/Registry.sol +20 -8
- package/contracts/registry/RegistryService.sol +70 -49
- package/contracts/registry/RegistryServiceManager.sol +13 -13
- package/contracts/registry/ReleaseManager.sol +8 -9
- package/contracts/registry/TokenRegistry.sol +15 -6
- package/contracts/shared/ERC165.sol +14 -12
- package/contracts/shared/INftOwnable.sol +11 -10
- package/contracts/shared/IPolicyHolder.sol +26 -0
- package/contracts/shared/IRegisterable.sol +3 -3
- package/contracts/shared/IRegistryLinked.sol +12 -0
- package/contracts/shared/IVersionable.sol +2 -2
- package/contracts/shared/NftOwnable.sol +66 -85
- package/contracts/shared/PolicyHolder.sol +81 -0
- package/contracts/shared/ProxyManager.sol +13 -5
- package/contracts/shared/Registerable.sol +6 -14
- package/contracts/shared/RegistryLinked.sol +48 -0
- package/contracts/shared/Service.sol +5 -5
- package/contracts/shared/Versionable.sol +3 -2
- package/contracts/test/TestRegisterable.sol +1 -1
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/ClaimId.sol +52 -0
- package/contracts/types/DistributorType.sol +2 -2
- package/contracts/types/ObjectType.sol +9 -5
- package/contracts/types/PayoutId.sol +54 -0
- package/contracts/types/RoleId.sol +3 -3
- package/package.json +3 -3
@@ -10,6 +10,7 @@ import {IProductService} from "../instance/service/IProductService.sol";
|
|
10
10
|
import {IInstanceService} from "../instance/IInstanceService.sol";
|
11
11
|
import {IInstance} from "../instance/IInstance.sol";
|
12
12
|
import {InstanceAccessManager} from "../instance/InstanceAccessManager.sol";
|
13
|
+
import {InstanceReader} from "../instance/InstanceReader.sol";
|
13
14
|
import {IRegistry} from "../registry/IRegistry.sol";
|
14
15
|
import {NftId} from "../types/NftId.sol";
|
15
16
|
import {ObjectType, INSTANCE, PRODUCT} from "../types/ObjectType.sol";
|
@@ -17,9 +18,9 @@ import {VersionPart} from "../types/Version.sol";
|
|
17
18
|
import {Registerable} from "../shared/Registerable.sol";
|
18
19
|
import {RoleId, RoleIdLib} from "../types/RoleId.sol";
|
19
20
|
import {IAccess} from "../instance/module/IAccess.sol";
|
21
|
+
import {VersionPart} from "../types/Version.sol";
|
20
22
|
|
21
23
|
// TODO discuss to inherit from oz accessmanaged
|
22
|
-
// TODO make contract upgradeable
|
23
24
|
// then add (Distribution|Pool|Product)Upradeable that also intherit from Versionable
|
24
25
|
// same pattern as for Service which is also upgradeable
|
25
26
|
abstract contract Component is
|
@@ -32,9 +33,11 @@ abstract contract Component is
|
|
32
33
|
|
33
34
|
struct ComponentStorage {
|
34
35
|
IInstance _instance; // instance for this component
|
36
|
+
InstanceReader _instanceReader; // instance reader for this component
|
35
37
|
string _name; // unique (per instance) component name
|
36
38
|
IERC20Metadata _token; // token for this component
|
37
39
|
address _wallet; // wallet for this component (default = component contract itself)
|
40
|
+
bool _isNftInterceptor; // declares if component is involved in nft transfers
|
38
41
|
IInstanceService _instanceService; // instance service for this component
|
39
42
|
|
40
43
|
NftId _productNftId; // only relevant for components that are linked to a aproduct
|
@@ -42,6 +45,14 @@ abstract contract Component is
|
|
42
45
|
}
|
43
46
|
|
44
47
|
|
48
|
+
modifier onlyChainNft() {
|
49
|
+
if(msg.sender != getRegistry().getChainNftAddress()) {
|
50
|
+
revert ErrorComponentNotChainNft(msg.sender);
|
51
|
+
}
|
52
|
+
_;
|
53
|
+
}
|
54
|
+
|
55
|
+
|
45
56
|
modifier onlyProductService() {
|
46
57
|
if(msg.sender != address(_getComponentStorage()._productService)) {
|
47
58
|
revert ErrorComponentNotProductService(msg.sender);
|
@@ -49,26 +60,13 @@ abstract contract Component is
|
|
49
60
|
_;
|
50
61
|
}
|
51
62
|
|
52
|
-
constructor(
|
53
|
-
address registry,
|
54
|
-
NftId instanceNftId,
|
55
|
-
string memory name,
|
56
|
-
address token,
|
57
|
-
ObjectType componentType,
|
58
|
-
bool isInterceptor,
|
59
|
-
address initialOwner,
|
60
|
-
bytes memory data
|
61
|
-
) {
|
62
|
-
_initializeComponent(registry, instanceNftId, name, token, componentType, isInterceptor, initialOwner, data);
|
63
|
-
}
|
64
|
-
|
65
63
|
function _getComponentStorage() private pure returns (ComponentStorage storage $) {
|
66
64
|
assembly {
|
67
65
|
$.slot := CONTRACT_LOCATION_V1
|
68
66
|
}
|
69
67
|
}
|
70
68
|
|
71
|
-
function
|
69
|
+
function initializeComponent(
|
72
70
|
address registry,
|
73
71
|
NftId instanceNftId,
|
74
72
|
string memory name,
|
@@ -78,15 +76,16 @@ abstract contract Component is
|
|
78
76
|
address initialOwner,
|
79
77
|
bytes memory data
|
80
78
|
)
|
81
|
-
|
82
|
-
initializer
|
79
|
+
public
|
83
80
|
virtual
|
81
|
+
onlyInitializing()
|
84
82
|
{
|
85
83
|
ComponentStorage storage $ = _getComponentStorage();
|
86
|
-
|
84
|
+
initializeRegisterable(registry, instanceNftId, componentType, isInterceptor, initialOwner, data);
|
87
85
|
|
88
86
|
// set unique name of component
|
89
87
|
$._name = name;
|
88
|
+
$._isNftInterceptor = isInterceptor;
|
90
89
|
|
91
90
|
// set and check linked instance
|
92
91
|
IRegistry.ObjectInfo memory instanceInfo = getRegistry().getObjectInfo(instanceNftId);
|
@@ -101,15 +100,25 @@ abstract contract Component is
|
|
101
100
|
// set linked services
|
102
101
|
VersionPart gifVersion = $._instance.getMajorVersion();
|
103
102
|
$._instanceService = IInstanceService(getRegistry().getServiceAddress(INSTANCE(), gifVersion));
|
103
|
+
$._instanceReader = $._instance.getInstanceReader();
|
104
104
|
$._productService = IProductService(getRegistry().getServiceAddress(PRODUCT(), gifVersion));
|
105
105
|
|
106
106
|
// set wallet and token
|
107
107
|
$._wallet = address(this);
|
108
108
|
$._token = IERC20Metadata(token);
|
109
109
|
|
110
|
-
|
110
|
+
registerInterface(type(IComponent).interfaceId);
|
111
111
|
}
|
112
112
|
|
113
|
+
/// @dev callback function for nft transfers. may only be called by chain nft contract.
|
114
|
+
/// default implementation is empty. overriding functions MUST add onlyChainNft modifier
|
115
|
+
function nftTransferFrom(address from, address to, uint256 tokenId)
|
116
|
+
external
|
117
|
+
virtual override
|
118
|
+
onlyChainNft()
|
119
|
+
{ }
|
120
|
+
|
121
|
+
// TODO discuss replacement with modifier restricted from accessmanaged
|
113
122
|
function lock() external onlyOwner override {
|
114
123
|
_getComponentStorage()._instanceService.setTargetLocked(getName(), true);
|
115
124
|
}
|
@@ -137,7 +146,11 @@ abstract contract Component is
|
|
137
146
|
/// if the current wallet has tokens, these will be transferred.
|
138
147
|
/// if the new wallet address is externally owned, an approval from the
|
139
148
|
/// owner of the external wallet for the component to move all tokens must exist.
|
140
|
-
function setWallet(address newWallet)
|
149
|
+
function setWallet(address newWallet)
|
150
|
+
external
|
151
|
+
override
|
152
|
+
onlyOwner
|
153
|
+
{
|
141
154
|
ComponentStorage storage $ = _getComponentStorage();
|
142
155
|
|
143
156
|
address currentWallet = $._wallet;
|
@@ -193,10 +206,23 @@ abstract contract Component is
|
|
193
206
|
return _getComponentStorage()._token;
|
194
207
|
}
|
195
208
|
|
209
|
+
function isNftInterceptor() public view override returns(bool isInterceptor) {
|
210
|
+
return _getComponentStorage()._isNftInterceptor;
|
211
|
+
}
|
212
|
+
|
196
213
|
function getInstance() public view override returns (IInstance instance) {
|
197
214
|
return _getComponentStorage()._instance;
|
198
215
|
}
|
199
216
|
|
217
|
+
function getInstanceReader() public view returns (InstanceReader reader) {
|
218
|
+
return _getComponentStorage()._instanceReader;
|
219
|
+
}
|
220
|
+
|
221
|
+
function getServiceAddress(ObjectType domain) public view returns (address service) {
|
222
|
+
VersionPart majorVersion = getInstance().getMajorVersion();
|
223
|
+
return getRegistry().getServiceAddress(domain, majorVersion);
|
224
|
+
}
|
225
|
+
|
200
226
|
function getName() public view override returns(string memory name) {
|
201
227
|
return _getComponentStorage()._name;
|
202
228
|
}
|
@@ -4,8 +4,8 @@ pragma solidity ^0.8.19;
|
|
4
4
|
import {DISTRIBUTION} from "../types/ObjectType.sol";
|
5
5
|
import {IDistributionService} from "../instance/service/IDistributionService.sol";
|
6
6
|
import {IProductService} from "../instance/service/IProductService.sol";
|
7
|
-
import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
|
8
|
-
import {ReferralId} from "../types/Referral.sol";
|
7
|
+
import {NftId, zeroNftId, NftIdLib, toNftId} from "../types/NftId.sol";
|
8
|
+
import {ReferralId, ReferralStatus, ReferralLib} from "../types/Referral.sol";
|
9
9
|
import {Fee, FeeLib} from "../types/Fee.sol";
|
10
10
|
import {Component} from "./Component.sol";
|
11
11
|
import {IDistributionComponent} from "./IDistributionComponent.sol";
|
@@ -15,46 +15,48 @@ import {ISetup} from "../instance/module/ISetup.sol";
|
|
15
15
|
import {Registerable} from "../shared/Registerable.sol";
|
16
16
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
17
17
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
18
|
+
import {UFixed} from "../types/UFixed.sol";
|
19
|
+
import {DistributorType} from "../types/DistributorType.sol";
|
20
|
+
import {Timestamp} from "../types/Timestamp.sol";
|
21
|
+
import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
|
22
|
+
|
18
23
|
|
19
24
|
abstract contract Distribution is
|
20
25
|
Component,
|
21
26
|
IDistributionComponent
|
22
27
|
{
|
23
|
-
|
24
|
-
|
25
|
-
bool internal _isVerifying;
|
26
|
-
Fee internal _initialDistributionFee;
|
28
|
+
// keccak256(abi.encode(uint256(keccak256("etherisc.storage.Distribution")) - 1)) & ~bytes32(uint256(0xff));
|
29
|
+
bytes32 public constant DISTRIBUTION_STORAGE_LOCATION_V1 = 0xaab7c5ea03d290056d6c060e0833d3ebcbe647f7694616a2ec52738a64b2f900;
|
27
30
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
+
struct DistributionStorage {
|
32
|
+
Fee _distributionFee;
|
33
|
+
TokenHandler _tokenHandler;
|
34
|
+
IDistributionService _distributionService;
|
35
|
+
mapping(address distributor => NftId distributorNftId) _distributorNftId;
|
36
|
+
}
|
31
37
|
|
32
|
-
|
38
|
+
function initializeDistribution(
|
33
39
|
address registry,
|
34
40
|
NftId instanceNftId,
|
35
|
-
// TODO refactor into tokenNftId
|
36
41
|
string memory name,
|
37
42
|
address token,
|
38
|
-
bool verifying,
|
39
43
|
Fee memory distributionFee,
|
40
44
|
address initialOwner,
|
41
45
|
bytes memory data
|
42
|
-
)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
true,
|
48
|
-
initialOwner,
|
49
|
-
data
|
50
|
-
) {
|
51
|
-
_isVerifying = verifying;
|
52
|
-
_initialDistributionFee = distributionFee;
|
46
|
+
)
|
47
|
+
public
|
48
|
+
virtual
|
49
|
+
onlyInitializing()
|
50
|
+
{
|
51
|
+
initializeComponent(registry, instanceNftId, name, token, DISTRIBUTION(), true, initialOwner, data);
|
53
52
|
|
54
|
-
|
55
|
-
|
53
|
+
DistributionStorage storage $ = _getDistributionStorage();
|
54
|
+
// TODO add validation
|
55
|
+
$._distributionFee = distributionFee;
|
56
|
+
$._tokenHandler = new TokenHandler(token);
|
57
|
+
$._distributionService = getInstance().getDistributionService();
|
56
58
|
|
57
|
-
|
59
|
+
registerInterface(type(IDistributionComponent).interfaceId);
|
58
60
|
}
|
59
61
|
|
60
62
|
function setFees(
|
@@ -65,7 +67,100 @@ abstract contract Distribution is
|
|
65
67
|
onlyOwner
|
66
68
|
restricted()
|
67
69
|
{
|
68
|
-
_distributionService.setFees(distributionFee);
|
70
|
+
_getDistributionStorage()._distributionService.setFees(distributionFee);
|
71
|
+
}
|
72
|
+
|
73
|
+
function getDistributionFee() external view returns (Fee memory distributionFee) {
|
74
|
+
DistributionStorage storage $ = _getDistributionStorage();
|
75
|
+
return $._distributionFee;
|
76
|
+
}
|
77
|
+
|
78
|
+
function createDistributorType(
|
79
|
+
string memory name,
|
80
|
+
UFixed minDiscountPercentage,
|
81
|
+
UFixed maxDiscountPercentage,
|
82
|
+
UFixed commissionPercentage,
|
83
|
+
uint32 maxReferralCount,
|
84
|
+
uint32 maxReferralLifetime,
|
85
|
+
bool allowSelfReferrals,
|
86
|
+
bool allowRenewals,
|
87
|
+
bytes memory data
|
88
|
+
)
|
89
|
+
public
|
90
|
+
returns (DistributorType distributorType)
|
91
|
+
{
|
92
|
+
DistributionStorage storage $ = _getDistributionStorage();
|
93
|
+
distributorType = $._distributionService.createDistributorType(
|
94
|
+
name,
|
95
|
+
minDiscountPercentage,
|
96
|
+
maxDiscountPercentage,
|
97
|
+
commissionPercentage,
|
98
|
+
maxReferralCount,
|
99
|
+
maxReferralLifetime,
|
100
|
+
allowSelfReferrals,
|
101
|
+
allowRenewals,
|
102
|
+
data);
|
103
|
+
}
|
104
|
+
|
105
|
+
function createDistributor(
|
106
|
+
address distributor,
|
107
|
+
DistributorType distributorType,
|
108
|
+
bytes memory data
|
109
|
+
)
|
110
|
+
public
|
111
|
+
returns(NftId distributorNftId)
|
112
|
+
{
|
113
|
+
DistributionStorage storage $ = _getDistributionStorage();
|
114
|
+
require($._distributorNftId[distributor].eqz(), "ERROR:DST-030:ALREADY_DISTRIBUTOR");
|
115
|
+
|
116
|
+
distributorNftId = $._distributionService.createDistributor(
|
117
|
+
distributor,
|
118
|
+
distributorType,
|
119
|
+
data);
|
120
|
+
|
121
|
+
$._distributorNftId[distributor] = distributorNftId;
|
122
|
+
}
|
123
|
+
|
124
|
+
function updateDistributorType(
|
125
|
+
NftId distributorNftId,
|
126
|
+
DistributorType distributorType,
|
127
|
+
bytes memory data
|
128
|
+
)
|
129
|
+
public
|
130
|
+
// TODO figure out what we need for authz
|
131
|
+
// and add it
|
132
|
+
{
|
133
|
+
DistributionStorage storage $ = _getDistributionStorage();
|
134
|
+
$._distributionService.updateDistributorType(
|
135
|
+
distributorNftId,
|
136
|
+
distributorType,
|
137
|
+
data);
|
138
|
+
}
|
139
|
+
|
140
|
+
/**
|
141
|
+
* @dev lets distributors create referral codes.
|
142
|
+
* referral codes need to be unique
|
143
|
+
*/
|
144
|
+
function createReferral(
|
145
|
+
NftId distributorNftId,
|
146
|
+
string memory code,
|
147
|
+
UFixed discountPercentage,
|
148
|
+
uint32 maxReferrals,
|
149
|
+
Timestamp expiryAt,
|
150
|
+
bytes memory data
|
151
|
+
)
|
152
|
+
public
|
153
|
+
// TODO add authz (only active distributor)
|
154
|
+
returns (ReferralId referralId)
|
155
|
+
{
|
156
|
+
DistributionStorage storage $ = _getDistributionStorage();
|
157
|
+
referralId = $._distributionService.createReferral(
|
158
|
+
distributorNftId,
|
159
|
+
code,
|
160
|
+
discountPercentage,
|
161
|
+
maxReferrals,
|
162
|
+
expiryAt,
|
163
|
+
data);
|
69
164
|
}
|
70
165
|
|
71
166
|
function calculateFeeAmount(
|
@@ -80,9 +175,53 @@ abstract contract Distribution is
|
|
80
175
|
ISetup.DistributionSetupInfo memory setupInfo = getSetupInfo();
|
81
176
|
Fee memory fee = setupInfo.distributionFee;
|
82
177
|
(feeAmount,) = FeeLib.calculateFee(fee, netPremiumAmount);
|
178
|
+
// TODO: use this?
|
179
|
+
// return _distributionService.calculateFeeAmount(referralId, premiumAmount);
|
180
|
+
}
|
181
|
+
|
182
|
+
function isDistributor(address candidate)
|
183
|
+
public
|
184
|
+
view
|
185
|
+
returns (bool)
|
186
|
+
{
|
187
|
+
DistributionStorage storage $ = _getDistributionStorage();
|
188
|
+
return $._distributorNftId[candidate].gtz();
|
189
|
+
}
|
190
|
+
|
191
|
+
function getDistributorNftId(address distributor)
|
192
|
+
public
|
193
|
+
view
|
194
|
+
returns (NftId distributorNftId)
|
195
|
+
{
|
196
|
+
DistributionStorage storage $ = _getDistributionStorage();
|
197
|
+
return $._distributorNftId[distributor];
|
198
|
+
}
|
199
|
+
|
200
|
+
function getDiscountPercentage(string memory referralCode)
|
201
|
+
external
|
202
|
+
view
|
203
|
+
returns (
|
204
|
+
UFixed discountPercentage,
|
205
|
+
ReferralStatus status
|
206
|
+
)
|
207
|
+
{
|
208
|
+
ReferralId referralId = getReferralId(referralCode);
|
209
|
+
return getInstanceReader().getDiscountPercentage(referralId);
|
83
210
|
}
|
84
211
|
|
85
212
|
|
213
|
+
function getReferralId(
|
214
|
+
string memory referralCode
|
215
|
+
)
|
216
|
+
public
|
217
|
+
view
|
218
|
+
returns (ReferralId referralId)
|
219
|
+
{
|
220
|
+
return ReferralLib.toReferralId(
|
221
|
+
getNftId(),
|
222
|
+
referralCode);
|
223
|
+
}
|
224
|
+
|
86
225
|
function calculateRenewalFeeAmount(
|
87
226
|
ReferralId referralId,
|
88
227
|
uint256 netPremiumAmount
|
@@ -98,14 +237,15 @@ abstract contract Distribution is
|
|
98
237
|
|
99
238
|
function processSale(
|
100
239
|
ReferralId referralId,
|
101
|
-
uint256
|
240
|
+
uint256 premiumAmount
|
102
241
|
)
|
103
242
|
external
|
104
243
|
onlyOwner
|
105
244
|
restricted()
|
106
245
|
virtual override
|
107
246
|
{
|
108
|
-
|
247
|
+
DistributionStorage storage $ = _getDistributionStorage();
|
248
|
+
$._distributionService.processSale(referralId, premiumAmount);
|
109
249
|
}
|
110
250
|
|
111
251
|
function processRenewal(
|
@@ -136,18 +276,33 @@ abstract contract Distribution is
|
|
136
276
|
}
|
137
277
|
|
138
278
|
function _getInitialSetupInfo() internal view returns (ISetup.DistributionSetupInfo memory setupInfo) {
|
279
|
+
DistributionStorage storage $ = _getDistributionStorage();
|
139
280
|
return ISetup.DistributionSetupInfo(
|
140
281
|
zeroNftId(),
|
141
|
-
_tokenHandler,
|
142
|
-
|
143
|
-
_isVerifying,
|
282
|
+
$._tokenHandler,
|
283
|
+
$._distributionFee,
|
144
284
|
address(this)
|
145
285
|
);
|
146
286
|
}
|
287
|
+
|
288
|
+
|
289
|
+
function nftTransferFrom(address from, address to, uint256 tokenId) external virtual override (Component, ITransferInterceptor) {
|
290
|
+
// keep track of distributor nft owner
|
291
|
+
emit LogDistributorUpdated(to, msg.sender);
|
292
|
+
DistributionStorage storage $ = _getDistributionStorage();
|
293
|
+
$._distributorNftId[from] = zeroNftId();
|
294
|
+
$._distributorNftId[to] = toNftId(tokenId);
|
295
|
+
}
|
147
296
|
|
148
297
|
|
149
298
|
/// @dev returns true iff the component needs to be called when selling/renewing policis
|
150
299
|
function isVerifying() external view returns (bool verifying) {
|
151
|
-
return
|
300
|
+
return true;
|
301
|
+
}
|
302
|
+
|
303
|
+
function _getDistributionStorage() private pure returns (DistributionStorage storage $) {
|
304
|
+
assembly {
|
305
|
+
$.slot := DISTRIBUTION_STORAGE_LOCATION_V1
|
306
|
+
}
|
152
307
|
}
|
153
308
|
}
|
@@ -3,21 +3,27 @@ pragma solidity ^0.8.20;
|
|
3
3
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
5
|
|
6
|
-
import {IRegisterable} from "../shared/IRegisterable.sol";
|
7
6
|
import {IInstance} from "../instance/IInstance.sol";
|
8
7
|
import {IInstanceService} from "../instance/IInstanceService.sol";
|
9
8
|
import {IProductService} from "../instance/service/IProductService.sol";
|
9
|
+
import {IRegisterable} from "../shared/IRegisterable.sol";
|
10
|
+
import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
|
10
11
|
import {NftId} from "../types/NftId.sol";
|
12
|
+
import {ObjectType} from "../types/ObjectType.sol";
|
11
13
|
|
12
|
-
interface IComponent is
|
14
|
+
interface IComponent is
|
15
|
+
IRegisterable,
|
16
|
+
ITransferInterceptor
|
17
|
+
{
|
13
18
|
|
19
|
+
error ErrorComponentNotChainNft(address caller);
|
20
|
+
error ErrorComponentNotProductService(address caller);
|
14
21
|
error ErrorComponentNotInstance(NftId instanceNftId, address instance);
|
15
22
|
error ErrorComponentProductNftAlreadySet();
|
16
23
|
error ErrorComponentWalletAddressZero();
|
17
24
|
error ErrorComponentWalletAddressIsSameAsCurrent(address newWallet);
|
18
25
|
error ErrorComponentWalletAllowanceTooSmall(address oldWallet, address newWallet, uint256 allowance, uint256 balance);
|
19
26
|
error ErrorComponentUnauthorized(address caller, uint64 requiredRoleIdNum);
|
20
|
-
error ErrorComponentNotProductService(address caller);
|
21
27
|
|
22
28
|
event LogComponentWalletAddressChanged(address newWallet);
|
23
29
|
event LogComponentWalletTokensTransferred(address from, address to, uint256 amount);
|
@@ -33,8 +39,14 @@ interface IComponent is IRegisterable {
|
|
33
39
|
function setWallet(address walletAddress) external;
|
34
40
|
function getWallet() external view returns (address walletAddress);
|
35
41
|
|
42
|
+
function isNftInterceptor() external view returns(bool isInterceptor);
|
43
|
+
|
36
44
|
function getInstance() external view returns (IInstance instance);
|
37
45
|
|
46
|
+
/// @dev returns the service address for the specified domain
|
47
|
+
/// gets address via lookup from registry using the major version form the linked instance
|
48
|
+
function getServiceAddress(ObjectType domain) external view returns (address service);
|
49
|
+
|
38
50
|
function setProductNftId(NftId productNftId) external;
|
39
51
|
function getProductNftId() external view returns (NftId productNftId);
|
40
52
|
|
@@ -4,17 +4,60 @@ pragma solidity ^0.8.19;
|
|
4
4
|
import {Fee} from "../types/Fee.sol";
|
5
5
|
import {IComponent} from "./IComponent.sol";
|
6
6
|
import {ISetup} from "../instance/module/ISetup.sol";
|
7
|
-
import {ReferralId} from "../types/Referral.sol";
|
7
|
+
import {ReferralId, ReferralStatus} from "../types/Referral.sol";
|
8
8
|
import {NftId} from "../types/NftId.sol";
|
9
|
+
import {DistributorType} from "../types/DistributorType.sol";
|
10
|
+
import {UFixed} from "../types/UFixed.sol";
|
11
|
+
import {Timestamp} from "../types/Timestamp.sol";
|
9
12
|
|
10
13
|
interface IDistributionComponent is IComponent {
|
11
14
|
|
15
|
+
event LogDistributorUpdated(address to, address caller);
|
16
|
+
|
12
17
|
function getSetupInfo() external view returns (ISetup.DistributionSetupInfo memory setupInfo);
|
13
18
|
|
14
19
|
function setFees(
|
15
20
|
Fee memory distributionFee
|
16
21
|
) external;
|
17
22
|
|
23
|
+
function createDistributorType(
|
24
|
+
string memory name,
|
25
|
+
UFixed minDiscountPercentage,
|
26
|
+
UFixed maxDiscountPercentage,
|
27
|
+
UFixed commissionPercentage,
|
28
|
+
uint32 maxReferralCount,
|
29
|
+
uint32 maxReferralLifetime,
|
30
|
+
bool allowSelfReferrals,
|
31
|
+
bool allowRenewals,
|
32
|
+
bytes memory data
|
33
|
+
) external returns (DistributorType distributorType);
|
34
|
+
|
35
|
+
function createDistributor(
|
36
|
+
address distributor,
|
37
|
+
DistributorType distributorType,
|
38
|
+
bytes memory data
|
39
|
+
) external returns(NftId distributorNftId);
|
40
|
+
|
41
|
+
function updateDistributorType(
|
42
|
+
NftId distributorNftId,
|
43
|
+
DistributorType distributorType,
|
44
|
+
bytes memory data
|
45
|
+
) external;
|
46
|
+
|
47
|
+
/**
|
48
|
+
* @dev lets distributors create referral codes.
|
49
|
+
* referral codes need to be unique
|
50
|
+
* distributor is identified via msg.sender.
|
51
|
+
*/
|
52
|
+
function createReferral(
|
53
|
+
NftId distributorNftId,
|
54
|
+
string memory code,
|
55
|
+
UFixed discountPercentage,
|
56
|
+
uint32 maxReferrals,
|
57
|
+
Timestamp expiryAt,
|
58
|
+
bytes memory data
|
59
|
+
) external returns (ReferralId referralId);
|
60
|
+
|
18
61
|
function calculateFeeAmount(
|
19
62
|
ReferralId referralId,
|
20
63
|
uint256 netPremiumAmount
|
@@ -39,6 +82,16 @@ interface IDistributionComponent is IComponent {
|
|
39
82
|
uint256 feeAmount
|
40
83
|
) external;
|
41
84
|
|
85
|
+
function getDiscountPercentage(
|
86
|
+
string memory referralCode
|
87
|
+
) external view returns (UFixed discountPercentage, ReferralStatus status);
|
88
|
+
|
89
|
+
function getDistributionFee() external view returns (Fee memory distibutionFee);
|
90
|
+
|
91
|
+
function getReferralId(
|
92
|
+
string memory referralCode
|
93
|
+
) external returns (ReferralId referralId);
|
94
|
+
|
42
95
|
/// @dev returns true iff the referral id is valid
|
43
96
|
function referralIsValid(ReferralId referralId) external view returns (bool isValid);
|
44
97
|
|
@@ -7,10 +7,14 @@ import {ISetup} from "../instance/module/ISetup.sol";
|
|
7
7
|
import {NftId} from "../types/NftId.sol";
|
8
8
|
import {UFixed} from "../types/UFixed.sol";
|
9
9
|
|
10
|
+
/// @dev pool components hold and manage the collateral to cover active policies
|
11
|
+
/// pools come in different flavors
|
10
12
|
interface IPoolComponent is IComponent {
|
11
13
|
|
12
14
|
event LogUnderwrittenByPool(NftId policyNftId, uint256 collateralizationAmount, address pool);
|
13
15
|
|
16
|
+
error ErrorPoolNotPoolService(address service);
|
17
|
+
|
14
18
|
function getSetupInfo() external view returns (ISetup.PoolSetupInfo memory setupInfo);
|
15
19
|
|
16
20
|
function setFees(
|
@@ -19,28 +23,59 @@ interface IPoolComponent is IComponent {
|
|
19
23
|
Fee memory performanceFee
|
20
24
|
) external;
|
21
25
|
|
26
|
+
/// @dev sets an additional bundle fee, this fee is added on top of the poolFee and deducted from the premium amounts.
|
27
|
+
/// via these fees individual bundler owner may earn income per policy in the context of peer to peer pools
|
22
28
|
function setBundleFee(
|
23
|
-
NftId
|
29
|
+
NftId bundleNftId,
|
24
30
|
Fee memory fee
|
25
31
|
) external;
|
26
32
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
function underwrite(
|
34
|
-
NftId policyNftId,
|
33
|
+
/// @dev this is a callback function that is called by the product service when underwriting a policy.
|
34
|
+
/// the pool has the option to check the details and object to underwriting by reverting.
|
35
|
+
/// the function is only called for "active" pools that ask to be involved/notified
|
36
|
+
/// by product related state changes.
|
37
|
+
function verifyApplication(
|
38
|
+
NftId applicationNftId,
|
35
39
|
bytes memory policyData,
|
36
40
|
bytes memory bundleFilter,
|
37
41
|
uint256 collateralizationAmount
|
38
42
|
) external;
|
39
43
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
+
function lockBundle(NftId bundleNftId) external;
|
45
|
+
|
46
|
+
function unlockBundle(NftId bundleNftId) external;
|
47
|
+
|
48
|
+
/// @dev defines the multiplier to calculate the required collateral to cover a given sum insured amount
|
49
|
+
/// default implementation returns 100%
|
50
|
+
function getCollateralizationLevel() external view returns (UFixed collateralizationLevel);
|
51
|
+
|
52
|
+
/// @dev defines the amount of collateral held in the pool.
|
53
|
+
/// if the value is < 100% the pool is required to hold a policy that covers the locally missing collateral
|
54
|
+
/// default implementation returns 100%
|
55
|
+
function getRetentionLevel() external view returns (UFixed retentionLevel);
|
56
|
+
|
57
|
+
/// @dev declares if pool intercept transfers of bundle nft ids
|
58
|
+
/// - yes: pool may block transfer of bundle ownership or simply updates some bookkeeping related to bundle ownership. callback function is nftTransferFrom
|
59
|
+
/// - no: pool is not involved in transfer of bundle ownership
|
60
|
+
/// default implementation returns false (no)
|
61
|
+
function isInterceptingBundleTransfers() external view returns (bool);
|
62
|
+
|
63
|
+
/// @dev declares if pool relies on external management of collateral (yes/no):
|
64
|
+
/// - yes: underwriting of new policies does not require an actual token balance, instead it is assumed that the pool owner will manage funds externally and inject enough tokens to allow process confirmed payouts
|
65
|
+
/// - no: the pool smart contract ensures that the necessary capacity of the pool prior to underwriting.
|
66
|
+
/// default implementation returns false (no)
|
67
|
+
function isExternallyManaged() external view returns (bool);
|
68
|
+
|
69
|
+
/// @dev declares if pool component is actively involved in underwriting (yes/no):
|
70
|
+
/// - yes: verifying pools components actively confirm underwriting applications, ie the pool component logic explicitly needs to confirm the locking of collateral to cover the sum insured of the policy
|
71
|
+
/// - no: underwriting a policy does not require any interaction with the pool component if the covering bundle can provide the necessary captial
|
72
|
+
/// default implementation returnsfalse (no)
|
73
|
+
function isVerifyingApplications() external view returns (bool);
|
74
|
+
|
75
|
+
/// @dev returns true iff the policy application data in policyData matches
|
76
|
+
/// with the bundle filter criteria encoded in bundleFilter
|
77
|
+
/// this is a callback function that is only called if a pool declares itself as a verifying pool
|
78
|
+
/// default implementation returns true
|
44
79
|
function policyMatchesBundle(
|
45
80
|
bytes memory policyData,
|
46
81
|
bytes memory bundleFilter
|
@@ -49,8 +84,4 @@ interface IPoolComponent is IComponent {
|
|
49
84
|
view
|
50
85
|
returns (bool isMatching);
|
51
86
|
|
52
|
-
function isConfirmingApplication() external view returns (bool isConfirmingApplication);
|
53
|
-
|
54
|
-
function getCollateralizationLevel() external view returns (UFixed collateralizationLevel);
|
55
|
-
|
56
87
|
}
|