@etherisc/gif-next 0.0.2-f9bc4c7-556 → 0.0.2-fbe22f0-239
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +314 -2
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/components/Component.sol/Component.json +858 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +4 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +1114 -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} +281 -226
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +695 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +601 -76
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +582 -61
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +1099 -159
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +1030 -84
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.json +66 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.json +24 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.json +42 -0
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +2 -2
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +2 -2
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +2 -2
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
- 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 +1150 -1021
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +591 -0
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +2047 -1067
- 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 +1386 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +1164 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +584 -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 +728 -0
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +45 -127
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +55 -245
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +4 -4
- 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/module/{bundle/IBundle.sol → IBundle.sol}/IBundle.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{access/IAccess.sol/IAccess.json → IDistribution.sol/IDistribution.json} +2 -2
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{policy/IPolicy.sol → IPolicy.sol}/IPolicy.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{risk/IRisk.sol → IRisk.sol}/IRisk.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +4 -0
- package/artifacts/contracts/instance/{base/ModuleBase.sol/ModuleBase.json → module/ISetup.sol/ISetup.json} +2 -2
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{treasury/ITreasury.sol → ITreasury.sol}/ITreasury.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +1091 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +1292 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +560 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +897 -0
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +548 -0
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +625 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +785 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/{base/InstanceBase.sol/InstanceBase.json → service/IDistributionService.sol/IDistributionService.json} +205 -85
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +771 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +203 -80
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +209 -150
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +1352 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +616 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +546 -86
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +548 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +521 -213
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +548 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +186 -12
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +466 -34
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +986 -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 +470 -103
- 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 +1325 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +575 -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 +505 -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 +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +41 -3
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +4 -0
- package/artifacts/contracts/{components/IBaseComponent.sol/IBaseComponent.json → shared/INftOwnable.sol/INftOwnable.json} +56 -79
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +129 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +116 -36
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +4 -0
- package/artifacts/contracts/{instance/service/IComponentOwnerService.sol/IComponentOwnerService.json → shared/IService.sol/IService.json} +174 -117
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +55 -14
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +4 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +277 -0
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +172 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +4 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +473 -0
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +293 -25
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +4 -0
- package/artifacts/contracts/shared/Service.sol/Service.json +601 -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 +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +78 -14
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +4 -4
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +309 -26
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +14 -14
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +412 -58
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +91 -53
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +103 -23
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/test/Usdc.sol/USDC.json +91 -53
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +4 -0
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +104 -0
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +52 -13
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +31 -17
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +26 -3
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.json +100 -0
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/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 +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +134 -8
- 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 +15 -2
- 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/{UFixedMathLib.json → UFixedLib.json} +3 -3
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +40 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +22 -3
- package/contracts/components/Component.sol +230 -0
- package/contracts/components/Distribution.sol +156 -0
- package/contracts/components/IComponent.sol +50 -0
- package/contracts/components/IDistributionComponent.sol +47 -0
- package/contracts/components/IPoolComponent.sol +65 -35
- package/contracts/components/IProductComponent.sol +29 -9
- package/contracts/components/Pool.sol +180 -100
- package/contracts/components/Product.sol +203 -42
- package/contracts/experiment/cloning/Cloner.sol +47 -0
- package/contracts/instance/BundleManager.sol +125 -0
- package/contracts/instance/Cloneable.sol +46 -0
- package/contracts/instance/IInstance.sol +65 -45
- package/contracts/instance/IInstanceService.sol +41 -0
- package/contracts/instance/Instance.sol +253 -53
- package/contracts/instance/InstanceAccessManager.sol +297 -0
- package/contracts/instance/InstanceReader.sol +293 -0
- package/contracts/instance/InstanceService.sol +434 -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 +13 -13
- package/contracts/instance/base/ILifecycle.sol +3 -3
- package/contracts/instance/base/KeyValueStore.sol +53 -37
- package/contracts/instance/base/Lifecycle.sol +16 -11
- package/contracts/instance/module/IAccess.sol +47 -0
- package/contracts/instance/module/IBundle.sol +20 -0
- package/contracts/instance/module/IDistribution.sol +39 -0
- package/contracts/instance/module/IPolicy.sol +45 -0
- package/contracts/instance/module/IRisk.sol +11 -0
- package/contracts/instance/module/ISetup.sol +47 -0
- package/contracts/instance/module/ITreasury.sol +23 -0
- package/contracts/instance/service/ApplicationService.sol +268 -0
- package/contracts/instance/service/BundleService.sol +298 -0
- package/contracts/instance/service/BundleServiceManager.sol +51 -0
- package/contracts/instance/service/DistributionService.sol +105 -0
- package/contracts/instance/service/DistributionServiceManager.sol +51 -0
- package/contracts/instance/service/IApplicationService.sol +82 -0
- package/contracts/instance/service/IBundleService.sol +54 -0
- package/contracts/instance/service/IDistributionService.sol +12 -0
- package/contracts/instance/service/IPolicyService.sol +88 -0
- package/contracts/instance/service/IPoolService.sol +8 -18
- package/contracts/instance/service/IProductService.sol +21 -39
- package/contracts/instance/service/PolicyService.sol +524 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +78 -92
- package/contracts/instance/service/PoolServiceManager.sol +51 -0
- package/contracts/instance/service/ProductService.sol +168 -289
- package/contracts/instance/service/ProductServiceManager.sol +54 -0
- package/contracts/registry/ChainNft.sol +79 -36
- package/contracts/registry/IRegistry.sol +66 -24
- package/contracts/registry/IRegistryService.sol +65 -0
- package/contracts/registry/ITransferInterceptor.sol +6 -0
- package/contracts/registry/Registry.sol +364 -283
- package/contracts/registry/RegistryAccessManager.sol +216 -0
- package/contracts/registry/RegistryService.sol +261 -0
- package/contracts/registry/RegistryServiceManager.sol +62 -0
- package/contracts/registry/ReleaseManager.sol +332 -0
- package/contracts/registry/TokenRegistry.sol +113 -0
- package/contracts/shared/ContractDeployerLib.sol +72 -0
- package/contracts/shared/ERC165.sol +13 -8
- package/contracts/shared/INftOwnable.sol +27 -0
- package/contracts/shared/IPolicyHolder.sol +26 -0
- package/contracts/shared/IRegisterable.sol +10 -19
- package/contracts/shared/IService.sol +16 -0
- package/contracts/shared/IVersionable.sol +55 -11
- package/contracts/shared/NftOwnable.sol +187 -0
- package/contracts/shared/PolicyHolder.sol +52 -0
- package/contracts/shared/ProxyManager.sol +95 -0
- package/contracts/shared/Registerable.sol +58 -63
- package/contracts/shared/Service.sol +60 -0
- package/contracts/shared/TokenHandler.sol +27 -0
- package/contracts/shared/UpgradableProxyWithAdmin.sol +16 -0
- package/contracts/shared/Versionable.sol +113 -54
- package/contracts/test/TestFee.sol +2 -2
- package/contracts/test/TestRegisterable.sol +5 -6
- package/contracts/test/TestRoleId.sol +1 -1
- package/contracts/test/TestService.sol +7 -14
- package/contracts/types/DistributorType.sol +55 -0
- package/contracts/types/Fee.sol +10 -5
- package/contracts/types/Key32.sol +8 -3
- package/contracts/types/NftIdSet.sol +26 -24
- package/contracts/types/NumberId.sol +52 -0
- package/contracts/types/ObjectType.sol +55 -14
- package/contracts/types/Referral.sol +85 -0
- package/contracts/types/RiskId.sol +43 -0
- package/contracts/types/RoleId.sol +62 -10
- package/contracts/types/StateId.sol +5 -1
- package/contracts/types/Timestamp.sol +7 -3
- package/contracts/types/UFixed.sol +128 -12
- package/contracts/types/Version.sol +13 -1
- package/package.json +6 -5
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +0 -174
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.dbg.json +0 -4
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.json +0 -24
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +0 -300
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -63
- package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IService.sol/IService.json +0 -300
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.json +0 -300
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.json +0 -333
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.json +0 -333
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.json +0 -296
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.json +0 -296
- package/artifacts/contracts/instance/module/compensation/CompensationModule.sol/CompensationModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/compensation/CompensationModule.sol/CompensationModule.json +0 -10
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensation.dbg.json +0 -4
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensation.json +0 -10
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensationModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensationModule.json +0 -10
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.json +0 -188
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.dbg.json +0 -4
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.json +0 -10
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.json +0 -188
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicy.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.json +0 -261
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.json +0 -261
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.json +0 -10
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.json +0 -149
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.json +0 -149
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.dbg.json +0 -4
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.json +0 -10
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.json +0 -10
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.json +0 -533
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.json +0 -76
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.json +0 -533
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -523
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.json +0 -24
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.dbg.json +0 -4
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.json +0 -24
- package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +0 -4
- package/artifacts/contracts/test/TestPool.sol/TestPool.json +0 -387
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +0 -4
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +0 -393
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +0 -4
- package/contracts/components/BaseComponent.sol +0 -88
- package/contracts/components/IBaseComponent.sol +0 -19
- package/contracts/experiment/statemachine/README.md +0 -112
- package/contracts/instance/IInstanceLinked.sol +0 -8
- package/contracts/instance/base/ComponentServiceBase.sol +0 -42
- package/contracts/instance/base/IInstanceBase.sol +0 -14
- package/contracts/instance/base/IService.sol +0 -15
- package/contracts/instance/base/InstanceBase.sol +0 -80
- package/contracts/instance/base/ModuleBase.sol +0 -52
- package/contracts/instance/base/ServiceBase.sol +0 -37
- package/contracts/instance/module/access/Access.sol +0 -149
- package/contracts/instance/module/access/IAccess.sol +0 -53
- package/contracts/instance/module/bundle/BundleModule.sol +0 -136
- package/contracts/instance/module/bundle/IBundle.sol +0 -58
- package/contracts/instance/module/compensation/CompensationModule.sol +0 -8
- package/contracts/instance/module/compensation/ICompensation.sol +0 -10
- package/contracts/instance/module/component/ComponentModule.sol +0 -95
- package/contracts/instance/module/component/IComponent.sol +0 -53
- package/contracts/instance/module/policy/IPolicy.sol +0 -60
- package/contracts/instance/module/policy/PolicyModule.sol +0 -76
- package/contracts/instance/module/pool/IPoolModule.sol +0 -41
- package/contracts/instance/module/pool/PoolModule.sol +0 -87
- package/contracts/instance/module/risk/IRisk.sol +0 -10
- package/contracts/instance/module/risk/RiskModule.sol +0 -8
- package/contracts/instance/module/treasury/ITreasury.sol +0 -103
- package/contracts/instance/module/treasury/TokenHandler.sol +0 -48
- package/contracts/instance/module/treasury/TreasuryModule.sol +0 -152
- package/contracts/instance/service/ComponentOwnerService.sol +0 -170
- package/contracts/instance/service/IComponentOwnerService.sol +0 -22
- package/contracts/registry/IChainNft.sol +0 -21
- package/contracts/registry/IRegistryLinked.sol +0 -8
- package/contracts/shared/IOwnable.sol +0 -6
- package/contracts/test/TestPool.sol +0 -22
- package/contracts/test/TestProduct.sol +0 -44
@@ -0,0 +1,105 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {IRegistry} from "../../registry/IRegistry.sol";
|
5
|
+
import {IInstance} from "../../instance/IInstance.sol";
|
6
|
+
import {InstanceAccessManager} from "../InstanceAccessManager.sol";
|
7
|
+
import {InstanceReader} from "../../instance/InstanceReader.sol";
|
8
|
+
import {ISetup} from "../../instance/module/ISetup.sol";
|
9
|
+
|
10
|
+
import {NftId, NftIdLib} from "../../types/NftId.sol";
|
11
|
+
import {Fee} from "../../types/Fee.sol";
|
12
|
+
import {DISTRIBUTION_OWNER_ROLE} from "../../types/RoleId.sol";
|
13
|
+
import {KEEP_STATE} from "../../types/StateId.sol";
|
14
|
+
import {ObjectType, DISTRIBUTION} from "../../types/ObjectType.sol";
|
15
|
+
import {Version, VersionLib} from "../../types/Version.sol";
|
16
|
+
|
17
|
+
import {IVersionable} from "../../shared/IVersionable.sol";
|
18
|
+
import {Versionable} from "../../shared/Versionable.sol";
|
19
|
+
|
20
|
+
import {IService} from "../../shared/IService.sol";
|
21
|
+
import {Service} from "../../shared/Service.sol";
|
22
|
+
import {ComponentService} from "../base/ComponentService.sol";
|
23
|
+
import {InstanceService} from "../InstanceService.sol";
|
24
|
+
import {IComponent} from "../../components/IComponent.sol";
|
25
|
+
import {IDistributionComponent} from "../../components/IDistributionComponent.sol";
|
26
|
+
import {IDistributionService} from "./IDistributionService.sol";
|
27
|
+
|
28
|
+
contract DistributionService is
|
29
|
+
ComponentService,
|
30
|
+
IDistributionService
|
31
|
+
{
|
32
|
+
using NftIdLib for NftId;
|
33
|
+
|
34
|
+
address internal _registryAddress;
|
35
|
+
|
36
|
+
function _initialize(
|
37
|
+
address owner,
|
38
|
+
bytes memory data
|
39
|
+
)
|
40
|
+
internal
|
41
|
+
initializer
|
42
|
+
virtual override
|
43
|
+
{
|
44
|
+
address initialOwner;
|
45
|
+
address registryAddress;
|
46
|
+
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
47
|
+
// TODO while DistributionService is not deployed in DistributionServiceManager constructor
|
48
|
+
// owner is DistributionServiceManager deployer
|
49
|
+
initializeService(registryAddress, owner);
|
50
|
+
registerInterface(type(IDistributionService).interfaceId);
|
51
|
+
}
|
52
|
+
|
53
|
+
function getDomain() public pure override(Service, IService) returns(ObjectType) {
|
54
|
+
return DISTRIBUTION();
|
55
|
+
}
|
56
|
+
|
57
|
+
function register(address distributionAddress)
|
58
|
+
external
|
59
|
+
returns(NftId distributionNftId)
|
60
|
+
{
|
61
|
+
(
|
62
|
+
IComponent component,
|
63
|
+
address owner,
|
64
|
+
IInstance instance,
|
65
|
+
NftId instanceNftId
|
66
|
+
) = _checkComponentForRegistration(
|
67
|
+
distributionAddress,
|
68
|
+
DISTRIBUTION(),
|
69
|
+
DISTRIBUTION_OWNER_ROLE());
|
70
|
+
|
71
|
+
IRegistry.ObjectInfo memory distributionInfo = getRegistryService().registerDistribution(component, owner);
|
72
|
+
IDistributionComponent distribution = IDistributionComponent(distributionAddress);
|
73
|
+
distribution.linkToRegisteredNftId();
|
74
|
+
distributionNftId = distributionInfo.nftId;
|
75
|
+
|
76
|
+
instance.createDistributionSetup(distributionNftId, distribution.getSetupInfo());
|
77
|
+
getInstanceService().createGifTarget(instanceNftId, distributionAddress, distribution.getName());
|
78
|
+
getInstanceService().grantDistributionDefaultPermissions(instanceNftId, distributionAddress, distribution.getName());
|
79
|
+
}
|
80
|
+
|
81
|
+
function _decodeAndVerifyDistributionData(bytes memory data)
|
82
|
+
internal
|
83
|
+
returns(string memory name)
|
84
|
+
{
|
85
|
+
(name) = abi.decode(data, (string));
|
86
|
+
|
87
|
+
// TODO add checks if applicable
|
88
|
+
}
|
89
|
+
|
90
|
+
function setFees(
|
91
|
+
Fee memory distributionFee
|
92
|
+
)
|
93
|
+
external
|
94
|
+
override
|
95
|
+
{
|
96
|
+
(IRegistry.ObjectInfo memory info , IInstance instance) = _getAndVerifyComponentInfoAndInstance(DISTRIBUTION());
|
97
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
98
|
+
NftId distributionNftId = info.nftId;
|
99
|
+
|
100
|
+
ISetup.DistributionSetupInfo memory distSetupInfo = instanceReader.getDistributionSetupInfo(distributionNftId);
|
101
|
+
distSetupInfo.distributionFee = distributionFee;
|
102
|
+
|
103
|
+
instance.updateDistributionSetup(distributionNftId, distSetupInfo, KEEP_STATE());
|
104
|
+
}
|
105
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {IVersionable} from "../../shared/IVersionable.sol";
|
5
|
+
import {ProxyManager} from "../../shared/ProxyManager.sol";
|
6
|
+
import {DistributionService} from "./DistributionService.sol";
|
7
|
+
import {Registry} from "../../registry/Registry.sol";
|
8
|
+
import {RegistryService} from "../../registry/RegistryService.sol";
|
9
|
+
import {REGISTRY} from "../../types/ObjectType.sol";
|
10
|
+
|
11
|
+
contract DistributionServiceManager is ProxyManager {
|
12
|
+
|
13
|
+
DistributionService private _distributionService;
|
14
|
+
|
15
|
+
/// @dev initializes proxy manager with distribution service implementation and deploys instance
|
16
|
+
constructor(
|
17
|
+
address registryAddress
|
18
|
+
)
|
19
|
+
ProxyManager()
|
20
|
+
{
|
21
|
+
DistributionService distSrv = new DistributionService();
|
22
|
+
bytes memory data = abi.encode(registryAddress, address(this));
|
23
|
+
IVersionable versionable = deploy(
|
24
|
+
address(distSrv),
|
25
|
+
data);
|
26
|
+
|
27
|
+
_distributionService = DistributionService(address(versionable));
|
28
|
+
|
29
|
+
// TODO `thi` must have a role or own nft to register service
|
30
|
+
//Registry registry = Registry(registryAddress);
|
31
|
+
//address registryServiceAddress = registry.getServiceAddress(REGISTRY(), _distributionService.getMajorVersion());
|
32
|
+
//RegistryService registryService = RegistryService(registryServiceAddress);
|
33
|
+
//registryService.registerService(_distributionService);
|
34
|
+
|
35
|
+
// TODO no nft to link yet
|
36
|
+
// link ownership of instance service manager ot nft owner of instance service
|
37
|
+
//_linkToNftOwnable(
|
38
|
+
// address(registryAddress),
|
39
|
+
// address(_distributionService));
|
40
|
+
}
|
41
|
+
|
42
|
+
//--- view functions ----------------------------------------------------//
|
43
|
+
function getDistributionService()
|
44
|
+
external
|
45
|
+
view
|
46
|
+
returns (DistributionService distributionService)
|
47
|
+
{
|
48
|
+
return _distributionService;
|
49
|
+
}
|
50
|
+
|
51
|
+
}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {IRisk} from "../module/IRisk.sol";
|
5
|
+
import {IService} from "../../shared/IService.sol";
|
6
|
+
|
7
|
+
import {NftId} from "../../types/NftId.sol";
|
8
|
+
import {ReferralId} from "../../types/Referral.sol";
|
9
|
+
import {RiskId} from "../../types/RiskId.sol";
|
10
|
+
import {StateId} from "../../types/StateId.sol";
|
11
|
+
import {Timestamp} from "../../types/Timestamp.sol";
|
12
|
+
import {UFixed} from "../../types/UFixed.sol";
|
13
|
+
import {Fee} from "../../types/Fee.sol";
|
14
|
+
|
15
|
+
/// @dev gif service responsible for creating applications
|
16
|
+
/// only product components may call transaction functions
|
17
|
+
interface IApplicationService is IService {
|
18
|
+
|
19
|
+
error IApplicationServicePolicyNotApplied(NftId applicationNftId);
|
20
|
+
|
21
|
+
/// @dev creates a new application based on the specified attributes
|
22
|
+
/// may only be called by a product component
|
23
|
+
function create(
|
24
|
+
address applicationOwner,
|
25
|
+
RiskId riskId,
|
26
|
+
NftId bundleNftId,
|
27
|
+
ReferralId referralId,
|
28
|
+
uint256 sumInsuredAmount,
|
29
|
+
uint256 lifetime,
|
30
|
+
bytes memory applicationData
|
31
|
+
) external returns (NftId applicationNftId);
|
32
|
+
|
33
|
+
/// @dev updates application attributes
|
34
|
+
/// may only be called while the application is in applied state
|
35
|
+
/// may only be called by the referenced product related to applicationNftId
|
36
|
+
function ajust(
|
37
|
+
NftId applicationNftId,
|
38
|
+
RiskId riskId,
|
39
|
+
NftId bundleNftId,
|
40
|
+
ReferralId referralId,
|
41
|
+
uint256 sumInsuredAmount,
|
42
|
+
uint256 lifetime,
|
43
|
+
bytes memory applicationData
|
44
|
+
) external;
|
45
|
+
|
46
|
+
/// @dev creates a new application that extends the provided policy
|
47
|
+
/// lifetime will seamlessly extend referenced policy, for closed policies
|
48
|
+
/// lifetime will start at underwriting time
|
49
|
+
/// product will need to limit the time window for renewal as underwriting
|
50
|
+
/// will lock the collateral at underwriting time which might be earlier than activation time
|
51
|
+
/// policyNftId needs to refer to an underwritten (or active or closed) policy
|
52
|
+
/// may only be called by the referenced product related to policyNftId
|
53
|
+
function renew(
|
54
|
+
NftId policyNftId, // policy to be renewd (renewal inherits policy attributes)
|
55
|
+
NftId bundleNftId // will likely need a newer bundle for underwriting
|
56
|
+
) external returns (NftId applicationNftId);
|
57
|
+
|
58
|
+
/// @dev revokes the application represented by {policyNftId}
|
59
|
+
/// an application can only be revoked in applied state
|
60
|
+
/// only the application holder may revoke an application
|
61
|
+
function revoke(NftId policyNftId) external;
|
62
|
+
|
63
|
+
/// @dev calculates the premium amount for the specified attributes
|
64
|
+
/// also returns the various fee components involved with creating a policy
|
65
|
+
function calculatePremium(
|
66
|
+
RiskId riskId,
|
67
|
+
uint256 sumInsuredAmount,
|
68
|
+
uint256 lifetime,
|
69
|
+
bytes memory applicationData,
|
70
|
+
NftId bundleNftId,
|
71
|
+
ReferralId referralId
|
72
|
+
)
|
73
|
+
external
|
74
|
+
view
|
75
|
+
returns (
|
76
|
+
uint256 premiumAmount,
|
77
|
+
uint256 distributionFeeAmount,
|
78
|
+
uint256 productFeeAmount,
|
79
|
+
uint256 poolFeeAmount,
|
80
|
+
uint256 bundleFeeAmount
|
81
|
+
);
|
82
|
+
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {NftId} from "../../types/NftId.sol";
|
5
|
+
import {Fee} from "../../types/Fee.sol";
|
6
|
+
import {StateId} from "../../types/StateId.sol";
|
7
|
+
import {IService} from "../../shared/IService.sol";
|
8
|
+
import {IBundle} from "../module/IBundle.sol";
|
9
|
+
import {IInstance} from "../../instance/IInstance.sol";
|
10
|
+
|
11
|
+
interface IBundleService is IService {
|
12
|
+
error ErrorIBundleServiceInsufficientAllowance(address bundleOwner, address tokenHandlerAddress, uint256 amount);
|
13
|
+
|
14
|
+
function createBundle(
|
15
|
+
address owner,
|
16
|
+
Fee memory fee,
|
17
|
+
uint256 amount,
|
18
|
+
uint256 lifetime,
|
19
|
+
bytes calldata filter
|
20
|
+
) external returns(NftId bundleNftId);
|
21
|
+
|
22
|
+
function setBundleFee(
|
23
|
+
NftId bundleNftId,
|
24
|
+
Fee memory fee
|
25
|
+
) external;
|
26
|
+
|
27
|
+
function updateBundle(NftId instanceNftId, NftId bundleNftId, IBundle.BundleInfo memory bundleInfo, StateId state) external;
|
28
|
+
|
29
|
+
function lockCollateral(
|
30
|
+
IInstance instanceNftId,
|
31
|
+
NftId policyNftId,
|
32
|
+
NftId bundleNftId,
|
33
|
+
uint256 collateralAmount,
|
34
|
+
uint256 netPremium
|
35
|
+
)
|
36
|
+
external
|
37
|
+
returns (
|
38
|
+
IBundle.BundleInfo memory bundleInfo
|
39
|
+
);
|
40
|
+
|
41
|
+
function increaseBalance(IInstance instance, NftId bundleNftId, uint256 amount) external;
|
42
|
+
|
43
|
+
function closePolicy(IInstance instance, NftId policyNftId, NftId bundleNftId, uint256 collateralAmount) external;
|
44
|
+
|
45
|
+
// function fundBundle(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
46
|
+
|
47
|
+
// function defundBundle(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
48
|
+
|
49
|
+
function lockBundle(NftId bundleNftId) external;
|
50
|
+
|
51
|
+
function unlockBundle(NftId bundleNftId) external;
|
52
|
+
|
53
|
+
// function closeBundle(NftId bundleNftId) external;
|
54
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {NftId} from "../../types/NftId.sol";
|
5
|
+
import {Fee} from "../../types/Fee.sol";
|
6
|
+
import {IService} from "../../shared/IService.sol";
|
7
|
+
|
8
|
+
interface IDistributionService is IService {
|
9
|
+
function setFees(
|
10
|
+
Fee memory distributionFee
|
11
|
+
) external;
|
12
|
+
}
|
@@ -0,0 +1,88 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {IRisk} from "../module/IRisk.sol";
|
5
|
+
import {IService} from "../../shared/IService.sol";
|
6
|
+
|
7
|
+
import {NftId} from "../../types/NftId.sol";
|
8
|
+
import {ReferralId} from "../../types/Referral.sol";
|
9
|
+
import {RiskId} from "../../types/RiskId.sol";
|
10
|
+
import {StateId} from "../../types/StateId.sol";
|
11
|
+
import {Timestamp} from "../../types/Timestamp.sol";
|
12
|
+
import {UFixed} from "../../types/UFixed.sol";
|
13
|
+
import {Fee} from "../../types/Fee.sol";
|
14
|
+
|
15
|
+
interface IPolicyService is IService {
|
16
|
+
|
17
|
+
error ErrorIPolicyServiceInsufficientAllowance(address customer, address tokenHandlerAddress, uint256 amount);
|
18
|
+
error ErrorIPolicyServicePremiumAlreadyPaid(NftId policyNftId, uint256 premiumPaidAmount);
|
19
|
+
error ErrorIPolicyServicePolicyNotActivated(NftId policyNftId);
|
20
|
+
error ErrorIPolicyServicePolicyAlreadyClosed(NftId policyNftId);
|
21
|
+
error ErrorIPolicyServicePolicyNotActive(NftId policyNftId, StateId state);
|
22
|
+
error ErrorIPolicyServicePremiumNotFullyPaid(NftId policyNftId, uint256 premiumAmount, uint256 premiumPaidAmount);
|
23
|
+
error ErrorIPolicyServiceOpenClaims(NftId policyNftId, uint16 openClaimsCount);
|
24
|
+
error ErrorIPolicyServicePolicyHasNotExpired(NftId policyNftId, Timestamp expiredAt);
|
25
|
+
|
26
|
+
function calculatePremium(
|
27
|
+
RiskId riskId,
|
28
|
+
uint256 sumInsuredAmount,
|
29
|
+
uint256 lifetime,
|
30
|
+
bytes memory applicationData,
|
31
|
+
NftId bundleNftId,
|
32
|
+
ReferralId referralId
|
33
|
+
)
|
34
|
+
external
|
35
|
+
view
|
36
|
+
returns (
|
37
|
+
uint256 premiumAmount,
|
38
|
+
uint256 productFeeAmount,
|
39
|
+
uint256 poolFeeAmount,
|
40
|
+
uint256 bundleFeeAmount,
|
41
|
+
uint256 distributionFeeAmount
|
42
|
+
);
|
43
|
+
|
44
|
+
|
45
|
+
function createApplication(
|
46
|
+
address applicationOwner,
|
47
|
+
RiskId riskId,
|
48
|
+
uint256 sumInsuredAmount,
|
49
|
+
uint256 lifetime,
|
50
|
+
bytes memory applicationData,
|
51
|
+
NftId bundleNftId,
|
52
|
+
ReferralId referralId
|
53
|
+
) external returns (NftId nftId);
|
54
|
+
|
55
|
+
/// @dev declines an application represented by {policyNftId}
|
56
|
+
/// an application can only be declined in applied state
|
57
|
+
/// only the related product may decline an application
|
58
|
+
function decline(NftId policyNftId) external;
|
59
|
+
|
60
|
+
/// @dev underwrites the policy represented by {policyNftId}.
|
61
|
+
/// optionally collects premiums and activates the policy.
|
62
|
+
/// - premium payment is only attempted if requirePremiumPayment is set to true
|
63
|
+
/// - activation is only done if activateAt is a non-zero timestamp
|
64
|
+
/// an application can only be underwritten in applied state
|
65
|
+
/// only the related product may underwrite an application
|
66
|
+
function underwrite(
|
67
|
+
NftId policyNftId,
|
68
|
+
bool requirePremiumPayment,
|
69
|
+
Timestamp activateAt
|
70
|
+
) external;
|
71
|
+
|
72
|
+
function collectPremium(NftId policyNftId, Timestamp activateAt) external;
|
73
|
+
|
74
|
+
function activate(NftId policyNftId, Timestamp activateAt) external;
|
75
|
+
|
76
|
+
function close(NftId nftId) external;
|
77
|
+
|
78
|
+
// function createClaim(uint256 nftId, uint256 claimAmount) external;
|
79
|
+
// function confirmClaim(uint256 nftId, uint256 claimId, uint256 claimAmount) external;
|
80
|
+
// function declineClaim(uint256 nftId, uint256 claimId) external;
|
81
|
+
// function closeClaim(uint256 nftId, uint256 claimId) external; // TODO payoutClaim() -> implicit close when payed out in full
|
82
|
+
|
83
|
+
function calculateRequiredCollateral(
|
84
|
+
UFixed collateralizationLevel,
|
85
|
+
uint256 sumInsuredAmount
|
86
|
+
) external pure returns(uint256 collateralAmount);
|
87
|
+
|
88
|
+
}
|
@@ -3,28 +3,18 @@ pragma solidity ^0.8.19;
|
|
3
3
|
|
4
4
|
import {NftId} from "../../types/NftId.sol";
|
5
5
|
import {Fee} from "../../types/Fee.sol";
|
6
|
-
import {
|
6
|
+
import {StateId} from "../../types/StateId.sol";
|
7
|
+
import {IService} from "../../shared/IService.sol";
|
8
|
+
import {IBundle} from "../module/IBundle.sol";
|
9
|
+
import {IInstance} from "../../instance/IInstance.sol";
|
7
10
|
|
8
11
|
interface IPoolService is IService {
|
12
|
+
|
13
|
+
function register(address poolAddress) external returns(NftId);
|
14
|
+
|
9
15
|
function setFees(
|
16
|
+
Fee memory poolFee,
|
10
17
|
Fee memory stakingFee,
|
11
18
|
Fee memory performanceFee
|
12
19
|
) external;
|
13
|
-
|
14
|
-
function createBundle(
|
15
|
-
address owner,
|
16
|
-
uint256 amount,
|
17
|
-
uint256 lifetime,
|
18
|
-
bytes calldata filter
|
19
|
-
) external returns(NftId bundleNftId);
|
20
|
-
|
21
|
-
// function fundBundle(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
22
|
-
|
23
|
-
// function defundBundle(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
24
|
-
|
25
|
-
// function lockBundle(NftId bundleNftId) external;
|
26
|
-
|
27
|
-
// function unlockBundle(NftId bundleNftId) external;
|
28
|
-
|
29
|
-
// function closeBundle(NftId bundleNftId) external;
|
30
20
|
}
|
@@ -1,58 +1,40 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
+
import {IRisk} from "../module/IRisk.sol";
|
5
|
+
import {IService} from "../../shared/IService.sol";
|
6
|
+
|
4
7
|
import {NftId} from "../../types/NftId.sol";
|
8
|
+
import {ReferralId} from "../../types/Referral.sol";
|
9
|
+
import {RiskId} from "../../types/RiskId.sol";
|
10
|
+
import {StateId} from "../../types/StateId.sol";
|
5
11
|
import {Timestamp} from "../../types/Timestamp.sol";
|
6
12
|
import {UFixed} from "../../types/UFixed.sol";
|
7
13
|
import {Fee} from "../../types/Fee.sol";
|
8
|
-
import {IService} from "../base/IService.sol";
|
9
14
|
|
10
15
|
interface IProductService is IService {
|
16
|
+
|
17
|
+
function register(address productAddress) external returns(NftId);
|
18
|
+
|
11
19
|
function setFees(
|
12
|
-
Fee memory
|
20
|
+
Fee memory productFee,
|
13
21
|
Fee memory processingFee
|
14
22
|
) external;
|
15
23
|
|
16
|
-
function
|
17
|
-
|
18
|
-
|
19
|
-
uint256 premiumAmount,
|
20
|
-
uint256 lifetime,
|
21
|
-
NftId bundleNftId
|
22
|
-
) external returns (NftId nftId);
|
23
|
-
|
24
|
-
// function revoke(unit256 nftId) external;
|
25
|
-
|
26
|
-
/**
|
27
|
-
* @dev underwrites the policy represented by {policyNftId}.
|
28
|
-
* optionally collects premiums and activates the policy.
|
29
|
-
* - premium payment is only attempted if requirePremiumPayment is set to true
|
30
|
-
* - activation is only done if activateAt is a non-zero timestamp
|
31
|
-
*/
|
32
|
-
function underwrite(
|
33
|
-
NftId policyNftId,
|
34
|
-
bool requirePremiumPayment,
|
35
|
-
Timestamp activateAt
|
24
|
+
function createRisk(
|
25
|
+
RiskId riskId,
|
26
|
+
bytes memory data
|
36
27
|
) external;
|
37
28
|
|
38
|
-
// function decline(uint256 nftId) external;
|
39
|
-
// function expire(uint256 nftId) external;
|
40
|
-
|
41
|
-
function collectPremium(NftId nftId, Timestamp activateAt) external;
|
42
|
-
|
43
|
-
function activate(NftId nftId, Timestamp activateAt) external;
|
44
29
|
|
30
|
+
function updateRisk(
|
31
|
+
RiskId riskId,
|
32
|
+
bytes memory data
|
33
|
+
) external;
|
45
34
|
|
46
|
-
function close(NftId nftId) external;
|
47
|
-
|
48
|
-
// function createClaim(uint256 nftId, uint256 claimAmount) external;
|
49
|
-
// function confirmClaim(uint256 nftId, uint256 claimId, uint256 claimAmount) external;
|
50
|
-
// function declineClaim(uint256 nftId, uint256 claimId) external;
|
51
|
-
// function closeClaim(uint256 nftId, uint256 claimId) external;
|
52
|
-
|
53
|
-
function calculateRequiredCollateral(
|
54
|
-
UFixed collateralizationLevel,
|
55
|
-
uint256 sumInsuredAmount
|
56
|
-
) external pure returns(uint256 collateralAmount);
|
57
35
|
|
36
|
+
function updateRiskState(
|
37
|
+
RiskId riskId,
|
38
|
+
StateId newState
|
39
|
+
) external;
|
58
40
|
}
|