@etherisc/gif-next 0.0.2-d2fd9d7-008 → 0.0.2-d30275e-758
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +28 -14
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/components/Component.sol/Component.json +842 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +946 -219
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +605 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +848 -31
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +846 -57
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +682 -9
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +806 -243
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +632 -194
- 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 +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +69 -66
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +5 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +303 -1340
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +337 -168
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +439 -3102
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +609 -178
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +124 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +251 -270
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +457 -402
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +292 -131
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +2663 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +11 -27
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/instance/base/{ComponentServiceBase.sol/ComponentServiceBase.json → ComponentService.sol/ComponentService.json} +277 -178
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +40 -10
- 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 +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +71 -45
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.json +10 -0
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +902 -0
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +649 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +1326 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +725 -0
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +1072 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +685 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +1022 -223
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +392 -79
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/{IComponentOwnerService.sol/IComponentOwnerService.json → IApplicationService.sol/IApplicationService.json} +235 -200
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +714 -0
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +602 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +585 -160
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +969 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +536 -304
- package/artifacts/contracts/instance/service/IPricingService.sol/IPricingService.dbg.json +4 -0
- package/artifacts/contracts/{shared/RegisterableUpgradable.sol/RegisterableUpgradable.json → instance/service/IPricingService.sol/IPricingService.json} +248 -172
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +78 -388
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +1575 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +741 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +832 -400
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +338 -93
- package/artifacts/contracts/instance/service/PricingService.sol/PricingService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PricingService.sol/PricingService.json +988 -0
- package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.json +689 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +289 -564
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +289 -124
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +15 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +244 -133
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +149 -230
- 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 +257 -235
- 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 +200 -335
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +298 -145
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +559 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +141 -53
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +41 -3
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +40 -29
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +129 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +21 -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 +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +86 -172
- 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 +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +191 -163
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
- 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 +6 -6
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +210 -214
- 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 -190
- 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/Amount.sol/AmountLib.dbg.json +4 -0
- package/artifacts/contracts/types/Amount.sol/AmountLib.json +209 -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/ClaimId.sol/ClaimIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +179 -0
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +40 -9
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +17 -4
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +209 -0
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +23 -4
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/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 +2 -2
- package/contracts/components/Component.sol +253 -0
- package/contracts/components/Distribution.sol +204 -83
- package/contracts/components/IComponent.sol +76 -0
- package/contracts/components/IDistributionComponent.sol +44 -17
- package/contracts/components/IPoolComponent.sol +88 -41
- package/contracts/components/IProductComponent.sol +10 -5
- package/contracts/components/Pool.sol +217 -182
- package/contracts/components/Product.sol +248 -163
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
- package/contracts/instance/BundleManager.sol +17 -20
- package/contracts/instance/Cloneable.sol +7 -2
- package/contracts/instance/IInstance.sol +57 -33
- package/contracts/instance/IInstanceService.sol +56 -9
- package/contracts/instance/Instance.sol +150 -367
- package/contracts/instance/InstanceAccessManager.sol +430 -177
- package/contracts/instance/InstanceAuthorizationsLib.sol +300 -0
- package/contracts/instance/InstanceReader.sol +44 -39
- package/contracts/instance/InstanceService.sol +243 -166
- package/contracts/instance/InstanceServiceManager.sol +6 -9
- package/contracts/instance/InstanceStore.sol +208 -0
- package/contracts/instance/ObjectManager.sol +11 -24
- package/contracts/instance/base/ComponentService.sol +148 -0
- package/contracts/instance/base/KeyValueStore.sol +13 -5
- package/contracts/instance/base/Lifecycle.sol +23 -6
- package/contracts/instance/module/IAccess.sol +36 -20
- package/contracts/instance/module/IBundle.sol +8 -5
- package/contracts/instance/module/IComponents.sol +41 -0
- package/contracts/instance/module/IDistribution.sol +2 -0
- package/contracts/instance/module/IPolicy.sol +41 -9
- package/contracts/instance/module/ISetup.sol +7 -20
- package/contracts/instance/service/ApplicationService.sol +185 -0
- package/contracts/instance/service/ApplicationServiceManager.sol +35 -0
- package/contracts/instance/service/BundleService.sol +440 -0
- package/contracts/instance/service/BundleServiceManager.sol +51 -0
- package/contracts/instance/service/ClaimService.sol +239 -0
- package/contracts/instance/service/ClaimServiceManager.sol +35 -0
- package/contracts/instance/service/DistributionService.sol +287 -33
- package/contracts/instance/service/DistributionServiceManager.sol +7 -10
- package/contracts/instance/service/IApplicationService.sol +61 -0
- package/contracts/instance/service/IBundleService.sol +102 -0
- package/contracts/instance/service/IClaimService.sol +92 -0
- package/contracts/instance/service/IDistributionService.sol +74 -1
- package/contracts/instance/service/IPolicyService.sol +139 -0
- package/contracts/instance/service/IPoolService.sol +76 -25
- package/contracts/instance/service/IPricingService.sol +36 -0
- package/contracts/instance/service/IProductService.sol +2 -72
- package/contracts/instance/service/PolicyService.sol +577 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +232 -183
- package/contracts/instance/service/PoolServiceManager.sol +6 -9
- package/contracts/instance/service/PricingService.sol +275 -0
- package/contracts/instance/service/PricingServiceManager.sol +51 -0
- package/contracts/instance/service/ProductService.sol +109 -469
- package/contracts/instance/service/ProductServiceManager.sol +2 -2
- package/contracts/registry/ChainNft.sol +9 -1
- package/contracts/registry/IRegistry.sol +39 -19
- package/contracts/registry/IRegistryService.sol +31 -13
- package/contracts/registry/ITransferInterceptor.sol +1 -0
- package/contracts/registry/Registry.sol +243 -224
- package/contracts/registry/RegistryAccessManager.sol +216 -0
- package/contracts/registry/RegistryService.sol +101 -173
- package/contracts/registry/RegistryServiceManager.sol +21 -39
- package/contracts/registry/ReleaseManager.sol +324 -0
- package/contracts/registry/TokenRegistry.sol +22 -17
- package/contracts/shared/ERC165.sol +14 -12
- package/contracts/shared/INftOwnable.sol +11 -10
- package/contracts/shared/IPolicyHolder.sol +26 -0
- package/contracts/shared/IRegisterable.sol +4 -6
- package/contracts/shared/IRegistryLinked.sol +12 -0
- package/contracts/shared/IService.sol +5 -4
- package/contracts/shared/IVersionable.sol +4 -47
- package/contracts/shared/NftOwnable.sol +66 -80
- package/contracts/shared/PolicyHolder.sol +81 -0
- package/contracts/shared/ProxyManager.sol +100 -25
- package/contracts/shared/Registerable.sol +16 -32
- package/contracts/shared/RegistryLinked.sol +48 -0
- package/contracts/shared/Service.sol +41 -24
- package/contracts/shared/TokenHandler.sol +11 -5
- package/contracts/shared/Versionable.sol +4 -92
- package/contracts/test/TestRegisterable.sol +1 -1
- package/contracts/test/TestService.sol +4 -3
- package/contracts/types/Amount.sol +70 -0
- package/contracts/types/Blocknumber.sol +1 -0
- package/contracts/types/ClaimId.sol +75 -0
- package/contracts/types/DistributorType.sol +2 -2
- package/contracts/types/Fee.sol +13 -5
- package/contracts/types/NftId.sol +8 -0
- package/contracts/types/ObjectType.sol +16 -7
- package/contracts/types/PayoutId.sol +82 -0
- package/contracts/types/Referral.sol +4 -0
- package/contracts/types/RoleId.sol +26 -19
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/StateId.sol +7 -2
- package/contracts/types/Timestamp.sol +18 -13
- package/contracts/types/UFixed.sol +1 -0
- package/contracts/types/Version.sol +1 -0
- 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 -327
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +0 -280
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.json +0 -66
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.json +0 -24
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.json +0 -42
- 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/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.json +0 -101
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.json +0 -1132
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.json +0 -1082
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -113
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -827
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
- package/contracts/components/BaseComponent.sol +0 -91
- package/contracts/components/IBaseComponent.sol +0 -25
- package/contracts/experiment/cloning/Cloner.sol +0 -47
- 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/AccessManagedSimple.sol +0 -115
- package/contracts/instance/AccessManagerSimple.sol +0 -692
- package/contracts/instance/IAccessManagerSimple.sol +0 -391
- package/contracts/instance/base/ComponentServiceBase.sol +0 -134
- package/contracts/instance/base/IInstanceBase.sol +0 -23
- package/contracts/instance/service/ComponentOwnerService.sol +0 -317
- package/contracts/instance/service/IComponentOwnerService.sol +0 -20
- package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -3,119 +3,113 @@ pragma solidity ^0.8.19;
|
|
3
3
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
5
|
|
6
|
+
import {Amount} from "../types/Amount.sol";
|
7
|
+
import {ClaimId} from "../types/ClaimId.sol";
|
8
|
+
import {Component} from "./Component.sol";
|
9
|
+
import {Fee} from "../types/Fee.sol";
|
6
10
|
import {IRisk} from "../instance/module/IRisk.sol";
|
7
|
-
import {
|
11
|
+
import {IApplicationService} from "../instance/service/IApplicationService.sol";
|
12
|
+
import {IPolicyService} from "../instance/service/IPolicyService.sol";
|
8
13
|
import {IProductService} from "../instance/service/IProductService.sol";
|
14
|
+
import {IClaimService} from "../instance/service/IClaimService.sol";
|
15
|
+
import {IPricingService} from "../instance/service/IPricingService.sol";
|
9
16
|
import {IProductComponent} from "./IProductComponent.sol";
|
10
|
-
import {NftId,
|
11
|
-
import {
|
17
|
+
import {NftId, NftIdLib} from "../types/NftId.sol";
|
18
|
+
import {PayoutId} from "../types/PayoutId.sol";
|
19
|
+
import {PRODUCT, APPLICATION, POLICY, CLAIM, PRICE } from "../types/ObjectType.sol";
|
12
20
|
import {ReferralId} from "../types/Referral.sol";
|
13
21
|
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
22
|
+
import {Seconds} from "../types/Seconds.sol";
|
14
23
|
import {StateId} from "../types/StateId.sol";
|
15
24
|
import {Timestamp} from "../types/Timestamp.sol";
|
16
|
-
import {Fee, FeeLib} from "../types/Fee.sol";
|
17
|
-
import {BaseComponent} from "./BaseComponent.sol";
|
18
25
|
|
19
|
-
import {IRegistry} from "../registry/IRegistry.sol";
|
20
|
-
import {IRegisterable} from "../shared/IRegisterable.sol";
|
21
|
-
import {Registerable} from "../shared/Registerable.sol";
|
22
26
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
23
27
|
|
24
28
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
29
|
+
import {IPolicy} from "../instance/module/IPolicy.sol";
|
25
30
|
import {ISetup} from "../instance/module/ISetup.sol";
|
31
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
26
32
|
import {Pool} from "../components/Pool.sol";
|
27
33
|
import {Distribution} from "../components/Distribution.sol";
|
28
34
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
35
|
+
abstract contract Product is
|
36
|
+
Component,
|
37
|
+
IProductComponent
|
38
|
+
{
|
39
|
+
// keccak256(abi.encode(uint256(keccak256("etherisc.storage.Product")) - 1)) & ~bytes32(uint256(0xff));
|
40
|
+
bytes32 public constant PRODUCT_STORAGE_LOCATION_V1 = 0x0bb7aafdb8e380f81267337bc5b5dfdf76e6d3a380ecadb51ec665246d9d6800;
|
41
|
+
|
42
|
+
struct ProductStorage {
|
43
|
+
IProductService _productService;
|
44
|
+
IApplicationService _applicationService;
|
45
|
+
IPolicyService _policyService;
|
46
|
+
IClaimService _claimService;
|
47
|
+
IPricingService _pricingService;
|
48
|
+
Pool _pool;
|
49
|
+
Distribution _distribution;
|
50
|
+
Fee _initialProductFee;
|
51
|
+
Fee _initialProcessingFee;
|
52
|
+
TokenHandler _tokenHandler;
|
53
|
+
NftId _poolNftId;
|
54
|
+
NftId _distributionNftId;
|
55
|
+
}
|
43
56
|
|
44
|
-
|
57
|
+
function initializeProduct(
|
45
58
|
address registry,
|
46
|
-
NftId
|
59
|
+
NftId instanceNftId,
|
60
|
+
string memory name,
|
47
61
|
address token,
|
48
62
|
bool isInterceptor,
|
49
63
|
address pool,
|
50
64
|
address distribution,
|
51
65
|
Fee memory productFee,
|
52
66
|
Fee memory processingFee,
|
53
|
-
address initialOwner
|
54
|
-
|
55
|
-
// TODO add validation
|
56
|
-
_productService = _instance.getProductService();
|
57
|
-
_pool = Pool(pool);
|
58
|
-
_distribution = Distribution(distribution);
|
59
|
-
_initialProductFee = productFee;
|
60
|
-
_initialProcessingFee = processingFee;
|
61
|
-
|
62
|
-
_tokenHandler = new TokenHandler(token);
|
63
|
-
|
64
|
-
_poolNftId = getRegistry().getNftId(address(_pool));
|
65
|
-
_distributionNftId = getRegistry().getNftId(address(_distribution));
|
66
|
-
|
67
|
-
_registerInterface(type(IProductComponent).interfaceId);
|
68
|
-
}
|
69
|
-
|
70
|
-
|
71
|
-
function calculatePremium(
|
72
|
-
uint256 sumInsuredAmount,
|
73
|
-
RiskId riskId,
|
74
|
-
uint256 lifetime,
|
75
|
-
bytes memory applicationData,
|
76
|
-
ReferralId referralId,
|
77
|
-
NftId bundleNftId
|
67
|
+
address initialOwner,
|
68
|
+
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
78
69
|
)
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
returns (uint256 premiumAmount)
|
70
|
+
public
|
71
|
+
virtual
|
72
|
+
onlyInitializing()
|
83
73
|
{
|
84
|
-
(
|
85
|
-
riskId,
|
86
|
-
sumInsuredAmount,
|
87
|
-
lifetime,
|
88
|
-
applicationData,
|
89
|
-
bundleNftId,
|
90
|
-
referralId
|
91
|
-
);
|
92
|
-
}
|
74
|
+
initializeComponent(registry, instanceNftId, name, token, PRODUCT(), isInterceptor, initialOwner, registryData);
|
93
75
|
|
76
|
+
ProductStorage storage $ = _getProductStorage();
|
77
|
+
// TODO add validation
|
78
|
+
// TODO refactor to go via registry ?
|
79
|
+
$._productService = IProductService(_getServiceAddress(PRODUCT()));
|
80
|
+
$._applicationService = IApplicationService(_getServiceAddress(APPLICATION()));
|
81
|
+
$._policyService = IPolicyService(_getServiceAddress(POLICY()));
|
82
|
+
$._claimService = IClaimService(_getServiceAddress(CLAIM()));
|
83
|
+
$._pricingService = IPricingService(_getServiceAddress(PRICE()));
|
84
|
+
$._pool = Pool(pool);
|
85
|
+
$._distribution = Distribution(distribution);
|
86
|
+
$._initialProductFee = productFee;
|
87
|
+
$._initialProcessingFee = processingFee;
|
88
|
+
$._tokenHandler = new TokenHandler(token);
|
89
|
+
$._poolNftId = getRegistry().getNftId(pool);
|
90
|
+
$._distributionNftId = getRegistry().getNftId(distribution);
|
91
|
+
|
92
|
+
registerInterface(type(IProductComponent).interfaceId);
|
93
|
+
}
|
94
94
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
bytes memory applicationData
|
95
|
+
// from product component
|
96
|
+
function setFees(
|
97
|
+
Fee memory productFee,
|
98
|
+
Fee memory processingFee
|
100
99
|
)
|
101
100
|
external
|
102
|
-
|
103
|
-
|
104
|
-
|
101
|
+
onlyOwner
|
102
|
+
restricted()
|
103
|
+
override
|
105
104
|
{
|
106
|
-
|
107
|
-
return sumInsuredAmount / 10;
|
108
|
-
}
|
109
|
-
|
110
|
-
function _toRiskId(string memory riskName) internal pure returns (RiskId riskId) {
|
111
|
-
return RiskIdLib.toRiskId(riskName);
|
105
|
+
_getProductService().setFees(productFee, processingFee);
|
112
106
|
}
|
113
107
|
|
114
108
|
function _createRisk(
|
115
109
|
RiskId id,
|
116
110
|
bytes memory data
|
117
111
|
) internal {
|
118
|
-
|
112
|
+
_getProductService().createRisk(
|
119
113
|
id,
|
120
114
|
data
|
121
115
|
);
|
@@ -125,7 +119,7 @@ contract Product is BaseComponent, IProductComponent {
|
|
125
119
|
RiskId id,
|
126
120
|
bytes memory data
|
127
121
|
) internal {
|
128
|
-
|
122
|
+
_getProductService().updateRisk(
|
129
123
|
id,
|
130
124
|
data
|
131
125
|
);
|
@@ -135,44 +129,47 @@ contract Product is BaseComponent, IProductComponent {
|
|
135
129
|
RiskId id,
|
136
130
|
StateId state
|
137
131
|
) internal {
|
138
|
-
|
132
|
+
_getProductService().updateRiskState(
|
139
133
|
id,
|
140
134
|
state
|
141
135
|
);
|
142
136
|
}
|
143
137
|
|
144
138
|
function _getRiskInfo(RiskId id) internal view returns (IRisk.RiskInfo memory info) {
|
145
|
-
return
|
139
|
+
return getInstance().getInstanceReader().getRiskInfo(id);
|
146
140
|
}
|
147
141
|
|
148
142
|
function _createApplication(
|
149
143
|
address applicationOwner,
|
150
144
|
RiskId riskId,
|
151
145
|
uint256 sumInsuredAmount,
|
152
|
-
|
153
|
-
bytes memory applicationData,
|
146
|
+
Seconds lifetime,
|
154
147
|
NftId bundleNftId,
|
155
|
-
ReferralId referralId
|
156
|
-
|
157
|
-
|
148
|
+
ReferralId referralId,
|
149
|
+
bytes memory applicationData
|
150
|
+
)
|
151
|
+
internal
|
152
|
+
returns (NftId applicationNftId)
|
153
|
+
{
|
154
|
+
return _getProductStorage()._applicationService.create(
|
158
155
|
applicationOwner,
|
159
156
|
riskId,
|
160
157
|
sumInsuredAmount,
|
161
158
|
lifetime,
|
162
|
-
applicationData,
|
163
159
|
bundleNftId,
|
164
|
-
referralId
|
160
|
+
referralId,
|
161
|
+
applicationData
|
165
162
|
);
|
166
163
|
}
|
167
164
|
|
168
|
-
function
|
165
|
+
function _collateralize(
|
169
166
|
NftId policyNftId,
|
170
167
|
bool requirePremiumPayment,
|
171
168
|
Timestamp activateAt
|
172
169
|
)
|
173
170
|
internal
|
174
171
|
{
|
175
|
-
|
172
|
+
_getProductStorage()._policyService.collateralize(
|
176
173
|
policyNftId,
|
177
174
|
requirePremiumPayment,
|
178
175
|
activateAt);
|
@@ -184,7 +181,7 @@ contract Product is BaseComponent, IProductComponent {
|
|
184
181
|
)
|
185
182
|
internal
|
186
183
|
{
|
187
|
-
|
184
|
+
_getProductStorage()._policyService.collectPremium(
|
188
185
|
policyNftId,
|
189
186
|
activateAt);
|
190
187
|
}
|
@@ -195,95 +192,183 @@ contract Product is BaseComponent, IProductComponent {
|
|
195
192
|
)
|
196
193
|
internal
|
197
194
|
{
|
198
|
-
|
195
|
+
_getProductStorage()._policyService.activate(
|
199
196
|
policyNftId,
|
200
197
|
activateAt);
|
201
198
|
}
|
202
199
|
|
203
|
-
function
|
204
|
-
|
200
|
+
function _close(
|
201
|
+
NftId policyNftId
|
202
|
+
)
|
203
|
+
internal
|
204
|
+
{
|
205
|
+
_getProductStorage()._policyService.close(
|
206
|
+
policyNftId);
|
205
207
|
}
|
206
208
|
|
207
|
-
function
|
208
|
-
|
209
|
+
function _submitClaim(
|
210
|
+
NftId policyNftId,
|
211
|
+
Amount claimAmount,
|
212
|
+
bytes memory claimData
|
213
|
+
)
|
214
|
+
internal
|
215
|
+
returns(ClaimId)
|
216
|
+
{
|
217
|
+
return _getProductStorage()._policyService.submitClaim(
|
218
|
+
policyNftId,
|
219
|
+
claimAmount,
|
220
|
+
claimData);
|
209
221
|
}
|
210
222
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
223
|
+
function _confirmClaim(
|
224
|
+
NftId policyNftId,
|
225
|
+
ClaimId claimId,
|
226
|
+
Amount confirmedAmount
|
215
227
|
)
|
216
|
-
|
217
|
-
onlyOwner
|
218
|
-
override
|
228
|
+
internal
|
219
229
|
{
|
220
|
-
|
230
|
+
_getProductStorage()._policyService.confirmClaim(
|
231
|
+
policyNftId,
|
232
|
+
claimId,
|
233
|
+
confirmedAmount);
|
221
234
|
}
|
222
235
|
|
223
|
-
function
|
224
|
-
|
225
|
-
|
236
|
+
function _declineClaim(
|
237
|
+
NftId policyNftId,
|
238
|
+
ClaimId claimId
|
239
|
+
)
|
240
|
+
internal
|
241
|
+
{
|
242
|
+
_getProductStorage()._policyService.declineClaim(
|
243
|
+
policyNftId,
|
244
|
+
claimId);
|
226
245
|
}
|
227
246
|
|
228
|
-
|
247
|
+
function _closeClaim(
|
248
|
+
NftId policyNftId,
|
249
|
+
ClaimId claimId
|
250
|
+
)
|
251
|
+
internal
|
252
|
+
{
|
253
|
+
_getProductStorage()._policyService.closeClaim(
|
254
|
+
policyNftId,
|
255
|
+
claimId);
|
256
|
+
}
|
229
257
|
|
230
|
-
function
|
231
|
-
|
258
|
+
function _createPayout(
|
259
|
+
NftId policyNftId,
|
260
|
+
ClaimId claimId,
|
261
|
+
Amount amount,
|
262
|
+
bytes memory data
|
263
|
+
)
|
264
|
+
internal
|
265
|
+
returns (PayoutId)
|
266
|
+
{
|
267
|
+
return _getProductStorage()._policyService.createPayout(
|
268
|
+
policyNftId,
|
269
|
+
claimId,
|
270
|
+
amount,
|
271
|
+
data);
|
272
|
+
}
|
273
|
+
|
274
|
+
function _processPayout(
|
275
|
+
NftId policyNftId,
|
276
|
+
PayoutId payoutId
|
277
|
+
)
|
278
|
+
internal
|
279
|
+
{
|
280
|
+
_getProductStorage()._policyService.processPayout(
|
281
|
+
policyNftId,
|
282
|
+
payoutId);
|
283
|
+
}
|
284
|
+
|
285
|
+
function calculatePremium(
|
286
|
+
uint256 sumInsuredAmount,
|
287
|
+
RiskId riskId,
|
288
|
+
Seconds lifetime,
|
289
|
+
bytes memory applicationData,
|
290
|
+
NftId bundleNftId,
|
291
|
+
ReferralId referralId
|
292
|
+
)
|
293
|
+
external
|
232
294
|
view
|
233
|
-
override
|
234
|
-
returns (
|
295
|
+
override
|
296
|
+
returns (uint256 premiumAmount)
|
297
|
+
{
|
298
|
+
IPolicy.Premium memory premium = _getProductStorage()._pricingService.calculatePremium(
|
299
|
+
getNftId(),
|
300
|
+
riskId,
|
301
|
+
sumInsuredAmount,
|
302
|
+
lifetime,
|
303
|
+
applicationData,
|
304
|
+
bundleNftId,
|
305
|
+
referralId
|
306
|
+
);
|
307
|
+
premiumAmount = premium.premiumAmount;
|
308
|
+
}
|
309
|
+
|
310
|
+
function calculateNetPremium(
|
311
|
+
uint256 sumInsuredAmount,
|
312
|
+
RiskId riskId,
|
313
|
+
Seconds lifetime,
|
314
|
+
bytes memory applicationData
|
315
|
+
)
|
316
|
+
external
|
317
|
+
view
|
318
|
+
virtual override
|
319
|
+
returns (uint256 netPremiumAmount)
|
235
320
|
{
|
236
|
-
//
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
(
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
distributionSetupInfo.distributionFee,
|
278
|
-
_initialProductFee,
|
279
|
-
_initialProcessingFee,
|
280
|
-
poolSetupInfo.poolFee,
|
281
|
-
poolSetupInfo.stakingFee,
|
282
|
-
poolSetupInfo.performanceFee,
|
283
|
-
false,
|
284
|
-
_wallet
|
285
|
-
)
|
286
|
-
)
|
321
|
+
// default 10% of sum insured
|
322
|
+
return sumInsuredAmount / 10;
|
323
|
+
}
|
324
|
+
|
325
|
+
function _toRiskId(string memory riskName) internal pure returns (RiskId riskId) {
|
326
|
+
return RiskIdLib.toRiskId(riskName);
|
327
|
+
}
|
328
|
+
|
329
|
+
function getPoolNftId() external view override returns (NftId poolNftId) {
|
330
|
+
return getRegistry().getNftId(address(_getProductStorage()._pool));
|
331
|
+
}
|
332
|
+
|
333
|
+
function getDistributionNftId() external view override returns (NftId distributionNftId) {
|
334
|
+
return getRegistry().getNftId(address(_getProductStorage()._distribution));
|
335
|
+
}
|
336
|
+
|
337
|
+
function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
338
|
+
InstanceReader reader = getInstance().getInstanceReader();
|
339
|
+
setupInfo = reader.getProductSetupInfo(getNftId());
|
340
|
+
|
341
|
+
// fallback to initial setup info (wallet is always != address(0))
|
342
|
+
if(setupInfo.wallet == address(0)) {
|
343
|
+
setupInfo = _getInitialSetupInfo();
|
344
|
+
}
|
345
|
+
}
|
346
|
+
|
347
|
+
function _getInitialSetupInfo() internal view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
348
|
+
ProductStorage storage $ = _getProductStorage();
|
349
|
+
|
350
|
+
ISetup.DistributionSetupInfo memory distributionSetupInfo = $._distribution.getSetupInfo();
|
351
|
+
IComponents.PoolInfo memory poolInfo = $._pool.getPoolInfo();
|
352
|
+
|
353
|
+
return ISetup.ProductSetupInfo(
|
354
|
+
getToken(),
|
355
|
+
$._tokenHandler,
|
356
|
+
$._distributionNftId,
|
357
|
+
$._poolNftId,
|
358
|
+
$._initialProductFee,
|
359
|
+
$._initialProcessingFee,
|
360
|
+
false,
|
361
|
+
getWallet()
|
287
362
|
);
|
288
363
|
}
|
289
|
-
|
364
|
+
|
365
|
+
function _getProductStorage() private pure returns (ProductStorage storage $) {
|
366
|
+
assembly {
|
367
|
+
$.slot := PRODUCT_STORAGE_LOCATION_V1
|
368
|
+
}
|
369
|
+
}
|
370
|
+
|
371
|
+
function _getProductService() internal view returns (IProductService) {
|
372
|
+
return _getProductStorage()._productService;
|
373
|
+
}
|
374
|
+
}
|
@@ -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
|
+
}
|
@@ -22,9 +22,10 @@ contract BundleManager is
|
|
22
22
|
event LogBundleManagerBundleAdded(NftId poolNftId, NftId bundleNftId);
|
23
23
|
event LogBundleManagerBundleUnlocked(NftId poolNftId, NftId bundleNftId);
|
24
24
|
event LogBundleManagerBundleLocked(NftId poolNftId, NftId bundleNftId);
|
25
|
+
event LogBundleManagerBundleClosed(NftId poolNftId, NftId bundleNftId);
|
25
26
|
|
26
|
-
error
|
27
|
-
error
|
27
|
+
error ErrorBundleManagerPolicyAlreadyActivated(NftId policyNftId);
|
28
|
+
error ErrorBundleManagerBundleLocked(NftId bundleNftId, NftId policyNftId);
|
28
29
|
error ErrorBundleManagerPolicyWithOpenClaims(NftId policyNftId, uint256 openClaimsCount);
|
29
30
|
error ErrorBundleManagerPolicyNotCloseable(NftId policyNftId);
|
30
31
|
error ErrorBundleManagerBundleUnknown(NftId bundleNftId);
|
@@ -32,21 +33,16 @@ contract BundleManager is
|
|
32
33
|
|
33
34
|
mapping(NftId bundleNftId => LibNftIdSet.Set policies) internal _activePolicies;
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
/// @dev links a policy with its bundle
|
40
|
-
// to link a policy it MUST NOT yet have been activated
|
41
|
-
// the bundle MUST be unlocked (active) for linking (underwriting) and registered with this instance
|
36
|
+
/// @dev links a policy to its bundle
|
37
|
+
// to link a policy it MUST NOT yet have been linked
|
42
38
|
function linkPolicy(NftId policyNftId) external restricted() {
|
43
|
-
NftId bundleNftId =
|
39
|
+
NftId bundleNftId = _instance.getInstanceReader().getPolicyInfo(policyNftId).bundleNftId;
|
44
40
|
// decision will likely depend on the decision what to check here and what in the service
|
45
|
-
NftId poolNftId =
|
41
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
46
42
|
|
47
43
|
// ensure bundle is unlocked (in active set) and registered with this instance
|
48
44
|
if (!_isActive(poolNftId, bundleNftId)) {
|
49
|
-
revert
|
45
|
+
revert ErrorBundleManagerBundleLocked(bundleNftId, policyNftId);
|
50
46
|
}
|
51
47
|
|
52
48
|
LibNftIdSet.add(_activePolicies[bundleNftId], policyNftId);
|
@@ -59,11 +55,11 @@ contract BundleManager is
|
|
59
55
|
// - the policy MUST be past its expiry period and it MUST NOT have any open claims
|
60
56
|
// - the policy's payoutAmount MUST be equal to its sumInsuredAmount and MUST NOT have any open claims
|
61
57
|
function unlinkPolicy(NftId policyNftId) external restricted() {
|
62
|
-
IPolicy.PolicyInfo memory policyInfo =
|
58
|
+
IPolicy.PolicyInfo memory policyInfo = _instance.getInstanceReader().getPolicyInfo(policyNftId);
|
63
59
|
|
64
60
|
NftId bundleNftId = policyInfo.bundleNftId;
|
65
61
|
// decision will likely depend on the decision what to check here and what in the service
|
66
|
-
NftId poolNftId =
|
62
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
67
63
|
|
68
64
|
// ensure bundle is registered with this instance
|
69
65
|
if (!_contains(poolNftId, bundleNftId)) {
|
@@ -75,10 +71,10 @@ contract BundleManager is
|
|
75
71
|
}
|
76
72
|
|
77
73
|
|
78
|
-
/// @dev add a new bundle to a
|
74
|
+
/// @dev add a new bundle to a pool registerd with this instance
|
79
75
|
// the corresponding pool is fetched via instance reader
|
80
76
|
function add(NftId bundleNftId) external restricted() {
|
81
|
-
NftId poolNftId =
|
77
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
82
78
|
|
83
79
|
// ensure pool is registered with instance
|
84
80
|
if(poolNftId.eqz()) {
|
@@ -89,16 +85,17 @@ contract BundleManager is
|
|
89
85
|
emit LogBundleManagerBundleAdded(poolNftId, bundleNftId);
|
90
86
|
}
|
91
87
|
|
92
|
-
|
88
|
+
|
89
|
+
/// @dev unlocked (active) bundles are available to collateralize new policies
|
93
90
|
function unlock(NftId bundleNftId) external restricted() {
|
94
|
-
NftId poolNftId =
|
91
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
95
92
|
_activate(poolNftId, bundleNftId);
|
96
93
|
emit LogBundleManagerBundleUnlocked(poolNftId, bundleNftId);
|
97
94
|
}
|
98
95
|
|
99
|
-
/// @dev locked (deactivated) bundles may not
|
96
|
+
/// @dev locked (deactivated) bundles may not collateralize any new policies
|
100
97
|
function lock(NftId bundleNftId) external restricted() {
|
101
|
-
NftId poolNftId =
|
98
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
102
99
|
_deactivate(poolNftId, bundleNftId);
|
103
100
|
emit LogBundleManagerBundleLocked(poolNftId, bundleNftId);
|
104
101
|
}
|
@@ -10,7 +10,8 @@ abstract contract Cloneable is
|
|
10
10
|
AccessManagedUpgradeable
|
11
11
|
{
|
12
12
|
event CloneableInitialized(address authority, address registry);
|
13
|
-
|
13
|
+
|
14
|
+
error CloneableAuthorityZero();
|
14
15
|
error CloneableRegistryInvalid(address registry);
|
15
16
|
|
16
17
|
IRegistry internal _registry;
|
@@ -25,9 +26,13 @@ abstract contract Cloneable is
|
|
25
26
|
address registry
|
26
27
|
)
|
27
28
|
public
|
28
|
-
|
29
|
+
onlyInitializing
|
29
30
|
{
|
30
31
|
// check/handle access managed
|
32
|
+
if(authority == address(0)) {
|
33
|
+
revert CloneableAuthorityZero();
|
34
|
+
}
|
35
|
+
|
31
36
|
__AccessManaged_init(authority);
|
32
37
|
|
33
38
|
// check/handle registry
|