@etherisc/gif-next 0.0.2-bfb44e0-483 → 0.0.2-c0b400a-177
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +8 -8
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +80 -145
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +125 -239
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +77 -92
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +102 -183
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +261 -201
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +81 -164
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +278 -288
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +85 -218
- 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 +496 -536
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +105 -212
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +567 -621
- 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 +170 -397
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +207 -116
- 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 +18 -220
- 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 +182 -331
- 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 +141 -366
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +182 -107
- 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 +824 -268
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +312 -109
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +124 -206
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +89 -257
- 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 +514 -157
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +45 -289
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +69 -153
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +12 -177
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +85 -442
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +188 -141
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +116 -249
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +187 -104
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +42 -272
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +179 -104
- 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 +71 -180
- 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 +90 -264
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +182 -113
- 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 +34 -67
- 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 +4 -30
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +4 -30
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.json +0 -21
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +12 -177
- 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 +10 -62
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -23
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +171 -88
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +11 -74
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -23
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +13 -215
- 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 +11 -74
- 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 +31 -269
- 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 +96 -81
- package/contracts/components/Distribution.sol +29 -47
- package/contracts/components/IComponent.sol +40 -16
- package/contracts/components/IDistributionComponent.sol +1 -30
- 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 +23 -11
- package/contracts/instance/IInstanceService.sol +18 -5
- package/contracts/instance/Instance.sol +62 -16
- package/contracts/instance/InstanceAccessManager.sol +382 -157
- package/contracts/instance/InstanceReader.sol +7 -10
- package/contracts/instance/InstanceService.sol +222 -160
- 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 +224 -31
- 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 +36 -3
- 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 +4 -9
- package/contracts/shared/IRegistryLinked.sol +0 -3
- package/contracts/shared/IService.sol +2 -0
- package/contracts/shared/IVersionable.sol +4 -47
- package/contracts/shared/NftOwnable.sol +10 -80
- package/contracts/shared/ProxyManager.sol +98 -24
- package/contracts/shared/Registerable.sol +3 -10
- package/contracts/shared/RegistryLinked.sol +10 -26
- 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/Fee.sol +1 -0
- package/contracts/types/NftId.sol +8 -0
- package/contracts/types/ObjectType.sol +5 -4
- 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/IB.sol/IB.json +0 -50
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.json +0 -63
- package/artifacts/contracts/experiment/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
@@ -2,43 +2,34 @@
|
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
4
|
import {IRegistry} from "../../registry/IRegistry.sol";
|
5
|
-
import {IProductComponent} from "../../components/IProductComponent.sol";
|
6
5
|
import {Product} from "../../components/Product.sol";
|
7
|
-
import {
|
6
|
+
import {IComponents} from "../module/IComponents.sol";
|
8
7
|
import {IDistributionComponent} from "../../components/IDistributionComponent.sol";
|
9
8
|
import {IInstance} from "../IInstance.sol";
|
10
9
|
import {IPolicy} from "../module/IPolicy.sol";
|
10
|
+
import {IPoolComponent} from "../../components/IPoolComponent.sol";
|
11
11
|
import {IRisk} from "../module/IRisk.sol";
|
12
12
|
import {IBundle} from "../module/IBundle.sol";
|
13
|
-
import {IProductService} from "./IProductService.sol";
|
14
|
-
import {ITreasury} from "../module/ITreasury.sol";
|
15
13
|
import {ISetup} from "../module/ISetup.sol";
|
16
14
|
|
17
15
|
import {TokenHandler} from "../../shared/TokenHandler.sol";
|
18
16
|
|
19
|
-
import {IVersionable} from "../../shared/IVersionable.sol";
|
20
|
-
import {Versionable} from "../../shared/Versionable.sol";
|
21
|
-
|
22
17
|
import {Timestamp, TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
|
23
18
|
import {UFixed, UFixedLib} from "../../types/UFixed.sol";
|
24
|
-
import {
|
25
|
-
import {ObjectType, INSTANCE, PRODUCT, POOL, POLICY, BUNDLE} from "../../types/ObjectType.sol";
|
19
|
+
import {ObjectType, APPLICATION, DISTRIBUTION, PRODUCT, POOL, POLICY, BUNDLE} from "../../types/ObjectType.sol";
|
26
20
|
import {APPLIED, UNDERWRITTEN, ACTIVE, KEEP_STATE, CLOSED} from "../../types/StateId.sol";
|
27
|
-
import {NftId, NftIdLib
|
28
|
-
import {Fee, FeeLib} from "../../types/Fee.sol";
|
29
|
-
import {ReferralId} from "../../types/Referral.sol";
|
30
|
-
import {RiskId} from "../../types/RiskId.sol";
|
21
|
+
import {NftId, NftIdLib} from "../../types/NftId.sol";
|
31
22
|
import {StateId} from "../../types/StateId.sol";
|
32
|
-
import {Version, VersionLib} from "../../types/Version.sol";
|
33
|
-
//import {RoleId, PRODUCT_OWNER_ROLE} from "../../types/RoleId.sol";
|
34
23
|
|
35
|
-
import {IService} from "../../shared/IService.sol";
|
36
|
-
import {Service} from "../../shared/Service.sol";
|
37
24
|
import {ComponentService} from "../base/ComponentService.sol";
|
38
|
-
import {
|
25
|
+
import {IApplicationService} from "./IApplicationService.sol";
|
26
|
+
import {IBundleService} from "./IBundleService.sol";
|
27
|
+
import {IDistributionService} from "./IDistributionService.sol";
|
39
28
|
import {InstanceReader} from "../InstanceReader.sol";
|
29
|
+
import {IPolicyService} from "./IPolicyService.sol";
|
40
30
|
import {IPoolService} from "./IPoolService.sol";
|
41
|
-
import {
|
31
|
+
import {IService} from "../../shared/IService.sol";
|
32
|
+
import {Service} from "../../shared/Service.sol";
|
42
33
|
|
43
34
|
|
44
35
|
contract PolicyService is
|
@@ -50,6 +41,8 @@ contract PolicyService is
|
|
50
41
|
|
51
42
|
IPoolService internal _poolService;
|
52
43
|
IBundleService internal _bundleService;
|
44
|
+
IApplicationService internal _applicationService;
|
45
|
+
IDistributionService internal _distributionService;
|
53
46
|
|
54
47
|
event LogProductServiceSender(address sender);
|
55
48
|
|
@@ -58,8 +51,8 @@ contract PolicyService is
|
|
58
51
|
bytes memory data
|
59
52
|
)
|
60
53
|
internal
|
61
|
-
initializer
|
62
54
|
virtual override
|
55
|
+
initializer
|
63
56
|
{
|
64
57
|
address registryAddress;
|
65
58
|
address initialOwner;
|
@@ -69,6 +62,8 @@ contract PolicyService is
|
|
69
62
|
|
70
63
|
_poolService = IPoolService(getRegistry().getServiceAddress(POOL(), getMajorVersion()));
|
71
64
|
_bundleService = IBundleService(getRegistry().getServiceAddress(BUNDLE(), getMajorVersion()));
|
65
|
+
_applicationService = IApplicationService(getRegistry().getServiceAddress(APPLICATION(), getMajorVersion()));
|
66
|
+
_distributionService = IDistributionService(getRegistry().getServiceAddress(DISTRIBUTION(), getMajorVersion()));
|
72
67
|
|
73
68
|
registerInterface(type(IPolicyService).interfaceId);
|
74
69
|
}
|
@@ -85,156 +80,6 @@ contract PolicyService is
|
|
85
80
|
product = Product(productInfo.objectAddress);
|
86
81
|
}
|
87
82
|
|
88
|
-
// TODO: no access restrictions
|
89
|
-
function calculatePremium(
|
90
|
-
RiskId riskId,
|
91
|
-
uint256 sumInsuredAmount,
|
92
|
-
uint256 lifetime,
|
93
|
-
bytes memory applicationData,
|
94
|
-
NftId bundleNftId,
|
95
|
-
ReferralId referralId
|
96
|
-
)
|
97
|
-
public
|
98
|
-
view
|
99
|
-
virtual override
|
100
|
-
returns (
|
101
|
-
uint256 premiumAmount,
|
102
|
-
uint256 productFeeAmount,
|
103
|
-
uint256 poolFeeAmount,
|
104
|
-
uint256 bundleFeeAmount,
|
105
|
-
uint256 distributionFeeAmount
|
106
|
-
)
|
107
|
-
{
|
108
|
-
Product product = _getAndVerifyInstanceAndProduct();
|
109
|
-
uint256 netPremiumAmount = product.calculateNetPremium(
|
110
|
-
sumInsuredAmount,
|
111
|
-
riskId,
|
112
|
-
lifetime,
|
113
|
-
applicationData
|
114
|
-
);
|
115
|
-
|
116
|
-
(
|
117
|
-
productFeeAmount,
|
118
|
-
poolFeeAmount,
|
119
|
-
bundleFeeAmount,
|
120
|
-
distributionFeeAmount
|
121
|
-
) = _calculateFeeAmounts(
|
122
|
-
netPremiumAmount,
|
123
|
-
product,
|
124
|
-
bundleNftId,
|
125
|
-
referralId
|
126
|
-
);
|
127
|
-
|
128
|
-
premiumAmount = netPremiumAmount + productFeeAmount;
|
129
|
-
premiumAmount += poolFeeAmount + bundleFeeAmount;
|
130
|
-
premiumAmount += distributionFeeAmount;
|
131
|
-
}
|
132
|
-
|
133
|
-
function _calculateFeeAmounts(
|
134
|
-
uint256 netPremiumAmount,
|
135
|
-
Product product,
|
136
|
-
NftId bundleNftId,
|
137
|
-
ReferralId referralId
|
138
|
-
)
|
139
|
-
internal
|
140
|
-
view
|
141
|
-
returns (
|
142
|
-
uint256 productFeeAmount,
|
143
|
-
uint256 poolFeeAmount,
|
144
|
-
uint256 bundleFeeAmount,
|
145
|
-
uint256 distributionFeeAmount
|
146
|
-
)
|
147
|
-
{
|
148
|
-
InstanceReader instanceReader;
|
149
|
-
{
|
150
|
-
IInstance instance = product.getInstance();
|
151
|
-
instanceReader = instance.getInstanceReader();
|
152
|
-
}
|
153
|
-
|
154
|
-
NftId poolNftId = product.getPoolNftId();
|
155
|
-
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
156
|
-
require(bundleInfo.poolNftId == poolNftId,"ERROR:PRS-035:BUNDLE_POOL_MISMATCH");
|
157
|
-
|
158
|
-
{
|
159
|
-
ISetup.ProductSetupInfo memory productSetupInfo = instanceReader.getProductSetupInfo(product.getProductNftId());
|
160
|
-
(productFeeAmount,) = FeeLib.calculateFee(productSetupInfo.productFee, netPremiumAmount);
|
161
|
-
}
|
162
|
-
{
|
163
|
-
ISetup.PoolSetupInfo memory poolSetupInfo = instanceReader.getPoolSetupInfo(poolNftId);
|
164
|
-
(poolFeeAmount,) = FeeLib.calculateFee(poolSetupInfo.poolFee, netPremiumAmount);
|
165
|
-
}
|
166
|
-
{
|
167
|
-
NftId distributionNftId = product.getDistributionNftId();
|
168
|
-
ISetup.DistributionSetupInfo memory distributionSetupInfo = instanceReader.getDistributionSetupInfo(distributionNftId);
|
169
|
-
(distributionFeeAmount,) = FeeLib.calculateFee(distributionSetupInfo.distributionFee, netPremiumAmount);
|
170
|
-
}
|
171
|
-
|
172
|
-
(bundleFeeAmount,) = FeeLib.calculateFee(bundleInfo.fee, netPremiumAmount);
|
173
|
-
}
|
174
|
-
|
175
|
-
|
176
|
-
function createApplication(
|
177
|
-
address applicationOwner,
|
178
|
-
RiskId riskId,
|
179
|
-
uint256 sumInsuredAmount,
|
180
|
-
uint256 lifetime,
|
181
|
-
bytes memory applicationData,
|
182
|
-
NftId bundleNftId,
|
183
|
-
ReferralId referralId
|
184
|
-
)
|
185
|
-
external
|
186
|
-
virtual override
|
187
|
-
returns (NftId policyNftId)
|
188
|
-
{
|
189
|
-
(IRegistry.ObjectInfo memory productInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
190
|
-
// TODO: add validations (see create bundle in pool service)
|
191
|
-
|
192
|
-
policyNftId = getRegistryService().registerPolicy(
|
193
|
-
IRegistry.ObjectInfo(
|
194
|
-
zeroNftId(),
|
195
|
-
productInfo.nftId,
|
196
|
-
POLICY(),
|
197
|
-
false, // intercepting property for policies is defined on product
|
198
|
-
address(0),
|
199
|
-
applicationOwner,
|
200
|
-
""
|
201
|
-
)
|
202
|
-
);
|
203
|
-
|
204
|
-
(uint256 premiumAmount,,,,) = calculatePremium(
|
205
|
-
riskId,
|
206
|
-
sumInsuredAmount,
|
207
|
-
lifetime,
|
208
|
-
applicationData,
|
209
|
-
bundleNftId,
|
210
|
-
referralId
|
211
|
-
);
|
212
|
-
|
213
|
-
IPolicy.PolicyInfo memory policyInfo = IPolicy.PolicyInfo(
|
214
|
-
productInfo.nftId,
|
215
|
-
bundleNftId,
|
216
|
-
referralId,
|
217
|
-
riskId,
|
218
|
-
sumInsuredAmount,
|
219
|
-
premiumAmount,
|
220
|
-
0,
|
221
|
-
lifetime,
|
222
|
-
applicationData,
|
223
|
-
"",
|
224
|
-
0,
|
225
|
-
0,
|
226
|
-
0,
|
227
|
-
zeroTimestamp(),
|
228
|
-
zeroTimestamp(),
|
229
|
-
zeroTimestamp()
|
230
|
-
);
|
231
|
-
|
232
|
-
instance.createPolicy(policyNftId, policyInfo);
|
233
|
-
instance.updatePolicyState(policyNftId, APPLIED());
|
234
|
-
|
235
|
-
// TODO: add logging
|
236
|
-
}
|
237
|
-
|
238
83
|
function _getAndVerifyUnderwritingSetup(
|
239
84
|
IInstance instance,
|
240
85
|
InstanceReader instanceReader,
|
@@ -257,7 +102,9 @@ contract PolicyService is
|
|
257
102
|
require(bundleInfo.poolNftId == poolNftId, "POLICY_BUNDLE_MISMATCH");
|
258
103
|
|
259
104
|
// calculate required collateral
|
260
|
-
|
105
|
+
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
106
|
+
IComponents.PoolInfo memory poolInfo = abi.decode(
|
107
|
+
componentInfo.data, (IComponents.PoolInfo));
|
261
108
|
|
262
109
|
// obtain remaining return values
|
263
110
|
// TODO required collateral amount should be calculated by pool service, not policy service
|
@@ -330,7 +177,6 @@ contract PolicyService is
|
|
330
177
|
if(requirePremiumPayment) {
|
331
178
|
netPremiumAmount = _processPremiumByTreasury(
|
332
179
|
instance,
|
333
|
-
productNftId,
|
334
180
|
applicationNftId,
|
335
181
|
policyInfo.premiumAmount);
|
336
182
|
|
@@ -358,13 +204,19 @@ contract PolicyService is
|
|
358
204
|
instance.updatePolicy(applicationNftId, policyInfo, newPolicyState);
|
359
205
|
|
360
206
|
// also verify/confirm application by pool if necessary
|
361
|
-
if(
|
207
|
+
if(abi.decode(
|
208
|
+
instanceReader.getComponentInfo(poolNftId).data,
|
209
|
+
(IComponents.PoolInfo)
|
210
|
+
).isVerifyingApplications
|
211
|
+
)
|
212
|
+
{
|
362
213
|
IPoolComponent pool = IPoolComponent(
|
363
214
|
getRegistry().getObjectInfo(poolNftId).objectAddress);
|
364
215
|
|
365
216
|
pool.verifyApplication(
|
366
217
|
applicationNftId,
|
367
218
|
policyInfo.applicationData,
|
219
|
+
bundleNftId,
|
368
220
|
bundleInfo.filter,
|
369
221
|
collateralAmount);
|
370
222
|
}
|
@@ -393,7 +245,6 @@ contract PolicyService is
|
|
393
245
|
|
394
246
|
uint256 netPremiumAmount = _processPremiumByTreasury(
|
395
247
|
instance,
|
396
|
-
productInfo.nftId,
|
397
248
|
policyNftId,
|
398
249
|
unpaidPremiumAmount);
|
399
250
|
|
@@ -428,9 +279,22 @@ contract PolicyService is
|
|
428
279
|
// TODO: add logging
|
429
280
|
}
|
430
281
|
|
282
|
+
|
283
|
+
function expire(
|
284
|
+
NftId policyNftId
|
285
|
+
)
|
286
|
+
external
|
287
|
+
override
|
288
|
+
// solhint-disable-next-line no-empty-blocks
|
289
|
+
{
|
290
|
+
|
291
|
+
}
|
292
|
+
|
431
293
|
function close(
|
432
294
|
NftId policyNftId
|
433
|
-
)
|
295
|
+
)
|
296
|
+
external
|
297
|
+
override
|
434
298
|
{
|
435
299
|
(, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
436
300
|
InstanceReader instanceReader = instance.getInstanceReader();
|
@@ -484,7 +348,6 @@ contract PolicyService is
|
|
484
348
|
|
485
349
|
function _processPremiumByTreasury(
|
486
350
|
IInstance instance,
|
487
|
-
NftId productNftId,
|
488
351
|
NftId policyNftId,
|
489
352
|
uint256 premiumAmount
|
490
353
|
)
|
@@ -493,30 +356,46 @@ contract PolicyService is
|
|
493
356
|
{
|
494
357
|
// process token transfer(s)
|
495
358
|
if(premiumAmount > 0) {
|
359
|
+
NftId productNftId = getRegistry().getObjectInfo(policyNftId).parentNftId;
|
496
360
|
ISetup.ProductSetupInfo memory productSetupInfo = instance.getInstanceReader().getProductSetupInfo(productNftId);
|
361
|
+
IPolicy.PolicyInfo memory policyInfo = instance.getInstanceReader().getPolicyInfo(policyNftId);
|
497
362
|
TokenHandler tokenHandler = productSetupInfo.tokenHandler;
|
498
363
|
address policyOwner = getRegistry().ownerOf(policyNftId);
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
premiumAmount
|
364
|
+
address poolWallet = instance.getInstanceReader().getComponentInfo(productSetupInfo.poolNftId).wallet;
|
365
|
+
IPolicy.Premium memory premium = _applicationService.calculatePremium(
|
366
|
+
productNftId,
|
367
|
+
policyInfo.riskId,
|
368
|
+
policyInfo.sumInsuredAmount,
|
369
|
+
policyInfo.lifetime,
|
370
|
+
policyInfo.applicationData,
|
371
|
+
policyInfo.bundleNftId,
|
372
|
+
policyInfo.referralId
|
509
373
|
);
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
374
|
+
|
375
|
+
if (premium.premiumAmount != premiumAmount) {
|
376
|
+
revert ErrorIPolicyServicePremiumMismatch(policyNftId, premiumAmount, premium.premiumAmount);
|
377
|
+
}
|
378
|
+
|
379
|
+
// move product fee to product wallet
|
380
|
+
address productWallet = productSetupInfo.wallet;
|
381
|
+
if (tokenHandler.getToken().allowance(policyOwner, address(tokenHandler)) < premium.premiumAmount) {
|
382
|
+
revert ErrorIPolicyServiceInsufficientAllowance(policyOwner, address(tokenHandler), premium.premiumAmount);
|
519
383
|
}
|
384
|
+
tokenHandler.transfer(policyOwner, productWallet, premium.productFeeFixAmount + premium.productFeeVarAmount);
|
385
|
+
|
386
|
+
// move distribution fee to distribution wallet
|
387
|
+
ISetup.DistributionSetupInfo memory distributionSetupInfo = instance.getInstanceReader().getDistributionSetupInfo(productSetupInfo.distributionNftId);
|
388
|
+
address distributionWallet = distributionSetupInfo.wallet;
|
389
|
+
uint256 distributionFeeAmountToTransfer = premium.distributionFeeFixAmount + premium.distributionFeeVarAmount - premium.discountAmount;
|
390
|
+
tokenHandler.transfer(policyOwner, distributionWallet, distributionFeeAmountToTransfer);
|
391
|
+
_distributionService.processSale(productSetupInfo.distributionNftId, policyInfo.referralId, premium, distributionFeeAmountToTransfer);
|
392
|
+
|
393
|
+
// move netpremium to pool wallet
|
394
|
+
tokenHandler.transfer(policyOwner, poolWallet, premium.netPremiumAmount);
|
395
|
+
|
396
|
+
// TODO: move pool related tokens too
|
397
|
+
// TODO: move bundle related tokens too
|
398
|
+
netPremiumAmount = premium.netPremiumAmount;
|
520
399
|
}
|
521
400
|
|
522
401
|
// TODO: add logging
|
@@ -16,7 +16,7 @@ contract PolicyServiceManager is ProxyManager {
|
|
16
16
|
constructor(
|
17
17
|
address registryAddress
|
18
18
|
)
|
19
|
-
ProxyManager()
|
19
|
+
ProxyManager(registryAddress)
|
20
20
|
{
|
21
21
|
PolicyService svc = new PolicyService();
|
22
22
|
bytes memory data = abi.encode(registryAddress, address(this));
|
@@ -39,7 +39,7 @@ contract PolicyServiceManager is ProxyManager {
|
|
39
39
|
// address(_productService));
|
40
40
|
|
41
41
|
// implies that after this constructor call only upgrade functionality is available
|
42
|
-
_isDeployed = true;
|
42
|
+
// _isDeployed = true;
|
43
43
|
}
|
44
44
|
|
45
45
|
//--- view functions ----------------------------------------------------//
|
@@ -6,20 +6,22 @@ import {IRegistry} from "../../registry/IRegistry.sol";
|
|
6
6
|
import {IInstance} from "../../instance/IInstance.sol";
|
7
7
|
import {IBundle} from "../../instance/module/IBundle.sol";
|
8
8
|
import {TokenHandler} from "../../instance/module/ITreasury.sol";
|
9
|
-
import {
|
9
|
+
import {IComponents} from "../module/IComponents.sol";
|
10
10
|
import {IPolicy} from "../module/IPolicy.sol";
|
11
11
|
|
12
12
|
import {IVersionable} from "../../shared/IVersionable.sol";
|
13
13
|
import {Versionable} from "../../shared/Versionable.sol";
|
14
14
|
import {INftOwnable} from "../../shared/INftOwnable.sol";
|
15
15
|
|
16
|
+
import {Fee, FeeLib} from "../../types/Fee.sol";
|
16
17
|
import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
|
17
18
|
import {ObjectType, POOL, BUNDLE} from "../../types/ObjectType.sol";
|
18
|
-
import {POOL_OWNER_ROLE, RoleId} from "../../types/RoleId.sol";
|
19
|
+
import {PUBLIC_ROLE, POOL_OWNER_ROLE, POLICY_SERVICE_ROLE, RoleId} from "../../types/RoleId.sol";
|
19
20
|
import {Fee, FeeLib} from "../../types/Fee.sol";
|
20
21
|
import {Version, VersionLib} from "../../types/Version.sol";
|
21
22
|
import {KEEP_STATE, StateId} from "../../types/StateId.sol";
|
22
23
|
import {TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
|
24
|
+
import {Version, VersionLib} from "../../types/Version.sol";
|
23
25
|
|
24
26
|
import {IService} from "../../shared/IService.sol";
|
25
27
|
import {Service} from "../../shared/Service.sol";
|
@@ -63,7 +65,7 @@ contract PoolService is
|
|
63
65
|
return POOL();
|
64
66
|
}
|
65
67
|
|
66
|
-
function register(address poolAddress)
|
68
|
+
/*function register(address poolAddress)
|
67
69
|
external
|
68
70
|
returns(NftId poolNftId)
|
69
71
|
{
|
@@ -78,32 +80,141 @@ contract PoolService is
|
|
78
80
|
POOL_OWNER_ROLE());
|
79
81
|
|
80
82
|
IPoolComponent pool = IPoolComponent(poolAddress);
|
81
|
-
IRegistry.ObjectInfo memory
|
83
|
+
IRegistry.ObjectInfo memory registryInfo = getRegistryService().registerPool(pool, owner);
|
82
84
|
pool.linkToRegisteredNftId();
|
83
|
-
poolNftId =
|
85
|
+
poolNftId = registryInfo.nftId;
|
84
86
|
|
85
87
|
instance.createPoolSetup(poolNftId, pool.getSetupInfo());
|
86
|
-
|
87
|
-
|
88
|
+
|
89
|
+
bytes4[][] memory selectors = new bytes4[][](2);
|
90
|
+
selectors[0] = new bytes4[](1);
|
91
|
+
selectors[1] = new bytes4[](1);
|
92
|
+
|
93
|
+
selectors[0][0] = IPoolComponent.setFees.selector;
|
94
|
+
selectors[1][0] = IPoolComponent.verifyApplication.selector;
|
95
|
+
|
96
|
+
RoleId[] memory roles = new RoleId[](2);
|
97
|
+
roles[0] = POOL_OWNER_ROLE();
|
98
|
+
roles[1] = POLICY_SERVICE_ROLE();
|
99
|
+
|
100
|
+
getInstanceService().createGifTarget(
|
101
|
+
instanceNftId,
|
102
|
+
poolAddress,
|
103
|
+
pool.getName(),
|
104
|
+
selectors,
|
105
|
+
roles);
|
106
|
+
}*/
|
107
|
+
|
108
|
+
function register(address poolAddress)
|
109
|
+
external
|
110
|
+
returns(NftId poolNftId)
|
111
|
+
{
|
112
|
+
(
|
113
|
+
IComponent component,
|
114
|
+
address owner,
|
115
|
+
IInstance instance,
|
116
|
+
NftId instanceNftId
|
117
|
+
) = _checkComponentForRegistration(
|
118
|
+
poolAddress,
|
119
|
+
POOL(),
|
120
|
+
POOL_OWNER_ROLE());
|
121
|
+
|
122
|
+
IPoolComponent pool = IPoolComponent(poolAddress);
|
123
|
+
IRegistry.ObjectInfo memory registryInfo = getRegistryService().registerPool(pool, owner);
|
124
|
+
pool.linkToRegisteredNftId();
|
125
|
+
poolNftId = registryInfo.nftId;
|
126
|
+
|
127
|
+
// amend component info with pool specific token handler
|
128
|
+
IComponents.ComponentInfo memory componentInfo = pool.getComponentInfo();
|
129
|
+
componentInfo.tokenHandler = new TokenHandler(address(componentInfo.token));
|
130
|
+
|
131
|
+
// save amended component info with instance
|
132
|
+
instance.createPoolSetup(poolNftId, componentInfo);
|
133
|
+
|
134
|
+
bytes4[][] memory selectors = new bytes4[][](2);
|
135
|
+
selectors[0] = new bytes4[](1);
|
136
|
+
selectors[1] = new bytes4[](1);
|
137
|
+
|
138
|
+
selectors[0][0] = IPoolComponent.setFees.selector;
|
139
|
+
selectors[1][0] = IPoolComponent.verifyApplication.selector;
|
140
|
+
|
141
|
+
RoleId[] memory roles = new RoleId[](2);
|
142
|
+
roles[0] = POOL_OWNER_ROLE();
|
143
|
+
roles[1] = POLICY_SERVICE_ROLE();
|
144
|
+
|
145
|
+
getInstanceService().createGifTarget(
|
146
|
+
instanceNftId,
|
147
|
+
poolAddress,
|
148
|
+
pool.getName(),
|
149
|
+
selectors,
|
150
|
+
roles);
|
151
|
+
}
|
152
|
+
|
153
|
+
|
154
|
+
function setMaxCapitalAmount(uint256 maxCapitalAmount)
|
155
|
+
external
|
156
|
+
virtual
|
157
|
+
{
|
158
|
+
(IRegistry.ObjectInfo memory registryInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
159
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
160
|
+
NftId poolNftId = registryInfo.nftId;
|
161
|
+
|
162
|
+
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
163
|
+
IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
|
164
|
+
uint256 previousMaxCapitalAmount = poolInfo.maxCapitalAmount;
|
165
|
+
|
166
|
+
poolInfo.maxCapitalAmount = maxCapitalAmount;
|
167
|
+
componentInfo.data = abi.encode(poolInfo);
|
168
|
+
instance.updatePoolSetup(poolNftId, componentInfo, KEEP_STATE());
|
169
|
+
|
170
|
+
emit LogPoolServiceMaxCapitalAmountUpdated(poolNftId, previousMaxCapitalAmount, maxCapitalAmount);
|
88
171
|
}
|
89
172
|
|
173
|
+
function setBundleOwnerRole(RoleId bundleOwnerRole)
|
174
|
+
external
|
175
|
+
virtual
|
176
|
+
{
|
177
|
+
(IRegistry.ObjectInfo memory registryInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
178
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
179
|
+
NftId poolNftId = registryInfo.nftId;
|
180
|
+
|
181
|
+
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
182
|
+
IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
|
183
|
+
|
184
|
+
// bundle owner role may only be set once per pool
|
185
|
+
if(poolInfo.bundleOwnerRole != PUBLIC_ROLE()) {
|
186
|
+
revert ErrorPoolServiceBundleOwnerRoleAlreadySet(poolNftId);
|
187
|
+
}
|
188
|
+
|
189
|
+
poolInfo.bundleOwnerRole = bundleOwnerRole;
|
190
|
+
componentInfo.data = abi.encode(poolInfo);
|
191
|
+
instance.updatePoolSetup(poolNftId, componentInfo, KEEP_STATE());
|
192
|
+
|
193
|
+
emit LogPoolServiceBundleOwnerRoleSet(poolNftId, bundleOwnerRole);
|
194
|
+
}
|
195
|
+
|
196
|
+
|
90
197
|
function setFees(
|
91
198
|
Fee memory poolFee,
|
92
199
|
Fee memory stakingFee,
|
93
200
|
Fee memory performanceFee
|
94
201
|
)
|
95
202
|
external
|
96
|
-
|
203
|
+
virtual
|
97
204
|
{
|
98
|
-
(IRegistry.ObjectInfo memory
|
205
|
+
(IRegistry.ObjectInfo memory registryInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
99
206
|
InstanceReader instanceReader = instance.getInstanceReader();
|
100
|
-
NftId poolNftId =
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
207
|
+
NftId poolNftId = registryInfo.nftId;
|
208
|
+
|
209
|
+
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
210
|
+
IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
|
211
|
+
|
212
|
+
poolInfo.poolFee = poolFee;
|
213
|
+
poolInfo.stakingFee = stakingFee;
|
214
|
+
poolInfo.performanceFee = performanceFee;
|
215
|
+
componentInfo.data = abi.encode(poolInfo);
|
216
|
+
instance.updatePoolSetup(poolNftId, componentInfo, KEEP_STATE());
|
217
|
+
|
218
|
+
// TODO add logging
|
108
219
|
}
|
109
220
|
}
|
@@ -16,7 +16,7 @@ contract PoolServiceManager is ProxyManager {
|
|
16
16
|
constructor(
|
17
17
|
address registryAddress
|
18
18
|
)
|
19
|
-
ProxyManager()
|
19
|
+
ProxyManager(registryAddress)
|
20
20
|
{
|
21
21
|
PoolService poolSrv = new PoolService();
|
22
22
|
bytes memory data = abi.encode(registryAddress, address(this));
|
@@ -113,12 +113,20 @@ contract ProductService is ComponentService, IProductService {
|
|
113
113
|
// create product setup in instance
|
114
114
|
instance.createProductSetup(productNftId, product.getSetupInfo());
|
115
115
|
|
116
|
+
bytes4[][] memory selectors = new bytes4[][](1);
|
117
|
+
selectors[0] = new bytes4[](1);
|
118
|
+
selectors[0][0] = IProductComponent.setFees.selector;
|
119
|
+
|
120
|
+
RoleId[] memory roles = new RoleId[](1);
|
121
|
+
roles[0] = PRODUCT_OWNER_ROLE();
|
122
|
+
|
116
123
|
// create target for instane access manager
|
117
124
|
getInstanceService().createGifTarget(
|
118
125
|
getRegistry().getNftId(address(instance)),
|
119
126
|
address(product),
|
120
|
-
product.getName()
|
121
|
-
|
127
|
+
product.getName(),
|
128
|
+
selectors,
|
129
|
+
roles);
|
122
130
|
}
|
123
131
|
|
124
132
|
function getDomain() public pure override(IService, Service) returns(ObjectType) {
|
@@ -16,7 +16,7 @@ contract ProductServiceManager is ProxyManager {
|
|
16
16
|
constructor(
|
17
17
|
address registryAddress
|
18
18
|
)
|
19
|
-
ProxyManager()
|
19
|
+
ProxyManager(registryAddress)
|
20
20
|
{
|
21
21
|
ProductService svc = new ProductService();
|
22
22
|
bytes memory data = abi.encode(registryAddress, address(this));
|
@@ -39,7 +39,7 @@ contract ProductServiceManager is ProxyManager {
|
|
39
39
|
// address(_productService));
|
40
40
|
|
41
41
|
// implies that after this constructor call only upgrade functionality is available
|
42
|
-
_isDeployed = true;
|
42
|
+
// _isDeployed = true;
|
43
43
|
}
|
44
44
|
|
45
45
|
//--- view functions ----------------------------------------------------//
|
@@ -95,6 +95,10 @@ contract ChainNft is ERC721Enumerable {
|
|
95
95
|
|
96
96
|
_totalMinted++;
|
97
97
|
_safeMint(to, tokenId);
|
98
|
+
|
99
|
+
if(interceptor != address(0)) {
|
100
|
+
ITransferInterceptor(interceptor).nftMint(to, tokenId);
|
101
|
+
}
|
98
102
|
}
|
99
103
|
|
100
104
|
|
@@ -195,6 +199,10 @@ contract ChainNft is ERC721Enumerable {
|
|
195
199
|
_chainIdDigits;
|
196
200
|
}
|
197
201
|
|
202
|
+
function getNextTokenId() external view returns (uint256) {
|
203
|
+
return calculateTokenId(_idNext);
|
204
|
+
}
|
205
|
+
|
198
206
|
function _getNextTokenId() private returns (uint256 id) {
|
199
207
|
id = calculateTokenId(_idNext);
|
200
208
|
_idNext++;
|
@@ -84,6 +84,8 @@ interface IRegistry is IERC165 {
|
|
84
84
|
|
85
85
|
function isRegisteredService(address contractAddress) external view returns (bool);
|
86
86
|
|
87
|
+
function isRegisteredComponent(address object) external view returns (bool);
|
88
|
+
|
87
89
|
function isValidRelease(VersionPart version) external view returns (bool);
|
88
90
|
|
89
91
|
function getServiceAddress(
|