@etherisc/gif-next 0.0.2-d3543ee-217 → 0.0.2-d408403-475
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +125 -6
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +4 -0
- package/artifacts/contracts/components/{Component.sol/Component.json → BaseComponent.sol/BaseComponent.json} +26 -57
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +4 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +405 -0
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +4 -0
- package/artifacts/contracts/{instance/component/IComponent.sol/IComponentContract.json → components/IBaseComponent.sol/IBaseComponent.json} +26 -57
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
- package/artifacts/contracts/components/{IPool.sol/IPoolComponent.json → IDistributionComponent.sol/IDistributionComponent.json} +162 -77
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +4 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +487 -0
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +4 -0
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +370 -0
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +290 -40
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +167 -69
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Require.sol/Require.json +2 -2
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.json +2 -2
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/A.json +2 -2
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.json +2 -2
- 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/SM.sol/SM.json +2 -2
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +2 -2
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.json +2 -2
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.json +2 -2
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1148 -620
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.dbg.json +4 -0
- package/artifacts/contracts/instance/{component/IComponent.sol → IInstanceLinked.sol}/IInstanceLinked.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +1457 -797
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/{component/ComponentModule.sol/ComponentModule.json → base/ComponentServiceBase.sol/ComponentServiceBase.json} +133 -132
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +113 -0
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +560 -0
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +4 -0
- package/artifacts/contracts/instance/{lifecycle/ILifecycle.sol/ILifecycleModule.json → base/ILifecycle.sol/ILifecycle.json} +10 -77
- package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +4 -0
- package/artifacts/contracts/instance/base/IService.sol/IService.json +300 -0
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.json +376 -0
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +710 -0
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +4 -0
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +169 -0
- package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.json +10 -0
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.json +300 -0
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +4 -0
- package/artifacts/contracts/instance/{access → module/access}/Access.sol/AccessModule.json +85 -152
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +4 -0
- package/artifacts/contracts/instance/{access → module/access}/IAccess.sol/IAccess.json +1 -1
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +4 -0
- package/artifacts/contracts/instance/{access → module/access}/IAccess.sol/IAccessModule.json +96 -99
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.json +297 -0
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.dbg.json +4 -0
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.json +10 -0
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.json +297 -0
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.json +117 -0
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/instance/{component → module/component}/IComponent.sol/IComponent.json +1 -1
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.dbg.json +4 -0
- package/artifacts/contracts/instance/{product/IProductService.sol/IProductService.json → module/component/IComponent.sol/IComponentModule.json} +51 -61
- package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.json +10 -0
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistribution.dbg.json +4 -0
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistribution.json +10 -0
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.json +10 -0
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicy.dbg.json +4 -0
- package/artifacts/contracts/instance/{policy → module/policy}/IPolicy.sol/IPolicy.json +1 -1
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.dbg.json +4 -0
- package/artifacts/contracts/instance/{policy → module/policy}/IPolicy.sol/IPolicyModule.json +147 -117
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +4 -0
- package/artifacts/contracts/instance/{policy → module/policy}/PolicyModule.sol/PolicyModule.json +148 -118
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +4 -0
- package/artifacts/contracts/instance/{pool → module/pool}/IPoolModule.sol/IPool.json +1 -1
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +4 -0
- package/artifacts/contracts/instance/{pool → module/pool}/IPoolModule.sol/IPoolModule.json +67 -52
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +4 -0
- package/artifacts/contracts/instance/{pool → module/pool}/PoolModule.sol/PoolModule.json +51 -62
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.dbg.json +4 -0
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.json +10 -0
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.json +113 -0
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.json +131 -0
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.dbg.json +4 -0
- package/artifacts/contracts/instance/{treasury → module/treasury}/ITreasury.sol/ITreasury.json +1 -1
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.dbg.json +4 -0
- package/artifacts/contracts/instance/{treasury → module/treasury}/ITreasury.sol/ITreasuryModule.json +278 -257
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.dbg.json +4 -0
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.json +76 -0
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +4 -0
- package/artifacts/contracts/instance/{treasury → module/treasury}/TreasuryModule.sol/TreasuryModule.json +278 -257
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +531 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +420 -0
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +364 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +325 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +440 -0
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +630 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +543 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +858 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +65 -2
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +147 -30
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.json +24 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +241 -25
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +4 -0
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +35 -0
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.dbg.json +4 -0
- package/artifacts/contracts/{registry/IRegistry.sol → shared/IOwnable.sol}/IOwnable.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +4 -0
- package/artifacts/contracts/{registry/IRegistry.sol → shared/IRegisterable.sol}/IRegisterable.json +16 -61
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +4 -0
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +164 -0
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +4 -0
- package/artifacts/contracts/{registry/Registry.sol → shared/Registerable.sol}/Registerable.json +16 -61
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +4 -0
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +164 -0
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.dbg.json +4 -0
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.json +405 -0
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +4 -0
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +119 -0
- package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +4 -0
- package/artifacts/contracts/test/TestPool.sol/TestPool.json +578 -0
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +4 -0
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +575 -0
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +4 -0
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +137 -0
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +4 -0
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +116 -0
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +4 -0
- package/artifacts/contracts/test/TestService.sol/TestService.json +379 -0
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +4 -0
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +338 -0
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +4 -0
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +218 -0
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +4 -0
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +206 -0
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +4 -0
- package/artifacts/contracts/test/Usdc.sol/USDC.json +338 -0
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +4 -0
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.json +10 -0
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +2 -2
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.json +2 -2
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +4 -0
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +257 -0
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +4 -0
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +111 -0
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +65 -4
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +4 -0
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +10 -0
- 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/ReferralId.sol/ReferralIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.json +99 -0
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +86 -0
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +30 -0
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +64 -2
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.json +88 -62
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +4 -0
- package/artifacts/contracts/types/Version.sol/VersionLib.json +139 -0
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +4 -0
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +30 -0
- package/contracts/components/BaseComponent.sol +94 -0
- package/contracts/components/Distribution.sol +132 -0
- package/contracts/components/IBaseComponent.sol +19 -0
- package/contracts/components/IDistributionComponent.sol +48 -0
- package/contracts/components/IPoolComponent.sol +71 -0
- package/contracts/components/IProductComponent.sol +38 -0
- package/contracts/components/Pool.sol +199 -16
- package/contracts/components/Product.sol +169 -31
- package/contracts/instance/IInstance.sol +39 -11
- package/contracts/instance/IInstanceLinked.sol +8 -0
- package/contracts/instance/Instance.sol +51 -49
- package/contracts/instance/base/ComponentServiceBase.sol +42 -0
- package/contracts/instance/base/IInstanceBase.sol +22 -0
- package/contracts/instance/base/IKeyValueStore.sol +50 -0
- package/contracts/instance/{lifecycle → base}/ILifecycle.sol +4 -21
- package/contracts/instance/base/IService.sol +15 -0
- package/contracts/instance/base/InstanceBase.sol +91 -0
- package/contracts/instance/base/KeyValueStore.sol +161 -0
- package/contracts/instance/base/Lifecycle.sol +100 -0
- package/contracts/instance/base/ModuleBase.sol +57 -0
- package/contracts/instance/base/ServiceBase.sol +37 -0
- package/contracts/instance/module/access/Access.sol +149 -0
- package/contracts/instance/module/access/IAccess.sol +53 -0
- package/contracts/instance/module/bundle/BundleModule.sol +134 -0
- package/contracts/instance/module/bundle/IBundle.sol +53 -0
- package/contracts/instance/module/component/ComponentModule.sol +70 -0
- package/contracts/instance/module/component/IComponent.sol +28 -0
- package/contracts/instance/module/distribution/DistributionModule.sol +17 -0
- package/contracts/instance/module/distribution/IDistribution.sol +10 -0
- package/contracts/instance/module/policy/IPolicy.sol +63 -0
- package/contracts/instance/module/policy/PolicyModule.sol +91 -0
- package/contracts/instance/module/pool/IPoolModule.sol +40 -0
- package/contracts/instance/module/pool/PoolModule.sol +90 -0
- package/contracts/instance/module/risk/IRisk.sol +26 -0
- package/contracts/instance/module/risk/RiskModule.sol +62 -0
- package/contracts/instance/module/treasury/ITreasury.sol +82 -0
- package/contracts/instance/module/treasury/TokenHandler.sol +48 -0
- package/contracts/instance/module/treasury/TreasuryModule.sol +138 -0
- package/contracts/instance/service/ComponentOwnerService.sol +157 -0
- package/contracts/instance/service/DistributionService.sol +59 -0
- package/contracts/instance/service/IComponentOwnerService.sol +22 -0
- package/contracts/instance/service/IDistributionService.sol +12 -0
- package/contracts/instance/service/IPoolService.sol +37 -0
- package/contracts/instance/service/IProductService.sol +107 -0
- package/contracts/instance/service/PoolService.sol +149 -0
- package/contracts/instance/service/ProductService.sol +509 -0
- package/contracts/registry/ChainNft.sol +61 -37
- package/contracts/registry/IRegistry.sol +24 -34
- package/contracts/registry/IRegistryLinked.sol +8 -0
- package/contracts/registry/Registry.sol +285 -85
- package/contracts/shared/ERC165.sol +21 -0
- package/contracts/shared/IOwnable.sol +6 -0
- package/contracts/shared/IRegisterable.sol +24 -0
- package/contracts/shared/IVersionable.sol +52 -0
- package/contracts/shared/Registerable.sol +86 -0
- package/contracts/shared/Versionable.sol +89 -0
- package/contracts/test/TestDistribution.sol +21 -0
- package/contracts/test/TestFee.sol +25 -0
- package/contracts/test/TestPool.sol +25 -0
- package/contracts/test/TestProduct.sol +72 -0
- package/contracts/test/TestRegisterable.sol +19 -0
- package/contracts/test/TestRoleId.sol +14 -0
- package/contracts/test/TestService.sol +32 -0
- package/contracts/test/TestToken.sol +26 -0
- package/contracts/test/TestVersion.sol +44 -0
- package/contracts/test/TestVersionable.sol +17 -0
- package/contracts/test/Usdc.sol +26 -0
- package/contracts/types/AddressSet.sol +58 -0
- package/contracts/types/Fee.sol +44 -20
- package/contracts/types/Key32.sol +45 -0
- package/contracts/types/NftId.sol +22 -1
- package/contracts/types/NftIdSet.sol +60 -0
- package/contracts/types/ObjectType.sol +37 -13
- package/contracts/types/ReferralId.sol +48 -0
- package/contracts/types/RiskId.sol +43 -0
- package/contracts/types/RoleId.sol +38 -0
- package/contracts/types/StateId.sol +13 -3
- package/contracts/types/Timestamp.sol +22 -1
- package/contracts/types/UFixed.sol +26 -23
- package/contracts/types/Version.sol +95 -0
- package/package.json +12 -4
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +0 -4
- package/artifacts/contracts/components/Component.sol/InstanceLinked.dbg.json +0 -4
- package/artifacts/contracts/components/Component.sol/InstanceLinked.json +0 -35
- package/artifacts/contracts/components/IPool.sol/IPoolComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IProduct.sol/IProductComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IProduct.sol/IProductComponent.json +0 -74
- package/artifacts/contracts/instance/access/Access.sol/AccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/access/IAccess.sol/IAccess.dbg.json +0 -4
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessCheckRole.dbg.json +0 -4
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessCheckRole.json +0 -35
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessComponentTypeRoles.dbg.json +0 -4
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessComponentTypeRoles.json +0 -50
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.json +0 -202
- package/artifacts/contracts/instance/component/IComponent.sol/IComponent.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentContract.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.json +0 -217
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.json +0 -141
- package/artifacts/contracts/instance/component/IComponent.sol/IInstanceLinked.dbg.json +0 -4
- package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycle.dbg.json +0 -4
- package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycle.json +0 -134
- package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/lifecycle/LifecycleModule.sol/LifecycleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/lifecycle/LifecycleModule.sol/LifecycleModule.json +0 -221
- package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicy.dbg.json +0 -4
- package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/policy/PolicyModule.sol/PolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/pool/IPoolModule.sol/IPool.dbg.json +0 -4
- package/artifacts/contracts/instance/pool/IPoolModule.sol/IPoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/pool/PoolModule.sol/PoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/product/IProductService.sol/IProductModule.dbg.json +0 -4
- package/artifacts/contracts/instance/product/IProductService.sol/IProductModule.json +0 -75
- package/artifacts/contracts/instance/product/IProductService.sol/IProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/product/ProductService.sol/ProductModule.dbg.json +0 -4
- package/artifacts/contracts/instance/product/ProductService.sol/ProductModule.json +0 -75
- package/artifacts/contracts/instance/product/ProductService.sol/ProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/product/ProductService.sol/ProductService.json +0 -196
- package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasury.dbg.json +0 -4
- package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/instance/treasury/TokenHandler.sol/TokenHandler.dbg.json +0 -4
- package/artifacts/contracts/instance/treasury/TokenHandler.sol/TokenHandler.json +0 -45
- package/artifacts/contracts/instance/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistry.sol/IOwnable.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistry.sol/IRegisterable.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistry.sol/IRegistryLinked.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistry.sol/IRegistryLinked.json +0 -49
- package/artifacts/contracts/registry/Registry.sol/Registerable.dbg.json +0 -4
- package/artifacts/contracts/registry/Registry.sol/RegistryLinked.dbg.json +0 -4
- package/artifacts/contracts/registry/Registry.sol/RegistryLinked.json +0 -60
- package/contracts/components/Component.sol +0 -77
- package/contracts/components/IPool.sol +0 -15
- package/contracts/components/IProduct.sol +0 -16
- package/contracts/instance/access/Access.sol +0 -165
- package/contracts/instance/access/IAccess.sol +0 -63
- package/contracts/instance/component/ComponentModule.sol +0 -274
- package/contracts/instance/component/IComponent.sol +0 -74
- package/contracts/instance/lifecycle/LifecycleModule.sol +0 -88
- package/contracts/instance/policy/IPolicy.sol +0 -50
- package/contracts/instance/policy/PolicyModule.sol +0 -114
- package/contracts/instance/pool/IPoolModule.sol +0 -23
- package/contracts/instance/pool/PoolModule.sol +0 -81
- package/contracts/instance/product/IProductService.sol +0 -36
- package/contracts/instance/product/ProductService.sol +0 -136
- package/contracts/instance/treasury/ITreasury.sol +0 -91
- package/contracts/instance/treasury/TokenHandler.sol +0 -24
- package/contracts/instance/treasury/TreasuryModule.sol +0 -168
@@ -2,33 +2,216 @@
|
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
4
|
import {ObjectType, POOL} from "../types/ObjectType.sol";
|
5
|
+
import {IProductService} from "../instance/service/IProductService.sol";
|
6
|
+
import {IPoolService} from "../instance/service/IPoolService.sol";
|
7
|
+
import {NftId} from "../types/NftId.sol";
|
5
8
|
import {Fee} from "../types/Fee.sol";
|
6
|
-
import {
|
7
|
-
import {
|
9
|
+
import {UFixed} from "../types/UFixed.sol";
|
10
|
+
import {IPoolComponent} from "./IPoolComponent.sol";
|
11
|
+
import {BaseComponent} from "./BaseComponent.sol";
|
8
12
|
|
9
|
-
contract Pool is
|
10
|
-
|
11
|
-
|
13
|
+
contract Pool is BaseComponent, IPoolComponent {
|
14
|
+
|
15
|
+
bool internal _isVerifying;
|
16
|
+
UFixed internal _collateralizationLevel;
|
17
|
+
|
18
|
+
Fee internal _initialPoolFee;
|
19
|
+
Fee internal _initialStakingFee;
|
20
|
+
Fee internal _initialPerformanceFee;
|
21
|
+
|
22
|
+
// may be used to interact with instance by derived contracts
|
23
|
+
IPoolService internal _poolService;
|
24
|
+
|
25
|
+
// only relevant to protect callback functions for "active" pools
|
26
|
+
IProductService private _productService;
|
27
|
+
|
28
|
+
modifier onlyPoolService() {
|
29
|
+
require(
|
30
|
+
msg.sender == address(_poolService),
|
31
|
+
"ERROR:POL-001:NOT_POOL_SERVICE");
|
32
|
+
_;
|
33
|
+
}
|
34
|
+
|
35
|
+
modifier onlyProductService() {
|
36
|
+
require(
|
37
|
+
msg.sender == address(_productService),
|
38
|
+
"ERROR:POL-002:NOT_PRODUCT_SERVICE");
|
39
|
+
_;
|
40
|
+
}
|
12
41
|
|
13
42
|
constructor(
|
14
43
|
address registry,
|
15
|
-
|
44
|
+
NftId instanceNftId,
|
45
|
+
// TODO refactor into tokenNftId
|
16
46
|
address token,
|
47
|
+
bool verifying,
|
48
|
+
UFixed collateralizationLevel,
|
49
|
+
Fee memory poolFee,
|
50
|
+
Fee memory stakingFee,
|
51
|
+
Fee memory performanceFee
|
52
|
+
)
|
53
|
+
BaseComponent(registry, instanceNftId, token)
|
54
|
+
{
|
55
|
+
_isVerifying = verifying;
|
56
|
+
// TODO add validation
|
57
|
+
_collateralizationLevel = collateralizationLevel;
|
58
|
+
_initialPoolFee = poolFee;
|
59
|
+
_initialStakingFee = stakingFee;
|
60
|
+
_initialPerformanceFee = performanceFee;
|
61
|
+
|
62
|
+
_poolService = _instance.getPoolService();
|
63
|
+
_productService = _instance.getProductService();
|
64
|
+
}
|
65
|
+
|
66
|
+
function setFees(
|
67
|
+
Fee memory poolFee,
|
17
68
|
Fee memory stakingFee,
|
18
69
|
Fee memory performanceFee
|
19
|
-
)
|
20
|
-
|
21
|
-
|
70
|
+
)
|
71
|
+
external
|
72
|
+
onlyOwner
|
73
|
+
override
|
74
|
+
{
|
75
|
+
_poolService.setFees(poolFee, stakingFee, performanceFee);
|
76
|
+
}
|
77
|
+
|
78
|
+
function createBundle(
|
79
|
+
Fee memory fee,
|
80
|
+
uint256 initialAmount,
|
81
|
+
uint256 lifetime,
|
82
|
+
bytes memory filter
|
83
|
+
)
|
84
|
+
external
|
85
|
+
virtual override
|
86
|
+
returns(NftId bundleNftId)
|
87
|
+
{
|
88
|
+
address owner = msg.sender;
|
89
|
+
bundleNftId = _poolService.createBundle(
|
90
|
+
owner,
|
91
|
+
fee,
|
92
|
+
initialAmount,
|
93
|
+
lifetime,
|
94
|
+
filter
|
95
|
+
);
|
96
|
+
|
97
|
+
// TODO add logging
|
98
|
+
}
|
99
|
+
|
100
|
+
function setBundleFee(
|
101
|
+
NftId bundleNftId,
|
102
|
+
Fee memory fee
|
103
|
+
)
|
104
|
+
external
|
105
|
+
override
|
106
|
+
// TODO add onlyBundleOwner
|
107
|
+
{
|
108
|
+
_poolService.setBundleFee(bundleNftId, fee);
|
109
|
+
}
|
110
|
+
|
111
|
+
/**
|
112
|
+
* @dev see {IPool.underwrite}.
|
113
|
+
* Default implementation that only writes a {LogUnderwrittenByPool} entry.
|
114
|
+
*/
|
115
|
+
function underwrite(
|
116
|
+
NftId policyNftId,
|
117
|
+
bytes memory policyData,
|
118
|
+
bytes memory bundleFilter,
|
119
|
+
uint256 collateralizationAmount
|
120
|
+
)
|
121
|
+
external
|
122
|
+
onlyProductService
|
123
|
+
virtual override
|
124
|
+
{
|
125
|
+
_underwrite(policyNftId, policyData, bundleFilter, collateralizationAmount);
|
126
|
+
}
|
127
|
+
|
128
|
+
/**
|
129
|
+
* @dev see {IPoolComponent.policyMatchesBundle}.
|
130
|
+
* Default implementation always returns true
|
131
|
+
*/
|
132
|
+
function policyMatchesBundle(
|
133
|
+
bytes memory, // policyData
|
134
|
+
bytes memory // bundleFilter
|
135
|
+
)
|
136
|
+
public
|
137
|
+
view
|
138
|
+
virtual override
|
139
|
+
returns (bool isMatching)
|
140
|
+
{
|
141
|
+
return true;
|
142
|
+
}
|
143
|
+
|
144
|
+
|
145
|
+
function isVerifying() external view override returns (bool verifying) {
|
146
|
+
return _isVerifying;
|
147
|
+
}
|
148
|
+
|
149
|
+
function getCollateralizationLevel() external view override returns (UFixed collateralizationLevel) {
|
150
|
+
return _collateralizationLevel;
|
151
|
+
}
|
152
|
+
|
153
|
+
function _underwrite(
|
154
|
+
NftId policyNftId,
|
155
|
+
bytes memory policyData,
|
156
|
+
bytes memory bundleFilter,
|
157
|
+
uint256 collateralizationAmount
|
158
|
+
)
|
159
|
+
internal
|
160
|
+
{
|
161
|
+
require(
|
162
|
+
policyMatchesBundle(policyData, bundleFilter),
|
163
|
+
"ERROR:POL-020:POLICY_BUNDLE_MISMATCH"
|
164
|
+
);
|
165
|
+
|
166
|
+
emit LogUnderwrittenByPool(policyNftId, collateralizationAmount, address(this));
|
167
|
+
}
|
168
|
+
|
169
|
+
function _createBundle(
|
170
|
+
address bundleOwner,
|
171
|
+
Fee memory fee,
|
172
|
+
uint256 amount,
|
173
|
+
uint256 lifetime,
|
174
|
+
bytes calldata filter
|
175
|
+
)
|
176
|
+
internal
|
177
|
+
returns(NftId bundleNftId)
|
178
|
+
{
|
179
|
+
bundleNftId = _poolService.createBundle(
|
180
|
+
bundleOwner,
|
181
|
+
fee,
|
182
|
+
amount,
|
183
|
+
lifetime,
|
184
|
+
filter
|
185
|
+
);
|
22
186
|
}
|
23
187
|
|
24
188
|
// from pool component
|
189
|
+
function getPoolFee()
|
190
|
+
external
|
191
|
+
view
|
192
|
+
override
|
193
|
+
returns (Fee memory poolFee)
|
194
|
+
{
|
195
|
+
NftId productNftId = _instance.getProductNftId(getNftId());
|
196
|
+
if (_instance.hasTreasuryInfo(productNftId)) {
|
197
|
+
return _instance.getTreasuryInfo(productNftId).poolFee;
|
198
|
+
} else {
|
199
|
+
return _initialPoolFee;
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
25
203
|
function getStakingFee()
|
26
204
|
external
|
27
205
|
view
|
28
206
|
override
|
29
207
|
returns (Fee memory stakingFee)
|
30
208
|
{
|
31
|
-
|
209
|
+
NftId productNftId = _instance.getProductNftId(getNftId());
|
210
|
+
if (_instance.hasTreasuryInfo(productNftId)) {
|
211
|
+
return _instance.getTreasuryInfo(productNftId).stakingFee;
|
212
|
+
} else {
|
213
|
+
return _initialStakingFee;
|
214
|
+
}
|
32
215
|
}
|
33
216
|
|
34
217
|
function getPerformanceFee()
|
@@ -37,16 +220,16 @@ contract Pool is Component, IPoolComponent {
|
|
37
220
|
override
|
38
221
|
returns (Fee memory performanceFee)
|
39
222
|
{
|
40
|
-
|
223
|
+
NftId productNftId = _instance.getProductNftId(getNftId());
|
224
|
+
if (_instance.hasTreasuryInfo(productNftId)) {
|
225
|
+
return _instance.getTreasuryInfo(productNftId).performanceFee;
|
226
|
+
} else {
|
227
|
+
return _initialPerformanceFee;
|
228
|
+
}
|
41
229
|
}
|
42
230
|
|
43
231
|
// from registerable
|
44
232
|
function getType() public pure override returns (ObjectType) {
|
45
233
|
return POOL();
|
46
234
|
}
|
47
|
-
|
48
|
-
// from registerable
|
49
|
-
function getData() external view override returns (bytes memory data) {
|
50
|
-
return bytes(abi.encode(getInstance().getNftId()));
|
51
|
-
}
|
52
235
|
}
|
@@ -1,71 +1,209 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
4
|
+
import {IRisk} from "../instance/module/risk/IRisk.sol";
|
5
|
+
import {ITreasury} from "../instance/module/treasury/ITreasury.sol";
|
6
|
+
import {IProductService} from "../instance/service/IProductService.sol";
|
7
|
+
import {IProductComponent} from "./IProductComponent.sol";
|
7
8
|
import {NftId} from "../types/NftId.sol";
|
8
9
|
import {ObjectType, PRODUCT} from "../types/ObjectType.sol";
|
10
|
+
import {ReferralId} from "../types/ReferralId.sol";
|
11
|
+
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
12
|
+
import {StateId} from "../types/StateId.sol";
|
13
|
+
import {Timestamp} from "../types/Timestamp.sol";
|
9
14
|
import {Fee} from "../types/Fee.sol";
|
10
|
-
import {
|
15
|
+
import {BaseComponent} from "./BaseComponent.sol";
|
11
16
|
|
12
|
-
contract Product is
|
13
|
-
IProductService
|
14
|
-
address
|
15
|
-
|
16
|
-
Fee
|
17
|
+
contract Product is BaseComponent, IProductComponent {
|
18
|
+
IProductService internal _productService;
|
19
|
+
address internal _pool;
|
20
|
+
address internal _distribution;
|
21
|
+
Fee internal _initialProductFee;
|
22
|
+
Fee internal _initialProcessingFee;
|
17
23
|
|
18
24
|
constructor(
|
19
25
|
address registry,
|
20
|
-
|
26
|
+
NftId instanceNftid,
|
21
27
|
address token,
|
22
28
|
address pool,
|
23
|
-
|
29
|
+
address distribution,
|
30
|
+
Fee memory productFee,
|
24
31
|
Fee memory processingFee
|
25
|
-
)
|
32
|
+
) BaseComponent(registry, instanceNftid, token) {
|
26
33
|
// TODO add validation
|
27
34
|
_productService = _instance.getProductService();
|
28
35
|
_pool = pool;
|
29
|
-
|
30
|
-
|
36
|
+
_distribution = distribution;
|
37
|
+
_initialProductFee = productFee;
|
38
|
+
_initialProcessingFee = processingFee;
|
39
|
+
}
|
40
|
+
|
41
|
+
|
42
|
+
function calculatePremium(
|
43
|
+
uint256 sumInsuredAmount,
|
44
|
+
RiskId riskId,
|
45
|
+
uint256 lifetime,
|
46
|
+
bytes memory applicationData,
|
47
|
+
ReferralId referralId,
|
48
|
+
NftId bundleNftId
|
49
|
+
)
|
50
|
+
external
|
51
|
+
view
|
52
|
+
override
|
53
|
+
returns (uint256 premiumAmount)
|
54
|
+
{
|
55
|
+
(premiumAmount,,,,) = _productService.calculatePremium(
|
56
|
+
riskId,
|
57
|
+
sumInsuredAmount,
|
58
|
+
lifetime,
|
59
|
+
applicationData,
|
60
|
+
bundleNftId,
|
61
|
+
referralId
|
62
|
+
);
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
function calculateNetPremium(
|
67
|
+
uint256 sumInsuredAmount,
|
68
|
+
RiskId riskId,
|
69
|
+
uint256 lifetime,
|
70
|
+
bytes memory applicationData
|
71
|
+
)
|
72
|
+
external
|
73
|
+
view
|
74
|
+
override
|
75
|
+
returns (uint256 netPremiumAmount)
|
76
|
+
{
|
77
|
+
// default 10% of sum insured
|
78
|
+
return sumInsuredAmount / 10;
|
79
|
+
}
|
80
|
+
|
81
|
+
function _toRiskId(string memory riskName) internal pure returns (RiskId riskId) {
|
82
|
+
return RiskIdLib.toRiskId(riskName);
|
83
|
+
}
|
84
|
+
|
85
|
+
function _createRisk(
|
86
|
+
RiskId id,
|
87
|
+
bytes memory data
|
88
|
+
) internal {
|
89
|
+
_productService.createRisk(
|
90
|
+
id,
|
91
|
+
data
|
92
|
+
);
|
93
|
+
}
|
94
|
+
|
95
|
+
function _setRiskInfo(
|
96
|
+
RiskId id,
|
97
|
+
IRisk.RiskInfo memory info
|
98
|
+
) internal {
|
99
|
+
_productService.setRiskInfo(
|
100
|
+
id,
|
101
|
+
info
|
102
|
+
);
|
103
|
+
}
|
104
|
+
|
105
|
+
function _updateRiskState(
|
106
|
+
RiskId id,
|
107
|
+
StateId state
|
108
|
+
) internal {
|
109
|
+
_productService.updateRiskState(
|
110
|
+
id,
|
111
|
+
state
|
112
|
+
);
|
113
|
+
}
|
114
|
+
|
115
|
+
function _getRiskInfo(RiskId id) internal view returns (IRisk.RiskInfo memory info) {
|
116
|
+
return _instance.getRiskInfo(id);
|
31
117
|
}
|
32
118
|
|
33
119
|
function _createApplication(
|
34
120
|
address applicationOwner,
|
121
|
+
RiskId riskId,
|
35
122
|
uint256 sumInsuredAmount,
|
36
|
-
uint256 premiumAmount,
|
37
123
|
uint256 lifetime,
|
38
|
-
|
124
|
+
bytes memory applicationData,
|
125
|
+
NftId bundleNftId,
|
126
|
+
ReferralId referralId
|
39
127
|
) internal returns (NftId nftId) {
|
40
128
|
nftId = _productService.createApplication(
|
41
129
|
applicationOwner,
|
130
|
+
riskId,
|
42
131
|
sumInsuredAmount,
|
43
|
-
premiumAmount,
|
44
132
|
lifetime,
|
45
|
-
|
133
|
+
applicationData,
|
134
|
+
bundleNftId,
|
135
|
+
referralId
|
46
136
|
);
|
47
137
|
}
|
48
138
|
|
49
|
-
function _underwrite(
|
50
|
-
|
139
|
+
function _underwrite(
|
140
|
+
NftId policyNftId,
|
141
|
+
bool requirePremiumPayment,
|
142
|
+
Timestamp activateAt
|
143
|
+
)
|
144
|
+
internal
|
145
|
+
{
|
146
|
+
_productService.underwrite(
|
147
|
+
policyNftId,
|
148
|
+
requirePremiumPayment,
|
149
|
+
activateAt);
|
150
|
+
}
|
151
|
+
|
152
|
+
function _collectPremium(
|
153
|
+
NftId policyNftId,
|
154
|
+
Timestamp activateAt
|
155
|
+
)
|
156
|
+
internal
|
157
|
+
{
|
158
|
+
_productService.collectPremium(
|
159
|
+
policyNftId,
|
160
|
+
activateAt);
|
51
161
|
}
|
52
162
|
|
53
|
-
function
|
54
|
-
|
163
|
+
function _activate(
|
164
|
+
NftId policyNftId,
|
165
|
+
Timestamp activateAt
|
166
|
+
)
|
167
|
+
internal
|
168
|
+
{
|
169
|
+
_productService.activate(
|
170
|
+
policyNftId,
|
171
|
+
activateAt);
|
55
172
|
}
|
56
173
|
|
57
174
|
function getPoolNftId() external view override returns (NftId poolNftId) {
|
58
175
|
return _registry.getNftId(_pool);
|
59
176
|
}
|
60
177
|
|
178
|
+
function getDistributionNftId() external view override returns (NftId distributionNftId) {
|
179
|
+
return _registry.getNftId(_distribution);
|
180
|
+
}
|
181
|
+
|
61
182
|
// from product component
|
62
|
-
function
|
183
|
+
function setFees(
|
184
|
+
Fee memory productFee,
|
185
|
+
Fee memory processingFee
|
186
|
+
)
|
187
|
+
external
|
188
|
+
onlyOwner
|
189
|
+
override
|
190
|
+
{
|
191
|
+
_productService.setFees(productFee, processingFee);
|
192
|
+
}
|
193
|
+
|
194
|
+
|
195
|
+
function getProductFee()
|
63
196
|
external
|
64
197
|
view
|
65
198
|
override
|
66
|
-
returns (Fee memory
|
199
|
+
returns (Fee memory productFee)
|
67
200
|
{
|
68
|
-
|
201
|
+
NftId productNftId = getNftId();
|
202
|
+
if (_instance.hasTreasuryInfo(productNftId)) {
|
203
|
+
return _instance.getTreasuryInfo(productNftId).productFee;
|
204
|
+
} else {
|
205
|
+
return _initialProductFee;
|
206
|
+
}
|
69
207
|
}
|
70
208
|
|
71
209
|
function getProcessingFee()
|
@@ -74,16 +212,16 @@ contract Product is Component, IProductComponent {
|
|
74
212
|
override
|
75
213
|
returns (Fee memory processingFee)
|
76
214
|
{
|
77
|
-
|
215
|
+
NftId productNftId = getNftId();
|
216
|
+
if (_instance.hasTreasuryInfo(productNftId)) {
|
217
|
+
return _instance.getTreasuryInfo(productNftId).processingFee;
|
218
|
+
} else {
|
219
|
+
return _initialProcessingFee;
|
220
|
+
}
|
78
221
|
}
|
79
222
|
|
80
223
|
// from registerable
|
81
224
|
function getType() public pure override returns (ObjectType) {
|
82
225
|
return PRODUCT();
|
83
226
|
}
|
84
|
-
|
85
|
-
// from registerable
|
86
|
-
function getData() external view override returns (bytes memory data) {
|
87
|
-
return bytes(abi.encode(getInstance().getNftId()));
|
88
|
-
}
|
89
227
|
}
|
@@ -1,25 +1,53 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
-
import {
|
5
|
-
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
|
11
|
-
import {
|
4
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
5
|
+
|
6
|
+
import {IVersionable} from "../shared/IVersionable.sol";
|
7
|
+
import {IRegisterable} from "../shared/IRegisterable.sol";
|
8
|
+
import {IOwnable} from "../shared/IOwnable.sol";
|
9
|
+
import {RoleId} from "../types/RoleId.sol";
|
10
|
+
|
11
|
+
import {IAccessModule} from "./module/access/IAccess.sol";
|
12
|
+
import {IBundleModule} from "./module/bundle/IBundle.sol";
|
13
|
+
import {IDistributionModule} from "./module/distribution/IDistribution.sol";
|
14
|
+
import {IComponentModule} from "./module/component/IComponent.sol";
|
15
|
+
import {IPolicyModule} from "./module/policy/IPolicy.sol";
|
16
|
+
import {IPoolModule} from "./module/pool/IPoolModule.sol";
|
17
|
+
import {IRiskModule} from "./module/risk/IRisk.sol";
|
18
|
+
import {ITreasuryModule} from "./module/treasury/ITreasury.sol";
|
19
|
+
|
20
|
+
import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
21
|
+
import {IRegistry, IRegistryLinked} from "../registry/IRegistryLinked.sol";
|
22
|
+
|
23
|
+
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
24
|
+
import {IDistributionService} from "./service/IDistributionService.sol";
|
25
|
+
import {IProductService} from "./service/IProductService.sol";
|
26
|
+
import {IPoolService} from "./service/IPoolService.sol";
|
27
|
+
import {IInstanceBase} from "./base/IInstanceBase.sol";
|
12
28
|
|
13
29
|
// solhint-disable-next-line no-empty-blocks
|
14
30
|
interface IInstance is
|
31
|
+
IERC165,
|
32
|
+
IVersionable,
|
15
33
|
IRegisterable,
|
16
34
|
IAccessModule,
|
17
|
-
ILifecycleModule,
|
18
35
|
IPolicyModule,
|
19
36
|
IPoolModule,
|
37
|
+
IRiskModule,
|
38
|
+
IBundleModule,
|
20
39
|
IComponentModule,
|
21
|
-
|
22
|
-
|
40
|
+
ITreasuryModule,
|
41
|
+
IDistributionModule,
|
42
|
+
IInstanceBase
|
23
43
|
{
|
44
|
+
function getRegistry() external view override (IPolicyModule, IRegisterable) returns (IRegistry registry);
|
45
|
+
function getOwner() external view override (IOwnable, IAccessModule) returns(address owner);
|
46
|
+
|
47
|
+
function getKeyValueStore() external view override (IInstanceBase) returns (IKeyValueStore keyValueStore);
|
48
|
+
function getComponentOwnerService() external view override (IInstanceBase, IComponentModule) returns(IComponentOwnerService);
|
49
|
+
function getDistributionService() external view override returns(IDistributionService);
|
50
|
+
function getProductService() external view override (IInstanceBase, IBundleModule, IPolicyModule) returns(IProductService);
|
51
|
+
function getPoolService() external view override (IInstanceBase, IBundleModule, IPoolModule) returns(IPoolService);
|
24
52
|
|
25
53
|
}
|