@etherisc/gif-next 0.0.2-239d061-784 → 0.0.2-23ade4a-264
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -10
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +97 -123
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +368 -163
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +81 -83
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +295 -121
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +261 -188
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +85 -155
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +288 -259
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +102 -196
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +64 -50
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +5 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +808 -456
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +171 -195
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +893 -800
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +448 -121
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +120 -227
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +249 -380
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +231 -114
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -13
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +39 -215
- 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 +40 -10
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +36 -11
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +54 -71
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.json +10 -0
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +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 +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +203 -326
- 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 +162 -361
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +206 -105
- 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 +1076 -241
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +354 -97
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +130 -199
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +95 -250
- 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 +705 -138
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +51 -282
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +75 -146
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +18 -170
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +106 -437
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +212 -139
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +137 -244
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +211 -102
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +63 -267
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +203 -102
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +15 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +19 -0
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +77 -173
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +18 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +31 -12
- 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 +109 -257
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +202 -107
- 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 +46 -53
- 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 +2 -2
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +17 -30
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +2 -2
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +17 -30
- 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 +18 -170
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +0 -150
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +22 -48
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +80 -4
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +195 -86
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +34 -71
- 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 +32 -208
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
- 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 +0 -150
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +2 -2
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +34 -71
- 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 +50 -262
- 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/TestVersion.sol/TestVersion.json +2 -2
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +6 -188
- 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/Blocknumber.sol/BlocknumberLib.json +2 -2
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +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/Fee.sol/FeeLib.json +2 -2
- 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 +17 -4
- 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 +23 -4
- 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/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +25 -7
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.json +2 -2
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +2 -2
- package/contracts/components/Component.sol +98 -77
- package/contracts/components/Distribution.sol +159 -35
- package/contracts/components/IComponent.sol +40 -16
- package/contracts/components/IDistributionComponent.sol +39 -15
- package/contracts/components/IPoolComponent.sol +73 -47
- package/contracts/components/IProductComponent.sol +3 -2
- package/contracts/components/Pool.sol +171 -126
- package/contracts/components/Product.sol +38 -23
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
- package/contracts/instance/BundleManager.sol +7 -5
- package/contracts/instance/Cloneable.sol +7 -2
- package/contracts/instance/IInstance.sol +36 -10
- package/contracts/instance/IInstanceService.sol +35 -4
- package/contracts/instance/Instance.sol +95 -36
- package/contracts/instance/InstanceAccessManager.sol +382 -157
- package/contracts/instance/InstanceReader.sol +7 -10
- package/contracts/instance/InstanceService.sol +234 -173
- package/contracts/instance/InstanceServiceManager.sol +1 -1
- package/contracts/instance/ObjectManager.sol +6 -8
- package/contracts/instance/base/ComponentService.sol +5 -5
- package/contracts/instance/base/KeyValueStore.sol +5 -2
- package/contracts/instance/base/Lifecycle.sol +11 -2
- package/contracts/instance/module/IAccess.sol +20 -13
- package/contracts/instance/module/IBundle.sol +2 -1
- package/contracts/instance/module/IComponents.sol +35 -0
- package/contracts/instance/module/IDistribution.sol +2 -0
- package/contracts/instance/module/IPolicy.sol +30 -3
- package/contracts/instance/module/ISetup.sol +7 -21
- package/contracts/instance/service/ApplicationService.sol +139 -57
- package/contracts/instance/service/ApplicationServiceManager.sol +35 -0
- package/contracts/instance/service/BundleService.sol +76 -38
- 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 +375 -13
- package/contracts/instance/service/DistributionServiceManager.sol +1 -1
- package/contracts/instance/service/IApplicationService.sol +9 -9
- package/contracts/instance/service/IBundleService.sol +19 -11
- package/contracts/instance/service/IClaimService.sol +61 -0
- package/contracts/instance/service/IDistributionService.sol +86 -0
- package/contracts/instance/service/IPolicyService.sol +18 -34
- package/contracts/instance/service/IPoolService.sol +17 -2
- package/contracts/instance/service/PolicyService.sol +74 -195
- package/contracts/instance/service/PolicyServiceManager.sol +2 -2
- package/contracts/instance/service/PoolService.sol +128 -17
- package/contracts/instance/service/PoolServiceManager.sol +1 -1
- package/contracts/instance/service/ProductService.sol +10 -2
- package/contracts/instance/service/ProductServiceManager.sol +2 -2
- package/contracts/registry/ChainNft.sol +8 -0
- package/contracts/registry/IRegistry.sol +2 -0
- package/contracts/registry/IRegistryService.sol +10 -8
- package/contracts/registry/ITransferInterceptor.sol +1 -0
- package/contracts/registry/Registry.sol +26 -21
- package/contracts/registry/RegistryService.sol +62 -40
- package/contracts/registry/RegistryServiceManager.sol +13 -13
- package/contracts/registry/ReleaseManager.sol +18 -28
- package/contracts/registry/TokenRegistry.sol +13 -10
- package/contracts/shared/ERC165.sol +2 -1
- package/contracts/shared/INftOwnable.sol +7 -11
- package/contracts/shared/IPolicyHolder.sol +2 -2
- 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 +18 -85
- package/contracts/shared/PolicyHolder.sol +31 -2
- package/contracts/shared/ProxyManager.sol +98 -24
- package/contracts/shared/Registerable.sol +3 -10
- package/contracts/shared/RegistryLinked.sol +48 -0
- package/contracts/shared/Service.sol +10 -12
- package/contracts/shared/TokenHandler.sol +11 -5
- package/contracts/shared/Versionable.sol +1 -90
- package/contracts/types/Blocknumber.sol +1 -0
- package/contracts/types/ClaimId.sol +52 -0
- package/contracts/types/DistributorType.sol +2 -2
- package/contracts/types/Fee.sol +1 -0
- package/contracts/types/NftId.sol +8 -0
- package/contracts/types/ObjectType.sol +6 -5
- package/contracts/types/PayoutId.sol +54 -0
- package/contracts/types/Referral.sol +4 -0
- package/contracts/types/RoleId.sol +16 -9
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/StateId.sol +1 -0
- package/contracts/types/Timestamp.sol +13 -13
- package/contracts/types/UFixed.sol +1 -0
- package/contracts/types/Version.sol +1 -0
- 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
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.20;
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import {IPoolService} from "../instance/service/IPoolService.sol";
|
|
6
|
-
import {IBundleService} from "../instance/service/IBundleService.sol";
|
|
7
|
-
import {NftId, NftIdLib} from "../types/NftId.sol";
|
|
4
|
+
import {Component} from "./Component.sol";
|
|
8
5
|
import {Fee, FeeLib} from "../types/Fee.sol";
|
|
9
|
-
import {
|
|
6
|
+
import {IBundleService} from "../instance/service/IBundleService.sol";
|
|
7
|
+
import {InstanceReader} from "../instance/InstanceReader.sol";
|
|
10
8
|
import {IPoolComponent} from "./IPoolComponent.sol";
|
|
11
|
-
import {
|
|
9
|
+
import {IPoolService} from "../instance/service/IPoolService.sol";
|
|
10
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
|
11
|
+
import {NftId, NftIdLib} from "../types/NftId.sol";
|
|
12
|
+
import {POOL} from "../types/ObjectType.sol";
|
|
13
|
+
import {RoleId, PUBLIC_ROLE} from "../types/RoleId.sol";
|
|
14
|
+
import {Seconds} from "../types/Seconds.sol";
|
|
12
15
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
import {ISetup} from "../instance/module/ISetup.sol";
|
|
16
|
-
import {InstanceReader} from "../instance/InstanceReader.sol";
|
|
16
|
+
import {UFixed, UFixedLib} from "../types/UFixed.sol";
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
abstract contract Pool is
|
|
@@ -24,24 +24,19 @@ abstract contract Pool is
|
|
|
24
24
|
bytes32 public constant POOL_STORAGE_LOCATION_V1 = 0x25e3e51823fbfffb988e0a2744bb93722d9f3e906c07cc0a9e77884c46c58300;
|
|
25
25
|
|
|
26
26
|
struct PoolStorage {
|
|
27
|
-
UFixed _collateralizationLevel;
|
|
28
|
-
UFixed _retentionLevel;
|
|
29
|
-
|
|
30
|
-
bool _isExternallyManaged;
|
|
31
|
-
bool _isInterceptingBundleTransfers;
|
|
32
|
-
bool _isVerifyingApplications;
|
|
33
|
-
|
|
34
|
-
Fee _initialPoolFee;
|
|
35
|
-
Fee _initialStakingFee;
|
|
36
|
-
Fee _initialPerformanceFee;
|
|
37
|
-
|
|
38
|
-
TokenHandler _tokenHandler;
|
|
39
|
-
|
|
40
|
-
// may be used to interact with instance by derived contracts
|
|
41
27
|
IPoolService _poolService;
|
|
42
28
|
IBundleService _bundleService;
|
|
43
29
|
}
|
|
44
30
|
|
|
31
|
+
|
|
32
|
+
modifier onlyBundleOwner(NftId bundleNftId) {
|
|
33
|
+
if(msg.sender != getRegistry().ownerOf(bundleNftId)) {
|
|
34
|
+
revert ErrorPoolNotBundleOwner(bundleNftId, msg.sender);
|
|
35
|
+
}
|
|
36
|
+
_;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
45
40
|
modifier onlyPoolService() {
|
|
46
41
|
if(msg.sender != address(_getPoolStorage()._poolService)) {
|
|
47
42
|
revert ErrorPoolNotPoolService(msg.sender);
|
|
@@ -54,98 +49,124 @@ abstract contract Pool is
|
|
|
54
49
|
address registry,
|
|
55
50
|
NftId instanceNftId,
|
|
56
51
|
string memory name,
|
|
57
|
-
// TODO refactor into tokenNftId
|
|
58
52
|
address token,
|
|
59
53
|
bool isInterceptingNftTransfers,
|
|
60
|
-
bool isExternallyManaging,
|
|
61
|
-
bool isVerifying,
|
|
62
|
-
UFixed collateralizationLevel,
|
|
63
|
-
UFixed retentionLevel,
|
|
64
54
|
address initialOwner,
|
|
65
|
-
bytes memory data
|
|
55
|
+
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
|
66
56
|
)
|
|
67
57
|
public
|
|
68
58
|
virtual
|
|
69
59
|
onlyInitializing()
|
|
70
60
|
{
|
|
71
|
-
initializeComponent(registry, instanceNftId, name, token, POOL(), isInterceptingNftTransfers, initialOwner,
|
|
61
|
+
initializeComponent(registry, instanceNftId, name, token, POOL(), isInterceptingNftTransfers, initialOwner, registryData);
|
|
72
62
|
|
|
73
63
|
PoolStorage storage $ = _getPoolStorage();
|
|
74
|
-
// TODO add validation
|
|
75
|
-
$._tokenHandler = new TokenHandler(token);
|
|
76
|
-
$._isExternallyManaged = isExternallyManaging;
|
|
77
|
-
$._isVerifyingApplications = isVerifying;
|
|
78
|
-
$._collateralizationLevel = collateralizationLevel;
|
|
79
|
-
$._retentionLevel = retentionLevel;
|
|
80
|
-
$._initialPoolFee = FeeLib.zeroFee();
|
|
81
|
-
$._initialStakingFee = FeeLib.zeroFee();
|
|
82
|
-
$._initialPerformanceFee = FeeLib.zeroFee();
|
|
83
64
|
$._poolService = getInstance().getPoolService();
|
|
84
65
|
$._bundleService = getInstance().getBundleService();
|
|
85
66
|
|
|
86
67
|
registerInterface(type(IPoolComponent).interfaceId);
|
|
87
68
|
}
|
|
88
69
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
function verifyApplication(
|
|
94
|
-
NftId applicationNftId,
|
|
95
|
-
bytes memory applicationData,
|
|
96
|
-
bytes memory bundleFilter,
|
|
97
|
-
uint256 collateralizationAmount
|
|
70
|
+
|
|
71
|
+
function stake(
|
|
72
|
+
NftId bundleNftId,
|
|
73
|
+
uint256 amount
|
|
98
74
|
)
|
|
99
|
-
|
|
75
|
+
public
|
|
76
|
+
virtual
|
|
100
77
|
restricted()
|
|
101
|
-
|
|
78
|
+
onlyBundleOwner(bundleNftId)
|
|
102
79
|
{
|
|
103
|
-
|
|
104
|
-
policyMatchesBundle(applicationData, bundleFilter),
|
|
105
|
-
"ERROR:POL-020:POLICY_BUNDLE_MISMATCH"
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
emit LogUnderwrittenByPool(applicationNftId, collateralizationAmount, address(this));
|
|
80
|
+
// TODO add implementation
|
|
109
81
|
}
|
|
110
82
|
|
|
111
83
|
|
|
112
|
-
function
|
|
113
|
-
|
|
84
|
+
function unstake(
|
|
85
|
+
NftId bundleNftId,
|
|
86
|
+
uint256 amount
|
|
87
|
+
)
|
|
88
|
+
public
|
|
89
|
+
virtual
|
|
90
|
+
restricted()
|
|
91
|
+
onlyBundleOwner(bundleNftId)
|
|
92
|
+
{
|
|
93
|
+
// TODO add implementation
|
|
114
94
|
}
|
|
115
95
|
|
|
116
96
|
|
|
117
|
-
function
|
|
118
|
-
|
|
97
|
+
function extend(
|
|
98
|
+
NftId bundleNftId,
|
|
99
|
+
Seconds lifetimeExtension
|
|
100
|
+
)
|
|
101
|
+
public
|
|
102
|
+
virtual
|
|
103
|
+
restricted()
|
|
104
|
+
onlyBundleOwner(bundleNftId)
|
|
105
|
+
{
|
|
106
|
+
// TODO add implementation
|
|
119
107
|
}
|
|
120
108
|
|
|
121
109
|
|
|
122
|
-
function
|
|
123
|
-
|
|
110
|
+
function lockBundle(NftId bundleNftId)
|
|
111
|
+
public
|
|
112
|
+
virtual
|
|
113
|
+
//restricted() // TODO consider adding this back
|
|
114
|
+
onlyBundleOwner(bundleNftId)
|
|
115
|
+
{
|
|
116
|
+
_getPoolStorage()._bundleService.lock(bundleNftId);
|
|
124
117
|
}
|
|
125
118
|
|
|
126
119
|
|
|
127
|
-
function
|
|
128
|
-
|
|
120
|
+
function unlockBundle(NftId bundleNftId)
|
|
121
|
+
public
|
|
122
|
+
virtual
|
|
123
|
+
//restricted()
|
|
124
|
+
onlyBundleOwner(bundleNftId)
|
|
125
|
+
{
|
|
126
|
+
_getPoolStorage()._bundleService.unlock(bundleNftId);
|
|
129
127
|
}
|
|
130
128
|
|
|
131
129
|
|
|
132
|
-
function
|
|
133
|
-
|
|
130
|
+
function close(NftId bundleNftId)
|
|
131
|
+
public
|
|
132
|
+
virtual
|
|
133
|
+
//restricted()
|
|
134
|
+
onlyBundleOwner(bundleNftId)
|
|
135
|
+
{
|
|
136
|
+
_getPoolStorage()._bundleService.close(bundleNftId);
|
|
134
137
|
}
|
|
135
138
|
|
|
136
139
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
bytes memory, // policyData
|
|
141
|
-
bytes memory // bundleFilter
|
|
140
|
+
function setBundleFee(
|
|
141
|
+
NftId bundleNftId,
|
|
142
|
+
Fee memory fee
|
|
142
143
|
)
|
|
143
144
|
public
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
virtual
|
|
146
|
+
restricted()
|
|
147
|
+
onlyBundleOwner(bundleNftId)
|
|
147
148
|
{
|
|
148
|
-
|
|
149
|
+
_getPoolStorage()._bundleService.setFee(bundleNftId, fee);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
function setMaxCapitalAmount(uint256 maxCapitalAmount)
|
|
154
|
+
public
|
|
155
|
+
virtual
|
|
156
|
+
restricted()
|
|
157
|
+
onlyOwner()
|
|
158
|
+
{
|
|
159
|
+
_getPoolStorage()._poolService.setMaxCapitalAmount(maxCapitalAmount);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
function setBundleOwnerRole(RoleId bundleOwnerRole)
|
|
164
|
+
public
|
|
165
|
+
virtual
|
|
166
|
+
restricted()
|
|
167
|
+
onlyOwner()
|
|
168
|
+
{
|
|
169
|
+
_getPoolStorage()._poolService.setBundleOwnerRole(bundleOwnerRole);
|
|
149
170
|
}
|
|
150
171
|
|
|
151
172
|
|
|
@@ -154,70 +175,63 @@ abstract contract Pool is
|
|
|
154
175
|
Fee memory stakingFee,
|
|
155
176
|
Fee memory performanceFee
|
|
156
177
|
)
|
|
157
|
-
|
|
158
|
-
|
|
178
|
+
public
|
|
179
|
+
virtual
|
|
159
180
|
restricted()
|
|
160
|
-
|
|
181
|
+
onlyOwner()
|
|
161
182
|
{
|
|
162
183
|
_getPoolStorage()._poolService.setFees(poolFee, stakingFee, performanceFee);
|
|
163
184
|
}
|
|
164
185
|
|
|
165
|
-
|
|
186
|
+
|
|
187
|
+
/// @dev see {IPool.verifyApplication}
|
|
188
|
+
function verifyApplication(
|
|
189
|
+
NftId applicationNftId,
|
|
190
|
+
bytes memory applicationData,
|
|
166
191
|
NftId bundleNftId,
|
|
167
|
-
|
|
192
|
+
bytes memory bundleFilter,
|
|
193
|
+
uint256 collateralizationAmount
|
|
168
194
|
)
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
195
|
+
public
|
|
196
|
+
virtual
|
|
197
|
+
restricted()
|
|
172
198
|
{
|
|
173
|
-
|
|
174
|
-
|
|
199
|
+
if(!applicationMatchesBundle(
|
|
200
|
+
applicationNftId,
|
|
201
|
+
applicationData,
|
|
202
|
+
bundleNftId,
|
|
203
|
+
bundleFilter,
|
|
204
|
+
collateralizationAmount)
|
|
205
|
+
)
|
|
206
|
+
{
|
|
207
|
+
revert ErrorPoolApplicationBundleMismatch(applicationNftId);
|
|
208
|
+
}
|
|
175
209
|
|
|
176
|
-
|
|
177
|
-
NftId bundleNftId
|
|
178
|
-
)
|
|
179
|
-
external
|
|
180
|
-
override
|
|
181
|
-
// TODO add onlyBundleOwner
|
|
182
|
-
{
|
|
183
|
-
_getPoolStorage()._bundleService.lockBundle(bundleNftId);
|
|
210
|
+
emit LogPoolVerifiedByPool(address(this), applicationNftId, collateralizationAmount);
|
|
184
211
|
}
|
|
185
212
|
|
|
186
|
-
|
|
187
|
-
|
|
213
|
+
|
|
214
|
+
/// @dev see {IPoolComponent.applicationMatchesBundle}
|
|
215
|
+
/// Override this function to implement any custom application verification
|
|
216
|
+
/// Default implementation always returns true
|
|
217
|
+
function applicationMatchesBundle(
|
|
218
|
+
NftId applicationNftId,
|
|
219
|
+
bytes memory applicationData,
|
|
220
|
+
NftId bundleNftId,
|
|
221
|
+
bytes memory bundleFilter,
|
|
222
|
+
uint256 collateralizationAmount
|
|
188
223
|
)
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
224
|
+
public
|
|
225
|
+
view
|
|
226
|
+
virtual override
|
|
227
|
+
returns (bool isMatching)
|
|
192
228
|
{
|
|
193
|
-
|
|
229
|
+
return true;
|
|
194
230
|
}
|
|
195
231
|
|
|
196
|
-
function getSetupInfo() public view returns (ISetup.PoolSetupInfo memory setupInfo) {
|
|
197
|
-
InstanceReader reader = getInstance().getInstanceReader();
|
|
198
|
-
setupInfo = reader.getPoolSetupInfo(getNftId());
|
|
199
|
-
|
|
200
|
-
// fallback to initial setup info (wallet is always != address(0))
|
|
201
|
-
if(setupInfo.wallet == address(0)) {
|
|
202
|
-
setupInfo = _getInitialSetupInfo();
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
232
|
|
|
206
|
-
function
|
|
207
|
-
|
|
208
|
-
return ISetup.PoolSetupInfo(
|
|
209
|
-
getProductNftId(),
|
|
210
|
-
$._tokenHandler,
|
|
211
|
-
isNftInterceptor(),
|
|
212
|
-
$._isExternallyManaged,
|
|
213
|
-
$._isVerifyingApplications,
|
|
214
|
-
$._collateralizationLevel,
|
|
215
|
-
$._retentionLevel,
|
|
216
|
-
$._initialPoolFee,
|
|
217
|
-
$._initialStakingFee,
|
|
218
|
-
$._initialPerformanceFee,
|
|
219
|
-
getWallet()
|
|
220
|
-
);
|
|
233
|
+
function getPoolInfo() external view returns (IComponents.PoolInfo memory poolInfo) {
|
|
234
|
+
poolInfo = abi.decode(getComponentInfo().data, (IComponents.PoolInfo));
|
|
221
235
|
}
|
|
222
236
|
|
|
223
237
|
// Internals
|
|
@@ -226,13 +240,13 @@ abstract contract Pool is
|
|
|
226
240
|
address bundleOwner,
|
|
227
241
|
Fee memory fee,
|
|
228
242
|
uint256 amount,
|
|
229
|
-
|
|
243
|
+
Seconds lifetime,
|
|
230
244
|
bytes memory filter
|
|
231
245
|
)
|
|
232
246
|
internal
|
|
233
247
|
returns(NftId bundleNftId)
|
|
234
248
|
{
|
|
235
|
-
bundleNftId = _getPoolStorage()._bundleService.
|
|
249
|
+
bundleNftId = _getPoolStorage()._bundleService.create(
|
|
236
250
|
bundleOwner,
|
|
237
251
|
fee,
|
|
238
252
|
amount,
|
|
@@ -242,10 +256,41 @@ abstract contract Pool is
|
|
|
242
256
|
// TODO add logging
|
|
243
257
|
}
|
|
244
258
|
|
|
259
|
+
// TODO remove function once this is no longer used to produce contract locations on the fly ...
|
|
245
260
|
function getContractLocation(bytes memory name) external pure returns (bytes32 hash) {
|
|
246
261
|
return keccak256(abi.encode(uint256(keccak256(name)) - 1)) & ~bytes32(uint256(0xff));
|
|
247
262
|
}
|
|
248
263
|
|
|
264
|
+
/// @dev defines initial pool specification
|
|
265
|
+
/// overwrite this function according to your use case
|
|
266
|
+
function _getInitialInfo()
|
|
267
|
+
internal
|
|
268
|
+
view
|
|
269
|
+
virtual override
|
|
270
|
+
returns (IComponents.ComponentInfo memory info)
|
|
271
|
+
{
|
|
272
|
+
return IComponents.ComponentInfo(
|
|
273
|
+
getName(),
|
|
274
|
+
getToken(),
|
|
275
|
+
TokenHandler(address(0)), // will be created by GIF service during registration
|
|
276
|
+
address(this), // contract is its own wallet
|
|
277
|
+
abi.encode(
|
|
278
|
+
IComponents.PoolInfo(
|
|
279
|
+
NftIdLib.zero(), // will be set when GIF registers the related product
|
|
280
|
+
PUBLIC_ROLE(), // bundleOwnerRole
|
|
281
|
+
type(uint256).max, // maxCapitalAmount,
|
|
282
|
+
isNftInterceptor(), // isInterceptingBundleTransfers
|
|
283
|
+
false, // isExternallyManaged,
|
|
284
|
+
false, // isVerifyingApplications,
|
|
285
|
+
UFixedLib.toUFixed(1), // collateralizationLevel,
|
|
286
|
+
UFixedLib.toUFixed(1), // retentionLevel,
|
|
287
|
+
FeeLib.zeroFee(), // initialPoolFee,
|
|
288
|
+
FeeLib.zeroFee(), // initialStakingFee,
|
|
289
|
+
FeeLib.zeroFee() // initialPerformanceFee,
|
|
290
|
+
)));
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
|
|
249
294
|
function _getPoolStorage() private pure returns (PoolStorage storage $) {
|
|
250
295
|
assembly {
|
|
251
296
|
$.slot := POOL_STORAGE_LOCATION_V1
|
|
@@ -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,7 +22,9 @@ 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";
|
|
27
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
|
22
28
|
import {Pool} from "../components/Pool.sol";
|
|
23
29
|
import {Distribution} from "../components/Distribution.sol";
|
|
24
30
|
|
|
@@ -30,7 +36,10 @@ abstract contract Product is
|
|
|
30
36
|
bytes32 public constant PRODUCT_STORAGE_LOCATION_V1 = 0x0bb7aafdb8e380f81267337bc5b5dfdf76e6d3a380ecadb51ec665246d9d6800;
|
|
31
37
|
|
|
32
38
|
struct ProductStorage {
|
|
39
|
+
IProductService _productService;
|
|
40
|
+
IApplicationService _applicationService;
|
|
33
41
|
IPolicyService _policyService;
|
|
42
|
+
IClaimService _claimService;
|
|
34
43
|
Pool _pool;
|
|
35
44
|
Distribution _distribution;
|
|
36
45
|
Fee _initialProductFee;
|
|
@@ -51,17 +60,21 @@ abstract contract Product is
|
|
|
51
60
|
Fee memory productFee,
|
|
52
61
|
Fee memory processingFee,
|
|
53
62
|
address initialOwner,
|
|
54
|
-
bytes memory data
|
|
63
|
+
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
|
55
64
|
)
|
|
56
65
|
public
|
|
57
66
|
virtual
|
|
58
67
|
onlyInitializing()
|
|
59
68
|
{
|
|
60
|
-
initializeComponent(registry, instanceNftId, name, token, PRODUCT(), isInterceptor, initialOwner,
|
|
69
|
+
initializeComponent(registry, instanceNftId, name, token, PRODUCT(), isInterceptor, initialOwner, registryData);
|
|
61
70
|
|
|
62
71
|
ProductStorage storage $ = _getProductStorage();
|
|
63
72
|
// TODO add validation
|
|
64
|
-
|
|
73
|
+
// TODO refactor to go via registry
|
|
74
|
+
$._productService = IProductService(_getServiceAddress(PRODUCT()));
|
|
75
|
+
$._applicationService = IApplicationService(_getServiceAddress(APPLICATION()));
|
|
76
|
+
$._policyService = IPolicyService(_getServiceAddress(POLICY()));
|
|
77
|
+
$._claimService = IClaimService(_getServiceAddress(CLAIM()));
|
|
65
78
|
$._pool = Pool(pool);
|
|
66
79
|
$._distribution = Distribution(distribution);
|
|
67
80
|
$._initialProductFee = productFee;
|
|
@@ -77,7 +90,7 @@ abstract contract Product is
|
|
|
77
90
|
function calculatePremium(
|
|
78
91
|
uint256 sumInsuredAmount,
|
|
79
92
|
RiskId riskId,
|
|
80
|
-
|
|
93
|
+
Seconds lifetime,
|
|
81
94
|
bytes memory applicationData,
|
|
82
95
|
NftId bundleNftId,
|
|
83
96
|
ReferralId referralId
|
|
@@ -87,7 +100,8 @@ abstract contract Product is
|
|
|
87
100
|
override
|
|
88
101
|
returns (uint256 premiumAmount)
|
|
89
102
|
{
|
|
90
|
-
|
|
103
|
+
IPolicy.Premium memory premium = _getProductStorage()._applicationService.calculatePremium(
|
|
104
|
+
getNftId(),
|
|
91
105
|
riskId,
|
|
92
106
|
sumInsuredAmount,
|
|
93
107
|
lifetime,
|
|
@@ -95,13 +109,14 @@ abstract contract Product is
|
|
|
95
109
|
bundleNftId,
|
|
96
110
|
referralId
|
|
97
111
|
);
|
|
112
|
+
premiumAmount = premium.premiumAmount;
|
|
98
113
|
}
|
|
99
114
|
|
|
100
115
|
|
|
101
116
|
function calculateNetPremium(
|
|
102
117
|
uint256 sumInsuredAmount,
|
|
103
118
|
RiskId riskId,
|
|
104
|
-
|
|
119
|
+
Seconds lifetime,
|
|
105
120
|
bytes memory applicationData
|
|
106
121
|
)
|
|
107
122
|
external
|
|
@@ -121,7 +136,7 @@ abstract contract Product is
|
|
|
121
136
|
RiskId id,
|
|
122
137
|
bytes memory data
|
|
123
138
|
) internal {
|
|
124
|
-
|
|
139
|
+
_getProductService().createRisk(
|
|
125
140
|
id,
|
|
126
141
|
data
|
|
127
142
|
);
|
|
@@ -131,7 +146,7 @@ abstract contract Product is
|
|
|
131
146
|
RiskId id,
|
|
132
147
|
bytes memory data
|
|
133
148
|
) internal {
|
|
134
|
-
|
|
149
|
+
_getProductService().updateRisk(
|
|
135
150
|
id,
|
|
136
151
|
data
|
|
137
152
|
);
|
|
@@ -141,7 +156,7 @@ abstract contract Product is
|
|
|
141
156
|
RiskId id,
|
|
142
157
|
StateId state
|
|
143
158
|
) internal {
|
|
144
|
-
|
|
159
|
+
_getProductService().updateRiskState(
|
|
145
160
|
id,
|
|
146
161
|
state
|
|
147
162
|
);
|
|
@@ -155,22 +170,22 @@ abstract contract Product is
|
|
|
155
170
|
address applicationOwner,
|
|
156
171
|
RiskId riskId,
|
|
157
172
|
uint256 sumInsuredAmount,
|
|
158
|
-
|
|
159
|
-
bytes memory applicationData,
|
|
173
|
+
Seconds lifetime,
|
|
160
174
|
NftId bundleNftId,
|
|
161
|
-
ReferralId referralId
|
|
175
|
+
ReferralId referralId,
|
|
176
|
+
bytes memory applicationData
|
|
162
177
|
)
|
|
163
178
|
internal
|
|
164
|
-
returns (NftId
|
|
179
|
+
returns (NftId applicationNftId)
|
|
165
180
|
{
|
|
166
|
-
return _getProductStorage().
|
|
181
|
+
return _getProductStorage()._applicationService.create(
|
|
167
182
|
applicationOwner,
|
|
168
183
|
riskId,
|
|
169
184
|
sumInsuredAmount,
|
|
170
185
|
lifetime,
|
|
171
|
-
applicationData,
|
|
172
186
|
bundleNftId,
|
|
173
|
-
referralId
|
|
187
|
+
referralId,
|
|
188
|
+
applicationData
|
|
174
189
|
);
|
|
175
190
|
}
|
|
176
191
|
|
|
@@ -235,7 +250,7 @@ abstract contract Product is
|
|
|
235
250
|
restricted()
|
|
236
251
|
override
|
|
237
252
|
{
|
|
238
|
-
|
|
253
|
+
_getProductService().setFees(productFee, processingFee);
|
|
239
254
|
}
|
|
240
255
|
|
|
241
256
|
function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
|
@@ -252,19 +267,15 @@ abstract contract Product is
|
|
|
252
267
|
ProductStorage storage $ = _getProductStorage();
|
|
253
268
|
|
|
254
269
|
ISetup.DistributionSetupInfo memory distributionSetupInfo = $._distribution.getSetupInfo();
|
|
255
|
-
|
|
270
|
+
IComponents.PoolInfo memory poolInfo = $._pool.getPoolInfo();
|
|
256
271
|
|
|
257
272
|
return ISetup.ProductSetupInfo(
|
|
258
273
|
getToken(),
|
|
259
274
|
$._tokenHandler,
|
|
260
275
|
$._distributionNftId,
|
|
261
276
|
$._poolNftId,
|
|
262
|
-
distributionSetupInfo.distributionFee,
|
|
263
277
|
$._initialProductFee,
|
|
264
278
|
$._initialProcessingFee,
|
|
265
|
-
poolSetupInfo.poolFee,
|
|
266
|
-
poolSetupInfo.stakingFee,
|
|
267
|
-
poolSetupInfo.performanceFee,
|
|
268
279
|
false,
|
|
269
280
|
getWallet()
|
|
270
281
|
);
|
|
@@ -275,4 +286,8 @@ abstract contract Product is
|
|
|
275
286
|
$.slot := PRODUCT_STORAGE_LOCATION_V1
|
|
276
287
|
}
|
|
277
288
|
}
|
|
289
|
+
|
|
290
|
+
function _getProductService() internal view returns (IProductService) {
|
|
291
|
+
return _getProductStorage()._productService;
|
|
292
|
+
}
|
|
278
293
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
pragma solidity ^0.8.20;
|
|
3
|
+
|
|
4
|
+
import {AccessManagerUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagerUpgradeable.sol";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
contract AccessManagerUpgradeableInitializeable is AccessManagerUpgradeable {
|
|
8
|
+
|
|
9
|
+
function initialize(address initialAdmin) initializer public {
|
|
10
|
+
__AccessManager_init(initialAdmin);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
}
|
|
@@ -22,9 +22,10 @@ contract BundleManager is
|
|
|
22
22
|
event LogBundleManagerBundleAdded(NftId poolNftId, NftId bundleNftId);
|
|
23
23
|
event LogBundleManagerBundleUnlocked(NftId poolNftId, NftId bundleNftId);
|
|
24
24
|
event LogBundleManagerBundleLocked(NftId poolNftId, NftId bundleNftId);
|
|
25
|
+
event LogBundleManagerBundleClosed(NftId poolNftId, NftId bundleNftId);
|
|
25
26
|
|
|
26
|
-
error
|
|
27
|
-
error
|
|
27
|
+
error ErrorBundleManagerPolicyAlreadyActivated(NftId policyNftId);
|
|
28
|
+
error ErrorBundleManagerBundleLocked(NftId bundleNftId, NftId policyNftId);
|
|
28
29
|
error ErrorBundleManagerPolicyWithOpenClaims(NftId policyNftId, uint256 openClaimsCount);
|
|
29
30
|
error ErrorBundleManagerPolicyNotCloseable(NftId policyNftId);
|
|
30
31
|
error ErrorBundleManagerBundleUnknown(NftId bundleNftId);
|
|
@@ -32,7 +33,7 @@ contract BundleManager is
|
|
|
32
33
|
|
|
33
34
|
mapping(NftId bundleNftId => LibNftIdSet.Set policies) internal _activePolicies;
|
|
34
35
|
|
|
35
|
-
/// @dev links a policy
|
|
36
|
+
/// @dev links a policy to its bundle
|
|
36
37
|
// to link a policy it MUST NOT yet have been activated
|
|
37
38
|
// the bundle MUST be unlocked (active) for linking (underwriting) and registered with this instance
|
|
38
39
|
function linkPolicy(NftId policyNftId) external restricted() {
|
|
@@ -42,7 +43,7 @@ contract BundleManager is
|
|
|
42
43
|
|
|
43
44
|
// ensure bundle is unlocked (in active set) and registered with this instance
|
|
44
45
|
if (!_isActive(poolNftId, bundleNftId)) {
|
|
45
|
-
revert
|
|
46
|
+
revert ErrorBundleManagerBundleLocked(bundleNftId, policyNftId);
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
LibNftIdSet.add(_activePolicies[bundleNftId], policyNftId);
|
|
@@ -71,7 +72,7 @@ contract BundleManager is
|
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
|
|
74
|
-
/// @dev add a new bundle to a
|
|
75
|
+
/// @dev add a new bundle to a pool registerd with this instance
|
|
75
76
|
// the corresponding pool is fetched via instance reader
|
|
76
77
|
function add(NftId bundleNftId) external restricted() {
|
|
77
78
|
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
|
@@ -85,6 +86,7 @@ contract BundleManager is
|
|
|
85
86
|
emit LogBundleManagerBundleAdded(poolNftId, bundleNftId);
|
|
86
87
|
}
|
|
87
88
|
|
|
89
|
+
|
|
88
90
|
/// @dev unlocked (active) bundles are available to underwrite new policies
|
|
89
91
|
function unlock(NftId bundleNftId) external restricted() {
|
|
90
92
|
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
|
@@ -10,7 +10,8 @@ abstract contract Cloneable is
|
|
|
10
10
|
AccessManagedUpgradeable
|
|
11
11
|
{
|
|
12
12
|
event CloneableInitialized(address authority, address registry);
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
error CloneableAuthorityZero();
|
|
14
15
|
error CloneableRegistryInvalid(address registry);
|
|
15
16
|
|
|
16
17
|
IRegistry internal _registry;
|
|
@@ -25,9 +26,13 @@ abstract contract Cloneable is
|
|
|
25
26
|
address registry
|
|
26
27
|
)
|
|
27
28
|
public
|
|
28
|
-
|
|
29
|
+
onlyInitializing
|
|
29
30
|
{
|
|
30
31
|
// check/handle access managed
|
|
32
|
+
if(authority == address(0)) {
|
|
33
|
+
revert CloneableAuthorityZero();
|
|
34
|
+
}
|
|
35
|
+
|
|
31
36
|
__AccessManaged_init(authority);
|
|
32
37
|
|
|
33
38
|
// check/handle registry
|