@etherisc/gif-next 0.0.2-f7be756-963 → 0.0.2-f7bec40-735
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +337 -19
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +698 -30
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +4 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +1376 -0
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +636 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +1000 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +4 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +1095 -0
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +4 -0
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +861 -0
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +1214 -135
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +1008 -156
- 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 +312 -1138
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +616 -0
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +441 -1229
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +1348 -0
- 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 +4 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1569 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +979 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +656 -0
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +2788 -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/ComponentService.sol/ComponentService.json +631 -0
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +429 -0
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +4 -0
- package/artifacts/contracts/instance/{lifecycle/ILifecycle.sol/ILifecycleModule.json → base/ILifecycle.sol/ILifecycle.json} +10 -77
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +532 -0
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +4 -0
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +194 -0
- 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/{access/IAccess.sol/IAccess.json → module/IBundle.sol/IBundle.json} +2 -2
- 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 +4 -0
- package/artifacts/contracts/instance/{component/IComponent.sol/IComponent.json → module/IDistribution.sol/IDistribution.json} +2 -2
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +4 -0
- package/artifacts/contracts/instance/{policy → module}/IPolicy.sol/IPolicy.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +4 -0
- package/artifacts/contracts/instance/{pool/IPoolModule.sol/IPool.json → module/IRisk.sol/IRisk.json} +2 -2
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +4 -0
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.json +10 -0
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +4 -0
- package/artifacts/contracts/instance/{treasury → module}/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 +918 -0
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +648 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +1288 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +696 -0
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +1384 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +752 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +1556 -0
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +780 -0
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +493 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +735 -0
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +743 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +840 -0
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +651 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +1077 -0
- package/artifacts/contracts/instance/service/IPricingService.sol/IPricingService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPricingService.sol/IPricingService.json +510 -0
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +442 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +1281 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +740 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +1622 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +708 -0
- package/artifacts/contracts/instance/service/PricingService.sol/PricingService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PricingService.sol/PricingService.json +1004 -0
- package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.json +688 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +864 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +640 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +252 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +595 -27
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +858 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +4 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +52 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +652 -50
- 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 +4 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +1150 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +657 -0
- 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 +4 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +485 -0
- package/artifacts/contracts/shared/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/shared/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.json +107 -0
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +4 -0
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +73 -0
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +4 -0
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +125 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +189 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +4 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +175 -0
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/{instance/access/IAccess.sol/IAccessCheckRole.json → shared/IRegistryLinked.sol/IRegistryLinked.json} +11 -11
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +4 -0
- package/artifacts/contracts/shared/IService.sol/IService.json +327 -0
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +4 -0
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +55 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +4 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +238 -0
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +302 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +4 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +569 -0
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +4 -0
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +339 -0
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +71 -0
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +4 -0
- package/artifacts/contracts/{registry/IChainNft.sol/IChainNft.json → shared/Service.sol/Service.json} +256 -220
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +114 -0
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +129 -0
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +4 -0
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +78 -0
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +4 -0
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +119 -0
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +4 -0
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +370 -0
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +4 -0
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +116 -0
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +4 -0
- package/artifacts/contracts/test/TestService.sol/TestService.json +588 -0
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +4 -0
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +376 -0
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +4 -0
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +218 -0
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +4 -0
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +104 -0
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +4 -0
- package/artifacts/contracts/test/Usdc.sol/USDC.json +376 -0
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +4 -0
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.json +10 -0
- package/artifacts/contracts/types/Amount.sol/AmountLib.dbg.json +4 -0
- package/artifacts/contracts/types/Amount.sol/AmountLib.json +281 -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 +4 -0
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +104 -0
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +4 -0
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +312 -0
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +4 -0
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +125 -0
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +78 -4
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +4 -0
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +33 -0
- 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 +209 -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 +4 -0
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +86 -0
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +156 -0
- 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 +110 -4
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +4 -0
- package/artifacts/contracts/{experiment/types/TypeB.sol/TypeBLib.json → types/UFixed.sol/MathLib.json} +4 -4
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +4 -0
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +479 -0
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +4 -0
- package/artifacts/contracts/types/Version.sol/VersionLib.json +177 -0
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +4 -0
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +49 -0
- package/contracts/components/Component.sol +245 -50
- package/contracts/components/Distribution.sol +285 -0
- package/contracts/components/IComponent.sol +90 -0
- package/contracts/components/IDistributionComponent.sol +71 -0
- package/contracts/components/IPoolComponent.sol +114 -0
- package/contracts/components/IProductComponent.sol +41 -0
- package/contracts/components/Pool.sol +280 -30
- package/contracts/components/Product.sol +337 -51
- package/contracts/instance/BundleManager.sol +126 -0
- package/contracts/instance/Cloneable.sol +51 -0
- package/contracts/instance/IInstance.sol +74 -22
- package/contracts/instance/IInstanceService.sol +73 -0
- package/contracts/instance/Instance.sol +210 -53
- package/contracts/instance/InstanceAccessManager.sol +541 -0
- package/contracts/instance/InstanceAuthorizationsLib.sol +308 -0
- package/contracts/instance/InstanceReader.sol +368 -0
- package/contracts/instance/InstanceService.sol +308 -0
- package/contracts/instance/InstanceServiceManager.sol +54 -0
- package/contracts/instance/InstanceStore.sol +212 -0
- package/contracts/instance/ObjectManager.sol +82 -0
- package/contracts/instance/base/ComponentService.sol +148 -0
- package/contracts/instance/base/IKeyValueStore.sol +49 -0
- package/contracts/instance/base/ILifecycle.sol +30 -0
- package/contracts/instance/base/KeyValueStore.sol +149 -0
- package/contracts/instance/base/Lifecycle.sol +120 -0
- package/contracts/instance/module/IAccess.sol +54 -0
- package/contracts/instance/module/IBundle.sol +23 -0
- package/contracts/instance/module/IComponents.sol +41 -0
- package/contracts/instance/module/IDistribution.sol +42 -0
- package/contracts/instance/module/IPolicy.sol +77 -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 +186 -0
- package/contracts/instance/service/ApplicationServiceManager.sol +35 -0
- package/contracts/instance/service/BundleService.sol +382 -0
- package/contracts/instance/service/BundleServiceManager.sol +51 -0
- package/contracts/instance/service/ClaimService.sol +437 -0
- package/contracts/instance/service/ClaimServiceManager.sol +35 -0
- package/contracts/instance/service/DistributionService.sol +348 -0
- package/contracts/instance/service/DistributionServiceManager.sol +51 -0
- package/contracts/instance/service/IApplicationService.sol +62 -0
- package/contracts/instance/service/IBundleService.sol +118 -0
- package/contracts/instance/service/IClaimService.sol +90 -0
- package/contracts/instance/service/IDistributionService.sol +87 -0
- package/contracts/instance/service/IPolicyService.sol +80 -0
- package/contracts/instance/service/IPoolService.sol +114 -0
- package/contracts/instance/service/IPricingService.sol +37 -0
- package/contracts/instance/service/IProductService.sol +40 -0
- package/contracts/instance/service/PolicyService.sol +376 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +403 -0
- package/contracts/instance/service/PoolServiceManager.sol +51 -0
- package/contracts/instance/service/PricingService.sol +275 -0
- package/contracts/instance/service/PricingServiceManager.sol +51 -0
- package/contracts/instance/service/ProductService.sol +210 -0
- package/contracts/instance/service/ProductServiceManager.sol +54 -0
- package/contracts/registry/ChainNft.sol +137 -62
- package/contracts/registry/IRegistry.sol +75 -41
- package/contracts/registry/IRegistryService.sol +66 -0
- package/contracts/registry/ITransferInterceptor.sol +7 -0
- package/contracts/registry/Registry.sol +413 -128
- package/contracts/registry/RegistryAccessManager.sol +216 -0
- package/contracts/registry/RegistryService.sol +286 -0
- package/contracts/registry/RegistryServiceManager.sol +62 -0
- package/contracts/registry/ReleaseManager.sol +324 -0
- package/contracts/registry/TokenRegistry.sol +116 -0
- package/contracts/shared/AccessManagerUpgradeableInitializeable.sol +13 -0
- package/contracts/shared/ContractDeployerLib.sol +72 -0
- package/contracts/shared/ERC165.sol +27 -0
- package/contracts/shared/INftOwnable.sol +23 -0
- package/contracts/shared/IPolicyHolder.sol +40 -0
- package/contracts/shared/IRegisterable.sol +15 -0
- package/contracts/shared/IRegistryLinked.sol +11 -0
- package/contracts/shared/IService.sol +18 -0
- package/contracts/shared/IVersionable.sol +53 -0
- package/contracts/shared/NftOwnable.sol +118 -0
- package/contracts/shared/PolicyHolder.sol +94 -0
- package/contracts/shared/ProxyManager.sol +169 -0
- package/contracts/shared/Registerable.sol +75 -0
- package/contracts/shared/RegistryLinked.sol +43 -0
- package/contracts/shared/Service.sol +72 -0
- package/contracts/shared/TokenHandler.sol +35 -0
- package/contracts/shared/UpgradableProxyWithAdmin.sol +16 -0
- package/contracts/shared/Versionable.sol +59 -0
- package/contracts/test/TestFee.sol +25 -0
- package/contracts/test/TestRegisterable.sol +18 -0
- package/contracts/test/TestRoleId.sol +14 -0
- package/contracts/test/TestService.sol +25 -0
- package/contracts/{mock/Dip.sol → test/TestToken.sol} +5 -5
- package/contracts/test/TestVersion.sol +44 -0
- package/contracts/test/TestVersionable.sol +17 -0
- package/contracts/{mock → test}/Usdc.sol +1 -1
- package/contracts/types/AddressSet.sol +58 -0
- package/contracts/types/Amount.sol +109 -0
- package/contracts/types/Blocknumber.sol +1 -0
- package/contracts/types/ClaimId.sol +75 -0
- package/contracts/types/DistributorType.sol +55 -0
- package/contracts/types/Fee.sol +53 -20
- package/contracts/types/Key32.sol +50 -0
- package/contracts/types/NftId.sol +30 -1
- package/contracts/types/NftIdSet.sol +62 -0
- package/contracts/types/NumberId.sol +52 -0
- package/contracts/types/ObjectType.sol +69 -15
- package/contracts/types/PayoutId.sol +82 -0
- package/contracts/types/Referral.sol +89 -0
- package/contracts/types/RiskId.sol +43 -0
- package/contracts/types/RoleId.sol +97 -0
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/StateId.sol +23 -4
- package/contracts/types/Timestamp.sol +36 -6
- package/contracts/types/UFixed.sol +139 -23
- package/contracts/types/Version.sol +108 -0
- package/package.json +11 -5
- package/artifacts/contracts/components/Component.sol/InstanceLinked.dbg.json +0 -4
- package/artifacts/contracts/components/Component.sol/InstanceLinked.json +0 -35
- package/artifacts/contracts/components/IPool.sol/IPoolComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IPool.sol/IPoolComponent.json +0 -255
- package/artifacts/contracts/components/IProduct.sol/IProductComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IProduct.sol/IProductComponent.json +0 -74
- 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/IB.sol/IB.json +0 -50
- 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/instance/access/Access.sol/AccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/access/Access.sol/AccessModule.json +0 -400
- package/artifacts/contracts/instance/access/IAccess.sol/IAccess.dbg.json +0 -4
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessCheckRole.dbg.json +0 -4
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessComponentTypeRoles.dbg.json +0 -4
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessComponentTypeRoles.json +0 -50
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessModule.json +0 -336
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentModule.json +0 -299
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.json +0 -202
- package/artifacts/contracts/instance/component/IComponent.sol/IComponent.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentContract.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentContract.json +0 -205
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.json +0 -217
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.json +0 -141
- package/artifacts/contracts/instance/component/IComponent.sol/IInstanceLinked.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IInstanceLinked.json +0 -24
- package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycle.dbg.json +0 -4
- package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycle.json +0 -134
- package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/lifecycle/LifecycleModule.sol/LifecycleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/lifecycle/LifecycleModule.sol/LifecycleModule.json +0 -221
- package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicy.dbg.json +0 -4
- package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicyModule.json +0 -254
- package/artifacts/contracts/instance/policy/PolicyModule.sol/PolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/policy/PolicyModule.sol/PolicyModule.json +0 -254
- package/artifacts/contracts/instance/pool/IPoolModule.sol/IPool.dbg.json +0 -4
- package/artifacts/contracts/instance/pool/IPoolModule.sol/IPoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/pool/IPoolModule.sol/IPoolModule.json +0 -129
- package/artifacts/contracts/instance/pool/PoolModule.sol/PoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/pool/PoolModule.sol/PoolModule.json +0 -155
- package/artifacts/contracts/instance/product/IProductService.sol/IProductModule.dbg.json +0 -4
- package/artifacts/contracts/instance/product/IProductService.sol/IProductModule.json +0 -75
- package/artifacts/contracts/instance/product/IProductService.sol/IProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/product/IProductService.sol/IProductService.json +0 -127
- package/artifacts/contracts/instance/product/ProductService.sol/ProductModule.dbg.json +0 -4
- package/artifacts/contracts/instance/product/ProductService.sol/ProductModule.json +0 -75
- package/artifacts/contracts/instance/product/ProductService.sol/ProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/product/ProductService.sol/ProductService.json +0 -196
- package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasury.dbg.json +0 -4
- package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasuryModule.json +0 -490
- package/artifacts/contracts/instance/treasury/TokenHandler.sol/TokenHandler.dbg.json +0 -4
- package/artifacts/contracts/instance/treasury/TokenHandler.sol/TokenHandler.json +0 -45
- package/artifacts/contracts/instance/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/instance/treasury/TreasuryModule.sol/TreasuryModule.json +0 -490
- package/artifacts/contracts/mock/Dip.sol/DIP.dbg.json +0 -4
- package/artifacts/contracts/mock/Dip.sol/DIP.json +0 -338
- package/artifacts/contracts/mock/TestPool.sol/TestPool.dbg.json +0 -4
- package/artifacts/contracts/mock/TestPool.sol/TestPool.json +0 -294
- package/artifacts/contracts/mock/TestProduct.sol/TestProduct.dbg.json +0 -4
- package/artifacts/contracts/mock/TestProduct.sol/TestProduct.json +0 -384
- package/artifacts/contracts/mock/Usdc.sol/USDC.dbg.json +0 -4
- package/artifacts/contracts/mock/Usdc.sol/USDC.json +0 -338
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistry.sol/IOwnable.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistry.sol/IOwnable.json +0 -24
- package/artifacts/contracts/registry/IRegistry.sol/IRegisterable.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistry.sol/IRegisterable.json +0 -166
- package/artifacts/contracts/registry/IRegistry.sol/IRegistryLinked.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistry.sol/IRegistryLinked.json +0 -49
- package/artifacts/contracts/registry/Registry.sol/Registerable.dbg.json +0 -4
- package/artifacts/contracts/registry/Registry.sol/Registerable.json +0 -166
- package/artifacts/contracts/registry/Registry.sol/RegistryLinked.dbg.json +0 -4
- package/artifacts/contracts/registry/Registry.sol/RegistryLinked.json +0 -60
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +0 -4
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.json +0 -479
- package/contracts/components/IPool.sol +0 -15
- package/contracts/components/IProduct.sol +0 -16
- 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/README.md +0 -112
- 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/access/Access.sol +0 -165
- package/contracts/instance/access/IAccess.sol +0 -63
- package/contracts/instance/component/ComponentModule.sol +0 -274
- package/contracts/instance/component/IComponent.sol +0 -74
- package/contracts/instance/lifecycle/ILifecycle.sol +0 -47
- package/contracts/instance/lifecycle/LifecycleModule.sol +0 -88
- package/contracts/instance/policy/IPolicy.sol +0 -50
- package/contracts/instance/policy/PolicyModule.sol +0 -114
- package/contracts/instance/pool/IPoolModule.sol +0 -23
- package/contracts/instance/pool/PoolModule.sol +0 -81
- package/contracts/instance/product/IProductService.sol +0 -36
- package/contracts/instance/product/ProductService.sol +0 -136
- package/contracts/instance/treasury/ITreasury.sol +0 -91
- package/contracts/instance/treasury/TokenHandler.sol +0 -24
- package/contracts/instance/treasury/TreasuryModule.sol +0 -168
- package/contracts/mock/TestPool.sol +0 -16
- package/contracts/mock/TestProduct.sol +0 -39
- package/contracts/registry/IChainNft.sol +0 -21
@@ -1,89 +1,375 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
-
import {
|
4
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
|
+
|
6
|
+
import {Amount, AmountLib} from "../types/Amount.sol";
|
7
|
+
import {ClaimId} from "../types/ClaimId.sol";
|
5
8
|
import {Component} from "./Component.sol";
|
6
|
-
import {IProductComponent} from "./IProduct.sol";
|
7
|
-
import {NftId} from "../types/NftId.sol";
|
8
|
-
import {ObjectType, PRODUCT} from "../types/ObjectType.sol";
|
9
9
|
import {Fee} from "../types/Fee.sol";
|
10
|
-
import {
|
10
|
+
import {IRisk} from "../instance/module/IRisk.sol";
|
11
|
+
import {IApplicationService} from "../instance/service/IApplicationService.sol";
|
12
|
+
import {IPolicyService} from "../instance/service/IPolicyService.sol";
|
13
|
+
import {IProductService} from "../instance/service/IProductService.sol";
|
14
|
+
import {IClaimService} from "../instance/service/IClaimService.sol";
|
15
|
+
import {IPricingService} from "../instance/service/IPricingService.sol";
|
16
|
+
import {IProductComponent} from "./IProductComponent.sol";
|
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";
|
20
|
+
import {ReferralId} from "../types/Referral.sol";
|
21
|
+
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
22
|
+
import {Seconds} from "../types/Seconds.sol";
|
23
|
+
import {StateId} from "../types/StateId.sol";
|
24
|
+
import {Timestamp} from "../types/Timestamp.sol";
|
25
|
+
|
26
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
27
|
+
|
28
|
+
import {InstanceReader} from "../instance/InstanceReader.sol";
|
29
|
+
import {IPolicy} from "../instance/module/IPolicy.sol";
|
30
|
+
import {ISetup} from "../instance/module/ISetup.sol";
|
31
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
32
|
+
import {Pool} from "../components/Pool.sol";
|
33
|
+
import {Distribution} from "../components/Distribution.sol";
|
34
|
+
|
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;
|
11
41
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
+
}
|
17
56
|
|
18
|
-
|
57
|
+
function initializeProduct(
|
19
58
|
address registry,
|
20
|
-
|
59
|
+
NftId instanceNftId,
|
60
|
+
string memory name,
|
21
61
|
address token,
|
62
|
+
bool isInterceptor,
|
22
63
|
address pool,
|
23
|
-
|
24
|
-
Fee memory
|
25
|
-
|
64
|
+
address distribution,
|
65
|
+
Fee memory productFee,
|
66
|
+
Fee memory processingFee,
|
67
|
+
address initialOwner,
|
68
|
+
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
69
|
+
)
|
70
|
+
public
|
71
|
+
virtual
|
72
|
+
onlyInitializing()
|
73
|
+
{
|
74
|
+
initializeComponent(registry, instanceNftId, name, token, PRODUCT(), isInterceptor, initialOwner, registryData);
|
75
|
+
|
76
|
+
ProductStorage storage $ = _getProductStorage();
|
26
77
|
// TODO add validation
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
+
|
95
|
+
// from product component
|
96
|
+
function setFees(
|
97
|
+
Fee memory productFee,
|
98
|
+
Fee memory processingFee
|
99
|
+
)
|
100
|
+
external
|
101
|
+
onlyOwner
|
102
|
+
restricted()
|
103
|
+
override
|
104
|
+
{
|
105
|
+
_getProductService().setFees(productFee, processingFee);
|
106
|
+
}
|
107
|
+
|
108
|
+
function _createRisk(
|
109
|
+
RiskId id,
|
110
|
+
bytes memory data
|
111
|
+
) internal {
|
112
|
+
_getProductService().createRisk(
|
113
|
+
id,
|
114
|
+
data
|
115
|
+
);
|
116
|
+
}
|
117
|
+
|
118
|
+
function _updateRisk(
|
119
|
+
RiskId id,
|
120
|
+
bytes memory data
|
121
|
+
) internal {
|
122
|
+
_getProductService().updateRisk(
|
123
|
+
id,
|
124
|
+
data
|
125
|
+
);
|
126
|
+
}
|
127
|
+
|
128
|
+
function _updateRiskState(
|
129
|
+
RiskId id,
|
130
|
+
StateId state
|
131
|
+
) internal {
|
132
|
+
_getProductService().updateRiskState(
|
133
|
+
id,
|
134
|
+
state
|
135
|
+
);
|
136
|
+
}
|
137
|
+
|
138
|
+
function _getRiskInfo(RiskId id) internal view returns (IRisk.RiskInfo memory info) {
|
139
|
+
return getInstance().getInstanceReader().getRiskInfo(id);
|
31
140
|
}
|
32
141
|
|
33
142
|
function _createApplication(
|
34
143
|
address applicationOwner,
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
NftId bundleNftId
|
39
|
-
|
40
|
-
|
144
|
+
RiskId riskId,
|
145
|
+
Amount sumInsuredAmount,
|
146
|
+
Seconds lifetime,
|
147
|
+
NftId bundleNftId,
|
148
|
+
ReferralId referralId,
|
149
|
+
bytes memory applicationData
|
150
|
+
)
|
151
|
+
internal
|
152
|
+
returns (NftId applicationNftId)
|
153
|
+
{
|
154
|
+
return _getProductStorage()._applicationService.create(
|
41
155
|
applicationOwner,
|
156
|
+
riskId,
|
42
157
|
sumInsuredAmount,
|
43
|
-
premiumAmount,
|
44
158
|
lifetime,
|
45
|
-
bundleNftId
|
159
|
+
bundleNftId,
|
160
|
+
referralId,
|
161
|
+
applicationData
|
46
162
|
);
|
47
163
|
}
|
48
164
|
|
49
|
-
function
|
50
|
-
|
165
|
+
function _collateralize(
|
166
|
+
NftId policyNftId,
|
167
|
+
bool requirePremiumPayment,
|
168
|
+
Timestamp activateAt
|
169
|
+
)
|
170
|
+
internal
|
171
|
+
{
|
172
|
+
_getProductStorage()._policyService.collateralize(
|
173
|
+
policyNftId,
|
174
|
+
requirePremiumPayment,
|
175
|
+
activateAt);
|
51
176
|
}
|
52
177
|
|
53
|
-
function _collectPremium(
|
54
|
-
|
178
|
+
function _collectPremium(
|
179
|
+
NftId policyNftId,
|
180
|
+
Timestamp activateAt
|
181
|
+
)
|
182
|
+
internal
|
183
|
+
{
|
184
|
+
_getProductStorage()._policyService.collectPremium(
|
185
|
+
policyNftId,
|
186
|
+
activateAt);
|
55
187
|
}
|
56
188
|
|
57
|
-
function
|
58
|
-
|
189
|
+
function _activate(
|
190
|
+
NftId policyNftId,
|
191
|
+
Timestamp activateAt
|
192
|
+
)
|
193
|
+
internal
|
194
|
+
{
|
195
|
+
_getProductStorage()._policyService.activate(
|
196
|
+
policyNftId,
|
197
|
+
activateAt);
|
59
198
|
}
|
60
199
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
200
|
+
function _close(
|
201
|
+
NftId policyNftId
|
202
|
+
)
|
203
|
+
internal
|
204
|
+
{
|
205
|
+
_getProductStorage()._policyService.close(
|
206
|
+
policyNftId);
|
207
|
+
}
|
208
|
+
|
209
|
+
function _submitClaim(
|
210
|
+
NftId policyNftId,
|
211
|
+
Amount claimAmount,
|
212
|
+
bytes memory claimData
|
213
|
+
)
|
214
|
+
internal
|
215
|
+
returns(ClaimId)
|
216
|
+
{
|
217
|
+
return _getProductStorage()._claimService.submit(
|
218
|
+
policyNftId,
|
219
|
+
claimAmount,
|
220
|
+
claimData);
|
221
|
+
}
|
222
|
+
|
223
|
+
function _confirmClaim(
|
224
|
+
NftId policyNftId,
|
225
|
+
ClaimId claimId,
|
226
|
+
Amount confirmedAmount
|
227
|
+
)
|
228
|
+
internal
|
229
|
+
{
|
230
|
+
_getProductStorage()._claimService.confirm(
|
231
|
+
policyNftId,
|
232
|
+
claimId,
|
233
|
+
confirmedAmount);
|
234
|
+
}
|
235
|
+
|
236
|
+
function _declineClaim(
|
237
|
+
NftId policyNftId,
|
238
|
+
ClaimId claimId
|
239
|
+
)
|
240
|
+
internal
|
241
|
+
{
|
242
|
+
_getProductStorage()._claimService.decline(
|
243
|
+
policyNftId,
|
244
|
+
claimId);
|
245
|
+
}
|
246
|
+
|
247
|
+
function _closeClaim(
|
248
|
+
NftId policyNftId,
|
249
|
+
ClaimId claimId
|
250
|
+
)
|
251
|
+
internal
|
67
252
|
{
|
68
|
-
|
253
|
+
_getProductStorage()._claimService.close(
|
254
|
+
policyNftId,
|
255
|
+
claimId);
|
69
256
|
}
|
70
257
|
|
71
|
-
function
|
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()._claimService.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()._claimService.processPayout(
|
281
|
+
policyNftId,
|
282
|
+
payoutId);
|
283
|
+
}
|
284
|
+
|
285
|
+
function calculatePremium(
|
286
|
+
Amount sumInsuredAmount,
|
287
|
+
RiskId riskId,
|
288
|
+
Seconds lifetime,
|
289
|
+
bytes memory applicationData,
|
290
|
+
NftId bundleNftId,
|
291
|
+
ReferralId referralId
|
292
|
+
)
|
293
|
+
external
|
294
|
+
view
|
295
|
+
override
|
296
|
+
returns (Amount 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
|
+
|
308
|
+
return AmountLib.toAmount(premium.premiumAmount);
|
309
|
+
}
|
310
|
+
|
311
|
+
function calculateNetPremium(
|
312
|
+
Amount sumInsuredAmount,
|
313
|
+
RiskId riskId,
|
314
|
+
Seconds lifetime,
|
315
|
+
bytes memory applicationData
|
316
|
+
)
|
72
317
|
external
|
73
318
|
view
|
74
|
-
override
|
75
|
-
returns (
|
319
|
+
virtual override
|
320
|
+
returns (Amount netPremiumAmount)
|
76
321
|
{
|
77
|
-
|
322
|
+
// default 10% of sum insured
|
323
|
+
return AmountLib.toAmount(sumInsuredAmount.toInt() / 10);
|
324
|
+
}
|
325
|
+
|
326
|
+
function _toRiskId(string memory riskName) internal pure returns (RiskId riskId) {
|
327
|
+
return RiskIdLib.toRiskId(riskName);
|
328
|
+
}
|
329
|
+
|
330
|
+
function getPoolNftId() external view override returns (NftId poolNftId) {
|
331
|
+
return getRegistry().getNftId(address(_getProductStorage()._pool));
|
332
|
+
}
|
333
|
+
|
334
|
+
function getDistributionNftId() external view override returns (NftId distributionNftId) {
|
335
|
+
return getRegistry().getNftId(address(_getProductStorage()._distribution));
|
336
|
+
}
|
337
|
+
|
338
|
+
function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
339
|
+
InstanceReader reader = getInstance().getInstanceReader();
|
340
|
+
setupInfo = reader.getProductSetupInfo(getNftId());
|
341
|
+
|
342
|
+
// fallback to initial setup info (wallet is always != address(0))
|
343
|
+
if(setupInfo.wallet == address(0)) {
|
344
|
+
setupInfo = _getInitialSetupInfo();
|
345
|
+
}
|
346
|
+
}
|
347
|
+
|
348
|
+
function _getInitialSetupInfo() internal view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
349
|
+
ProductStorage storage $ = _getProductStorage();
|
350
|
+
|
351
|
+
ISetup.DistributionSetupInfo memory distributionSetupInfo = $._distribution.getSetupInfo();
|
352
|
+
IComponents.PoolInfo memory poolInfo = $._pool.getPoolInfo();
|
353
|
+
|
354
|
+
return ISetup.ProductSetupInfo(
|
355
|
+
getToken(),
|
356
|
+
$._tokenHandler,
|
357
|
+
$._distributionNftId,
|
358
|
+
$._poolNftId,
|
359
|
+
$._initialProductFee,
|
360
|
+
$._initialProcessingFee,
|
361
|
+
false,
|
362
|
+
getWallet()
|
363
|
+
);
|
78
364
|
}
|
79
365
|
|
80
|
-
|
81
|
-
|
82
|
-
|
366
|
+
function _getProductStorage() private pure returns (ProductStorage storage $) {
|
367
|
+
assembly {
|
368
|
+
$.slot := PRODUCT_STORAGE_LOCATION_V1
|
369
|
+
}
|
83
370
|
}
|
84
371
|
|
85
|
-
|
86
|
-
|
87
|
-
return bytes(abi.encode(getInstance().getNftId()));
|
372
|
+
function _getProductService() internal view returns (IProductService) {
|
373
|
+
return _getProductStorage()._productService;
|
88
374
|
}
|
89
|
-
}
|
375
|
+
}
|
@@ -0,0 +1,126 @@
|
|
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 linked
|
38
|
+
function linkPolicy(NftId policyNftId) external restricted() {
|
39
|
+
NftId bundleNftId = _instance.getInstanceReader().getPolicyInfo(policyNftId).bundleNftId;
|
40
|
+
// decision will likely depend on the decision what to check here and what in the service
|
41
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
42
|
+
|
43
|
+
// ensure bundle is unlocked (in active set) and registered with this instance
|
44
|
+
if (!_isActive(poolNftId, bundleNftId)) {
|
45
|
+
revert ErrorBundleManagerBundleLocked(bundleNftId, policyNftId);
|
46
|
+
}
|
47
|
+
|
48
|
+
LibNftIdSet.add(_activePolicies[bundleNftId], policyNftId);
|
49
|
+
emit LogBundleManagerPolicyLinked(bundleNftId, policyNftId);
|
50
|
+
}
|
51
|
+
|
52
|
+
|
53
|
+
/// @dev unlinks a policy from its bundle
|
54
|
+
// to unlink a policy it must closable, ie. meet one of the following criterias
|
55
|
+
// - the policy MUST be past its expiry period and it MUST NOT have any open claims
|
56
|
+
// - the policy's payoutAmount MUST be equal to its sumInsuredAmount and MUST NOT have any open claims
|
57
|
+
function unlinkPolicy(NftId policyNftId) external restricted() {
|
58
|
+
IPolicy.PolicyInfo memory policyInfo = _instance.getInstanceReader().getPolicyInfo(policyNftId);
|
59
|
+
|
60
|
+
NftId bundleNftId = policyInfo.bundleNftId;
|
61
|
+
// decision will likely depend on the decision what to check here and what in the service
|
62
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
63
|
+
|
64
|
+
// ensure bundle is registered with this instance
|
65
|
+
if (!_contains(poolNftId, bundleNftId)) {
|
66
|
+
revert ErrorBundleManagerBundleUnknown(bundleNftId);
|
67
|
+
}
|
68
|
+
|
69
|
+
LibNftIdSet.remove(_activePolicies[bundleNftId], policyNftId);
|
70
|
+
emit LogBundleManagerPolicyUnlinked(policyInfo.bundleNftId, policyNftId);
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
/// @dev add a new bundle to a pool registerd with this instance
|
75
|
+
// the corresponding pool is fetched via instance reader
|
76
|
+
function add(NftId bundleNftId) external restricted() {
|
77
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
78
|
+
|
79
|
+
// ensure pool is registered with instance
|
80
|
+
if(poolNftId.eqz()) {
|
81
|
+
revert ErrorBundleManagerBundleNotRegistered(bundleNftId);
|
82
|
+
}
|
83
|
+
|
84
|
+
_add(poolNftId, bundleNftId);
|
85
|
+
emit LogBundleManagerBundleAdded(poolNftId, bundleNftId);
|
86
|
+
}
|
87
|
+
|
88
|
+
|
89
|
+
/// @dev unlocked (active) bundles are available to collateralize new policies
|
90
|
+
function unlock(NftId bundleNftId) external restricted() {
|
91
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
92
|
+
_activate(poolNftId, bundleNftId);
|
93
|
+
emit LogBundleManagerBundleUnlocked(poolNftId, bundleNftId);
|
94
|
+
}
|
95
|
+
|
96
|
+
/// @dev locked (deactivated) bundles may not collateralize any new policies
|
97
|
+
function lock(NftId bundleNftId) external restricted() {
|
98
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
99
|
+
_deactivate(poolNftId, bundleNftId);
|
100
|
+
emit LogBundleManagerBundleLocked(poolNftId, bundleNftId);
|
101
|
+
}
|
102
|
+
|
103
|
+
function bundles(NftId poolNftId) external view returns(uint256) {
|
104
|
+
return _objects(poolNftId);
|
105
|
+
}
|
106
|
+
|
107
|
+
function getBundleNftId(NftId poolNftId, uint256 idx) external view returns(NftId bundleNftId) {
|
108
|
+
return _getObject(poolNftId, idx);
|
109
|
+
}
|
110
|
+
|
111
|
+
function activeBundles(NftId poolNftId) external view returns(uint256) {
|
112
|
+
return _activeObjs(poolNftId);
|
113
|
+
}
|
114
|
+
|
115
|
+
function getActiveBundleNftId(NftId poolNftId, uint256 idx) external view returns(NftId bundleNftId) {
|
116
|
+
return _getActiveObject(poolNftId, idx);
|
117
|
+
}
|
118
|
+
|
119
|
+
function activePolicies(NftId bundleNftId) external view returns(uint256) {
|
120
|
+
return LibNftIdSet.size(_activePolicies[bundleNftId]);
|
121
|
+
}
|
122
|
+
|
123
|
+
function getActivePolicy(NftId bundleNftId, uint256 idx) external view returns(NftId policyNftId) {
|
124
|
+
return LibNftIdSet.getElementAt(_activePolicies[bundleNftId], idx);
|
125
|
+
}
|
126
|
+
}
|
@@ -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
|
+
}
|