@etherisc/gif-next 0.0.2-e5ea33d → 0.0.2-e69072e-892
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +413 -9
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +626 -31
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +4 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +1279 -0
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/{registry/IChainNft.sol/IChainNft.json → components/IComponent.sol/IComponent.json} +234 -239
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +829 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +4 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +1029 -0
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +4 -0
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +672 -0
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +1319 -81
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +959 -91
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +4 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +764 -0
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +185 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +2038 -508
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +509 -0
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +2715 -456
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +984 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1355 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +1046 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +693 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +261 -0
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +552 -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/base/ILifecycle.sol/ILifecycle.json +115 -0
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +502 -0
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +4 -0
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +169 -0
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +254 -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/IDistribution.sol/IDistribution.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.json +10 -0
- 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/{component/IComponent.sol/IComponent.json → module/ISetup.sol/ISetup.json} +2 -2
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +4 -0
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.json +10 -0
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +968 -0
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +665 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +1096 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +661 -0
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +754 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +637 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +1553 -0
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +793 -0
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +556 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +633 -0
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +409 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +858 -0
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +519 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +347 -0
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +384 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +1000 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +689 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +727 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +649 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +777 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +649 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +239 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +519 -61
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +890 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +4 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +34 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +567 -75
- 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 +1177 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +670 -0
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +547 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +4 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +498 -0
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +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/{registry/Registry.sol/Registerable.json → shared/INftOwnable.sol/INftOwnable.json} +46 -74
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/{instance/product/IProductService.sol/IProductService.json → shared/IPolicyHolder.sol/IPolicyHolder.json} +68 -53
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +4 -0
- package/artifacts/contracts/{instance/pool/PoolModule.sol/PoolModule.json → shared/IRegisterable.sol/IRegisterable.json} +106 -80
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/{registry/IRegistry.sol → shared/IRegistryLinked.sol}/IRegistryLinked.json +18 -19
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +4 -0
- package/artifacts/contracts/shared/IService.sol/IService.json +269 -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 +251 -0
- 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 +4 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +582 -0
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +4 -0
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +352 -0
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +84 -0
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +4 -0
- package/artifacts/contracts/shared/Service.sol/Service.json +425 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +96 -0
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +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 +383 -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 +521 -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/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +2 -2
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.json +2 -2
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +100 -0
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +4 -0
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +104 -0
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +4 -0
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +257 -0
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +4 -0
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +125 -0
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +65 -4
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +4 -0
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +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 +4 -0
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +92 -0
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +100 -0
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +4 -0
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +123 -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 +4 -0
- package/artifacts/contracts/types/StateId.sol/StateIdLib.json +92 -0
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +97 -4
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +4 -0
- package/artifacts/contracts/types/UFixed.sol/MathLib.json +10 -0
- 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 +206 -45
- package/contracts/components/Distribution.sol +293 -0
- package/contracts/components/IComponent.sol +68 -0
- package/contracts/components/IDistributionComponent.sol +79 -0
- package/contracts/components/IPoolComponent.sol +151 -0
- package/contracts/components/IProductComponent.sol +40 -0
- package/contracts/components/Pool.sol +368 -12
- package/contracts/components/Product.sol +262 -28
- package/contracts/instance/BundleManager.sol +125 -0
- package/contracts/instance/Cloneable.sol +46 -0
- package/contracts/instance/IInstance.sol +91 -17
- package/contracts/instance/IInstanceService.sol +59 -0
- package/contracts/instance/Instance.sol +280 -53
- package/contracts/instance/InstanceAccessManager.sol +297 -0
- package/contracts/instance/InstanceReader.sol +293 -0
- package/contracts/instance/InstanceService.sol +490 -0
- package/contracts/instance/InstanceServiceManager.sol +54 -0
- package/contracts/instance/ObjectManager.sol +84 -0
- package/contracts/instance/base/ComponentService.sol +134 -0
- package/contracts/instance/base/IKeyValueStore.sol +49 -0
- package/contracts/instance/base/ILifecycle.sol +30 -0
- package/contracts/instance/base/KeyValueStore.sol +172 -0
- package/contracts/instance/base/Lifecycle.sol +100 -0
- package/contracts/instance/module/IAccess.sol +47 -0
- package/contracts/instance/module/IBundle.sol +21 -0
- package/contracts/instance/module/IDistribution.sol +41 -0
- package/contracts/instance/module/IPolicy.sol +72 -0
- package/contracts/instance/module/IRisk.sol +11 -0
- package/contracts/instance/module/ISetup.sol +46 -0
- package/contracts/instance/module/ITreasury.sol +23 -0
- package/contracts/instance/service/ApplicationService.sol +350 -0
- package/contracts/instance/service/ApplicationServiceManager.sol +35 -0
- package/contracts/instance/service/BundleService.sol +299 -0
- package/contracts/instance/service/BundleServiceManager.sol +51 -0
- package/contracts/instance/service/ClaimService.sol +151 -0
- package/contracts/instance/service/ClaimServiceManager.sol +35 -0
- package/contracts/instance/service/DistributionService.sol +394 -0
- package/contracts/instance/service/DistributionServiceManager.sol +51 -0
- package/contracts/instance/service/IApplicationService.sol +82 -0
- package/contracts/instance/service/IBundleService.sol +55 -0
- package/contracts/instance/service/IClaimService.sol +61 -0
- package/contracts/instance/service/IDistributionService.sol +86 -0
- package/contracts/instance/service/IPolicyService.sol +70 -0
- package/contracts/instance/service/IPoolService.sol +20 -0
- package/contracts/instance/service/IProductService.sol +40 -0
- package/contracts/instance/service/PolicyService.sol +404 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +109 -0
- package/contracts/instance/service/PoolServiceManager.sol +51 -0
- package/contracts/instance/service/ProductService.sol +233 -0
- package/contracts/instance/service/ProductServiceManager.sol +54 -0
- package/contracts/registry/ChainNft.sol +129 -62
- package/contracts/registry/IRegistry.sol +69 -50
- package/contracts/registry/IRegistryService.sol +67 -0
- package/contracts/registry/ITransferInterceptor.sol +6 -0
- package/contracts/registry/Registry.sol +395 -140
- package/contracts/registry/RegistryAccessManager.sol +216 -0
- package/contracts/registry/RegistryService.sol +283 -0
- package/contracts/registry/RegistryServiceManager.sol +62 -0
- package/contracts/registry/ReleaseManager.sol +322 -0
- package/contracts/registry/TokenRegistry.sol +116 -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 +26 -0
- package/contracts/shared/IRegisterable.sol +15 -0
- package/contracts/shared/IRegistryLinked.sol +12 -0
- package/contracts/shared/IService.sol +18 -0
- package/contracts/shared/IVersionable.sol +53 -0
- package/contracts/shared/NftOwnable.sol +120 -0
- package/contracts/shared/PolicyHolder.sol +81 -0
- package/contracts/shared/ProxyManager.sol +169 -0
- package/contracts/shared/Registerable.sol +74 -0
- package/contracts/shared/RegistryLinked.sol +48 -0
- package/contracts/shared/Service.sol +58 -0
- package/contracts/shared/TokenHandler.sol +27 -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/test/TestToken.sol +26 -0
- package/contracts/test/TestVersion.sol +44 -0
- package/contracts/test/TestVersionable.sol +17 -0
- package/contracts/test/Usdc.sol +26 -0
- package/contracts/types/AddressSet.sol +58 -0
- package/contracts/types/ClaimId.sol +52 -0
- package/contracts/types/DistributorType.sol +55 -0
- package/contracts/types/Fee.sol +56 -0
- package/contracts/types/Key32.sol +50 -0
- package/contracts/types/NftId.sol +22 -1
- package/contracts/types/NftIdSet.sol +62 -0
- package/contracts/types/NumberId.sol +52 -0
- package/contracts/types/ObjectType.sol +156 -0
- package/contracts/types/PayoutId.sol +54 -0
- package/contracts/types/Referral.sol +85 -0
- package/contracts/types/RiskId.sol +43 -0
- package/contracts/types/RoleId.sol +95 -0
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/StateId.sol +105 -0
- package/contracts/types/Timestamp.sol +30 -6
- package/contracts/types/UFixed.sol +150 -30
- package/contracts/types/Version.sol +107 -0
- package/package.json +16 -6
- 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 -179
- package/artifacts/contracts/components/IProduct.sol/IProductComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IProduct.sol/IProductComponent.json +0 -192
- 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/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/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/IAccessCheckRole.json +0 -35
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessComponentTypeRoles.dbg.json +0 -4
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessComponentTypeRoles.json +0 -50
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/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 -327
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.json +0 -147
- 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 -179
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.json +0 -245
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.json +0 -94
- 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/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 -231
- package/artifacts/contracts/instance/policy/PolicyModule.sol/PolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/policy/PolicyModule.sol/PolicyModule.json +0 -231
- 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 -149
- package/artifacts/contracts/instance/pool/PoolModule.sol/PoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/product/IProductService.sol/IProductModule.dbg.json +0 -4
- package/artifacts/contracts/instance/product/IProductService.sol/IProductModule.json +0 -75
- package/artifacts/contracts/instance/product/IProductService.sol/IProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/product/ProductService.sol/ProductModule.dbg.json +0 -4
- package/artifacts/contracts/instance/product/ProductService.sol/ProductModule.json +0 -75
- package/artifacts/contracts/instance/product/ProductService.sol/ProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/product/ProductService.sol/ProductService.json +0 -167
- 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/Registry.sol/Registerable.dbg.json +0 -4
- package/artifacts/contracts/registry/Registry.sol/RegistryLinked.dbg.json +0 -4
- package/artifacts/contracts/registry/Registry.sol/RegistryLinked.json +0 -60
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +0 -4
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.json +0 -453
- package/contracts/components/IPool.sol +0 -9
- package/contracts/components/IProduct.sol +0 -9
- 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/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 -213
- package/contracts/instance/component/IComponent.sol +0 -73
- package/contracts/instance/policy/IPolicy.sol +0 -51
- package/contracts/instance/policy/PolicyModule.sol +0 -91
- package/contracts/instance/pool/IPoolModule.sol +0 -29
- package/contracts/instance/pool/PoolModule.sol +0 -73
- package/contracts/instance/product/IProductService.sol +0 -36
- package/contracts/instance/product/ProductService.sol +0 -112
- package/contracts/registry/IChainNft.sol +0 -21
@@ -1,51 +0,0 @@
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.19;
|
3
|
-
|
4
|
-
import {IOwnable, IRegistryLinked, IRegisterable, IRegistry} from "../../registry/IRegistry.sol";
|
5
|
-
import {IInstance} from "../IInstance.sol";
|
6
|
-
import {IProductService} from "../product/IProductService.sol";
|
7
|
-
import {NftId} from "../../types/NftId.sol";
|
8
|
-
|
9
|
-
// TODO check if there is value to introuce IContract and let IPolicy derive from IContract
|
10
|
-
interface IPolicy {
|
11
|
-
enum PolicyState {
|
12
|
-
Undefined,
|
13
|
-
Applied,
|
14
|
-
Rejected,
|
15
|
-
Active,
|
16
|
-
Closed
|
17
|
-
}
|
18
|
-
|
19
|
-
struct PolicyInfo {
|
20
|
-
NftId nftId;
|
21
|
-
PolicyState state; // applied, withdrawn, rejected, active, closed
|
22
|
-
uint256 sumInsuredAmount;
|
23
|
-
uint256 premiumAmount;
|
24
|
-
uint256 lifetime; // activatedAt + lifetime >= expiredAt
|
25
|
-
uint256 createdAt;
|
26
|
-
uint256 activatedAt; // time of underwriting
|
27
|
-
uint256 expiredAt; // no new claims
|
28
|
-
uint256 closedAt; // no locked capital
|
29
|
-
}
|
30
|
-
}
|
31
|
-
|
32
|
-
interface IPolicyModule is IOwnable, IRegistryLinked, IPolicy {
|
33
|
-
function createApplication(
|
34
|
-
IRegistry.RegistryInfo memory productInfo,
|
35
|
-
address applicationOwner,
|
36
|
-
uint256 sumInsuredAmount,
|
37
|
-
uint256 premiumAmount,
|
38
|
-
uint256 lifetime,
|
39
|
-
NftId bundleNftId
|
40
|
-
) external returns (NftId nftId);
|
41
|
-
|
42
|
-
function activate(NftId nftId) external;
|
43
|
-
|
44
|
-
function getBundleNftForPolicy(
|
45
|
-
NftId nftId
|
46
|
-
) external view returns (NftId bundleNft);
|
47
|
-
|
48
|
-
function getPolicyInfo(
|
49
|
-
NftId nftId
|
50
|
-
) external view returns (PolicyInfo memory info);
|
51
|
-
}
|
@@ -1,91 +0,0 @@
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.19;
|
3
|
-
|
4
|
-
// import {IOwnable, IRegistryLinked, IRegisterable} from "../../registry/IRegistry.sol";
|
5
|
-
import {IRegistry, IRegistryLinked} from "../../registry/IRegistry.sol";
|
6
|
-
|
7
|
-
import {IProductService} from "../product/IProductService.sol";
|
8
|
-
import {IPolicy, IPolicyModule} from "./IPolicy.sol";
|
9
|
-
import {NftId, NftIdLib} from "../../types/NftId.sol";
|
10
|
-
|
11
|
-
abstract contract PolicyModule is IRegistryLinked, IPolicyModule {
|
12
|
-
using NftIdLib for NftId;
|
13
|
-
|
14
|
-
mapping(NftId nftId => PolicyInfo info) private _policyInfo;
|
15
|
-
mapping(NftId nftId => NftId bundleNftId) private _bundleForPolicy;
|
16
|
-
|
17
|
-
IProductService private _productService;
|
18
|
-
|
19
|
-
// TODO find a better place to avoid dupliation
|
20
|
-
modifier onlyProductService2() {
|
21
|
-
require(
|
22
|
-
address(_productService) == msg.sender,
|
23
|
-
"ERROR:POL-001:NOT_PRODUCT_SERVICE"
|
24
|
-
);
|
25
|
-
_;
|
26
|
-
}
|
27
|
-
|
28
|
-
constructor(address productService) {
|
29
|
-
_productService = IProductService(productService);
|
30
|
-
}
|
31
|
-
|
32
|
-
function createApplication(
|
33
|
-
IRegistry.RegistryInfo memory productInfo,
|
34
|
-
address applicationOwner,
|
35
|
-
uint256 sumInsuredAmount,
|
36
|
-
uint256 premiumAmount,
|
37
|
-
uint256 lifetime,
|
38
|
-
NftId bundleNftId
|
39
|
-
) external override onlyProductService2 returns (NftId nftId) {
|
40
|
-
// TODO add parameter validation
|
41
|
-
if (bundleNftId.gtz()) {
|
42
|
-
IRegistry.RegistryInfo memory bundleInfo = this
|
43
|
-
.getRegistry()
|
44
|
-
.getInfo(bundleNftId);
|
45
|
-
// IRegistry.RegistryInfo memory poolInfo = this.getRegistry().getInfo(bundleInfo.parentNftId);
|
46
|
-
}
|
47
|
-
|
48
|
-
nftId = this.getRegistry().registerObjectForInstance(
|
49
|
-
productInfo.nftId,
|
50
|
-
this.getRegistry().POLICY(),
|
51
|
-
applicationOwner
|
52
|
-
);
|
53
|
-
|
54
|
-
_policyInfo[nftId] = PolicyInfo(
|
55
|
-
nftId,
|
56
|
-
PolicyState.Applied,
|
57
|
-
sumInsuredAmount,
|
58
|
-
premiumAmount,
|
59
|
-
lifetime,
|
60
|
-
block.timestamp,
|
61
|
-
0, // activatedAt
|
62
|
-
0, // expiredAt
|
63
|
-
0 // closedAt
|
64
|
-
);
|
65
|
-
|
66
|
-
_bundleForPolicy[nftId] = bundleNftId;
|
67
|
-
|
68
|
-
// add logging
|
69
|
-
}
|
70
|
-
|
71
|
-
function activate(NftId nftId) external override onlyProductService2 {
|
72
|
-
PolicyInfo storage info = _policyInfo[nftId];
|
73
|
-
info.activatedAt = block.timestamp;
|
74
|
-
info.expiredAt = block.timestamp + info.lifetime;
|
75
|
-
info.state = PolicyState.Active;
|
76
|
-
|
77
|
-
// add logging
|
78
|
-
}
|
79
|
-
|
80
|
-
function getBundleNftForPolicy(
|
81
|
-
NftId nftId
|
82
|
-
) external view returns (NftId bundleNft) {
|
83
|
-
return _bundleForPolicy[nftId];
|
84
|
-
}
|
85
|
-
|
86
|
-
function getPolicyInfo(
|
87
|
-
NftId nftId
|
88
|
-
) external view returns (PolicyInfo memory info) {
|
89
|
-
return _policyInfo[nftId];
|
90
|
-
}
|
91
|
-
}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.19;
|
3
|
-
|
4
|
-
import {IOwnable, IRegistry, IRegistryLinked} from "../../registry/IRegistry.sol";
|
5
|
-
import {NftId} from "../../types/NftId.sol";
|
6
|
-
|
7
|
-
interface IPool {
|
8
|
-
struct PoolInfo {
|
9
|
-
NftId nftId;
|
10
|
-
address wallet;
|
11
|
-
address token;
|
12
|
-
uint256 capital;
|
13
|
-
uint256 lockedCapital;
|
14
|
-
}
|
15
|
-
}
|
16
|
-
|
17
|
-
interface IPoolModule is IOwnable, IRegistryLinked, IPool {
|
18
|
-
function underwrite(NftId poolNftId, NftId policyNftId) external;
|
19
|
-
|
20
|
-
function createPoolInfo(
|
21
|
-
NftId nftId,
|
22
|
-
address wallet,
|
23
|
-
address token
|
24
|
-
) external;
|
25
|
-
|
26
|
-
function getPoolInfo(
|
27
|
-
NftId nftId
|
28
|
-
) external view returns (PoolInfo memory info);
|
29
|
-
}
|
@@ -1,73 +0,0 @@
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.19;
|
3
|
-
|
4
|
-
import {IOwnable, IRegistry, IRegistryLinked} from "../../registry/IRegistry.sol";
|
5
|
-
import {IProductService} from "../product/IProductService.sol";
|
6
|
-
import {IPolicy, IPolicyModule} from "../policy/IPolicy.sol";
|
7
|
-
import {IPoolModule} from "./IPoolModule.sol";
|
8
|
-
import {NftId, NftIdLib} from "../../types/NftId.sol";
|
9
|
-
|
10
|
-
abstract contract PoolModule is IPoolModule {
|
11
|
-
using NftIdLib for NftId;
|
12
|
-
|
13
|
-
uint256 public constant INITIAL_CAPITAL = 10000 * 10 ** 6;
|
14
|
-
|
15
|
-
mapping(NftId nftId => PoolInfo info) private _poolInfo;
|
16
|
-
|
17
|
-
IProductService private _productService;
|
18
|
-
|
19
|
-
modifier onlyProductService() {
|
20
|
-
require(
|
21
|
-
address(_productService) == msg.sender,
|
22
|
-
"ERROR:POL-001:NOT_PRODUCT_SERVICE"
|
23
|
-
);
|
24
|
-
_;
|
25
|
-
}
|
26
|
-
|
27
|
-
constructor(address productService) {
|
28
|
-
_productService = IProductService(productService);
|
29
|
-
}
|
30
|
-
|
31
|
-
function createPoolInfo(
|
32
|
-
NftId nftId,
|
33
|
-
address wallet,
|
34
|
-
address token
|
35
|
-
) public override {
|
36
|
-
require(_poolInfo[nftId].nftId.eqz(), "ERROR:PL-001:ALREADY_CREATED");
|
37
|
-
|
38
|
-
_poolInfo[nftId] = PoolInfo(
|
39
|
-
nftId,
|
40
|
-
wallet,
|
41
|
-
token,
|
42
|
-
INITIAL_CAPITAL,
|
43
|
-
0 // locked capital
|
44
|
-
);
|
45
|
-
}
|
46
|
-
|
47
|
-
function underwrite(
|
48
|
-
NftId poolNftId,
|
49
|
-
NftId policyNftId
|
50
|
-
) external override onlyProductService {
|
51
|
-
PoolInfo storage poolInfo = _poolInfo[poolNftId];
|
52
|
-
require(poolInfo.nftId == poolNftId, "ERROR:PL-002:POOL_UNKNOWN");
|
53
|
-
|
54
|
-
IPolicyModule policyModule = IPolicyModule(address(this));
|
55
|
-
IPolicy.PolicyInfo memory policyInfo = policyModule.getPolicyInfo(
|
56
|
-
policyNftId
|
57
|
-
);
|
58
|
-
|
59
|
-
require(
|
60
|
-
poolInfo.capital - poolInfo.lockedCapital >=
|
61
|
-
policyInfo.sumInsuredAmount,
|
62
|
-
"ERROR:PL-003:CAPACITY_TOO_LOW"
|
63
|
-
);
|
64
|
-
|
65
|
-
poolInfo.lockedCapital += policyInfo.sumInsuredAmount;
|
66
|
-
}
|
67
|
-
|
68
|
-
function getPoolInfo(
|
69
|
-
NftId nftId
|
70
|
-
) external view override returns (PoolInfo memory info) {
|
71
|
-
info = _poolInfo[nftId];
|
72
|
-
}
|
73
|
-
}
|
@@ -1,36 +0,0 @@
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.19;
|
3
|
-
|
4
|
-
import {IOwnable, IRegistryLinked, IRegisterable} from "../../registry/IRegistry.sol";
|
5
|
-
import {IInstance} from "../IInstance.sol";
|
6
|
-
import {NftId} from "../../types/NftId.sol";
|
7
|
-
|
8
|
-
// TODO or name this IProtectionService to have Product be something more generic (loan, savings account, ...)
|
9
|
-
interface IProductService is IRegistryLinked {
|
10
|
-
function createApplication(
|
11
|
-
address applicationOwner,
|
12
|
-
uint256 sumInsuredAmount,
|
13
|
-
uint256 premiumAmount,
|
14
|
-
uint256 lifetime,
|
15
|
-
NftId bundleNftId
|
16
|
-
) external returns (NftId nftId);
|
17
|
-
|
18
|
-
// function revoke(unit256 nftId) external;
|
19
|
-
|
20
|
-
function underwrite(NftId nftId) external;
|
21
|
-
|
22
|
-
// function decline(uint256 nftId) external;
|
23
|
-
// function expire(uint256 nftId) external;
|
24
|
-
function close(NftId nftId) external;
|
25
|
-
|
26
|
-
// function collectPremium(uint256 nftId, uint256 premiumAmount) external;
|
27
|
-
|
28
|
-
// function createClaim(uint256 nftId, uint256 claimAmount) external;
|
29
|
-
// function confirmClaim(uint256 nftId, uint256 claimId, uint256 claimAmount) external;
|
30
|
-
// function declineClaim(uint256 nftId, uint256 claimId) external;
|
31
|
-
// function closeClaim(uint256 nftId, uint256 claimId) external;
|
32
|
-
}
|
33
|
-
|
34
|
-
interface IProductModule is IOwnable, IRegistryLinked {
|
35
|
-
function getProductService() external view returns (IProductService);
|
36
|
-
}
|
@@ -1,112 +0,0 @@
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.19;
|
3
|
-
|
4
|
-
// import {IProduct} from "../../components/IProduct.sol";
|
5
|
-
// import {IOwnable, IRegistryLinked, IRegisterable, IRegistry} from "../../registry/IRegistry.sol";
|
6
|
-
// import {IInstance} from "../IInstance.sol";
|
7
|
-
import {IRegistry} from "../../registry/IRegistry.sol";
|
8
|
-
import {IPolicyModule} from "../policy/IPolicy.sol";
|
9
|
-
import {RegistryLinked} from "../../registry/Registry.sol";
|
10
|
-
import {IProductService, IProductModule} from "./IProductService.sol";
|
11
|
-
import {IComponentModule} from "../../instance/component/IComponent.sol";
|
12
|
-
import {IPoolModule} from "../../instance/pool/IPoolModule.sol";
|
13
|
-
import {NftId, NftIdLib} from "../../types/NftId.sol";
|
14
|
-
|
15
|
-
// TODO or name this ProtectionService to have Product be something more generic (loan, savings account, ...)
|
16
|
-
contract ProductService is RegistryLinked, IProductService {
|
17
|
-
using NftIdLib for NftId;
|
18
|
-
|
19
|
-
constructor(address registry) RegistryLinked(registry) {}
|
20
|
-
|
21
|
-
function createApplication(
|
22
|
-
address applicationOwner,
|
23
|
-
uint256 sumInsuredAmount,
|
24
|
-
uint256 premiumAmount,
|
25
|
-
uint256 lifetime,
|
26
|
-
NftId bundleNftId
|
27
|
-
) external override returns (NftId nftId) {
|
28
|
-
// same as only registered product
|
29
|
-
NftId productNftId = _registry.getNftId(msg.sender);
|
30
|
-
require(productNftId.gtz(), "ERROR_PRODUCT_UNKNOWN");
|
31
|
-
IRegistry.RegistryInfo memory productInfo = _registry.getInfo(
|
32
|
-
productNftId
|
33
|
-
);
|
34
|
-
require(
|
35
|
-
productInfo.objectType == _registry.PRODUCT(),
|
36
|
-
"ERROR_NOT_PRODUCT"
|
37
|
-
);
|
38
|
-
|
39
|
-
IRegistry.RegistryInfo memory instanceInfo = _registry.getInfo(
|
40
|
-
productInfo.parentNftId
|
41
|
-
);
|
42
|
-
require(instanceInfo.nftId.gtz(), "ERROR_INSTANCE_UNKNOWN");
|
43
|
-
require(
|
44
|
-
instanceInfo.objectType == _registry.INSTANCE(),
|
45
|
-
"ERROR_NOT_INSTANCE"
|
46
|
-
);
|
47
|
-
|
48
|
-
IPolicyModule policyModule = IPolicyModule(instanceInfo.objectAddress);
|
49
|
-
nftId = policyModule.createApplication(
|
50
|
-
productInfo,
|
51
|
-
applicationOwner,
|
52
|
-
sumInsuredAmount,
|
53
|
-
premiumAmount,
|
54
|
-
lifetime,
|
55
|
-
bundleNftId
|
56
|
-
);
|
57
|
-
|
58
|
-
// add logging
|
59
|
-
}
|
60
|
-
|
61
|
-
function underwrite(NftId nftId) external override {
|
62
|
-
// same as only registered product
|
63
|
-
NftId productNftId = _registry.getNftId(msg.sender);
|
64
|
-
require(productNftId.gtz(), "ERROR_PRODUCT_UNKNOWN");
|
65
|
-
IRegistry.RegistryInfo memory productInfo = _registry.getInfo(
|
66
|
-
productNftId
|
67
|
-
);
|
68
|
-
require(
|
69
|
-
productInfo.objectType == _registry.PRODUCT(),
|
70
|
-
"ERROR_NOT_PRODUCT"
|
71
|
-
);
|
72
|
-
|
73
|
-
IRegistry.RegistryInfo memory instanceInfo = _registry.getInfo(
|
74
|
-
productInfo.parentNftId
|
75
|
-
);
|
76
|
-
require(instanceInfo.nftId.gtz(), "ERROR_INSTANCE_UNKNOWN");
|
77
|
-
require(
|
78
|
-
instanceInfo.objectType == _registry.INSTANCE(),
|
79
|
-
"ERROR_NOT_INSTANCE"
|
80
|
-
);
|
81
|
-
|
82
|
-
// get responsible pool
|
83
|
-
IComponentModule componentModule = IComponentModule(
|
84
|
-
instanceInfo.objectAddress
|
85
|
-
);
|
86
|
-
NftId poolNftId = componentModule.getPoolNftId(productNftId);
|
87
|
-
|
88
|
-
// lock capital (and update pool accounting)
|
89
|
-
IPoolModule poolModule = IPoolModule(instanceInfo.objectAddress);
|
90
|
-
poolModule.underwrite(poolNftId, nftId);
|
91
|
-
|
92
|
-
// activate policy
|
93
|
-
IPolicyModule policyModule = IPolicyModule(instanceInfo.objectAddress);
|
94
|
-
policyModule.activate(nftId);
|
95
|
-
|
96
|
-
// add logging
|
97
|
-
}
|
98
|
-
|
99
|
-
function close(NftId nftId) external override {}
|
100
|
-
}
|
101
|
-
|
102
|
-
abstract contract ProductModule is IProductModule {
|
103
|
-
IProductService private _productService;
|
104
|
-
|
105
|
-
constructor(address productService) {
|
106
|
-
_productService = IProductService(productService);
|
107
|
-
}
|
108
|
-
|
109
|
-
function getProductService() external view returns (IProductService) {
|
110
|
-
return _productService;
|
111
|
-
}
|
112
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.19;
|
3
|
-
|
4
|
-
import {IERC721Enumerable} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
|
5
|
-
|
6
|
-
interface IChainNft is IERC721Enumerable {
|
7
|
-
function mint(
|
8
|
-
address to,
|
9
|
-
string memory uri
|
10
|
-
) external returns (uint256 tokenId);
|
11
|
-
|
12
|
-
function burn(uint256 tokenId) external;
|
13
|
-
|
14
|
-
function setURI(uint256 tokenId, string memory uri) external;
|
15
|
-
|
16
|
-
function exists(uint256 tokenId) external view returns (bool);
|
17
|
-
|
18
|
-
function totalMinted() external view returns (uint256);
|
19
|
-
|
20
|
-
function getRegistryAddress() external view returns (address registry);
|
21
|
-
}
|