@etherisc/gif-next 0.0.2-7b65ccc-404 → 0.0.2-7bc90c5-046
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 +19 -2
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +33 -52
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +2 -2
- package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +0 -19
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +2 -2
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +2 -2
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +42 -248
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +2 -2
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +0 -222
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +134 -286
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +84 -120
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +0 -37
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +49 -62
- package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +1463 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +410 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +1712 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +410 -0
- package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.json +376 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +1411 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +1171 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +1517 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +1978 -0
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +10 -99
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +97 -100
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +14 -14
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +236 -116
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +39 -146
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +61 -81
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +211 -205
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
- package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
- package/artifacts/contracts/mock/Dip.sol/Dip.json +2 -2
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +32 -238
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +2 -2
- package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +0 -37
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +0 -222
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +37 -144
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +60 -80
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +5 -283
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +16 -16
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +112 -258
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +89 -121
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +17 -32
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +2 -95
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +74 -143
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +2 -280
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +117 -349
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +63 -111
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +36 -162
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +57 -89
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +3 -225
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +2 -2
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +206 -175
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +92 -100
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +5 -0
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +114 -0
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +266 -119
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +43 -43
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +0 -37
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +4 -0
- package/artifacts/contracts/product/{IProductService.sol/IProductService.json → IRiskService.sol/IRiskService.json} +2 -2
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +372 -316
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +104 -100
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +115 -267
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +80 -120
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +3 -225
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +4 -0
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +588 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +682 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +59 -16
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +221 -21
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +419 -82
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +243 -131
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +23 -130
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +52 -72
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +24 -14
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +6 -6
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/shared/Component.sol/Component.json +0 -211
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +89 -212
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +96 -114
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +5 -112
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +92 -0
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponent.sol/IComponent.json +0 -26
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +0 -37
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +14 -46
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +1 -1
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +2 -22
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +0 -222
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +6 -57
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +18 -140
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +8 -97
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +5 -112
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +330 -11
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +108 -0
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +27 -27
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +63 -93
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +85 -262
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +77 -88
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +6 -6
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +31 -138
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +56 -76
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +84 -84
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +54 -23
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.json +2 -2
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
- package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +60 -4
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +26 -2
- package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
- package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +23 -4
- package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +39 -70
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
- package/contracts/authorization/AccessAdmin.sol +25 -24
- package/contracts/authorization/Authorization.sol +0 -1
- package/contracts/authorization/IAccessAdmin.sol +0 -1
- package/contracts/distribution/Distribution.sol +1 -1
- package/contracts/distribution/DistributionService.sol +31 -32
- package/contracts/distribution/DistributionServiceManager.sol +6 -6
- package/contracts/distribution/IDistributionService.sol +9 -5
- package/contracts/examples/fire/FirePool.sol +75 -0
- package/contracts/examples/fire/FirePoolAuthorization.sol +34 -0
- package/contracts/examples/fire/FireProduct.sol +326 -0
- package/contracts/examples/fire/FireProductAuthorization.sol +31 -0
- package/contracts/examples/fire/FireUSD.sol +26 -0
- package/contracts/examples/unpermissioned/SimpleDistribution.sol +50 -0
- package/contracts/examples/unpermissioned/SimpleOracle.sol +137 -0
- package/contracts/examples/unpermissioned/SimplePool.sol +76 -0
- package/contracts/examples/unpermissioned/SimpleProduct.sol +351 -0
- package/contracts/instance/IInstance.sol +7 -30
- package/contracts/instance/Instance.sol +10 -35
- package/contracts/instance/InstanceAdmin.sol +23 -4
- package/contracts/instance/InstanceAuthorizationV3.sol +3 -3
- package/contracts/instance/InstanceReader.sol +32 -7
- package/contracts/instance/InstanceService.sol +62 -39
- package/contracts/instance/InstanceServiceManager.sol +6 -7
- package/contracts/instance/InstanceStore.sol +11 -1
- package/contracts/instance/base/ObjectLifecycle.sol +9 -4
- package/contracts/instance/module/IComponents.sol +1 -7
- package/contracts/instance/module/IPolicy.sol +22 -22
- package/contracts/mock/Dip.sol +1 -1
- package/contracts/oracle/Oracle.sol +2 -1
- package/contracts/oracle/OracleService.sol +9 -6
- package/contracts/oracle/OracleServiceManager.sol +6 -6
- package/contracts/pool/BasicPool.sol +4 -4
- package/contracts/pool/BasicPoolAuthorization.sol +2 -2
- package/contracts/pool/BundleService.sol +52 -48
- package/contracts/pool/BundleServiceManager.sol +6 -6
- package/contracts/pool/IBundleService.sol +8 -6
- package/contracts/pool/IPoolService.sol +32 -30
- package/contracts/pool/Pool.sol +17 -23
- package/contracts/pool/PoolService.sol +69 -123
- package/contracts/pool/PoolServiceManager.sol +4 -4
- package/contracts/product/ApplicationService.sol +43 -26
- package/contracts/product/ApplicationServiceManager.sol +4 -4
- package/contracts/product/BasicProduct.sol +3 -32
- package/contracts/product/ClaimService.sol +208 -79
- package/contracts/product/ClaimServiceManager.sol +4 -4
- package/contracts/product/IApplicationService.sol +1 -0
- package/contracts/product/IClaimService.sol +28 -5
- package/contracts/product/IPolicyService.sol +31 -32
- package/contracts/product/IPricingService.sol +7 -7
- package/contracts/product/IProductComponent.sol +0 -1
- package/contracts/product/{IProductService.sol → IRiskService.sol} +1 -1
- package/contracts/product/PolicyService.sol +370 -195
- package/contracts/product/PolicyServiceManager.sol +4 -4
- package/contracts/product/PricingService.sol +46 -46
- package/contracts/product/PricingServiceManager.sol +3 -3
- package/contracts/product/Product.sol +67 -34
- package/contracts/product/{ProductService.sol → RiskService.sol} +7 -10
- package/contracts/product/RiskServiceManager.sol +39 -0
- package/contracts/registry/ChainNft.sol +65 -32
- package/contracts/registry/IRegistry.sol +49 -15
- package/contracts/registry/Registry.sol +321 -195
- package/contracts/registry/RegistryAdmin.sol +150 -51
- package/contracts/registry/RegistryService.sol +2 -2
- package/contracts/registry/RegistryServiceManager.sol +2 -2
- package/contracts/registry/ReleaseRegistry.sol +12 -6
- package/contracts/registry/ServiceAuthorizationV3.sol +2 -3
- package/contracts/shared/Component.sol +17 -29
- package/contracts/shared/ComponentService.sol +20 -30
- package/contracts/shared/ComponentServiceManager.sol +8 -5
- package/contracts/shared/ComponentVerifyingService.sol +1 -1
- package/contracts/shared/ContractLib.sol +38 -0
- package/contracts/shared/IComponent.sol +4 -4
- package/contracts/shared/IInstanceLinkedComponent.sol +8 -15
- package/contracts/shared/IPolicyHolder.sol +12 -22
- package/contracts/shared/InitializableERC165.sol +2 -2
- package/contracts/shared/InstanceLinkedComponent.sol +4 -4
- package/contracts/shared/NftOwnable.sol +5 -5
- package/contracts/shared/PolicyHolder.sol +12 -53
- package/contracts/shared/Registerable.sol +4 -4
- package/contracts/shared/RegistryLinked.sol +3 -2
- package/contracts/shared/Service.sol +16 -11
- package/contracts/shared/TokenHandler.sol +100 -19
- package/contracts/shared/TokenHandlerDeployerLib.sol +12 -0
- package/contracts/staking/IStaking.sol +2 -1
- package/contracts/staking/StakeManagerLib.sol +18 -25
- package/contracts/staking/Staking.sol +11 -29
- package/contracts/staking/StakingManager.sol +8 -6
- package/contracts/staking/StakingService.sol +10 -14
- package/contracts/staking/StakingServiceManager.sol +2 -2
- package/contracts/staking/TargetManagerLib.sol +7 -3
- package/contracts/type/Blocknumber.sol +7 -1
- package/contracts/type/NftId.sol +1 -0
- package/contracts/type/ObjectType.sol +15 -11
- package/contracts/type/RiskId.sol +15 -1
- package/contracts/type/Seconds.sol +8 -0
- package/contracts/type/StateId.sol +1 -0
- package/contracts/type/Timestamp.sol +11 -1
- package/contracts/upgradeability/ProxyManager.sol +67 -34
- package/contracts/upgradeability/Versionable.sol +2 -2
- package/package.json +1 -1
- package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +0 -4
- package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +0 -4
- package/artifacts/contracts/product/ProductService.sol/ProductService.json +0 -708
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +0 -4
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +0 -702
- package/contracts/product/ProductServiceManager.sol +0 -39
@@ -1,8 +1,6 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
|
-
|
6
4
|
import {IBundle} from "../instance/module/IBundle.sol";
|
7
5
|
import {IBundleService} from "./IBundleService.sol";
|
8
6
|
import {IComponents} from "../instance/module/IComponents.sol";
|
@@ -17,13 +15,12 @@ import {IStaking} from "../staking/IStaking.sol";
|
|
17
15
|
|
18
16
|
import {Amount, AmountLib} from "../type/Amount.sol";
|
19
17
|
import {Fee, FeeLib} from "../type/Fee.sol";
|
20
|
-
import {NftId
|
18
|
+
import {NftId} from "../type/NftId.sol";
|
21
19
|
import {ObjectType, POOL, BUNDLE, COMPONENT, INSTANCE, REGISTRY} from "../type/ObjectType.sol";
|
22
20
|
import {RoleId, PUBLIC_ROLE} from "../type/RoleId.sol";
|
23
21
|
import {Fee, FeeLib} from "../type/Fee.sol";
|
24
22
|
import {KEEP_STATE} from "../type/StateId.sol";
|
25
23
|
import {Seconds} from "../type/Seconds.sol";
|
26
|
-
import {TokenHandler} from "../shared/TokenHandler.sol";
|
27
24
|
import {UFixed} from "../type/UFixed.sol";
|
28
25
|
import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
|
29
26
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
@@ -47,16 +44,15 @@ contract PoolService is
|
|
47
44
|
bytes memory data
|
48
45
|
)
|
49
46
|
internal
|
50
|
-
initializer
|
51
47
|
virtual override
|
48
|
+
initializer()
|
52
49
|
{
|
53
50
|
(
|
54
|
-
address registryAddress
|
55
|
-
//address managerAddress
|
51
|
+
address registryAddress,
|
56
52
|
address authority
|
57
|
-
) = abi.decode(data, (address, address
|
53
|
+
) = abi.decode(data, (address, address));
|
58
54
|
|
59
|
-
|
55
|
+
_initializeService(registryAddress, authority, owner);
|
60
56
|
|
61
57
|
_registryService = IRegistryService(_getServiceAddress(REGISTRY()));
|
62
58
|
_bundleService = IBundleService(_getServiceAddress(BUNDLE()));
|
@@ -65,27 +61,23 @@ contract PoolService is
|
|
65
61
|
|
66
62
|
_staking = IStaking(getRegistry().getStakingAddress());
|
67
63
|
|
68
|
-
|
64
|
+
_registerInterface(type(IPoolService).interfaceId);
|
69
65
|
}
|
70
66
|
|
71
|
-
|
72
|
-
function
|
67
|
+
/// @inheritdoc IPoolService
|
68
|
+
function setMaxBalanceAmount(Amount maxBalanceAmount)
|
73
69
|
external
|
74
70
|
virtual
|
75
71
|
{
|
76
|
-
/*
|
77
72
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
78
73
|
InstanceReader instanceReader = instance.getInstanceReader();
|
74
|
+
IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
|
79
75
|
|
80
|
-
|
81
|
-
|
82
|
-
Amount previousMaxCapitalAmount = poolInfo.maxCapitalAmount;
|
83
|
-
|
84
|
-
poolInfo.maxCapitalAmount = maxCapitalAmount;
|
76
|
+
Amount previousMaxBalanceAmount = poolInfo.maxBalanceAmount;
|
77
|
+
poolInfo.maxBalanceAmount = maxBalanceAmount;
|
85
78
|
instance.getInstanceStore().updatePool(poolNftId, poolInfo, KEEP_STATE());
|
86
79
|
|
87
|
-
emit
|
88
|
-
*/
|
80
|
+
emit LogPoolServiceMaxBalanceAmountUpdated(poolNftId, previousMaxBalanceAmount, maxBalanceAmount);
|
89
81
|
}
|
90
82
|
|
91
83
|
function setBundleOwnerRole(RoleId bundleOwnerRole)
|
@@ -109,32 +101,10 @@ contract PoolService is
|
|
109
101
|
emit LogPoolServiceBundleOwnerRoleSet(poolNftId, bundleOwnerRole);
|
110
102
|
}
|
111
103
|
|
112
|
-
|
113
|
-
function setFees(
|
114
|
-
Fee memory poolFee,
|
115
|
-
Fee memory stakingFee,
|
116
|
-
Fee memory performanceFee
|
117
|
-
)
|
118
|
-
external
|
119
|
-
virtual
|
120
|
-
{
|
121
|
-
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
122
|
-
|
123
|
-
IComponents.PoolInfo memory poolInfo = instance.getInstanceReader().getPoolInfo(poolNftId);
|
124
|
-
poolInfo.poolFee = poolFee;
|
125
|
-
poolInfo.stakingFee = stakingFee;
|
126
|
-
poolInfo.performanceFee = performanceFee;
|
127
|
-
|
128
|
-
instance.getInstanceStore().updatePool(poolNftId, poolInfo, KEEP_STATE());
|
129
|
-
|
130
|
-
// TODO add logging
|
131
|
-
}
|
132
|
-
|
133
104
|
/// @inheritdoc IPoolService
|
134
105
|
function createBundle(
|
135
106
|
address bundleOwner, // initial bundle owner
|
136
107
|
Fee memory fee, // fees deducted from premium that go to bundle owner
|
137
|
-
Amount stakingAmount, // staking amount - staking fees result in initial bundle capital
|
138
108
|
Seconds lifetime, // initial duration for which new policies are covered
|
139
109
|
bytes calldata filter // optional use case specific criteria that define if a policy may be covered by this bundle
|
140
110
|
)
|
@@ -143,40 +113,17 @@ contract PoolService is
|
|
143
113
|
returns(NftId bundleNftId)
|
144
114
|
{
|
145
115
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
146
|
-
InstanceReader instanceReader = instance.getInstanceReader();
|
147
|
-
|
148
|
-
(
|
149
|
-
Amount stakingFeeAmount,
|
150
|
-
Amount stakingNetAmount
|
151
|
-
) = FeeLib.calculateFee(
|
152
|
-
_getStakingFee(instanceReader, poolNftId),
|
153
|
-
stakingAmount);
|
154
|
-
|
155
|
-
// TODO: staking amount must be be > maxCapitalAmount
|
156
116
|
|
117
|
+
// create the empty bundle
|
157
118
|
bundleNftId = _bundleService.create(
|
158
119
|
instance,
|
159
120
|
poolNftId,
|
160
121
|
bundleOwner,
|
161
122
|
fee,
|
162
|
-
|
123
|
+
AmountLib.zero(),
|
163
124
|
lifetime,
|
164
125
|
filter);
|
165
126
|
|
166
|
-
// pool book keeping
|
167
|
-
_componentService.increasePoolBalance(
|
168
|
-
instance.getInstanceStore(),
|
169
|
-
poolNftId,
|
170
|
-
stakingNetAmount,
|
171
|
-
stakingFeeAmount);
|
172
|
-
|
173
|
-
// pool bookkeeping and collect tokens from bundle owner
|
174
|
-
_collectStakingAmount(
|
175
|
-
instanceReader,
|
176
|
-
poolNftId,
|
177
|
-
bundleOwner,
|
178
|
-
stakingAmount);
|
179
|
-
|
180
127
|
emit LogPoolServiceBundleCreated(instance.getNftId(), poolNftId, bundleNftId);
|
181
128
|
}
|
182
129
|
|
@@ -196,14 +143,26 @@ contract PoolService is
|
|
196
143
|
{
|
197
144
|
(NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
198
145
|
|
199
|
-
// TODO
|
146
|
+
// TODO get performance fee for pool (#477)
|
200
147
|
|
201
148
|
// releasing collateral in bundle
|
202
|
-
_bundleService.close(instance, bundleNftId);
|
203
|
-
|
204
|
-
// TODO get performance fee for pool, transfer of remaining funds + bundle fees to bundle owner
|
149
|
+
(Amount unstakedAmount, Amount feeAmount) = _bundleService.close(instance, bundleNftId);
|
205
150
|
|
151
|
+
_componentService.decreasePoolBalance(
|
152
|
+
instance.getInstanceStore(),
|
153
|
+
poolNftId,
|
154
|
+
unstakedAmount + feeAmount,
|
155
|
+
AmountLib.zero());
|
156
|
+
|
206
157
|
emit LogPoolServiceBundleClosed(instance.getNftId(), poolNftId, bundleNftId);
|
158
|
+
|
159
|
+
if ((unstakedAmount + feeAmount).gtz()){
|
160
|
+
IComponents.ComponentInfo memory poolComponentInfo = instance.getInstanceReader().getComponentInfo(poolNftId);
|
161
|
+
poolComponentInfo.tokenHandler.distributeTokens(
|
162
|
+
poolComponentInfo.wallet,
|
163
|
+
getRegistry().ownerOf(bundleNftId),
|
164
|
+
unstakedAmount + feeAmount);
|
165
|
+
}
|
207
166
|
}
|
208
167
|
|
209
168
|
/// @inheritdoc IPoolService
|
@@ -222,15 +181,18 @@ contract PoolService is
|
|
222
181
|
revert ErrorPoolServiceBundlePoolMismatch(bundleNftId, poolNftId);
|
223
182
|
}
|
224
183
|
|
225
|
-
|
226
|
-
|
227
|
-
|
184
|
+
{
|
185
|
+
Amount currentPoolBalance = instanceReader.getBalanceAmount(poolNftId);
|
186
|
+
if (currentPoolBalance + amount > poolInfo.maxBalanceAmount) {
|
187
|
+
revert ErrorPoolServiceMaxBalanceAmountExceeded(poolNftId, poolInfo.maxBalanceAmount, currentPoolBalance, amount);
|
188
|
+
}
|
228
189
|
}
|
229
190
|
|
230
191
|
// calculate fees
|
192
|
+
Amount feeAmount;
|
231
193
|
(
|
232
|
-
|
233
|
-
|
194
|
+
feeAmount,
|
195
|
+
netAmount
|
234
196
|
) = FeeLib.calculateFee(
|
235
197
|
_getStakingFee(instanceReader, poolNftId),
|
236
198
|
amount);
|
@@ -246,13 +208,14 @@ contract PoolService is
|
|
246
208
|
|
247
209
|
// collect tokens from bundle owner
|
248
210
|
address bundleOwner = getRegistry().ownerOf(bundleNftId);
|
211
|
+
emit LogPoolServiceBundleStaked(instance.getNftId(), poolNftId, bundleNftId, amount, netAmount);
|
212
|
+
|
213
|
+
// TODO only collect staking token when pool is not externally managed
|
249
214
|
_collectStakingAmount(
|
250
215
|
instanceReader,
|
251
216
|
poolNftId,
|
252
217
|
bundleOwner,
|
253
218
|
amount);
|
254
|
-
|
255
|
-
emit LogPoolServiceBundleStaked(instance.getNftId(), poolNftId, bundleNftId, amount, netAmount);
|
256
219
|
}
|
257
220
|
|
258
221
|
/// @inheritdoc IPoolService
|
@@ -271,10 +234,6 @@ contract PoolService is
|
|
271
234
|
revert ErrorPoolServiceBundlePoolMismatch(bundleNftId, poolNftId);
|
272
235
|
}
|
273
236
|
|
274
|
-
if (amount.eqz()) {
|
275
|
-
revert ErrorPoolServiceAmountIsZero();
|
276
|
-
}
|
277
|
-
|
278
237
|
// call bundle service for bookkeeping and additional checks
|
279
238
|
Amount unstakedAmount = _bundleService.unstake(instance, bundleNftId, amount);
|
280
239
|
|
@@ -292,39 +251,39 @@ contract PoolService is
|
|
292
251
|
|
293
252
|
IComponents.ComponentInfo memory poolComponentInfo = instanceReader.getComponentInfo(poolNftId);
|
294
253
|
address poolWallet = poolComponentInfo.wallet;
|
295
|
-
|
296
|
-
// check allowance
|
297
|
-
{
|
298
|
-
IERC20Metadata token = IERC20Metadata(poolComponentInfo.token);
|
299
|
-
uint256 tokenAllowance = token.allowance(poolWallet, address(poolComponentInfo.tokenHandler));
|
300
|
-
if (tokenAllowance < unstakedAmount.toInt()) {
|
301
|
-
revert ErrorPoolServiceWalletAllowanceTooSmall(poolWallet, address(poolComponentInfo.tokenHandler), tokenAllowance, amount.toInt());
|
302
|
-
}
|
303
|
-
}
|
304
|
-
|
305
254
|
// transfer amount to bundle owner
|
306
255
|
address owner = getRegistry().ownerOf(bundleNftId);
|
307
|
-
// TODO: centralize token handling (issue #471)
|
308
|
-
poolComponentInfo.tokenHandler.transfer(poolWallet, owner, unstakedAmount);
|
309
|
-
|
310
256
|
emit LogPoolServiceBundleUnstaked(instance.getNftId(), poolNftId, bundleNftId, unstakedAmount);
|
311
|
-
|
257
|
+
poolComponentInfo.tokenHandler.distributeTokens(
|
258
|
+
poolWallet,
|
259
|
+
owner,
|
260
|
+
unstakedAmount);
|
312
261
|
return unstakedAmount;
|
313
262
|
}
|
314
263
|
|
315
|
-
|
316
|
-
|
264
|
+
|
265
|
+
function fundPoolWallet(NftId poolNftId, Amount amount)
|
266
|
+
external
|
317
267
|
virtual
|
318
|
-
|
319
|
-
|
268
|
+
restricted()
|
269
|
+
{
|
270
|
+
// TODO check that poolNftId is externally managed
|
271
|
+
// TODO implement
|
272
|
+
}
|
273
|
+
|
274
|
+
|
275
|
+
function defundPoolWallet(NftId poolNftId, Amount amount)
|
276
|
+
external
|
277
|
+
virtual
|
278
|
+
restricted()
|
320
279
|
{
|
321
|
-
|
322
|
-
|
280
|
+
// TODO check that poolNftId is externally managed
|
281
|
+
// TODO implement
|
323
282
|
}
|
324
283
|
|
325
284
|
function processSale(
|
326
285
|
NftId bundleNftId,
|
327
|
-
IPolicy.
|
286
|
+
IPolicy.PremiumInfo memory premium
|
328
287
|
)
|
329
288
|
external
|
330
289
|
virtual
|
@@ -336,9 +295,9 @@ contract PoolService is
|
|
336
295
|
IRegistry.ObjectInfo memory instanceObjectInfo = registry.getObjectInfo(poolObjectInfo.parentNftId);
|
337
296
|
IInstance instance = IInstance(instanceObjectInfo.objectAddress);
|
338
297
|
|
339
|
-
Amount poolFeeAmount =
|
340
|
-
Amount bundleFeeAmount =
|
341
|
-
Amount bundleNetAmount =
|
298
|
+
Amount poolFeeAmount = premium.poolFeeFixAmount + premium.poolFeeVarAmount;
|
299
|
+
Amount bundleFeeAmount = premium.bundleFeeFixAmount + premium.bundleFeeVarAmount;
|
300
|
+
Amount bundleNetAmount = premium.netPremiumAmount;
|
342
301
|
|
343
302
|
InstanceStore instanceStore = instance.getInstanceStore();
|
344
303
|
_componentService.increasePoolBalance(
|
@@ -524,7 +483,6 @@ contract PoolService is
|
|
524
483
|
}
|
525
484
|
|
526
485
|
|
527
|
-
// TODO create (I)TreasuryService that deals with all gif related token transfers
|
528
486
|
/// @dev transfers the specified amount from the bundle owner to the pool's wallet
|
529
487
|
function _collectStakingAmount(
|
530
488
|
InstanceReader instanceReader,
|
@@ -537,23 +495,11 @@ contract PoolService is
|
|
537
495
|
|
538
496
|
// collecting investor token
|
539
497
|
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
540
|
-
TokenHandler tokenHandler = componentInfo.tokenHandler;
|
541
498
|
address poolWallet = componentInfo.wallet;
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
revert ErrorPoolServiceWalletAllowanceTooSmall(bundleOwner, address(tokenHandler), allowance, amount.toInt());
|
547
|
-
}
|
548
|
-
|
549
|
-
// TODO: centralize token handling (issue #471)
|
550
|
-
tokenHandler.transfer(
|
551
|
-
bundleOwner,
|
552
|
-
poolWallet,
|
553
|
-
amount);
|
554
|
-
} else {
|
555
|
-
revert ErrorPoolServiceAmountIsZero();
|
556
|
-
}
|
499
|
+
componentInfo.tokenHandler.collectTokens(
|
500
|
+
bundleOwner,
|
501
|
+
poolWallet,
|
502
|
+
amount);
|
557
503
|
}
|
558
504
|
|
559
505
|
function _getDomain() internal pure override returns(ObjectType) {
|
@@ -12,14 +12,14 @@ contract PoolServiceManager is ProxyManager {
|
|
12
12
|
/// @dev initializes proxy manager with pool service implementation
|
13
13
|
constructor(
|
14
14
|
address authority,
|
15
|
-
address
|
15
|
+
address registry,
|
16
16
|
bytes32 salt
|
17
17
|
)
|
18
|
-
ProxyManager(registryAddress)
|
19
18
|
{
|
20
19
|
PoolService poolSrv = new PoolService{salt: salt}();
|
21
|
-
bytes memory data = abi.encode(
|
22
|
-
IVersionable versionable =
|
20
|
+
bytes memory data = abi.encode(registry, authority);
|
21
|
+
IVersionable versionable = initialize(
|
22
|
+
registry,
|
23
23
|
address(poolSrv),
|
24
24
|
data,
|
25
25
|
salt);
|
@@ -41,18 +41,17 @@ contract ApplicationService is
|
|
41
41
|
initializer()
|
42
42
|
{
|
43
43
|
(
|
44
|
-
address registryAddress
|
45
|
-
//address managerAddress
|
44
|
+
address registryAddress,
|
46
45
|
address authority
|
47
|
-
) = abi.decode(data, (address, address
|
46
|
+
) = abi.decode(data, (address, address));
|
48
47
|
|
49
|
-
|
48
|
+
_initializeService(registryAddress, authority, owner);
|
50
49
|
|
51
50
|
_distributionService = IDistributionService(_getServiceAddress(DISTRIBUTION()));
|
52
51
|
_pricingService = IPricingService(_getServiceAddress(PRICE()));
|
53
52
|
_registryService = IRegistryService(_getServiceAddress(REGISTRY()));
|
54
53
|
|
55
|
-
|
54
|
+
_registerInterface(type(IApplicationService).interfaceId);
|
56
55
|
}
|
57
56
|
|
58
57
|
|
@@ -111,8 +110,7 @@ contract ApplicationService is
|
|
111
110
|
view
|
112
111
|
returns (Amount premiumAmount)
|
113
112
|
{
|
114
|
-
return
|
115
|
-
_pricingService.calculatePremium(
|
113
|
+
return _pricingService.calculatePremium(
|
116
114
|
info.productNftId,
|
117
115
|
info.riskId,
|
118
116
|
info.sumInsuredAmount,
|
@@ -120,7 +118,7 @@ contract ApplicationService is
|
|
120
118
|
info.applicationData,
|
121
119
|
info.bundleNftId,
|
122
120
|
info.referralId
|
123
|
-
).premiumAmount
|
121
|
+
).premiumAmount;
|
124
122
|
}
|
125
123
|
|
126
124
|
|
@@ -128,6 +126,7 @@ contract ApplicationService is
|
|
128
126
|
address applicationOwner,
|
129
127
|
RiskId riskId,
|
130
128
|
Amount sumInsuredAmount,
|
129
|
+
Amount premiumAmount,
|
131
130
|
Seconds lifetime,
|
132
131
|
NftId bundleNftId,
|
133
132
|
ReferralId referralId,
|
@@ -152,14 +151,45 @@ contract ApplicationService is
|
|
152
151
|
applicationNftId = _registerApplication(productNftId, applicationOwner);
|
153
152
|
|
154
153
|
// create policy info for application
|
155
|
-
IPolicy.PolicyInfo memory applicationInfo =
|
154
|
+
IPolicy.PolicyInfo memory applicationInfo = _createApplicationInfo(
|
155
|
+
productNftId,
|
156
|
+
riskId,
|
157
|
+
sumInsuredAmount,
|
158
|
+
premiumAmount,
|
159
|
+
lifetime,
|
160
|
+
bundleNftId,
|
161
|
+
referralId,
|
162
|
+
applicationData);
|
163
|
+
|
164
|
+
// register application with instance
|
165
|
+
instance.getInstanceStore().createApplication(
|
166
|
+
applicationNftId,
|
167
|
+
applicationInfo);
|
168
|
+
|
169
|
+
// TODO: add logging
|
170
|
+
}
|
171
|
+
|
172
|
+
function _createApplicationInfo(
|
173
|
+
NftId productNftId,
|
174
|
+
RiskId riskId,
|
175
|
+
Amount sumInsuredAmount,
|
176
|
+
Amount premiumAmount,
|
177
|
+
Seconds lifetime,
|
178
|
+
NftId bundleNftId,
|
179
|
+
ReferralId referralId,
|
180
|
+
bytes memory applicationData
|
181
|
+
)
|
182
|
+
internal
|
183
|
+
virtual
|
184
|
+
returns (IPolicy.PolicyInfo memory applicationInfo)
|
185
|
+
{
|
186
|
+
return IPolicy.PolicyInfo({
|
156
187
|
productNftId: productNftId,
|
157
188
|
bundleNftId: bundleNftId,
|
158
189
|
referralId: referralId,
|
159
190
|
riskId: riskId,
|
160
191
|
sumInsuredAmount: sumInsuredAmount,
|
161
|
-
premiumAmount:
|
162
|
-
premiumPaidAmount: AmountLib.zero(),
|
192
|
+
premiumAmount: premiumAmount,
|
163
193
|
lifetime: lifetime,
|
164
194
|
applicationData: applicationData,
|
165
195
|
processData: "",
|
@@ -171,21 +201,8 @@ contract ApplicationService is
|
|
171
201
|
expiredAt: zeroTimestamp(),
|
172
202
|
closedAt: zeroTimestamp()
|
173
203
|
});
|
174
|
-
|
175
|
-
// TODO consider to provide this amount externally
|
176
|
-
// actual calculation is done 2nd time anyway for premium collection
|
177
|
-
// calculate premium amount
|
178
|
-
applicationInfo.premiumAmount = _calculatePremiumAmount(applicationInfo);
|
179
|
-
|
180
|
-
// register application with instance
|
181
|
-
instance.getInstanceStore().createApplication(
|
182
|
-
applicationNftId,
|
183
|
-
applicationInfo);
|
184
|
-
|
185
|
-
// TODO: add logging
|
186
204
|
}
|
187
205
|
|
188
|
-
|
189
206
|
function renew(
|
190
207
|
NftId policyNftId, // policy to be renewd (renewal inherits policy attributes)
|
191
208
|
NftId bundleNftId // will likely need a newer bundle for underwriting
|
@@ -194,7 +211,7 @@ contract ApplicationService is
|
|
194
211
|
virtual override
|
195
212
|
returns (NftId applicationNftId)
|
196
213
|
{
|
197
|
-
|
214
|
+
// TODO implement
|
198
215
|
}
|
199
216
|
|
200
217
|
|
@@ -210,7 +227,7 @@ contract ApplicationService is
|
|
210
227
|
external
|
211
228
|
virtual override
|
212
229
|
{
|
213
|
-
|
230
|
+
// TODO implement
|
214
231
|
}
|
215
232
|
|
216
233
|
function revoke(NftId applicationNftId)
|
@@ -12,14 +12,14 @@ contract ApplicationServiceManager is ProxyManager {
|
|
12
12
|
/// @dev initializes proxy manager with service implementation
|
13
13
|
constructor(
|
14
14
|
address authority,
|
15
|
-
address
|
15
|
+
address registry,
|
16
16
|
bytes32 salt
|
17
17
|
)
|
18
|
-
ProxyManager(registryAddress)
|
19
18
|
{
|
20
19
|
ApplicationService svc = new ApplicationService{salt: salt}();
|
21
|
-
bytes memory data = abi.encode(
|
22
|
-
IVersionable versionable =
|
20
|
+
bytes memory data = abi.encode(registry, authority);
|
21
|
+
IVersionable versionable = initialize(
|
22
|
+
registry,
|
23
23
|
address(svc),
|
24
24
|
data,
|
25
25
|
salt);
|
@@ -1,43 +1,15 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {
|
5
|
-
|
6
|
-
import {Amount, AmountLib} from "../type/Amount.sol";
|
7
|
-
import {ClaimId} from "../type/ClaimId.sol";
|
8
|
-
import {InstanceLinkedComponent} from "../shared/InstanceLinkedComponent.sol";
|
9
|
-
import {Fee, FeeLib} from "../type/Fee.sol";
|
10
|
-
import {IRisk} from "../instance/module/IRisk.sol";
|
11
|
-
import {IApplicationService} from "./IApplicationService.sol";
|
4
|
+
import {Fee} from "../type/Fee.sol";
|
12
5
|
import {IAuthorization} from "../authorization/IAuthorization.sol";
|
13
|
-
import {
|
14
|
-
import {IPolicyService} from "./IPolicyService.sol";
|
15
|
-
import {IProductService} from "./IProductService.sol";
|
16
|
-
import {IClaimService} from "./IClaimService.sol";
|
17
|
-
import {IPricingService} from "./IPricingService.sol";
|
18
|
-
import {IProductComponent} from "./IProductComponent.sol";
|
19
|
-
import {NftId, NftIdLib} from "../type/NftId.sol";
|
6
|
+
import {NftId} from "../type/NftId.sol";
|
20
7
|
import {Product} from "../product/Product.sol";
|
21
|
-
import {PayoutId} from "../type/PayoutId.sol";
|
22
|
-
import {COMPONENT, PRODUCT, APPLICATION, POLICY, CLAIM, PRICE } from "../type/ObjectType.sol";
|
23
|
-
import {ReferralId} from "../type/Referral.sol";
|
24
|
-
import {RiskId, RiskIdLib} from "../type/RiskId.sol";
|
25
|
-
import {Seconds} from "../type/Seconds.sol";
|
26
|
-
import {StateId} from "../type/StateId.sol";
|
27
|
-
import {Timestamp} from "../type/Timestamp.sol";
|
28
|
-
|
29
|
-
import {TokenHandler} from "../shared/TokenHandler.sol";
|
30
|
-
|
31
|
-
import {InstanceReader} from "../instance/InstanceReader.sol";
|
32
|
-
import {IPolicy} from "../instance/module/IPolicy.sol";
|
33
|
-
import {IComponents} from "../instance/module/IComponents.sol";
|
34
|
-
import {Pool} from "../pool/Pool.sol";
|
35
|
-
import {Distribution} from "../distribution/Distribution.sol";
|
36
8
|
|
37
9
|
abstract contract BasicProduct is
|
38
10
|
Product
|
39
11
|
{
|
40
|
-
|
12
|
+
|
41
13
|
function setFees(
|
42
14
|
Fee memory productFee,
|
43
15
|
Fee memory processingFee
|
@@ -50,7 +22,6 @@ abstract contract BasicProduct is
|
|
50
22
|
_setFees(productFee, processingFee);
|
51
23
|
}
|
52
24
|
|
53
|
-
|
54
25
|
function _initializeBasicProduct(
|
55
26
|
address registry,
|
56
27
|
NftId instanceNftId,
|