@etherisc/gif-next 0.0.2-da06f3b-803 → 0.0.2-da0f894-204
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 +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +212 -94
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +552 -122
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +64 -72
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +279 -98
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +406 -90
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +68 -144
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +654 -117
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +316 -166
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +2 -2
- 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 +765 -323
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +97 -180
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +841 -574
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +134 -231
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +98 -124
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +265 -269
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +319 -99
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +118 -169
- 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 +62 -36
- 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 +947 -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 +261 -267
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +305 -93
- 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 +1031 -250
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +441 -85
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +535 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +130 -212
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +409 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +552 -135
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +40 -287
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +22 -169
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +22 -169
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +164 -391
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +311 -127
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +142 -221
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +302 -90
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +142 -221
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +302 -90
- 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 +15 -21
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +83 -174
- 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 +28 -34
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +193 -216
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +300 -94
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +11 -11
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +141 -37
- 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 -29
- 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 -169
- 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 +113 -33
- 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 -74
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +125 -55
- 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 +113 -164
- 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 +125 -55
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +6 -6
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +134 -221
- 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 +82 -77
- package/contracts/components/Distribution.sol +188 -48
- package/contracts/components/IComponent.sol +42 -17
- package/contracts/components/IDistributionComponent.sol +39 -7
- package/contracts/components/IPoolComponent.sol +121 -21
- package/contracts/components/IProductComponent.sol +3 -2
- package/contracts/components/Pool.sol +290 -120
- package/contracts/components/Product.sol +92 -69
- package/contracts/instance/BundleManager.sol +1 -1
- package/contracts/instance/IInstance.sol +21 -1
- package/contracts/instance/IInstanceService.sol +19 -2
- package/contracts/instance/Instance.sol +58 -36
- package/contracts/instance/InstanceAccessManager.sol +136 -253
- package/contracts/instance/InstanceService.sol +154 -137
- package/contracts/instance/InstanceServiceManager.sol +1 -1
- package/contracts/instance/base/ComponentService.sol +1 -1
- package/contracts/instance/module/IAccess.sol +10 -11
- 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 +346 -0
- package/contracts/instance/service/ApplicationServiceManager.sol +35 -0
- package/contracts/instance/service/BundleService.sol +15 -9
- 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 +303 -15
- package/contracts/instance/service/DistributionServiceManager.sol +1 -1
- package/contracts/instance/service/IApplicationService.sol +81 -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 +126 -260
- package/contracts/instance/service/PolicyServiceManager.sol +2 -2
- package/contracts/instance/service/PoolService.sol +2 -3
- package/contracts/instance/service/PoolServiceManager.sol +1 -1
- package/contracts/instance/service/ProductService.sol +9 -9
- package/contracts/instance/service/ProductServiceManager.sol +2 -2
- package/contracts/registry/IRegistry.sol +3 -4
- package/contracts/registry/IRegistryService.sol +10 -8
- package/contracts/registry/Registry.sol +28 -21
- package/contracts/registry/RegistryService.sol +69 -48
- package/contracts/registry/RegistryServiceManager.sol +13 -13
- package/contracts/registry/ReleaseManager.sol +18 -28
- package/contracts/registry/TokenRegistry.sol +16 -12
- 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 +3 -3
- 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 -85
- package/contracts/shared/PolicyHolder.sol +81 -0
- package/contracts/shared/ProxyManager.sol +100 -25
- package/contracts/shared/Registerable.sol +7 -19
- package/contracts/shared/RegistryLinked.sol +48 -0
- package/contracts/shared/Service.sol +15 -17
- 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 +14 -12
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/Timestamp.sol +12 -13
- package/package.json +1 -1
- 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/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
@@ -4,12 +4,16 @@ 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";
|
@@ -18,26 +22,35 @@ import {Component} from "./Component.sol";
|
|
18
22
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
19
23
|
|
20
24
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
25
|
+
import {IPolicy} from "../instance/module/IPolicy.sol";
|
21
26
|
import {ISetup} from "../instance/module/ISetup.sol";
|
22
27
|
import {Pool} from "../components/Pool.sol";
|
23
28
|
import {Distribution} from "../components/Distribution.sol";
|
24
29
|
|
25
|
-
abstract contract Product is
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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
|
+
}
|
37
50
|
|
38
|
-
|
51
|
+
function initializeProduct(
|
39
52
|
address registry,
|
40
|
-
NftId
|
53
|
+
NftId instanceNftId,
|
41
54
|
string memory name,
|
42
55
|
address token,
|
43
56
|
bool isInterceptor,
|
@@ -46,37 +59,37 @@ abstract contract Product is Component, IProductComponent {
|
|
46
59
|
Fee memory productFee,
|
47
60
|
Fee memory processingFee,
|
48
61
|
address initialOwner,
|
49
|
-
bytes memory data
|
50
|
-
)
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
PRODUCT(),
|
56
|
-
isInterceptor,
|
57
|
-
initialOwner,
|
58
|
-
data
|
59
|
-
) {
|
60
|
-
// TODO add validation
|
61
|
-
_policyService = getInstance().getPolicyService();
|
62
|
-
_pool = Pool(pool);
|
63
|
-
_distribution = Distribution(distribution);
|
64
|
-
_initialProductFee = productFee;
|
65
|
-
_initialProcessingFee = processingFee;
|
66
|
-
|
67
|
-
_tokenHandler = new TokenHandler(token);
|
68
|
-
|
69
|
-
_poolNftId = getRegistry().getNftId(address(_pool));
|
70
|
-
_distributionNftId = getRegistry().getNftId(address(_distribution));
|
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);
|
71
69
|
|
72
|
-
|
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);
|
73
86
|
}
|
74
87
|
|
75
88
|
|
76
89
|
function calculatePremium(
|
77
90
|
uint256 sumInsuredAmount,
|
78
91
|
RiskId riskId,
|
79
|
-
|
92
|
+
Seconds lifetime,
|
80
93
|
bytes memory applicationData,
|
81
94
|
NftId bundleNftId,
|
82
95
|
ReferralId referralId
|
@@ -86,7 +99,8 @@ abstract contract Product is Component, IProductComponent {
|
|
86
99
|
override
|
87
100
|
returns (uint256 premiumAmount)
|
88
101
|
{
|
89
|
-
|
102
|
+
IPolicy.Premium memory premium = _getProductStorage()._applicationService.calculatePremium(
|
103
|
+
getNftId(),
|
90
104
|
riskId,
|
91
105
|
sumInsuredAmount,
|
92
106
|
lifetime,
|
@@ -94,13 +108,14 @@ abstract contract Product is Component, IProductComponent {
|
|
94
108
|
bundleNftId,
|
95
109
|
referralId
|
96
110
|
);
|
111
|
+
premiumAmount = premium.premiumAmount;
|
97
112
|
}
|
98
113
|
|
99
114
|
|
100
115
|
function calculateNetPremium(
|
101
116
|
uint256 sumInsuredAmount,
|
102
117
|
RiskId riskId,
|
103
|
-
|
118
|
+
Seconds lifetime,
|
104
119
|
bytes memory applicationData
|
105
120
|
)
|
106
121
|
external
|
@@ -120,7 +135,7 @@ abstract contract Product is Component, IProductComponent {
|
|
120
135
|
RiskId id,
|
121
136
|
bytes memory data
|
122
137
|
) internal {
|
123
|
-
|
138
|
+
_getProductService().createRisk(
|
124
139
|
id,
|
125
140
|
data
|
126
141
|
);
|
@@ -130,7 +145,7 @@ abstract contract Product is Component, IProductComponent {
|
|
130
145
|
RiskId id,
|
131
146
|
bytes memory data
|
132
147
|
) internal {
|
133
|
-
|
148
|
+
_getProductService().updateRisk(
|
134
149
|
id,
|
135
150
|
data
|
136
151
|
);
|
@@ -140,7 +155,7 @@ abstract contract Product is Component, IProductComponent {
|
|
140
155
|
RiskId id,
|
141
156
|
StateId state
|
142
157
|
) internal {
|
143
|
-
|
158
|
+
_getProductService().updateRiskState(
|
144
159
|
id,
|
145
160
|
state
|
146
161
|
);
|
@@ -154,19 +169,22 @@ abstract contract Product is Component, IProductComponent {
|
|
154
169
|
address applicationOwner,
|
155
170
|
RiskId riskId,
|
156
171
|
uint256 sumInsuredAmount,
|
157
|
-
|
158
|
-
bytes memory applicationData,
|
172
|
+
Seconds lifetime,
|
159
173
|
NftId bundleNftId,
|
160
|
-
ReferralId referralId
|
161
|
-
|
162
|
-
|
174
|
+
ReferralId referralId,
|
175
|
+
bytes memory applicationData
|
176
|
+
)
|
177
|
+
internal
|
178
|
+
returns (NftId applicationNftId)
|
179
|
+
{
|
180
|
+
return _getProductStorage()._applicationService.create(
|
163
181
|
applicationOwner,
|
164
182
|
riskId,
|
165
183
|
sumInsuredAmount,
|
166
184
|
lifetime,
|
167
|
-
applicationData,
|
168
185
|
bundleNftId,
|
169
|
-
referralId
|
186
|
+
referralId,
|
187
|
+
applicationData
|
170
188
|
);
|
171
189
|
}
|
172
190
|
|
@@ -177,7 +195,7 @@ abstract contract Product is Component, IProductComponent {
|
|
177
195
|
)
|
178
196
|
internal
|
179
197
|
{
|
180
|
-
_policyService.underwrite(
|
198
|
+
_getProductStorage()._policyService.underwrite(
|
181
199
|
policyNftId,
|
182
200
|
requirePremiumPayment,
|
183
201
|
activateAt);
|
@@ -189,7 +207,7 @@ abstract contract Product is Component, IProductComponent {
|
|
189
207
|
)
|
190
208
|
internal
|
191
209
|
{
|
192
|
-
_policyService.collectPremium(
|
210
|
+
_getProductStorage()._policyService.collectPremium(
|
193
211
|
policyNftId,
|
194
212
|
activateAt);
|
195
213
|
}
|
@@ -200,7 +218,7 @@ abstract contract Product is Component, IProductComponent {
|
|
200
218
|
)
|
201
219
|
internal
|
202
220
|
{
|
203
|
-
_policyService.activate(
|
221
|
+
_getProductStorage()._policyService.activate(
|
204
222
|
policyNftId,
|
205
223
|
activateAt);
|
206
224
|
}
|
@@ -210,15 +228,15 @@ abstract contract Product is Component, IProductComponent {
|
|
210
228
|
)
|
211
229
|
internal
|
212
230
|
{
|
213
|
-
_policyService.close(policyNftId);
|
231
|
+
_getProductStorage()._policyService.close(policyNftId);
|
214
232
|
}
|
215
233
|
|
216
234
|
function getPoolNftId() external view override returns (NftId poolNftId) {
|
217
|
-
return getRegistry().getNftId(address(_pool));
|
235
|
+
return getRegistry().getNftId(address(_getProductStorage()._pool));
|
218
236
|
}
|
219
237
|
|
220
238
|
function getDistributionNftId() external view override returns (NftId distributionNftId) {
|
221
|
-
return getRegistry().getNftId(address(_distribution));
|
239
|
+
return getRegistry().getNftId(address(_getProductStorage()._distribution));
|
222
240
|
}
|
223
241
|
|
224
242
|
// from product component
|
@@ -231,7 +249,7 @@ abstract contract Product is Component, IProductComponent {
|
|
231
249
|
restricted()
|
232
250
|
override
|
233
251
|
{
|
234
|
-
|
252
|
+
_getProductService().setFees(productFee, processingFee);
|
235
253
|
}
|
236
254
|
|
237
255
|
function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
@@ -245,22 +263,27 @@ abstract contract Product is Component, IProductComponent {
|
|
245
263
|
}
|
246
264
|
|
247
265
|
function _getInitialSetupInfo() internal view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
248
|
-
|
249
|
-
ISetup.PoolSetupInfo memory poolSetupInfo = _pool.getSetupInfo();
|
266
|
+
ProductStorage storage $ = _getProductStorage();
|
250
267
|
|
251
268
|
return ISetup.ProductSetupInfo(
|
252
269
|
getToken(),
|
253
|
-
_tokenHandler,
|
254
|
-
_distributionNftId,
|
255
|
-
_poolNftId,
|
256
|
-
|
257
|
-
|
258
|
-
_initialProcessingFee,
|
259
|
-
poolSetupInfo.poolFee,
|
260
|
-
poolSetupInfo.stakingFee,
|
261
|
-
poolSetupInfo.performanceFee,
|
270
|
+
$._tokenHandler,
|
271
|
+
$._distributionNftId,
|
272
|
+
$._poolNftId,
|
273
|
+
$._initialProductFee,
|
274
|
+
$._initialProcessingFee,
|
262
275
|
false,
|
263
276
|
getWallet()
|
264
277
|
);
|
265
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
|
+
}
|
266
289
|
}
|
@@ -71,7 +71,7 @@ contract BundleManager is
|
|
71
71
|
}
|
72
72
|
|
73
73
|
|
74
|
-
/// @dev add a new bundle to a
|
74
|
+
/// @dev add a new bundle to a pool registerd with this instance
|
75
75
|
// the corresponding pool is fetched via instance reader
|
76
76
|
function add(NftId bundleNftId) external restricted() {
|
77
77
|
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
@@ -19,6 +19,7 @@ import {IDistributionService} from "./service/IDistributionService.sol";
|
|
19
19
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
20
20
|
import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
21
21
|
import {IPolicy} from "./module/IPolicy.sol";
|
22
|
+
import {IDistribution} from "./module/IDistribution.sol";
|
22
23
|
import {IPolicyService} from "./service/IPolicyService.sol";
|
23
24
|
import {IPoolService} from "./service/IPoolService.sol";
|
24
25
|
import {IProductService} from "./service/IProductService.sol";
|
@@ -30,6 +31,7 @@ import {NftId} from "../types/NftId.sol";
|
|
30
31
|
import {RiskId} from "../types/RiskId.sol";
|
31
32
|
import {StateId} from "../types/StateId.sol";
|
32
33
|
import {VersionPart} from "../types/Version.sol";
|
34
|
+
import {Key32} from "../types/Key32.sol";
|
33
35
|
|
34
36
|
|
35
37
|
|
@@ -58,14 +60,32 @@ interface IInstance is IRegisterable, IKeyValueStore, IAccessManaged {
|
|
58
60
|
function updateProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup, StateId newState) external;
|
59
61
|
function updateProductSetupState(NftId productNftId, StateId newState) external;
|
60
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
|
+
|
61
75
|
function createRisk(RiskId riskId, IRisk.RiskInfo memory risk) external;
|
62
76
|
function updateRisk(RiskId riskId, IRisk.RiskInfo memory risk, StateId newState) external;
|
63
77
|
function updateRiskState(RiskId riskId, StateId newState) external;
|
64
78
|
|
65
|
-
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
|
+
|
66
83
|
function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
|
67
84
|
function updatePolicyState(NftId policyNftId, StateId newState) external;
|
68
85
|
|
86
|
+
// TODO add claims/payouts function to instance
|
87
|
+
// function updateClaims(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
|
88
|
+
|
69
89
|
function getMajorVersion() external pure returns (VersionPart majorVersion);
|
70
90
|
function getInstanceReader() external view returns (InstanceReader);
|
71
91
|
function getBundleManager() external view returns (BundleManager);
|
@@ -17,9 +17,26 @@ 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
|
-
error ErrorInstanceServiceNotInstance(NftId nftId);
|
23
40
|
error ErrorInstanceServiceComponentNotRegistered(address componentAddress);
|
24
41
|
error ErrorInstanceServiceInvalidComponentType(address componentAddress, ObjectType expectedType, ObjectType componentType);
|
25
42
|
|
@@ -36,7 +53,7 @@ interface IInstanceService is IService {
|
|
36
53
|
);
|
37
54
|
|
38
55
|
function hasRole(address account, RoleId role, address instanceAddress) external returns (bool);
|
39
|
-
function
|
56
|
+
function setTargetLocked(string memory targetName, bool locked) external;
|
40
57
|
|
41
58
|
}
|
42
59
|
|
@@ -5,8 +5,9 @@ import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/acce
|
|
5
5
|
|
6
6
|
import {Key32, KeyId, Key32Lib} from "../types/Key32.sol";
|
7
7
|
import {NftId} from "../types/NftId.sol";
|
8
|
+
import {ClaimId} from "../types/ClaimId.sol";
|
8
9
|
import {NumberId} from "../types/NumberId.sol";
|
9
|
-
import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, ROLE, PRODUCT, TARGET, COMPONENT} from "../types/ObjectType.sol";
|
10
|
+
import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, ROLE, PRODUCT, TARGET, COMPONENT, DISTRIBUTOR, DISTRIBUTOR_TYPE} from "../types/ObjectType.sol";
|
10
11
|
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
11
12
|
import {RoleId, RoleIdLib} from "../types/RoleId.sol";
|
12
13
|
import {StateId, ACTIVE} from "../types/StateId.sol";
|
@@ -25,6 +26,7 @@ import {KeyValueStore} from "./base/KeyValueStore.sol";
|
|
25
26
|
|
26
27
|
import {IAccess} from "./module/IAccess.sol";
|
27
28
|
import {IBundle} from "./module/IBundle.sol";
|
29
|
+
import {IDistribution} from "./module/IDistribution.sol";
|
28
30
|
import {IPolicy} from "./module/IPolicy.sol";
|
29
31
|
import {IRisk} from "./module/IRisk.sol";
|
30
32
|
import {ISetup} from "./module/ISetup.sol";
|
@@ -59,13 +61,12 @@ contract Instance is
|
|
59
61
|
|
60
62
|
function initialize(address accessManagerAddress, address registryAddress, NftId registryNftId, address initialOwner)
|
61
63
|
public
|
62
|
-
initializer
|
64
|
+
initializer()
|
63
65
|
{
|
64
66
|
__AccessManaged_init(accessManagerAddress);
|
65
67
|
|
66
|
-
|
67
|
-
|
68
|
-
_registerInterface(type(IInstance).interfaceId);
|
68
|
+
initializeRegisterable(registryAddress, registryNftId, INSTANCE(), false, initialOwner, "");
|
69
|
+
registerInterface(type(IInstance).interfaceId);
|
69
70
|
}
|
70
71
|
|
71
72
|
//--- ProductSetup ------------------------------------------------------//
|
@@ -107,43 +108,43 @@ contract Instance is
|
|
107
108
|
updateState(_toNftKey32(poolNftId, POOL()), newState);
|
108
109
|
}
|
109
110
|
|
110
|
-
//--- DistributorType
|
111
|
-
function createDistributorType(
|
112
|
-
create(
|
111
|
+
//--- DistributorType -------------------------------------------------------//
|
112
|
+
function createDistributorType(Key32 distributorKey, IDistribution.DistributorTypeInfo memory info) external restricted() {
|
113
|
+
create(distributorKey, abi.encode(info));
|
113
114
|
}
|
114
115
|
|
115
|
-
function updateDistributorType(
|
116
|
-
update(
|
116
|
+
function updateDistributorType(Key32 distributorKey, IDistribution.DistributorTypeInfo memory info, StateId newState) external restricted() {
|
117
|
+
update(distributorKey, abi.encode(info), newState);
|
117
118
|
}
|
118
119
|
|
119
|
-
function updateDistributorTypeState(
|
120
|
-
updateState(
|
120
|
+
function updateDistributorTypeState(Key32 distributorKey, StateId newState) external restricted() {
|
121
|
+
updateState(distributorKey, newState);
|
121
122
|
}
|
122
123
|
|
123
124
|
//--- Distributor -------------------------------------------------------//
|
124
|
-
function createDistributor(NftId
|
125
|
-
create(
|
125
|
+
function createDistributor(NftId nftId, IDistribution.DistributorInfo memory info) external restricted() {
|
126
|
+
create(toDistributorKey32(nftId), abi.encode(info));
|
126
127
|
}
|
127
128
|
|
128
|
-
function updateDistributor(NftId
|
129
|
-
update(
|
129
|
+
function updateDistributor(NftId nftId, IDistribution.DistributorInfo memory info, StateId newState) external restricted() {
|
130
|
+
update(toDistributorKey32(nftId), abi.encode(info), newState);
|
130
131
|
}
|
131
132
|
|
132
|
-
function updateDistributorState(NftId
|
133
|
-
updateState(
|
133
|
+
function updateDistributorState(NftId nftId, StateId newState) external restricted() {
|
134
|
+
updateState(toDistributorKey32(nftId), newState);
|
134
135
|
}
|
135
136
|
|
136
137
|
//--- Referral ----------------------------------------------------------//
|
137
|
-
function createReferral(
|
138
|
-
create(
|
138
|
+
function createReferral(Key32 referralKey, IDistribution.ReferralInfo memory referralInfo) external restricted() {
|
139
|
+
create(referralKey, abi.encode(referralInfo));
|
139
140
|
}
|
140
141
|
|
141
|
-
function updateReferral(
|
142
|
-
update(
|
142
|
+
function updateReferral(Key32 referralKey, IDistribution.ReferralInfo memory referralInfo, StateId newState) external restricted() {
|
143
|
+
update(referralKey, abi.encode(referralInfo), newState);
|
143
144
|
}
|
144
145
|
|
145
|
-
function updateReferralState(
|
146
|
-
updateState(
|
146
|
+
function updateReferralState(Key32 referralKey, StateId newState) external restricted() {
|
147
|
+
updateState(referralKey, newState);
|
147
148
|
}
|
148
149
|
|
149
150
|
//--- Bundle ------------------------------------------------------------//
|
@@ -172,11 +173,20 @@ contract Instance is
|
|
172
173
|
updateState(riskId.toKey32(), newState);
|
173
174
|
}
|
174
175
|
|
175
|
-
//--- Policy
|
176
|
-
function
|
177
|
-
create(toPolicyKey32(
|
176
|
+
//--- Application (Policy) ----------------------------------------------//
|
177
|
+
function createApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy) external restricted() {
|
178
|
+
create(toPolicyKey32(applicationNftId), abi.encode(policy));
|
178
179
|
}
|
179
180
|
|
181
|
+
function updateApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
|
182
|
+
update(toPolicyKey32(applicationNftId), abi.encode(policy), newState);
|
183
|
+
}
|
184
|
+
|
185
|
+
function updateApplicationState(NftId applicationNftId, StateId newState) external restricted() {
|
186
|
+
updateState(toPolicyKey32(applicationNftId), newState);
|
187
|
+
}
|
188
|
+
|
189
|
+
//--- Policy ------------------------------------------------------------//
|
180
190
|
function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
|
181
191
|
update(toPolicyKey32(policyNftId), abi.encode(policy), newState);
|
182
192
|
}
|
@@ -186,15 +196,15 @@ contract Instance is
|
|
186
196
|
}
|
187
197
|
|
188
198
|
//--- Claim -------------------------------------------------------------//
|
189
|
-
function createClaim(NftId policyNftId,
|
199
|
+
function createClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim) external restricted() {
|
190
200
|
create(toPolicyKey32(policyNftId), abi.encode(claim));
|
191
201
|
}
|
192
202
|
|
193
|
-
function updateClaim(NftId policyNftId,
|
203
|
+
function updateClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim, StateId newState) external restricted() {
|
194
204
|
update(toPolicyKey32(policyNftId), abi.encode(claim), newState);
|
195
205
|
}
|
196
206
|
|
197
|
-
function updateClaimState(NftId policyNftId, StateId newState) external restricted() {
|
207
|
+
function updateClaimState(NftId policyNftId, ClaimId claimId, StateId newState) external restricted() {
|
198
208
|
updateState(toPolicyKey32(policyNftId), newState);
|
199
209
|
}
|
200
210
|
|
@@ -203,7 +213,7 @@ contract Instance is
|
|
203
213
|
create(toPolicyKey32(policyNftId), abi.encode(payout));
|
204
214
|
}
|
205
215
|
|
206
|
-
function
|
216
|
+
function updatePayout(NftId policyNftId, NumberId payoutId, IPolicy.PayoutInfo memory payout, StateId newState) external restricted() {
|
207
217
|
update(toPolicyKey32(policyNftId), abi.encode(payout), newState);
|
208
218
|
}
|
209
219
|
|
@@ -224,24 +234,36 @@ contract Instance is
|
|
224
234
|
return policyNftId.toKey32(POLICY());
|
225
235
|
}
|
226
236
|
|
237
|
+
function toDistributionKey32(NftId distNftId) public pure returns (Key32) {
|
238
|
+
return distNftId.toKey32(DISTRIBUTION());
|
239
|
+
}
|
240
|
+
|
241
|
+
function toDistributorTypeKey32(NftId distNftId) public pure returns (Key32) {
|
242
|
+
return distNftId.toKey32(DISTRIBUTOR_TYPE());
|
243
|
+
}
|
244
|
+
|
245
|
+
function toDistributorKey32(NftId distNftId) public pure returns (Key32) {
|
246
|
+
return distNftId.toKey32(DISTRIBUTOR());
|
247
|
+
}
|
248
|
+
|
227
249
|
function getDistributionService() external view returns (IDistributionService) {
|
228
|
-
return IDistributionService(
|
250
|
+
return IDistributionService(getRegistry().getServiceAddress(DISTRIBUTION(), VersionPart.wrap(3)));
|
229
251
|
}
|
230
252
|
|
231
253
|
function getProductService() external view returns (IProductService) {
|
232
|
-
return IProductService(
|
254
|
+
return IProductService(getRegistry().getServiceAddress(PRODUCT(), VersionPart.wrap(3)));
|
233
255
|
}
|
234
256
|
|
235
257
|
function getPoolService() external view returns (IPoolService) {
|
236
|
-
return IPoolService(
|
258
|
+
return IPoolService(getRegistry().getServiceAddress(POOL(), VersionPart.wrap(3)));
|
237
259
|
}
|
238
260
|
|
239
261
|
function getPolicyService() external view returns (IPolicyService) {
|
240
|
-
return IPolicyService(
|
262
|
+
return IPolicyService(getRegistry().getServiceAddress(POLICY(), VersionPart.wrap(3)));
|
241
263
|
}
|
242
264
|
|
243
265
|
function getBundleService() external view returns (IBundleService) {
|
244
|
-
return IBundleService(
|
266
|
+
return IBundleService(getRegistry().getServiceAddress(BUNDLE(), VersionPart.wrap(3)));
|
245
267
|
}
|
246
268
|
|
247
269
|
function setInstanceReader(InstanceReader instanceReader) external restricted() {
|