@etherisc/gif-next 0.0.2-e1e92ab-754 → 0.0.2-e26c262-698
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +232 -2
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/components/Component.sol/Component.json +832 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +954 -192
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/{instance/base/ComponentServiceBase.sol/ComponentServiceBase.json → components/IComponent.sol/IComponent.json} +192 -168
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +719 -27
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +773 -127
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +556 -33
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +906 -266
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +702 -159
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +4 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +778 -0
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +190 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1415 -1008
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +567 -0
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +2129 -1194
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +1311 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1279 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +1033 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +701 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +256 -0
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/instance/base/{InstanceBase.sol/InstanceBase.json → ComponentService.sol/ComponentService.json} +203 -195
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +27 -158
- 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 +67 -245
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +36 -11
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +237 -0
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{bundle/IBundle.sol → IBundle.sol}/IBundle.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{pool/IPoolModule.sol/IPool.json → IComponents.sol/IComponents.json} +2 -2
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{distribution/IDistribution.sol → IDistribution.sol}/IDistribution.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{policy/IPolicy.sol → IPolicy.sol}/IPolicy.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{risk/IRisk.sol → IRisk.sol}/IRisk.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +4 -0
- package/artifacts/contracts/instance/{base/ModuleBase.sol/ModuleBase.json → module/ISetup.sol/ISetup.json} +2 -2
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{treasury/ITreasury.sol → ITreasury.sol}/ITreasury.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +968 -0
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +665 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +1093 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +661 -0
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +754 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +637 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +1341 -239
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +805 -0
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +556 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +630 -0
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/{IComponentOwnerService.sol/IComponentOwnerService.json → IClaimService.sol/IClaimService.json} +150 -207
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +727 -160
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/{base/ServiceBase.sol/ServiceBase.json → service/IPolicyService.sol/IPolicyService.json} +263 -191
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +84 -217
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +47 -414
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +1021 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +689 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +314 -243
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +657 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +242 -533
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +649 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +60 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +373 -61
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +234 -216
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +18 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +333 -188
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +229 -297
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +312 -132
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +547 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +4 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +498 -0
- 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/{instance/module/component/IComponent.sol/IComponentModule.json → shared/IPolicyHolder.sol/IPolicyHolder.json} +69 -57
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +21 -34
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/{experiment/inheritance/IB.sol/IB.json → shared/IRegistryLinked.sol/IRegistryLinked.json} +18 -20
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +4 -0
- package/artifacts/contracts/{components/IBaseComponent.sol/IBaseComponent.json → shared/IService.sol/IService.json} +59 -44
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +2 -152
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +120 -27
- 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 +294 -61
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +129 -51
- 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 +4 -0
- package/artifacts/contracts/{instance/base/IService.sol/IService.json → shared/Service.sol/Service.json} +155 -151
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +96 -0
- 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 -152
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +2 -2
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +129 -51
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +14 -14
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +148 -211
- 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/TestVersion.sol/TestVersion.json +2 -2
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +8 -174
- 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/Blocknumber.sol/BlocknumberLib.json +2 -2
- 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 +4 -0
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +104 -0
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +2 -2
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +31 -17
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +17 -4
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +26 -3
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.json +100 -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/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 +4 -0
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +142 -0
- 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 +134 -8
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +4 -0
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.json +124 -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 +38 -7
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.json +2 -2
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +22 -3
- package/contracts/components/Component.sol +251 -0
- package/contracts/components/Distribution.sol +204 -79
- package/contracts/components/IComponent.sol +74 -0
- package/contracts/components/IDistributionComponent.sol +43 -18
- package/contracts/components/IPoolComponent.sol +88 -39
- package/contracts/components/IProductComponent.sol +12 -9
- package/contracts/components/Pool.sol +216 -163
- package/contracts/components/Product.sol +133 -139
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
- package/contracts/instance/BundleManager.sol +127 -0
- package/contracts/instance/Cloneable.sol +51 -0
- package/contracts/instance/IInstance.sol +85 -39
- package/contracts/instance/IInstanceService.sol +72 -0
- package/contracts/instance/Instance.sol +310 -66
- package/contracts/instance/InstanceAccessManager.sol +522 -0
- package/contracts/instance/InstanceReader.sol +290 -0
- package/contracts/instance/InstanceService.sol +495 -0
- package/contracts/instance/InstanceServiceManager.sol +54 -0
- package/contracts/instance/ObjectManager.sol +82 -0
- package/contracts/instance/base/ComponentService.sol +134 -0
- package/contracts/instance/base/IKeyValueStore.sol +13 -14
- package/contracts/instance/base/ILifecycle.sol +3 -3
- package/contracts/instance/base/KeyValueStore.sol +52 -38
- package/contracts/instance/base/Lifecycle.sol +12 -3
- package/contracts/instance/module/IAccess.sol +54 -0
- package/contracts/instance/module/IBundle.sol +21 -0
- package/contracts/instance/module/IComponents.sol +35 -0
- package/contracts/instance/module/IDistribution.sol +41 -0
- package/contracts/instance/module/IPolicy.sol +72 -0
- package/contracts/instance/module/IRisk.sol +11 -0
- package/contracts/instance/module/ISetup.sol +33 -0
- package/contracts/instance/module/ITreasury.sol +23 -0
- package/contracts/instance/service/ApplicationService.sol +350 -0
- package/contracts/instance/service/ApplicationServiceManager.sol +35 -0
- package/contracts/instance/service/BundleService.sol +336 -0
- package/contracts/instance/service/BundleServiceManager.sol +51 -0
- package/contracts/instance/service/ClaimService.sol +151 -0
- package/contracts/instance/service/ClaimServiceManager.sol +35 -0
- package/contracts/instance/service/DistributionService.sol +435 -22
- package/contracts/instance/service/DistributionServiceManager.sol +51 -0
- package/contracts/instance/service/IApplicationService.sol +82 -0
- package/contracts/instance/service/IBundleService.sol +62 -0
- package/contracts/instance/service/IClaimService.sol +61 -0
- package/contracts/instance/service/IDistributionService.sol +87 -1
- package/contracts/instance/service/IPolicyService.sol +72 -0
- package/contracts/instance/service/IPoolService.sol +22 -24
- package/contracts/instance/service/IProductService.sol +9 -76
- package/contracts/instance/service/PolicyService.sol +403 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +181 -110
- package/contracts/instance/service/PoolServiceManager.sol +51 -0
- package/contracts/instance/service/ProductService.sol +163 -432
- package/contracts/instance/service/ProductServiceManager.sol +54 -0
- package/contracts/registry/ChainNft.sol +47 -24
- package/contracts/registry/IRegistry.sol +52 -8
- package/contracts/registry/IRegistryService.sol +52 -20
- package/contracts/registry/ITransferInterceptor.sol +1 -0
- package/contracts/registry/Registry.sol +277 -236
- package/contracts/registry/RegistryAccessManager.sol +216 -0
- package/contracts/registry/RegistryService.sol +113 -271
- package/contracts/registry/RegistryServiceManager.sol +24 -25
- package/contracts/registry/ReleaseManager.sol +322 -0
- package/contracts/registry/TokenRegistry.sol +116 -0
- package/contracts/shared/ERC165.sol +14 -8
- package/contracts/shared/INftOwnable.sol +11 -10
- package/contracts/shared/IPolicyHolder.sol +26 -0
- package/contracts/shared/IRegisterable.sol +4 -6
- package/contracts/shared/IRegistryLinked.sol +12 -0
- package/contracts/shared/IService.sol +18 -0
- package/contracts/shared/IVersionable.sol +4 -47
- package/contracts/shared/NftOwnable.sol +67 -83
- package/contracts/shared/PolicyHolder.sol +81 -0
- package/contracts/shared/ProxyManager.sol +100 -25
- package/contracts/shared/Registerable.sol +16 -31
- package/contracts/shared/RegistryLinked.sol +48 -0
- package/contracts/shared/Service.sol +58 -0
- package/contracts/shared/TokenHandler.sol +33 -0
- package/contracts/shared/Versionable.sol +4 -92
- package/contracts/test/TestRegisterable.sol +1 -1
- package/contracts/test/TestRoleId.sol +1 -1
- package/contracts/test/TestService.sol +6 -7
- package/contracts/types/Blocknumber.sol +1 -0
- package/contracts/types/ClaimId.sol +52 -0
- package/contracts/types/DistributorType.sol +55 -0
- package/contracts/types/Fee.sol +1 -0
- package/contracts/types/Key32.sol +8 -3
- package/contracts/types/NftId.sol +8 -0
- package/contracts/types/NftIdSet.sol +26 -24
- package/contracts/types/NumberId.sol +52 -0
- package/contracts/types/ObjectType.sol +40 -14
- package/contracts/types/PayoutId.sol +54 -0
- package/contracts/types/Referral.sol +89 -0
- package/contracts/types/RoleId.sol +67 -15
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/StateId.sol +6 -1
- package/contracts/types/Timestamp.sol +17 -13
- package/contracts/types/UFixed.sol +1 -0
- package/contracts/types/Version.sol +5 -1
- package/package.json +3 -3
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +0 -301
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +0 -4
- package/artifacts/contracts/experiment/errors/Require.sol/Require.json +0 -105
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +0 -4
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.json +0 -105
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/A.sol/A.json +0 -128
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.json +0 -42
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/B.sol/B.json +0 -76
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/C.sol/C.json +0 -89
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.json +0 -128
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.json +0 -37
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.json +0 -63
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +0 -59
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.json +0 -124
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.json +0 -74
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +0 -124
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +0 -207
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +0 -4
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.json +0 -10
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +0 -4
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.json +0 -10
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.dbg.json +0 -4
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.json +0 -24
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -113
- package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +0 -4
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.json +0 -297
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.json +0 -297
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.json +0 -117
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.dbg.json +0 -4
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.json +0 -10
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.json +0 -10
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistribution.dbg.json +0 -4
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.json +0 -10
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicy.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.json +0 -271
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.json +0 -271
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.json +0 -164
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.json +0 -164
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.dbg.json +0 -4
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.json +0 -113
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.json +0 -131
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.json +0 -638
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.json +0 -76
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.json +0 -638
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -827
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +0 -4
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.json +0 -457
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.dbg.json +0 -4
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.json +0 -557
- package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +0 -4
- package/artifacts/contracts/test/TestPool.sol/TestPool.json +0 -716
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +0 -4
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +0 -744
- package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.json +0 -99
- package/contracts/components/BaseComponent.sol +0 -79
- package/contracts/components/IBaseComponent.sol +0 -19
- package/contracts/experiment/errors/Require.sol +0 -38
- package/contracts/experiment/errors/Revert.sol +0 -44
- package/contracts/experiment/inheritance/A.sol +0 -53
- package/contracts/experiment/inheritance/B.sol +0 -28
- package/contracts/experiment/inheritance/C.sol +0 -34
- package/contracts/experiment/inheritance/IA.sol +0 -13
- package/contracts/experiment/inheritance/IB.sol +0 -10
- package/contracts/experiment/inheritance/IC.sol +0 -12
- package/contracts/experiment/statemachine/Dummy.sol +0 -27
- package/contracts/experiment/statemachine/ISM.sol +0 -25
- package/contracts/experiment/statemachine/SM.sol +0 -57
- package/contracts/experiment/statemachine/SimpleStateMachine.sol +0 -31
- package/contracts/experiment/types/TypeA.sol +0 -47
- package/contracts/experiment/types/TypeB.sol +0 -29
- package/contracts/instance/IInstanceLinked.sol +0 -8
- package/contracts/instance/base/ComponentServiceBase.sol +0 -49
- package/contracts/instance/base/IInstanceBase.sol +0 -23
- package/contracts/instance/base/IService.sol +0 -15
- package/contracts/instance/base/InstanceBase.sol +0 -89
- package/contracts/instance/base/ModuleBase.sol +0 -57
- package/contracts/instance/base/ServiceBase.sol +0 -44
- package/contracts/instance/module/bundle/BundleModule.sol +0 -134
- package/contracts/instance/module/bundle/IBundle.sol +0 -53
- package/contracts/instance/module/component/ComponentModule.sol +0 -71
- package/contracts/instance/module/component/IComponent.sol +0 -28
- package/contracts/instance/module/distribution/DistributionModule.sol +0 -17
- package/contracts/instance/module/distribution/IDistribution.sol +0 -10
- package/contracts/instance/module/policy/IPolicy.sol +0 -63
- package/contracts/instance/module/policy/PolicyModule.sol +0 -91
- package/contracts/instance/module/pool/IPoolModule.sol +0 -41
- package/contracts/instance/module/pool/PoolModule.sol +0 -95
- package/contracts/instance/module/risk/IRisk.sol +0 -26
- package/contracts/instance/module/risk/RiskModule.sol +0 -62
- package/contracts/instance/module/treasury/ITreasury.sol +0 -84
- package/contracts/instance/module/treasury/TokenHandler.sol +0 -48
- package/contracts/instance/module/treasury/TreasuryModule.sol +0 -131
- package/contracts/instance/service/ComponentOwnerService.sol +0 -315
- package/contracts/instance/service/IComponentOwnerService.sol +0 -20
- package/contracts/registry/IChainNft.sol +0 -22
- package/contracts/test/TestDistribution.sol +0 -22
- package/contracts/test/TestPool.sol +0 -27
- package/contracts/test/TestProduct.sol +0 -74
- package/contracts/types/ReferralId.sol +0 -48
@@ -3,75 +3,105 @@ pragma solidity ^0.8.19;
|
|
3
3
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
5
|
|
6
|
-
import {IRisk} from "../instance/module/
|
7
|
-
import {
|
6
|
+
import {IRisk} from "../instance/module/IRisk.sol";
|
7
|
+
import {IApplicationService} from "../instance/service/IApplicationService.sol";
|
8
|
+
import {IPolicyService} from "../instance/service/IPolicyService.sol";
|
8
9
|
import {IProductService} from "../instance/service/IProductService.sol";
|
10
|
+
import {IClaimService} from "../instance/service/IClaimService.sol";
|
9
11
|
import {IProductComponent} from "./IProductComponent.sol";
|
10
|
-
import {NftId,
|
11
|
-
import {
|
12
|
-
import {ReferralId} from "../types/
|
12
|
+
import {NftId, NftIdLib} from "../types/NftId.sol";
|
13
|
+
import {PRODUCT, APPLICATION, POLICY, CLAIM } from "../types/ObjectType.sol";
|
14
|
+
import {ReferralId} from "../types/Referral.sol";
|
13
15
|
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
16
|
+
import {Seconds} from "../types/Seconds.sol";
|
14
17
|
import {StateId} from "../types/StateId.sol";
|
15
18
|
import {Timestamp} from "../types/Timestamp.sol";
|
16
|
-
import {Fee
|
17
|
-
import {
|
19
|
+
import {Fee} from "../types/Fee.sol";
|
20
|
+
import {Component} from "./Component.sol";
|
18
21
|
|
19
|
-
import {
|
20
|
-
import {IRegisterable} from "../shared/IRegisterable.sol";
|
21
|
-
import {Registerable} from "../shared/Registerable.sol";
|
22
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
22
23
|
|
23
|
-
import {
|
24
|
+
import {InstanceReader} from "../instance/InstanceReader.sol";
|
25
|
+
import {IPolicy} from "../instance/module/IPolicy.sol";
|
26
|
+
import {ISetup} from "../instance/module/ISetup.sol";
|
27
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
24
28
|
import {Pool} from "../components/Pool.sol";
|
29
|
+
import {Distribution} from "../components/Distribution.sol";
|
30
|
+
|
31
|
+
abstract contract Product is
|
32
|
+
Component,
|
33
|
+
IProductComponent
|
34
|
+
{
|
35
|
+
// keccak256(abi.encode(uint256(keccak256("etherisc.storage.Product")) - 1)) & ~bytes32(uint256(0xff));
|
36
|
+
bytes32 public constant PRODUCT_STORAGE_LOCATION_V1 = 0x0bb7aafdb8e380f81267337bc5b5dfdf76e6d3a380ecadb51ec665246d9d6800;
|
37
|
+
|
38
|
+
struct ProductStorage {
|
39
|
+
IProductService _productService;
|
40
|
+
IApplicationService _applicationService;
|
41
|
+
IPolicyService _policyService;
|
42
|
+
IClaimService _claimService;
|
43
|
+
Pool _pool;
|
44
|
+
Distribution _distribution;
|
45
|
+
Fee _initialProductFee;
|
46
|
+
Fee _initialProcessingFee;
|
47
|
+
TokenHandler _tokenHandler;
|
48
|
+
NftId _poolNftId;
|
49
|
+
NftId _distributionNftId;
|
50
|
+
}
|
25
51
|
|
26
|
-
|
27
|
-
IProductService internal _productService;
|
28
|
-
Pool internal _pool;
|
29
|
-
address internal _distribution;
|
30
|
-
Fee internal _initialProductFee;
|
31
|
-
Fee internal _initialProcessingFee;
|
32
|
-
|
33
|
-
NftId internal _poolNftId;
|
34
|
-
NftId internal _distributionNftId;
|
35
|
-
|
36
|
-
constructor(
|
52
|
+
function initializeProduct(
|
37
53
|
address registry,
|
38
|
-
NftId
|
54
|
+
NftId instanceNftId,
|
55
|
+
string memory name,
|
39
56
|
address token,
|
40
57
|
bool isInterceptor,
|
41
58
|
address pool,
|
42
59
|
address distribution,
|
43
60
|
Fee memory productFee,
|
44
61
|
Fee memory processingFee,
|
45
|
-
address initialOwner
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
_poolNftId = getRegistry().getNftId(address(_pool));
|
55
|
-
_distributionNftId = getRegistry().getNftId(_distribution);
|
62
|
+
address initialOwner,
|
63
|
+
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
64
|
+
)
|
65
|
+
public
|
66
|
+
virtual
|
67
|
+
onlyInitializing()
|
68
|
+
{
|
69
|
+
initializeComponent(registry, instanceNftId, name, token, PRODUCT(), isInterceptor, initialOwner, registryData);
|
56
70
|
|
57
|
-
|
71
|
+
ProductStorage storage $ = _getProductStorage();
|
72
|
+
// TODO add validation
|
73
|
+
// TODO refactor to go via registry
|
74
|
+
$._productService = IProductService(_getServiceAddress(PRODUCT()));
|
75
|
+
$._applicationService = IApplicationService(_getServiceAddress(APPLICATION()));
|
76
|
+
$._policyService = IPolicyService(_getServiceAddress(POLICY()));
|
77
|
+
$._claimService = IClaimService(_getServiceAddress(CLAIM()));
|
78
|
+
$._pool = Pool(pool);
|
79
|
+
$._distribution = Distribution(distribution);
|
80
|
+
$._initialProductFee = productFee;
|
81
|
+
$._initialProcessingFee = processingFee;
|
82
|
+
$._tokenHandler = new TokenHandler(token);
|
83
|
+
$._poolNftId = getRegistry().getNftId(pool);
|
84
|
+
$._distributionNftId = getRegistry().getNftId(distribution);
|
85
|
+
|
86
|
+
registerInterface(type(IProductComponent).interfaceId);
|
58
87
|
}
|
59
88
|
|
60
89
|
|
61
90
|
function calculatePremium(
|
62
91
|
uint256 sumInsuredAmount,
|
63
92
|
RiskId riskId,
|
64
|
-
|
93
|
+
Seconds lifetime,
|
65
94
|
bytes memory applicationData,
|
66
|
-
|
67
|
-
|
95
|
+
NftId bundleNftId,
|
96
|
+
ReferralId referralId
|
68
97
|
)
|
69
98
|
external
|
70
99
|
view
|
71
100
|
override
|
72
101
|
returns (uint256 premiumAmount)
|
73
102
|
{
|
74
|
-
|
103
|
+
IPolicy.Premium memory premium = _getProductStorage()._applicationService.calculatePremium(
|
104
|
+
getNftId(),
|
75
105
|
riskId,
|
76
106
|
sumInsuredAmount,
|
77
107
|
lifetime,
|
@@ -79,13 +109,14 @@ contract Product is BaseComponent, IProductComponent {
|
|
79
109
|
bundleNftId,
|
80
110
|
referralId
|
81
111
|
);
|
112
|
+
premiumAmount = premium.premiumAmount;
|
82
113
|
}
|
83
114
|
|
84
115
|
|
85
116
|
function calculateNetPremium(
|
86
117
|
uint256 sumInsuredAmount,
|
87
118
|
RiskId riskId,
|
88
|
-
|
119
|
+
Seconds lifetime,
|
89
120
|
bytes memory applicationData
|
90
121
|
)
|
91
122
|
external
|
@@ -105,19 +136,19 @@ contract Product is BaseComponent, IProductComponent {
|
|
105
136
|
RiskId id,
|
106
137
|
bytes memory data
|
107
138
|
) internal {
|
108
|
-
|
139
|
+
_getProductService().createRisk(
|
109
140
|
id,
|
110
141
|
data
|
111
142
|
);
|
112
143
|
}
|
113
144
|
|
114
|
-
function
|
145
|
+
function _updateRisk(
|
115
146
|
RiskId id,
|
116
|
-
|
147
|
+
bytes memory data
|
117
148
|
) internal {
|
118
|
-
|
149
|
+
_getProductService().updateRisk(
|
119
150
|
id,
|
120
|
-
|
151
|
+
data
|
121
152
|
);
|
122
153
|
}
|
123
154
|
|
@@ -125,33 +156,36 @@ contract Product is BaseComponent, IProductComponent {
|
|
125
156
|
RiskId id,
|
126
157
|
StateId state
|
127
158
|
) internal {
|
128
|
-
|
159
|
+
_getProductService().updateRiskState(
|
129
160
|
id,
|
130
161
|
state
|
131
162
|
);
|
132
163
|
}
|
133
164
|
|
134
165
|
function _getRiskInfo(RiskId id) internal view returns (IRisk.RiskInfo memory info) {
|
135
|
-
return
|
166
|
+
return getInstance().getInstanceReader().getRiskInfo(id);
|
136
167
|
}
|
137
168
|
|
138
169
|
function _createApplication(
|
139
170
|
address applicationOwner,
|
140
171
|
RiskId riskId,
|
141
172
|
uint256 sumInsuredAmount,
|
142
|
-
|
143
|
-
bytes memory applicationData,
|
173
|
+
Seconds lifetime,
|
144
174
|
NftId bundleNftId,
|
145
|
-
ReferralId referralId
|
146
|
-
|
147
|
-
|
175
|
+
ReferralId referralId,
|
176
|
+
bytes memory applicationData
|
177
|
+
)
|
178
|
+
internal
|
179
|
+
returns (NftId applicationNftId)
|
180
|
+
{
|
181
|
+
return _getProductStorage()._applicationService.create(
|
148
182
|
applicationOwner,
|
149
183
|
riskId,
|
150
184
|
sumInsuredAmount,
|
151
185
|
lifetime,
|
152
|
-
applicationData,
|
153
186
|
bundleNftId,
|
154
|
-
referralId
|
187
|
+
referralId,
|
188
|
+
applicationData
|
155
189
|
);
|
156
190
|
}
|
157
191
|
|
@@ -162,7 +196,7 @@ contract Product is BaseComponent, IProductComponent {
|
|
162
196
|
)
|
163
197
|
internal
|
164
198
|
{
|
165
|
-
|
199
|
+
_getProductStorage()._policyService.underwrite(
|
166
200
|
policyNftId,
|
167
201
|
requirePremiumPayment,
|
168
202
|
activateAt);
|
@@ -174,7 +208,7 @@ contract Product is BaseComponent, IProductComponent {
|
|
174
208
|
)
|
175
209
|
internal
|
176
210
|
{
|
177
|
-
|
211
|
+
_getProductStorage()._policyService.collectPremium(
|
178
212
|
policyNftId,
|
179
213
|
activateAt);
|
180
214
|
}
|
@@ -185,17 +219,25 @@ contract Product is BaseComponent, IProductComponent {
|
|
185
219
|
)
|
186
220
|
internal
|
187
221
|
{
|
188
|
-
|
222
|
+
_getProductStorage()._policyService.activate(
|
189
223
|
policyNftId,
|
190
224
|
activateAt);
|
191
225
|
}
|
192
226
|
|
227
|
+
function _close(
|
228
|
+
NftId policyNftId
|
229
|
+
)
|
230
|
+
internal
|
231
|
+
{
|
232
|
+
_getProductStorage()._policyService.close(policyNftId);
|
233
|
+
}
|
234
|
+
|
193
235
|
function getPoolNftId() external view override returns (NftId poolNftId) {
|
194
|
-
return getRegistry().getNftId(address(_pool));
|
236
|
+
return getRegistry().getNftId(address(_getProductStorage()._pool));
|
195
237
|
}
|
196
238
|
|
197
239
|
function getDistributionNftId() external view override returns (NftId distributionNftId) {
|
198
|
-
return getRegistry().getNftId(_distribution);
|
240
|
+
return getRegistry().getNftId(address(_getProductStorage()._distribution));
|
199
241
|
}
|
200
242
|
|
201
243
|
// from product component
|
@@ -205,95 +247,47 @@ contract Product is BaseComponent, IProductComponent {
|
|
205
247
|
)
|
206
248
|
external
|
207
249
|
onlyOwner
|
250
|
+
restricted()
|
208
251
|
override
|
209
252
|
{
|
210
|
-
|
253
|
+
_getProductService().setFees(productFee, processingFee);
|
211
254
|
}
|
212
255
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
NftId productNftId = getNftId();
|
221
|
-
if (_instance.hasTreasuryInfo(productNftId)) {
|
222
|
-
return _instance.getTreasuryInfo(productNftId).productFee;
|
223
|
-
} else {
|
224
|
-
return _initialProductFee;
|
256
|
+
function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
257
|
+
InstanceReader reader = getInstance().getInstanceReader();
|
258
|
+
setupInfo = reader.getProductSetupInfo(getNftId());
|
259
|
+
|
260
|
+
// fallback to initial setup info (wallet is always != address(0))
|
261
|
+
if(setupInfo.wallet == address(0)) {
|
262
|
+
setupInfo = _getInitialSetupInfo();
|
225
263
|
}
|
226
264
|
}
|
227
265
|
|
228
|
-
function
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
266
|
+
function _getInitialSetupInfo() internal view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
267
|
+
ProductStorage storage $ = _getProductStorage();
|
268
|
+
|
269
|
+
ISetup.DistributionSetupInfo memory distributionSetupInfo = $._distribution.getSetupInfo();
|
270
|
+
IComponents.PoolInfo memory poolInfo = $._pool.getPoolInfo();
|
271
|
+
|
272
|
+
return ISetup.ProductSetupInfo(
|
273
|
+
getToken(),
|
274
|
+
$._tokenHandler,
|
275
|
+
$._distributionNftId,
|
276
|
+
$._poolNftId,
|
277
|
+
$._initialProductFee,
|
278
|
+
$._initialProcessingFee,
|
279
|
+
false,
|
280
|
+
getWallet()
|
281
|
+
);
|
240
282
|
}
|
241
283
|
|
242
|
-
|
284
|
+
function _getProductStorage() private pure returns (ProductStorage storage $) {
|
285
|
+
assembly {
|
286
|
+
$.slot := PRODUCT_STORAGE_LOCATION_V1
|
287
|
+
}
|
288
|
+
}
|
243
289
|
|
244
|
-
|
245
|
-
|
246
|
-
public
|
247
|
-
view
|
248
|
-
override (IRegisterable, Registerable)
|
249
|
-
returns (IRegistry.ObjectInfo memory, bytes memory)
|
250
|
-
{
|
251
|
-
// from Registerable
|
252
|
-
(
|
253
|
-
IRegistry.ObjectInfo memory productInfo,
|
254
|
-
bytes memory data
|
255
|
-
) = super.getInitialInfo();
|
256
|
-
|
257
|
-
// TODO read pool & distribution fees
|
258
|
-
// 1) from pool -> the only option -> pool must be registered first?
|
259
|
-
// 2) from instance -> all fees are set into instance at product registration which is ongoing here
|
260
|
-
// checks are done in registryProduct() where THIS function is called
|
261
|
-
//require(getRegistry().getObjectInfo(_poolNftId).objectType == POOL(), "POOL_NOT_REGISTERED");
|
262
|
-
//require(getRegistry().getObjectInfo(_distributionNftId).objectType == DISTRIBUTION(), "DISTRIBUTION_NOT_REGISTERED");
|
263
|
-
|
264
|
-
// from PoolComponent
|
265
|
-
(
|
266
|
-
IRegistry.ObjectInfo memory poolInfo,
|
267
|
-
bytes memory poolData
|
268
|
-
) = _pool.getInitialInfo();
|
269
|
-
|
270
|
-
(
|
271
|
-
/*IPool.PoolInfo memory info*/,
|
272
|
-
/*address wallet*/,
|
273
|
-
/*IERC20Metadata token*/,
|
274
|
-
Fee memory initialPoolFee,
|
275
|
-
Fee memory initialStakingFee,
|
276
|
-
Fee memory initialPerformanceFee
|
277
|
-
) = abi.decode(poolData, (IPool.PoolInfo, address, IERC20Metadata, Fee, Fee, Fee));
|
278
|
-
|
279
|
-
// TODO from DistributionComponent
|
280
|
-
|
281
|
-
return (
|
282
|
-
productInfo,
|
283
|
-
abi.encode(
|
284
|
-
ITreasury.TreasuryInfo(
|
285
|
-
_poolNftId,
|
286
|
-
_distributionNftId,
|
287
|
-
_token,
|
288
|
-
_initialProductFee,
|
289
|
-
_initialProcessingFee,
|
290
|
-
initialPoolFee,
|
291
|
-
initialStakingFee,
|
292
|
-
initialPerformanceFee,
|
293
|
-
FeeLib.zeroFee()//_instance.getDistributionFee(_distributionNftId)
|
294
|
-
),
|
295
|
-
_wallet
|
296
|
-
)
|
297
|
-
);
|
290
|
+
function _getProductService() internal view returns (IProductService) {
|
291
|
+
return _getProductStorage()._productService;
|
298
292
|
}
|
299
293
|
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {AccessManagerUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagerUpgradeable.sol";
|
5
|
+
|
6
|
+
|
7
|
+
contract AccessManagerUpgradeableInitializeable is AccessManagerUpgradeable {
|
8
|
+
|
9
|
+
function initialize(address initialAdmin) initializer public {
|
10
|
+
__AccessManager_init(initialAdmin);
|
11
|
+
}
|
12
|
+
|
13
|
+
}
|
@@ -0,0 +1,127 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {IInstance} from "./IInstance.sol";
|
5
|
+
import {INSTANCE} from "../types/ObjectType.sol";
|
6
|
+
import {InstanceReader} from "./InstanceReader.sol";
|
7
|
+
import {IPolicy} from "../instance/module/IPolicy.sol";
|
8
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
9
|
+
import {LibNftIdSet} from "../types/NftIdSet.sol";
|
10
|
+
import {NftId} from "../types/NftId.sol";
|
11
|
+
import {TimestampLib} from "../types/Timestamp.sol";
|
12
|
+
|
13
|
+
import {ObjectManager} from "./ObjectManager.sol";
|
14
|
+
|
15
|
+
contract BundleManager is
|
16
|
+
ObjectManager
|
17
|
+
{
|
18
|
+
|
19
|
+
event LogBundleManagerPolicyLinked(NftId bundleNftId, NftId policyNftId);
|
20
|
+
event LogBundleManagerPolicyUnlinked(NftId bundleNftId, NftId policyNftId);
|
21
|
+
|
22
|
+
event LogBundleManagerBundleAdded(NftId poolNftId, NftId bundleNftId);
|
23
|
+
event LogBundleManagerBundleUnlocked(NftId poolNftId, NftId bundleNftId);
|
24
|
+
event LogBundleManagerBundleLocked(NftId poolNftId, NftId bundleNftId);
|
25
|
+
event LogBundleManagerBundleClosed(NftId poolNftId, NftId bundleNftId);
|
26
|
+
|
27
|
+
error ErrorBundleManagerPolicyAlreadyActivated(NftId policyNftId);
|
28
|
+
error ErrorBundleManagerBundleLocked(NftId bundleNftId, NftId policyNftId);
|
29
|
+
error ErrorBundleManagerPolicyWithOpenClaims(NftId policyNftId, uint256 openClaimsCount);
|
30
|
+
error ErrorBundleManagerPolicyNotCloseable(NftId policyNftId);
|
31
|
+
error ErrorBundleManagerBundleUnknown(NftId bundleNftId);
|
32
|
+
error ErrorBundleManagerBundleNotRegistered(NftId bundleNftId);
|
33
|
+
|
34
|
+
mapping(NftId bundleNftId => LibNftIdSet.Set policies) internal _activePolicies;
|
35
|
+
|
36
|
+
/// @dev links a policy to its bundle
|
37
|
+
// to link a policy it MUST NOT yet have been activated
|
38
|
+
// the bundle MUST be unlocked (active) for linking (underwriting) and registered with this instance
|
39
|
+
function linkPolicy(NftId policyNftId) external restricted() {
|
40
|
+
NftId bundleNftId = _instance.getInstanceReader().getPolicyInfo(policyNftId).bundleNftId;
|
41
|
+
// decision will likely depend on the decision what to check here and what in the service
|
42
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
43
|
+
|
44
|
+
// ensure bundle is unlocked (in active set) and registered with this instance
|
45
|
+
if (!_isActive(poolNftId, bundleNftId)) {
|
46
|
+
revert ErrorBundleManagerBundleLocked(bundleNftId, policyNftId);
|
47
|
+
}
|
48
|
+
|
49
|
+
LibNftIdSet.add(_activePolicies[bundleNftId], policyNftId);
|
50
|
+
emit LogBundleManagerPolicyLinked(bundleNftId, policyNftId);
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
/// @dev unlinks a policy from its bundle
|
55
|
+
// to unlink a policy it must closable, ie. meet one of the following criterias
|
56
|
+
// - the policy MUST be past its expiry period and it MUST NOT have any open claims
|
57
|
+
// - the policy's payoutAmount MUST be equal to its sumInsuredAmount and MUST NOT have any open claims
|
58
|
+
function unlinkPolicy(NftId policyNftId) external restricted() {
|
59
|
+
IPolicy.PolicyInfo memory policyInfo = _instance.getInstanceReader().getPolicyInfo(policyNftId);
|
60
|
+
|
61
|
+
NftId bundleNftId = policyInfo.bundleNftId;
|
62
|
+
// decision will likely depend on the decision what to check here and what in the service
|
63
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
64
|
+
|
65
|
+
// ensure bundle is registered with this instance
|
66
|
+
if (!_contains(poolNftId, bundleNftId)) {
|
67
|
+
revert ErrorBundleManagerBundleUnknown(bundleNftId);
|
68
|
+
}
|
69
|
+
|
70
|
+
LibNftIdSet.remove(_activePolicies[bundleNftId], policyNftId);
|
71
|
+
emit LogBundleManagerPolicyUnlinked(policyInfo.bundleNftId, policyNftId);
|
72
|
+
}
|
73
|
+
|
74
|
+
|
75
|
+
/// @dev add a new bundle to a pool registerd with this instance
|
76
|
+
// the corresponding pool is fetched via instance reader
|
77
|
+
function add(NftId bundleNftId) external restricted() {
|
78
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
79
|
+
|
80
|
+
// ensure pool is registered with instance
|
81
|
+
if(poolNftId.eqz()) {
|
82
|
+
revert ErrorBundleManagerBundleNotRegistered(bundleNftId);
|
83
|
+
}
|
84
|
+
|
85
|
+
_add(poolNftId, bundleNftId);
|
86
|
+
emit LogBundleManagerBundleAdded(poolNftId, bundleNftId);
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
/// @dev unlocked (active) bundles are available to underwrite new policies
|
91
|
+
function unlock(NftId bundleNftId) external restricted() {
|
92
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
93
|
+
_activate(poolNftId, bundleNftId);
|
94
|
+
emit LogBundleManagerBundleUnlocked(poolNftId, bundleNftId);
|
95
|
+
}
|
96
|
+
|
97
|
+
/// @dev locked (deactivated) bundles may not underwrite any new policies
|
98
|
+
function lock(NftId bundleNftId) external restricted() {
|
99
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
100
|
+
_deactivate(poolNftId, bundleNftId);
|
101
|
+
emit LogBundleManagerBundleLocked(poolNftId, bundleNftId);
|
102
|
+
}
|
103
|
+
|
104
|
+
function bundles(NftId poolNftId) external view returns(uint256) {
|
105
|
+
return _objects(poolNftId);
|
106
|
+
}
|
107
|
+
|
108
|
+
function getBundleNftId(NftId poolNftId, uint256 idx) external view returns(NftId bundleNftId) {
|
109
|
+
return _getObject(poolNftId, idx);
|
110
|
+
}
|
111
|
+
|
112
|
+
function activeBundles(NftId poolNftId) external view returns(uint256) {
|
113
|
+
return _activeObjs(poolNftId);
|
114
|
+
}
|
115
|
+
|
116
|
+
function getActiveBundleNftId(NftId poolNftId, uint256 idx) external view returns(NftId bundleNftId) {
|
117
|
+
return _getActiveObject(poolNftId, idx);
|
118
|
+
}
|
119
|
+
|
120
|
+
function activePolicies(NftId bundleNftId) external view returns(uint256) {
|
121
|
+
return LibNftIdSet.size(_activePolicies[bundleNftId]);
|
122
|
+
}
|
123
|
+
|
124
|
+
function getActivePolicy(NftId bundleNftId, uint256 idx) external view returns(NftId policyNftId) {
|
125
|
+
return LibNftIdSet.getElementAt(_activePolicies[bundleNftId], idx);
|
126
|
+
}
|
127
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
|
5
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
6
|
+
|
7
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
8
|
+
|
9
|
+
abstract contract Cloneable is
|
10
|
+
AccessManagedUpgradeable
|
11
|
+
{
|
12
|
+
event CloneableInitialized(address authority, address registry);
|
13
|
+
|
14
|
+
error CloneableAuthorityZero();
|
15
|
+
error CloneableRegistryInvalid(address registry);
|
16
|
+
|
17
|
+
IRegistry internal _registry;
|
18
|
+
|
19
|
+
constructor() {
|
20
|
+
_registry = IRegistry(address(0));
|
21
|
+
}
|
22
|
+
|
23
|
+
/// @dev call to initialize MUST be made in the same transaction as cloning of the contract
|
24
|
+
function initialize(
|
25
|
+
address authority,
|
26
|
+
address registry
|
27
|
+
)
|
28
|
+
public
|
29
|
+
onlyInitializing
|
30
|
+
{
|
31
|
+
// check/handle access managed
|
32
|
+
if(authority == address(0)) {
|
33
|
+
revert CloneableAuthorityZero();
|
34
|
+
}
|
35
|
+
|
36
|
+
__AccessManaged_init(authority);
|
37
|
+
|
38
|
+
// check/handle registry
|
39
|
+
if (registry.code.length == 0) {
|
40
|
+
revert CloneableRegistryInvalid(registry);
|
41
|
+
}
|
42
|
+
|
43
|
+
_registry = IRegistry(registry);
|
44
|
+
|
45
|
+
emit CloneableInitialized(authority, registry);
|
46
|
+
}
|
47
|
+
|
48
|
+
function getRegistry() external view returns (IRegistry) {
|
49
|
+
return _registry;
|
50
|
+
}
|
51
|
+
}
|