@etherisc/gif-next 0.0.2-e5a2253-213 → 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 +73 -1
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/components/{BaseComponent.sol/BaseComponent.json → Component.sol/Component.json} +340 -59
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +804 -211
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/components/{IBaseComponent.sol/IBaseComponent.json → IComponent.sol/IComponent.json} +95 -56
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +699 -22
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +814 -60
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +519 -4
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +896 -298
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +442 -129
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +38 -62
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +910 -289
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +110 -171
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +874 -557
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +52 -115
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +101 -168
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +346 -263
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +319 -86
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -32
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/instance/base/{ComponentServiceBase.sol/ComponentServiceBase.json → ComponentService.sol/ComponentService.json} +119 -189
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +2 -2
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +13 -13
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +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 +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +258 -283
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +305 -80
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +754 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +637 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +983 -221
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +441 -72
- 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 +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +130 -217
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +4 -0
- package/artifacts/contracts/{shared/RegisterableUpgradable.sol/RegisterableUpgradable.json → instance/service/IClaimService.sol/IClaimService.json} +146 -179
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +552 -140
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +40 -292
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +22 -174
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +22 -174
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +161 -407
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +311 -114
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +139 -237
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +302 -77
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +139 -237
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +302 -77
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +98 -5
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +112 -198
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +112 -27
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +18 -18
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +216 -234
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +300 -81
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +70 -53
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +151 -50
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +41 -3
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +40 -29
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +129 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +21 -34
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/{experiment/inheritance/IB.sol/IB.json → shared/IRegistryLinked.sol/IRegistryLinked.json} +18 -20
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +22 -174
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +2 -152
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +120 -27
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +248 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +294 -61
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +129 -51
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +84 -0
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +114 -157
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +2 -152
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +129 -51
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +135 -214
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +8 -190
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +100 -0
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +100 -0
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +2 -2
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +4 -0
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.json +124 -0
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +25 -7
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/contracts/components/Component.sol +221 -0
- package/contracts/components/Distribution.sol +206 -67
- package/contracts/components/IComponent.sol +68 -0
- package/contracts/components/IDistributionComponent.sol +44 -9
- package/contracts/components/IPoolComponent.sol +124 -39
- package/contracts/components/IProductComponent.sol +8 -3
- package/contracts/components/Pool.sol +284 -164
- package/contracts/components/Product.sol +110 -116
- package/contracts/instance/BundleManager.sol +8 -12
- package/contracts/instance/IInstance.sol +41 -9
- package/contracts/instance/IInstanceService.sol +20 -1
- package/contracts/instance/Instance.sol +90 -61
- package/contracts/instance/InstanceAccessManager.sol +18 -24
- package/contracts/instance/InstanceReader.sol +3 -25
- package/contracts/instance/InstanceService.sol +195 -50
- package/contracts/instance/InstanceServiceManager.sol +1 -1
- package/contracts/instance/ObjectManager.sol +7 -24
- package/contracts/instance/base/{ComponentServiceBase.sol → ComponentService.sol} +9 -13
- package/contracts/instance/module/IAccess.sol +3 -4
- package/contracts/instance/module/IBundle.sol +2 -1
- package/contracts/instance/module/IDistribution.sol +2 -0
- package/contracts/instance/module/IPolicy.sol +30 -3
- package/contracts/instance/module/ISetup.sol +10 -10
- package/contracts/instance/service/ApplicationService.sol +350 -0
- package/contracts/instance/service/ApplicationServiceManager.sol +35 -0
- package/contracts/instance/service/BundleService.sol +17 -12
- package/contracts/instance/service/BundleServiceManager.sol +1 -1
- package/contracts/instance/service/ClaimService.sol +151 -0
- package/contracts/instance/service/ClaimServiceManager.sol +35 -0
- package/contracts/instance/service/DistributionService.sol +312 -33
- package/contracts/instance/service/DistributionServiceManager.sol +1 -1
- package/contracts/instance/service/IApplicationService.sol +82 -0
- package/contracts/instance/service/IBundleService.sol +14 -3
- package/contracts/instance/service/IClaimService.sol +61 -0
- package/contracts/instance/service/IDistributionService.sol +74 -0
- package/contracts/instance/service/IPolicyService.sol +26 -50
- package/contracts/instance/service/PolicyService.sol +127 -262
- package/contracts/instance/service/PolicyServiceManager.sol +2 -2
- package/contracts/instance/service/PoolService.sol +12 -45
- package/contracts/instance/service/PoolServiceManager.sol +1 -1
- package/contracts/instance/service/ProductService.sol +50 -26
- package/contracts/instance/service/ProductServiceManager.sol +2 -2
- package/contracts/registry/IRegistry.sol +16 -8
- package/contracts/registry/IRegistryService.sol +19 -10
- package/contracts/registry/Registry.sol +120 -52
- package/contracts/registry/RegistryAccessManager.sol +31 -25
- package/contracts/registry/RegistryService.sol +91 -128
- package/contracts/registry/RegistryServiceManager.sol +13 -13
- package/contracts/registry/ReleaseManager.sol +86 -106
- package/contracts/registry/TokenRegistry.sol +19 -13
- package/contracts/shared/ERC165.sol +14 -12
- package/contracts/shared/INftOwnable.sol +11 -10
- package/contracts/shared/IPolicyHolder.sol +26 -0
- package/contracts/shared/IRegisterable.sol +4 -4
- package/contracts/shared/IRegistryLinked.sol +12 -0
- package/contracts/shared/IService.sol +2 -0
- package/contracts/shared/IVersionable.sol +4 -47
- package/contracts/shared/NftOwnable.sol +66 -80
- package/contracts/shared/PolicyHolder.sol +81 -0
- package/contracts/shared/ProxyManager.sol +100 -25
- package/contracts/shared/Registerable.sol +16 -32
- package/contracts/shared/RegistryLinked.sol +48 -0
- package/contracts/shared/Service.sol +19 -19
- package/contracts/shared/Versionable.sol +4 -92
- package/contracts/test/TestRegisterable.sol +1 -1
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/ClaimId.sol +52 -0
- package/contracts/types/DistributorType.sol +2 -2
- package/contracts/types/ObjectType.sol +9 -5
- package/contracts/types/PayoutId.sol +54 -0
- package/contracts/types/RoleId.sol +12 -7
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/Timestamp.sol +12 -13
- package/package.json +3 -3
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.json +0 -66
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.json +0 -24
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.json +0 -42
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +0 -4
- package/artifacts/contracts/experiment/errors/Require.sol/Require.json +0 -105
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +0 -4
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.json +0 -105
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/A.sol/A.json +0 -128
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.json +0 -42
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/B.sol/B.json +0 -76
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/C.sol/C.json +0 -89
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.json +0 -128
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.json +0 -37
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.json +0 -63
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +0 -59
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.json +0 -124
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.json +0 -74
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +0 -124
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +0 -207
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +0 -4
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.json +0 -10
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +0 -4
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.json +0 -10
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +0 -1206
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +0 -448
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +0 -763
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -100
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
- package/contracts/components/BaseComponent.sol +0 -168
- package/contracts/components/IBaseComponent.sol +0 -35
- package/contracts/experiment/cloning/Cloner.sol +0 -47
- package/contracts/experiment/errors/Require.sol +0 -38
- package/contracts/experiment/errors/Revert.sol +0 -44
- package/contracts/experiment/inheritance/A.sol +0 -53
- package/contracts/experiment/inheritance/B.sol +0 -28
- package/contracts/experiment/inheritance/C.sol +0 -34
- package/contracts/experiment/inheritance/IA.sol +0 -13
- package/contracts/experiment/inheritance/IB.sol +0 -10
- package/contracts/experiment/inheritance/IC.sol +0 -12
- package/contracts/experiment/statemachine/Dummy.sol +0 -27
- package/contracts/experiment/statemachine/ISM.sol +0 -25
- package/contracts/experiment/statemachine/SM.sol +0 -57
- package/contracts/experiment/statemachine/SimpleStateMachine.sol +0 -31
- package/contracts/experiment/types/TypeA.sol +0 -47
- package/contracts/experiment/types/TypeB.sol +0 -29
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +0 -23
- package/contracts/instance/IInstanceBase.sol +0 -25
- package/contracts/instance/InstanceBase.sol +0 -39
- package/contracts/instance/base/IInstanceBase.sol +0 -21
- package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -4,71 +4,92 @@ pragma solidity ^0.8.19;
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
5
|
|
6
6
|
import {IRisk} from "../instance/module/IRisk.sol";
|
7
|
+
import {IApplicationService} from "../instance/service/IApplicationService.sol";
|
7
8
|
import {IPolicyService} from "../instance/service/IPolicyService.sol";
|
9
|
+
import {IProductService} from "../instance/service/IProductService.sol";
|
10
|
+
import {IClaimService} from "../instance/service/IClaimService.sol";
|
8
11
|
import {IProductComponent} from "./IProductComponent.sol";
|
9
12
|
import {NftId, NftIdLib} from "../types/NftId.sol";
|
10
|
-
import {PRODUCT} from "../types/ObjectType.sol";
|
13
|
+
import {PRODUCT, APPLICATION, POLICY, CLAIM } from "../types/ObjectType.sol";
|
11
14
|
import {ReferralId} from "../types/Referral.sol";
|
12
15
|
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
16
|
+
import {Seconds} from "../types/Seconds.sol";
|
13
17
|
import {StateId} from "../types/StateId.sol";
|
14
18
|
import {Timestamp} from "../types/Timestamp.sol";
|
15
19
|
import {Fee} from "../types/Fee.sol";
|
16
|
-
import {
|
20
|
+
import {Component} from "./Component.sol";
|
17
21
|
|
18
|
-
import {IRegistry} from "../registry/IRegistry.sol";
|
19
|
-
import {IRegisterable} from "../shared/IRegisterable.sol";
|
20
|
-
import {Registerable} from "../shared/Registerable.sol";
|
21
22
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
22
23
|
|
23
24
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
25
|
+
import {IPolicy} from "../instance/module/IPolicy.sol";
|
24
26
|
import {ISetup} from "../instance/module/ISetup.sol";
|
25
27
|
import {Pool} from "../components/Pool.sol";
|
26
28
|
import {Distribution} from "../components/Distribution.sol";
|
27
29
|
|
28
|
-
abstract contract Product is
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
30
|
+
abstract contract Product is
|
31
|
+
Component,
|
32
|
+
IProductComponent
|
33
|
+
{
|
34
|
+
// keccak256(abi.encode(uint256(keccak256("etherisc.storage.Product")) - 1)) & ~bytes32(uint256(0xff));
|
35
|
+
bytes32 public constant PRODUCT_STORAGE_LOCATION_V1 = 0x0bb7aafdb8e380f81267337bc5b5dfdf76e6d3a380ecadb51ec665246d9d6800;
|
36
|
+
|
37
|
+
struct ProductStorage {
|
38
|
+
IProductService _productService;
|
39
|
+
IApplicationService _applicationService;
|
40
|
+
IPolicyService _policyService;
|
41
|
+
IClaimService _claimService;
|
42
|
+
Pool _pool;
|
43
|
+
Distribution _distribution;
|
44
|
+
Fee _initialProductFee;
|
45
|
+
Fee _initialProcessingFee;
|
46
|
+
TokenHandler _tokenHandler;
|
47
|
+
NftId _poolNftId;
|
48
|
+
NftId _distributionNftId;
|
49
|
+
}
|
40
50
|
|
41
|
-
|
51
|
+
function initializeProduct(
|
42
52
|
address registry,
|
43
|
-
NftId
|
53
|
+
NftId instanceNftId,
|
54
|
+
string memory name,
|
44
55
|
address token,
|
45
56
|
bool isInterceptor,
|
46
57
|
address pool,
|
47
58
|
address distribution,
|
48
59
|
Fee memory productFee,
|
49
60
|
Fee memory processingFee,
|
50
|
-
address initialOwner
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
_tokenHandler = new TokenHandler(token);
|
60
|
-
|
61
|
-
_poolNftId = getRegistry().getNftId(address(_pool));
|
62
|
-
_distributionNftId = getRegistry().getNftId(address(_distribution));
|
61
|
+
address initialOwner,
|
62
|
+
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
63
|
+
)
|
64
|
+
public
|
65
|
+
virtual
|
66
|
+
onlyInitializing()
|
67
|
+
{
|
68
|
+
initializeComponent(registry, instanceNftId, name, token, PRODUCT(), isInterceptor, initialOwner, registryData);
|
63
69
|
|
64
|
-
|
70
|
+
ProductStorage storage $ = _getProductStorage();
|
71
|
+
// TODO add validation
|
72
|
+
// TODO refactor to go via registry
|
73
|
+
$._productService = IProductService(_getServiceAddress(PRODUCT()));
|
74
|
+
$._applicationService = IApplicationService(_getServiceAddress(APPLICATION()));
|
75
|
+
$._policyService = IPolicyService(_getServiceAddress(POLICY()));
|
76
|
+
$._claimService = IClaimService(_getServiceAddress(CLAIM()));
|
77
|
+
$._pool = Pool(pool);
|
78
|
+
$._distribution = Distribution(distribution);
|
79
|
+
$._initialProductFee = productFee;
|
80
|
+
$._initialProcessingFee = processingFee;
|
81
|
+
$._tokenHandler = new TokenHandler(token);
|
82
|
+
$._poolNftId = getRegistry().getNftId(pool);
|
83
|
+
$._distributionNftId = getRegistry().getNftId(distribution);
|
84
|
+
|
85
|
+
registerInterface(type(IProductComponent).interfaceId);
|
65
86
|
}
|
66
87
|
|
67
88
|
|
68
89
|
function calculatePremium(
|
69
90
|
uint256 sumInsuredAmount,
|
70
91
|
RiskId riskId,
|
71
|
-
|
92
|
+
Seconds lifetime,
|
72
93
|
bytes memory applicationData,
|
73
94
|
NftId bundleNftId,
|
74
95
|
ReferralId referralId
|
@@ -78,7 +99,8 @@ abstract contract Product is BaseComponent, IProductComponent {
|
|
78
99
|
override
|
79
100
|
returns (uint256 premiumAmount)
|
80
101
|
{
|
81
|
-
|
102
|
+
IPolicy.Premium memory premium = _getProductStorage()._applicationService.calculatePremium(
|
103
|
+
getNftId(),
|
82
104
|
riskId,
|
83
105
|
sumInsuredAmount,
|
84
106
|
lifetime,
|
@@ -86,13 +108,14 @@ abstract contract Product is BaseComponent, IProductComponent {
|
|
86
108
|
bundleNftId,
|
87
109
|
referralId
|
88
110
|
);
|
111
|
+
premiumAmount = premium.premiumAmount;
|
89
112
|
}
|
90
113
|
|
91
114
|
|
92
115
|
function calculateNetPremium(
|
93
116
|
uint256 sumInsuredAmount,
|
94
117
|
RiskId riskId,
|
95
|
-
|
118
|
+
Seconds lifetime,
|
96
119
|
bytes memory applicationData
|
97
120
|
)
|
98
121
|
external
|
@@ -112,7 +135,7 @@ abstract contract Product is BaseComponent, IProductComponent {
|
|
112
135
|
RiskId id,
|
113
136
|
bytes memory data
|
114
137
|
) internal {
|
115
|
-
|
138
|
+
_getProductService().createRisk(
|
116
139
|
id,
|
117
140
|
data
|
118
141
|
);
|
@@ -122,7 +145,7 @@ abstract contract Product is BaseComponent, IProductComponent {
|
|
122
145
|
RiskId id,
|
123
146
|
bytes memory data
|
124
147
|
) internal {
|
125
|
-
|
148
|
+
_getProductService().updateRisk(
|
126
149
|
id,
|
127
150
|
data
|
128
151
|
);
|
@@ -132,33 +155,36 @@ abstract contract Product is BaseComponent, IProductComponent {
|
|
132
155
|
RiskId id,
|
133
156
|
StateId state
|
134
157
|
) internal {
|
135
|
-
|
158
|
+
_getProductService().updateRiskState(
|
136
159
|
id,
|
137
160
|
state
|
138
161
|
);
|
139
162
|
}
|
140
163
|
|
141
164
|
function _getRiskInfo(RiskId id) internal view returns (IRisk.RiskInfo memory info) {
|
142
|
-
return
|
165
|
+
return getInstance().getInstanceReader().getRiskInfo(id);
|
143
166
|
}
|
144
167
|
|
145
168
|
function _createApplication(
|
146
169
|
address applicationOwner,
|
147
170
|
RiskId riskId,
|
148
171
|
uint256 sumInsuredAmount,
|
149
|
-
|
150
|
-
bytes memory applicationData,
|
172
|
+
Seconds lifetime,
|
151
173
|
NftId bundleNftId,
|
152
|
-
ReferralId referralId
|
153
|
-
|
154
|
-
|
174
|
+
ReferralId referralId,
|
175
|
+
bytes memory applicationData
|
176
|
+
)
|
177
|
+
internal
|
178
|
+
returns (NftId applicationNftId)
|
179
|
+
{
|
180
|
+
return _getProductStorage()._applicationService.create(
|
155
181
|
applicationOwner,
|
156
182
|
riskId,
|
157
183
|
sumInsuredAmount,
|
158
184
|
lifetime,
|
159
|
-
applicationData,
|
160
185
|
bundleNftId,
|
161
|
-
referralId
|
186
|
+
referralId,
|
187
|
+
applicationData
|
162
188
|
);
|
163
189
|
}
|
164
190
|
|
@@ -169,7 +195,7 @@ abstract contract Product is BaseComponent, IProductComponent {
|
|
169
195
|
)
|
170
196
|
internal
|
171
197
|
{
|
172
|
-
_policyService.underwrite(
|
198
|
+
_getProductStorage()._policyService.underwrite(
|
173
199
|
policyNftId,
|
174
200
|
requirePremiumPayment,
|
175
201
|
activateAt);
|
@@ -181,7 +207,7 @@ abstract contract Product is BaseComponent, IProductComponent {
|
|
181
207
|
)
|
182
208
|
internal
|
183
209
|
{
|
184
|
-
_policyService.collectPremium(
|
210
|
+
_getProductStorage()._policyService.collectPremium(
|
185
211
|
policyNftId,
|
186
212
|
activateAt);
|
187
213
|
}
|
@@ -192,7 +218,7 @@ abstract contract Product is BaseComponent, IProductComponent {
|
|
192
218
|
)
|
193
219
|
internal
|
194
220
|
{
|
195
|
-
_policyService.activate(
|
221
|
+
_getProductStorage()._policyService.activate(
|
196
222
|
policyNftId,
|
197
223
|
activateAt);
|
198
224
|
}
|
@@ -202,15 +228,15 @@ abstract contract Product is BaseComponent, IProductComponent {
|
|
202
228
|
)
|
203
229
|
internal
|
204
230
|
{
|
205
|
-
_policyService.close(policyNftId);
|
231
|
+
_getProductStorage()._policyService.close(policyNftId);
|
206
232
|
}
|
207
233
|
|
208
234
|
function getPoolNftId() external view override returns (NftId poolNftId) {
|
209
|
-
return getRegistry().getNftId(address(_pool));
|
235
|
+
return getRegistry().getNftId(address(_getProductStorage()._pool));
|
210
236
|
}
|
211
237
|
|
212
238
|
function getDistributionNftId() external view override returns (NftId distributionNftId) {
|
213
|
-
return getRegistry().getNftId(address(_distribution));
|
239
|
+
return getRegistry().getNftId(address(_getProductStorage()._distribution));
|
214
240
|
}
|
215
241
|
|
216
242
|
// from product component
|
@@ -220,76 +246,44 @@ abstract contract Product is BaseComponent, IProductComponent {
|
|
220
246
|
)
|
221
247
|
external
|
222
248
|
onlyOwner
|
249
|
+
restricted()
|
223
250
|
override
|
224
251
|
{
|
225
|
-
|
252
|
+
_getProductService().setFees(productFee, processingFee);
|
226
253
|
}
|
227
254
|
|
228
255
|
function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
229
|
-
InstanceReader reader =
|
230
|
-
|
231
|
-
}
|
256
|
+
InstanceReader reader = getInstance().getInstanceReader();
|
257
|
+
setupInfo = reader.getProductSetupInfo(getNftId());
|
232
258
|
|
233
|
-
|
259
|
+
// fallback to initial setup info (wallet is always != address(0))
|
260
|
+
if(setupInfo.wallet == address(0)) {
|
261
|
+
setupInfo = _getInitialSetupInfo();
|
262
|
+
}
|
263
|
+
}
|
234
264
|
|
235
|
-
function
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
// TODO read pool & distribution fees
|
248
|
-
// 1) from pool -> the only option -> pool must be registered first?
|
249
|
-
// 2) from instance -> all fees are set into instance at product registration which is ongoing here
|
250
|
-
// checks are done in registryProduct() where THIS function is called
|
251
|
-
//require(getRegistry().getObjectInfo(_poolNftId).objectType == POOL(), "POOL_NOT_REGISTERED");
|
252
|
-
//require(getRegistry().getObjectInfo(_distributionNftId).objectType == DISTRIBUTION(), "DISTRIBUTION_NOT_REGISTERED");
|
253
|
-
|
254
|
-
// from PoolComponent
|
255
|
-
(
|
256
|
-
,
|
257
|
-
bytes memory poolData
|
258
|
-
) = _pool.getInitialInfo();
|
259
|
-
|
260
|
-
(
|
261
|
-
, ISetup.PoolSetupInfo memory poolSetupInfo
|
262
|
-
) = abi.decode(poolData, (string, ISetup.PoolSetupInfo));
|
263
|
-
|
264
|
-
// from DistributionComponent
|
265
|
-
(
|
266
|
-
,
|
267
|
-
bytes memory distributionData
|
268
|
-
) = _distribution.getInitialInfo();
|
269
|
-
|
270
|
-
(
|
271
|
-
, ISetup.DistributionSetupInfo memory distributionSetupInfo
|
272
|
-
) = abi.decode(distributionData, (string, ISetup.DistributionSetupInfo));
|
273
|
-
|
274
|
-
return (
|
275
|
-
productInfo,
|
276
|
-
abi.encode(
|
277
|
-
getName(),
|
278
|
-
ISetup.ProductSetupInfo(
|
279
|
-
_token,
|
280
|
-
_tokenHandler,
|
281
|
-
_distributionNftId,
|
282
|
-
_poolNftId,
|
283
|
-
distributionSetupInfo.distributionFee,
|
284
|
-
_initialProductFee,
|
285
|
-
_initialProcessingFee,
|
286
|
-
poolSetupInfo.poolFee,
|
287
|
-
poolSetupInfo.stakingFee,
|
288
|
-
poolSetupInfo.performanceFee,
|
289
|
-
false,
|
290
|
-
_wallet
|
291
|
-
)
|
292
|
-
)
|
265
|
+
function _getInitialSetupInfo() internal view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
266
|
+
ProductStorage storage $ = _getProductStorage();
|
267
|
+
|
268
|
+
return ISetup.ProductSetupInfo(
|
269
|
+
getToken(),
|
270
|
+
$._tokenHandler,
|
271
|
+
$._distributionNftId,
|
272
|
+
$._poolNftId,
|
273
|
+
$._initialProductFee,
|
274
|
+
$._initialProcessingFee,
|
275
|
+
false,
|
276
|
+
getWallet()
|
293
277
|
);
|
294
278
|
}
|
279
|
+
|
280
|
+
function _getProductStorage() private pure returns (ProductStorage storage $) {
|
281
|
+
assembly {
|
282
|
+
$.slot := PRODUCT_STORAGE_LOCATION_V1
|
283
|
+
}
|
284
|
+
}
|
285
|
+
|
286
|
+
function _getProductService() internal view returns (IProductService) {
|
287
|
+
return _getProductStorage()._productService;
|
288
|
+
}
|
295
289
|
}
|
@@ -32,17 +32,13 @@ contract BundleManager is
|
|
32
32
|
|
33
33
|
mapping(NftId bundleNftId => LibNftIdSet.Set policies) internal _activePolicies;
|
34
34
|
|
35
|
-
constructor() ObjectManager() {
|
36
|
-
}
|
37
|
-
|
38
|
-
|
39
35
|
/// @dev links a policy with its bundle
|
40
36
|
// to link a policy it MUST NOT yet have been activated
|
41
37
|
// the bundle MUST be unlocked (active) for linking (underwriting) and registered with this instance
|
42
38
|
function linkPolicy(NftId policyNftId) external restricted() {
|
43
|
-
NftId bundleNftId =
|
39
|
+
NftId bundleNftId = _instance.getInstanceReader().getPolicyInfo(policyNftId).bundleNftId;
|
44
40
|
// decision will likely depend on the decision what to check here and what in the service
|
45
|
-
NftId poolNftId =
|
41
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
46
42
|
|
47
43
|
// ensure bundle is unlocked (in active set) and registered with this instance
|
48
44
|
if (!_isActive(poolNftId, bundleNftId)) {
|
@@ -59,11 +55,11 @@ contract BundleManager is
|
|
59
55
|
// - the policy MUST be past its expiry period and it MUST NOT have any open claims
|
60
56
|
// - the policy's payoutAmount MUST be equal to its sumInsuredAmount and MUST NOT have any open claims
|
61
57
|
function unlinkPolicy(NftId policyNftId) external restricted() {
|
62
|
-
IPolicy.PolicyInfo memory policyInfo =
|
58
|
+
IPolicy.PolicyInfo memory policyInfo = _instance.getInstanceReader().getPolicyInfo(policyNftId);
|
63
59
|
|
64
60
|
NftId bundleNftId = policyInfo.bundleNftId;
|
65
61
|
// decision will likely depend on the decision what to check here and what in the service
|
66
|
-
NftId poolNftId =
|
62
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
67
63
|
|
68
64
|
// ensure bundle is registered with this instance
|
69
65
|
if (!_contains(poolNftId, bundleNftId)) {
|
@@ -75,10 +71,10 @@ contract BundleManager is
|
|
75
71
|
}
|
76
72
|
|
77
73
|
|
78
|
-
/// @dev add a new bundle to a
|
74
|
+
/// @dev add a new bundle to a pool registerd with this instance
|
79
75
|
// the corresponding pool is fetched via instance reader
|
80
76
|
function add(NftId bundleNftId) external restricted() {
|
81
|
-
NftId poolNftId =
|
77
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
82
78
|
|
83
79
|
// ensure pool is registered with instance
|
84
80
|
if(poolNftId.eqz()) {
|
@@ -91,14 +87,14 @@ contract BundleManager is
|
|
91
87
|
|
92
88
|
/// @dev unlocked (active) bundles are available to underwrite new policies
|
93
89
|
function unlock(NftId bundleNftId) external restricted() {
|
94
|
-
NftId poolNftId =
|
90
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
95
91
|
_activate(poolNftId, bundleNftId);
|
96
92
|
emit LogBundleManagerBundleUnlocked(poolNftId, bundleNftId);
|
97
93
|
}
|
98
94
|
|
99
95
|
/// @dev locked (deactivated) bundles may not underwrite any new policies
|
100
96
|
function lock(NftId bundleNftId) external restricted() {
|
101
|
-
NftId poolNftId =
|
97
|
+
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
102
98
|
_deactivate(poolNftId, bundleNftId);
|
103
99
|
emit LogBundleManagerBundleLocked(poolNftId, bundleNftId);
|
104
100
|
}
|
@@ -1,29 +1,42 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
5
4
|
import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
6
5
|
|
6
|
+
import {NftId} from "../types/NftId.sol";
|
7
|
+
import {StateId} from "../types/StateId.sol";
|
8
|
+
import {RiskId} from "../types/RiskId.sol";
|
9
|
+
|
10
|
+
import {IRegisterable} from "../shared/IRegisterable.sol";
|
11
|
+
|
12
|
+
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
7
13
|
import {BundleManager} from "./BundleManager.sol";
|
8
14
|
import {InstanceReader} from "./InstanceReader.sol";
|
9
15
|
|
10
|
-
import {
|
16
|
+
import {IBundle} from "./module/IBundle.sol";
|
17
|
+
import {IBundleService} from "./service/IBundleService.sol";
|
11
18
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
19
|
+
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
20
|
+
import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
21
|
+
import {IPolicy} from "./module/IPolicy.sol";
|
22
|
+
import {IDistribution} from "./module/IDistribution.sol";
|
23
|
+
import {IPolicyService} from "./service/IPolicyService.sol";
|
12
24
|
import {IPoolService} from "./service/IPoolService.sol";
|
13
25
|
import {IProductService} from "./service/IProductService.sol";
|
14
26
|
import {IPolicyService} from "./service/IPolicyService.sol";
|
15
27
|
import {IBundleService} from "./service/IBundleService.sol";
|
16
|
-
import {
|
28
|
+
import {IRisk} from "./module/IRisk.sol";
|
17
29
|
import {ISetup} from "./module/ISetup.sol";
|
18
30
|
import {NftId} from "../types/NftId.sol";
|
19
|
-
import {StateId} from "../types/StateId.sol";
|
20
31
|
import {RiskId} from "../types/RiskId.sol";
|
21
|
-
import {
|
22
|
-
import {
|
23
|
-
import {
|
32
|
+
import {StateId} from "../types/StateId.sol";
|
33
|
+
import {VersionPart} from "../types/Version.sol";
|
34
|
+
import {Key32} from "../types/Key32.sol";
|
35
|
+
|
24
36
|
|
25
37
|
|
26
|
-
|
38
|
+
|
39
|
+
interface IInstance is IRegisterable, IKeyValueStore, IAccessManaged {
|
27
40
|
|
28
41
|
function getDistributionService() external view returns (IDistributionService);
|
29
42
|
function getProductService() external view returns (IProductService);
|
@@ -47,14 +60,33 @@ interface IInstance is IERC165, IKeyValueStore, IAccessManaged {
|
|
47
60
|
function updateProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup, StateId newState) external;
|
48
61
|
function updateProductSetupState(NftId productNftId, StateId newState) external;
|
49
62
|
|
63
|
+
function createDistributorType(Key32 distributorKey, IDistribution.DistributorTypeInfo memory info) external;
|
64
|
+
function updateDistributorType(Key32 distributorKey, IDistribution.DistributorTypeInfo memory info, StateId newState) external;
|
65
|
+
function updateDistributorTypeState(Key32 distributorKey, StateId newState) external;
|
66
|
+
|
67
|
+
function createDistributor(NftId nftId, IDistribution.DistributorInfo memory info) external;
|
68
|
+
function updateDistributor(NftId nftId, IDistribution.DistributorInfo memory info, StateId newState) external;
|
69
|
+
function updateDistributorState(NftId nftId, StateId newState) external;
|
70
|
+
|
71
|
+
function createReferral(Key32 referralKey, IDistribution.ReferralInfo memory referralInfo) external;
|
72
|
+
function updateReferral(Key32 referralKey, IDistribution.ReferralInfo memory referralInfo, StateId newState) external;
|
73
|
+
function updateReferralState(Key32 referralKey, StateId newState) external;
|
74
|
+
|
50
75
|
function createRisk(RiskId riskId, IRisk.RiskInfo memory risk) external;
|
51
76
|
function updateRisk(RiskId riskId, IRisk.RiskInfo memory risk, StateId newState) external;
|
52
77
|
function updateRiskState(RiskId riskId, StateId newState) external;
|
53
78
|
|
54
|
-
function
|
79
|
+
function createApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy) external;
|
80
|
+
function updateApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
|
81
|
+
function updateApplicationState(NftId applicationNftId, StateId newState) external;
|
82
|
+
|
55
83
|
function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
|
56
84
|
function updatePolicyState(NftId policyNftId, StateId newState) external;
|
57
85
|
|
86
|
+
// TODO add claims/payouts function to instance
|
87
|
+
// function updateClaims(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
|
88
|
+
|
89
|
+
function getMajorVersion() external pure returns (VersionPart majorVersion);
|
58
90
|
function getInstanceReader() external view returns (InstanceReader);
|
59
91
|
function getBundleManager() external view returns (BundleManager);
|
60
92
|
}
|
@@ -8,7 +8,7 @@ import {IService} from "../shared/IService.sol";
|
|
8
8
|
import {IRegistry} from "../registry/IRegistry.sol";
|
9
9
|
|
10
10
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
11
|
-
import {
|
11
|
+
import {IComponent} from "../components/IComponent.sol";
|
12
12
|
|
13
13
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
14
14
|
import {Instance} from "./Instance.sol";
|
@@ -17,9 +17,28 @@ import {BundleManager} from "./BundleManager.sol";
|
|
17
17
|
|
18
18
|
interface IInstanceService is IService {
|
19
19
|
|
20
|
+
error ErrorInstanceServiceMasterInstanceAlreadySet();
|
21
|
+
error ErrorInstanceServiceMasterInstanceAccessManagerAlreadySet();
|
22
|
+
error ErrorInstanceServiceMasterBundleManagerAlreadySet();
|
23
|
+
error ErrorInstanceServiceInstanceAddressZero();
|
24
|
+
|
25
|
+
error ErrorInstanceServiceMasterInstanceReaderNotSet();
|
26
|
+
error ErrorInstanceServiceInstanceReaderAddressZero();
|
27
|
+
error ErrorInstanceServiceInstanceReaderSameAsMasterInstanceReader();
|
28
|
+
error ErrorInstanceServiceInstanceReaderInstanceMismatch();
|
29
|
+
|
30
|
+
error ErrorInstanceServiceAccessManagerZero();
|
31
|
+
error ErrorInstanceServiceInstanceReaderZero();
|
32
|
+
error ErrorInstanceServiceBundleManagerZero();
|
33
|
+
|
34
|
+
error ErrorInstanceServiceInstanceAuthorityMismatch();
|
35
|
+
error ErrorInstanceServiceInstanceReaderInstanceMismatch2();
|
36
|
+
error ErrorInstanceServiceBundleMangerInstanceMismatch();
|
37
|
+
|
20
38
|
error ErrorInstanceServiceRequestUnauhorized(address caller);
|
21
39
|
error ErrorInstanceServiceNotInstanceOwner(address caller, NftId instanceNftId);
|
22
40
|
error ErrorInstanceServiceComponentNotRegistered(address componentAddress);
|
41
|
+
error ErrorInstanceServiceInvalidComponentType(address componentAddress, ObjectType expectedType, ObjectType componentType);
|
23
42
|
|
24
43
|
event LogInstanceCloned(address clonedAccessManagerAddress, address clonedInstanceAddress, address clonedInstanceReaderAddress, NftId clonedInstanceNftId);
|
25
44
|
|