@etherisc/gif-next 0.0.2-bf51045-496 → 0.0.2-bf9f7e6-880
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 +44 -0
- package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +1 -1
- package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +69 -62
- package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +29 -31
- package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +1 -1
- package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.json +33 -9
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +454 -253
- package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.dbg.json +4 -0
- package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.json +673 -0
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +202 -5
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +227 -26
- 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 +353 -189
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +105 -18
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
- 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 +74 -157
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +212 -38
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +39 -95
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +271 -185
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +66 -60
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +26 -82
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +159 -72
- package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +92 -88
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +193 -51
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +248 -237
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +212 -38
- package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +132 -173
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +212 -38
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +75 -68
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +123 -116
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +193 -51
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +338 -242
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +212 -38
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +88 -45
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +158 -29
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +108 -9
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +187 -54
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +677 -325
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +193 -51
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +496 -324
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +121 -85
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +26 -38
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +619 -559
- package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +1 -1
- package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +96 -53
- 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 +16 -5
- package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.json +168 -0
- 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/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +60 -51
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +194 -40
- 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 +30 -21
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +27 -3
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +44 -35
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +75 -68
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +34 -36
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +65 -56
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +193 -51
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +108 -207
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +42 -64
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +44 -86
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +40 -31
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +138 -193
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +53 -44
- package/artifacts/contracts/pool/PoolLib.sol/PoolLib.dbg.json +4 -0
- package/artifacts/contracts/pool/PoolLib.sol/PoolLib.json +456 -0
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +254 -299
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +70 -56
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +123 -50
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +37 -27
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +176 -152
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +212 -38
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +244 -187
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +64 -74
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +69 -3
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +142 -20
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +105 -68
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +48 -3
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +157 -133
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.json +58 -7
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +193 -173
- package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.dbg.json +4 -0
- package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.json +293 -0
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +54 -56
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +96 -108
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +35 -57
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +170 -146
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +131 -81
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +46 -28
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +36 -12
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +31 -7
- package/artifacts/contracts/registry/IRelease.sol/IRelease.dbg.json +4 -0
- package/artifacts/contracts/registry/IRelease.sol/IRelease.json +24 -0
- 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 +74 -50
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +553 -434
- package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.json +878 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +51 -44
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +22 -24
- package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +1954 -0
- 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 +333 -63
- 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 +4 -4
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/shared/Component.sol/Component.json +43 -34
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +147 -165
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +48 -50
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +27 -16
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +113 -4
- package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +1 -1
- package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +1 -1
- package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.json +40 -0
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponent.sol/IComponent.json +30 -21
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +71 -72
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +30 -21
- 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/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +120 -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/IService.sol/IService.json +27 -3
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +2 -2
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +43 -34
- 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 +2 -2
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +118 -62
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +27 -16
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +63 -162
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +118 -29
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +32 -32
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +113 -39
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +131 -7
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +169 -97
- package/artifacts/contracts/staking/StakingLib.sol/StakingLib.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingLib.sol/StakingLib.json +469 -0
- 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 +44 -32
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +34 -61
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +168 -53
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +31 -29
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +148 -134
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +47 -37
- 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/Amount.sol/AmountLib.json +10 -10
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- 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/Fee.sol/FeeLib.json +93 -37
- 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/Key32Set.sol/LibKey32Set.dbg.json +1 -1
- package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.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 +33 -31
- 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 +30 -6
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +79 -15
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
- package/artifacts/contracts/type/Selector.sol/SelectorLib.json +21 -2
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.json +2 -2
- package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
- 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 +2 -2
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +60 -36
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -21
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionPartLib.json +101 -2
- 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 +4 -4
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
- package/contracts/accounting/AccountingService.sol +3 -4
- package/contracts/accounting/AccountingServiceManager.sol +1 -1
- package/contracts/accounting/IAccountingService.sol +2 -2
- package/contracts/authorization/AccessAdmin.sol +293 -204
- package/contracts/authorization/AccessAdminLib.sol +183 -0
- package/contracts/authorization/AccessManagerCloneable.sol +146 -4
- package/contracts/authorization/Authorization.sol +307 -231
- package/contracts/authorization/IAccess.sol +13 -5
- package/contracts/authorization/IAccessAdmin.sol +69 -36
- package/contracts/authorization/IAuthorization.sol +21 -1
- package/contracts/distribution/BasicDistribution.sol +13 -11
- package/contracts/distribution/BasicDistributionAuthorization.sol +21 -8
- package/contracts/distribution/Distribution.sol +13 -56
- package/contracts/distribution/DistributionService.sol +83 -55
- package/contracts/distribution/DistributionServiceManager.sol +1 -1
- package/contracts/distribution/IDistributionComponent.sol +0 -9
- package/contracts/distribution/IDistributionService.sol +18 -15
- package/contracts/examples/fire/FirePool.sol +0 -4
- package/contracts/examples/fire/FirePoolAuthorization.sol +1 -1
- package/contracts/examples/fire/FireProduct.sol +4 -7
- package/contracts/examples/fire/FireProductAuthorization.sol +1 -1
- package/contracts/examples/unpermissioned/SimpleDistribution.sol +32 -8
- package/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol +1 -1
- package/contracts/examples/unpermissioned/SimpleOracle.sol +4 -8
- package/contracts/examples/unpermissioned/SimplePool.sol +0 -5
- package/contracts/examples/unpermissioned/SimplePoolAuthorization.sol +1 -1
- package/contracts/examples/unpermissioned/SimpleProduct.sol +29 -8
- package/contracts/examples/unpermissioned/SimpleProductAuthorization.sol +1 -1
- package/contracts/instance/BundleSet.sol +4 -4
- package/contracts/instance/IInstance.sol +51 -16
- package/contracts/instance/IInstanceService.sol +20 -2
- package/contracts/instance/Instance.sol +90 -25
- package/contracts/instance/InstanceAdmin.sol +261 -99
- package/contracts/instance/InstanceAuthorizationV3.sol +49 -36
- package/contracts/instance/InstanceReader.sol +103 -34
- package/contracts/instance/InstanceService.sol +154 -87
- package/contracts/instance/InstanceServiceManager.sol +1 -1
- package/contracts/instance/InstanceStore.sol +13 -2
- package/contracts/instance/RiskSet.sol +11 -12
- package/contracts/instance/base/ObjectLifecycle.sol +4 -2
- package/contracts/instance/base/ObjectSet.sol +7 -8
- package/contracts/instance/base/ObjectSetHelperLib.sol +30 -0
- package/contracts/instance/module/IBundle.sol +6 -5
- package/contracts/instance/module/IComponents.sol +19 -7
- package/contracts/instance/module/IDistribution.sol +21 -8
- package/contracts/instance/module/IPolicy.sol +28 -8
- package/contracts/instance/module/IRisk.sol +4 -0
- package/contracts/oracle/BasicOracle.sol +1 -3
- package/contracts/oracle/BasicOracleAuthorization.sol +3 -12
- package/contracts/oracle/IOracle.sol +9 -4
- package/contracts/oracle/Oracle.sol +1 -3
- package/contracts/oracle/OracleService.sol +16 -15
- package/contracts/oracle/OracleServiceManager.sol +1 -1
- package/contracts/pool/BasicPool.sol +0 -2
- package/contracts/pool/BasicPoolAuthorization.sol +21 -13
- package/contracts/pool/BundleService.sol +28 -58
- package/contracts/pool/BundleServiceManager.sol +1 -1
- package/contracts/pool/IBundleService.sol +13 -19
- package/contracts/pool/IPoolService.sol +50 -38
- package/contracts/pool/Pool.sol +9 -11
- package/contracts/pool/PoolLib.sol +216 -0
- package/contracts/pool/PoolService.sol +294 -154
- package/contracts/pool/PoolServiceManager.sol +1 -1
- package/contracts/product/ApplicationService.sol +24 -9
- package/contracts/product/ApplicationServiceManager.sol +1 -1
- package/contracts/product/BasicProduct.sol +2 -2
- package/contracts/product/BasicProductAuthorization.sol +23 -8
- package/contracts/product/ClaimService.sol +157 -139
- package/contracts/product/ClaimServiceManager.sol +1 -1
- package/contracts/product/IApplicationService.sol +3 -0
- package/contracts/product/IClaimService.sol +14 -2
- package/contracts/product/IPolicyService.sol +11 -6
- package/contracts/product/IPricingService.sol +1 -0
- package/contracts/product/IProductComponent.sol +4 -1
- package/contracts/product/IRiskService.sol +7 -7
- package/contracts/product/PolicyService.sol +86 -158
- package/contracts/product/PolicyServiceLib.sol +65 -0
- package/contracts/product/PolicyServiceManager.sol +1 -1
- package/contracts/product/PricingService.sol +30 -21
- package/contracts/product/PricingServiceManager.sol +3 -3
- package/contracts/product/Product.sol +55 -15
- package/contracts/product/RiskService.sol +76 -29
- package/contracts/product/RiskServiceManager.sol +1 -1
- package/contracts/registry/IRegistry.sol +12 -15
- package/contracts/registry/IRelease.sol +29 -0
- package/contracts/registry/Registry.sol +7 -2
- package/contracts/registry/RegistryAdmin.sol +143 -342
- package/contracts/registry/RegistryAuthorization.sol +267 -0
- package/contracts/registry/RegistryService.sol +3 -3
- package/contracts/registry/RegistryServiceManager.sol +1 -1
- package/contracts/registry/ReleaseAdmin.sol +253 -0
- package/contracts/registry/ReleaseLifecycle.sol +2 -0
- package/contracts/registry/ReleaseRegistry.sol +146 -115
- package/contracts/registry/ServiceAuthorizationV3.sol +126 -2
- package/contracts/registry/TokenRegistry.sol +6 -8
- package/contracts/shared/Component.sol +17 -26
- package/contracts/shared/ComponentService.sol +141 -129
- package/contracts/shared/ComponentServiceManager.sol +1 -1
- package/contracts/shared/ComponentVerifyingService.sol +1 -1
- package/contracts/shared/ContractLib.sol +60 -3
- package/contracts/shared/IComponent.sol +0 -4
- package/contracts/shared/IComponentService.sol +9 -13
- package/contracts/shared/IRegisterable.sol +15 -4
- package/contracts/shared/IService.sol +3 -5
- package/contracts/shared/InitializableERC165.sol +9 -1
- package/contracts/shared/InstanceLinkedComponent.sol +2 -4
- package/contracts/shared/NftOwnable.sol +5 -5
- package/contracts/shared/PolicyHolder.sol +1 -1
- package/contracts/shared/Registerable.sol +42 -19
- package/contracts/shared/RegistryLinked.sol +1 -1
- package/contracts/shared/Service.sol +8 -27
- package/contracts/shared/TokenHandler.sol +45 -92
- package/contracts/staking/IStaking.sol +12 -10
- package/contracts/staking/IStakingService.sol +16 -1
- package/contracts/staking/Staking.sol +59 -28
- package/contracts/staking/{StakeManagerLib.sol → StakingLib.sol} +80 -23
- package/contracts/staking/StakingReader.sol +6 -16
- package/contracts/staking/StakingService.sol +68 -44
- package/contracts/staking/StakingServiceManager.sol +5 -4
- package/contracts/staking/StakingStore.sol +2 -1
- package/contracts/type/Fee.sol +8 -8
- package/contracts/type/ObjectType.sol +47 -39
- package/contracts/type/RiskId.sol +9 -3
- package/contracts/type/RoleId.sol +24 -4
- package/contracts/type/Selector.sol +5 -0
- package/contracts/type/Timestamp.sol +0 -5
- package/contracts/type/UFixed.sol +27 -10
- package/contracts/type/Version.sol +54 -5
- package/contracts/upgradeability/ProxyManager.sol +1 -1
- package/package.json +2 -2
- package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.dbg.json +0 -4
- package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.json +0 -1196
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +0 -4
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +0 -129
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +0 -4
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +0 -440
- package/contracts/authorization/ReleaseAccessManager.sol +0 -38
- package/contracts/instance/module/IAccess.sol +0 -46
@@ -8,6 +8,7 @@ import {IComponents} from "../instance/module/IComponents.sol";
|
|
8
8
|
import {IComponentService} from "../shared/IComponentService.sol";
|
9
9
|
import {IInstance} from "../instance/IInstance.sol";
|
10
10
|
import {IPolicy} from "../instance/module/IPolicy.sol";
|
11
|
+
import {IPolicyHolder} from "../shared/IPolicyHolder.sol";
|
11
12
|
import {IPoolComponent} from "../pool/IPoolComponent.sol";
|
12
13
|
import {IPoolService} from "./IPoolService.sol";
|
13
14
|
import {IProductComponent} from "../product/IProductComponent.sol";
|
@@ -17,18 +18,20 @@ import {IStaking} from "../staking/IStaking.sol";
|
|
17
18
|
import {Amount, AmountLib} from "../type/Amount.sol";
|
18
19
|
import {ClaimId} from "../type/ClaimId.sol";
|
19
20
|
import {ContractLib} from "../shared/ContractLib.sol";
|
20
|
-
import {
|
21
|
+
import {InstanceReader} from "../instance/InstanceReader.sol";
|
22
|
+
import {InstanceStore} from "../instance/InstanceStore.sol";
|
23
|
+
import {KEEP_STATE} from "../type/StateId.sol";
|
21
24
|
import {NftId} from "../type/NftId.sol";
|
22
25
|
import {ObjectType, ACCOUNTING, POOL, BUNDLE, PRODUCT, POLICY, COMPONENT} from "../type/ObjectType.sol";
|
23
|
-
import {
|
24
|
-
import {
|
25
|
-
import {UFixed} from "../type/UFixed.sol";
|
26
|
+
import {PayoutId} from "../type/PayoutId.sol";
|
27
|
+
import {PoolLib} from "./PoolLib.sol";
|
26
28
|
import {Service} from "../shared/Service.sol";
|
27
|
-
import {
|
28
|
-
import {
|
29
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
30
|
+
import {UFixed} from "../type/UFixed.sol";
|
29
31
|
|
30
32
|
string constant POOL_SERVICE_NAME = "PoolService";
|
31
33
|
|
34
|
+
|
32
35
|
contract PoolService is
|
33
36
|
Service,
|
34
37
|
IPoolService
|
@@ -47,11 +50,11 @@ contract PoolService is
|
|
47
50
|
initializer()
|
48
51
|
{
|
49
52
|
(
|
50
|
-
address
|
51
|
-
address
|
53
|
+
address authority,
|
54
|
+
address registry
|
52
55
|
) = abi.decode(data, (address, address));
|
53
56
|
|
54
|
-
|
57
|
+
__Service_init(authority, registry, owner);
|
55
58
|
|
56
59
|
_accountingService = IAccountingService(_getServiceAddress(ACCOUNTING()));
|
57
60
|
_bundleService = IBundleService(_getServiceAddress(BUNDLE()));
|
@@ -102,8 +105,7 @@ contract PoolService is
|
|
102
105
|
|
103
106
|
if ((unstakedAmount + feeAmount).gtz()){
|
104
107
|
IComponents.ComponentInfo memory poolComponentInfo = instance.getInstanceReader().getComponentInfo(poolNftId);
|
105
|
-
poolComponentInfo.tokenHandler.
|
106
|
-
poolComponentInfo.tokenHandler.getWallet(),
|
108
|
+
poolComponentInfo.tokenHandler.pushToken(
|
107
109
|
getRegistry().ownerOf(bundleNftId),
|
108
110
|
unstakedAmount + feeAmount);
|
109
111
|
}
|
@@ -123,7 +125,7 @@ contract PoolService is
|
|
123
125
|
|
124
126
|
(NftId poolNftId, IInstance instance) = _getAndVerifyActivePool();
|
125
127
|
InstanceReader instanceReader = instance.getInstanceReader();
|
126
|
-
NftId productNftId = getRegistry().
|
128
|
+
NftId productNftId = getRegistry().getParentNftId(poolNftId);
|
127
129
|
|
128
130
|
// check policy matches with calling pool
|
129
131
|
IPolicy.PolicyInfo memory policyInfo = instanceReader.getPolicyInfo(policyNftId);
|
@@ -144,23 +146,47 @@ contract PoolService is
|
|
144
146
|
}
|
145
147
|
|
146
148
|
|
149
|
+
// function _checkAndGetPoolInfo(NftId bundleNftId)
|
150
|
+
// internal
|
151
|
+
// view
|
152
|
+
// returns (
|
153
|
+
// InstanceReader instanceReader,
|
154
|
+
// InstanceStore instanceStore,
|
155
|
+
// NftId instanceNftId,
|
156
|
+
// NftId poolNftId,
|
157
|
+
// IComponents.PoolInfo memory poolInfo
|
158
|
+
// )
|
159
|
+
// {
|
160
|
+
// _checkNftType(bundleNftId, BUNDLE());
|
161
|
+
|
162
|
+
// (NftId poolNftId, IInstance instance) = _getAndVerifyActivePool();
|
163
|
+
// instanceReader = instance.getInstanceReader();
|
164
|
+
// instanceStore = instance.getInstanceStore();
|
165
|
+
// instanceNftId = instance.getNftId();
|
166
|
+
// poolInfo = instanceReader.getPoolInfo(poolNftId);
|
167
|
+
|
168
|
+
// if (getRegistry().getParentNftId(bundleNftId) != poolNftId) {
|
169
|
+
// revert ErrorPoolServiceBundlePoolMismatch(bundleNftId, poolNftId);
|
170
|
+
// }
|
171
|
+
// }
|
172
|
+
|
173
|
+
|
147
174
|
/// @inheritdoc IPoolService
|
148
175
|
function stake(NftId bundleNftId, Amount amount)
|
149
176
|
external
|
150
177
|
virtual
|
151
178
|
// TODO: restricted() (once #462 is done)
|
152
|
-
returns(
|
179
|
+
returns(
|
180
|
+
Amount netAmount
|
181
|
+
)
|
153
182
|
{
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
if (bundleInfo.poolNftId != poolNftId) {
|
162
|
-
revert ErrorPoolServiceBundlePoolMismatch(bundleNftId, poolNftId);
|
163
|
-
}
|
183
|
+
(
|
184
|
+
InstanceReader instanceReader,
|
185
|
+
InstanceStore instanceStore,
|
186
|
+
NftId instanceNftId,
|
187
|
+
NftId poolNftId,
|
188
|
+
IComponents.PoolInfo memory poolInfo
|
189
|
+
) = PoolLib.checkAndGetPoolInfo(getRegistry(), msg.sender, bundleNftId);
|
164
190
|
|
165
191
|
{
|
166
192
|
Amount currentPoolBalance = instanceReader.getBalanceAmount(poolNftId);
|
@@ -170,37 +196,33 @@ contract PoolService is
|
|
170
196
|
}
|
171
197
|
|
172
198
|
// calculate fees
|
173
|
-
IRegistry registry = getRegistry();
|
174
199
|
Amount feeAmount;
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
(
|
180
|
-
|
181
|
-
|
182
|
-
)
|
183
|
-
stakingFee,
|
184
|
-
amount);
|
185
|
-
}
|
200
|
+
(
|
201
|
+
feeAmount,
|
202
|
+
netAmount
|
203
|
+
) = PoolLib.calculateStakingAmounts(
|
204
|
+
getRegistry(),
|
205
|
+
instanceReader,
|
206
|
+
poolNftId,
|
207
|
+
amount);
|
186
208
|
|
187
209
|
// do all the book keeping
|
188
210
|
_accountingService.increasePoolBalance(
|
189
|
-
|
211
|
+
instanceStore,
|
190
212
|
poolNftId,
|
191
213
|
netAmount,
|
192
214
|
feeAmount);
|
193
215
|
|
194
|
-
_bundleService.stake(
|
216
|
+
_bundleService.stake(instanceReader, instanceStore, bundleNftId, netAmount);
|
195
217
|
|
196
|
-
emit LogPoolServiceBundleStaked(
|
218
|
+
emit LogPoolServiceBundleStaked(instanceNftId, poolNftId, bundleNftId, amount, netAmount);
|
197
219
|
|
198
220
|
// only collect staking amount when pool is not externally managed
|
199
221
|
if (!poolInfo.isExternallyManaged) {
|
200
222
|
|
201
223
|
// collect tokens from bundle owner
|
202
224
|
address bundleOwner = getRegistry().ownerOf(bundleNftId);
|
203
|
-
|
225
|
+
_pullStakingAmount(
|
204
226
|
instanceReader,
|
205
227
|
poolNftId,
|
206
228
|
bundleOwner,
|
@@ -216,19 +238,15 @@ contract PoolService is
|
|
216
238
|
// TODO: restricted() (once #462 is done)
|
217
239
|
returns(Amount netAmount)
|
218
240
|
{
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
if (bundleInfo.poolNftId != poolNftId) {
|
227
|
-
revert ErrorPoolServiceBundlePoolMismatch(bundleNftId, poolNftId);
|
228
|
-
}
|
241
|
+
(
|
242
|
+
InstanceReader instanceReader,
|
243
|
+
InstanceStore instanceStore,
|
244
|
+
NftId instanceNftId,
|
245
|
+
NftId poolNftId,
|
246
|
+
) = PoolLib.checkAndGetPoolInfo(getRegistry(), msg.sender, bundleNftId);
|
229
247
|
|
230
248
|
// call bundle service for bookkeeping and additional checks
|
231
|
-
Amount unstakedAmount = _bundleService.unstake(
|
249
|
+
Amount unstakedAmount = _bundleService.unstake(instanceStore, bundleNftId, amount);
|
232
250
|
|
233
251
|
// Important: from now on work only with unstakedAmount as it is the only reliable amount.
|
234
252
|
// if amount was max, this was set to the available amount
|
@@ -244,14 +262,14 @@ contract PoolService is
|
|
244
262
|
AmountLib.zero());
|
245
263
|
|
246
264
|
|
247
|
-
emit LogPoolServiceBundleUnstaked(
|
265
|
+
emit LogPoolServiceBundleUnstaked(instanceNftId, poolNftId, bundleNftId, unstakedAmount, netAmount);
|
248
266
|
|
249
267
|
// only distribute staking amount when pool is not externally managed
|
250
268
|
if (!instanceReader.getPoolInfo(poolNftId).isExternallyManaged) {
|
251
269
|
|
252
270
|
// transfer amount to bundle owner
|
253
271
|
address bundleOwner = getRegistry().ownerOf(bundleNftId);
|
254
|
-
|
272
|
+
_pushUnstakingAmount(
|
255
273
|
instanceReader,
|
256
274
|
poolNftId,
|
257
275
|
bundleOwner,
|
@@ -279,7 +297,7 @@ contract PoolService is
|
|
279
297
|
address poolOwner = getRegistry().ownerOf(poolNftId);
|
280
298
|
emit LogPoolServiceWalletFunded(poolNftId, poolOwner, amount);
|
281
299
|
|
282
|
-
|
300
|
+
_pullStakingAmount(
|
283
301
|
reader,
|
284
302
|
poolNftId,
|
285
303
|
poolOwner,
|
@@ -306,7 +324,7 @@ contract PoolService is
|
|
306
324
|
address poolOwner = getRegistry().ownerOf(poolNftId);
|
307
325
|
emit LogPoolServiceWalletDefunded(poolNftId, poolOwner, amount);
|
308
326
|
|
309
|
-
|
327
|
+
_pushUnstakingAmount(
|
310
328
|
reader,
|
311
329
|
poolNftId,
|
312
330
|
poolOwner,
|
@@ -325,7 +343,7 @@ contract PoolService is
|
|
325
343
|
_checkNftType(bundleNftId, BUNDLE());
|
326
344
|
|
327
345
|
IRegistry registry = getRegistry();
|
328
|
-
NftId poolNftId = registry.
|
346
|
+
NftId poolNftId = registry.getParentNftId(bundleNftId);
|
329
347
|
(, address instanceAddress) = ContractLib.getInfoAndInstance(registry, poolNftId, true);
|
330
348
|
IInstance instance = IInstance(instanceAddress);
|
331
349
|
|
@@ -375,7 +393,7 @@ contract PoolService is
|
|
375
393
|
totalCollateralAmount,
|
376
394
|
localCollateralAmount,
|
377
395
|
poolIsVerifyingApplications
|
378
|
-
) = calculateRequiredCollateral(
|
396
|
+
) = PoolLib.calculateRequiredCollateral(
|
379
397
|
instance.getInstanceReader(),
|
380
398
|
productNftId,
|
381
399
|
sumInsuredAmount);
|
@@ -410,21 +428,24 @@ contract PoolService is
|
|
410
428
|
}
|
411
429
|
|
412
430
|
function processPayout(
|
413
|
-
|
414
|
-
|
431
|
+
InstanceReader instanceReader,
|
432
|
+
InstanceStore instanceStore,
|
433
|
+
NftId productNftId,
|
415
434
|
NftId policyNftId,
|
416
|
-
|
417
|
-
|
435
|
+
NftId bundleNftId,
|
436
|
+
PayoutId payoutId,
|
437
|
+
Amount payoutAmount,
|
438
|
+
address payoutBeneficiary
|
418
439
|
)
|
419
440
|
external
|
420
441
|
virtual
|
421
442
|
restricted()
|
422
443
|
{
|
444
|
+
// checks
|
423
445
|
_checkNftType(policyNftId, POLICY());
|
424
446
|
|
425
|
-
|
426
|
-
NftId poolNftId = getRegistry().
|
427
|
-
InstanceStore instanceStore = instance.getInstanceStore();
|
447
|
+
// effects
|
448
|
+
NftId poolNftId = getRegistry().getParentNftId(bundleNftId);
|
428
449
|
|
429
450
|
_accountingService.decreasePoolBalance(
|
430
451
|
instanceStore,
|
@@ -439,16 +460,121 @@ contract PoolService is
|
|
439
460
|
AmountLib.zero());
|
440
461
|
|
441
462
|
_bundleService.releaseCollateral(
|
442
|
-
|
463
|
+
instanceStore,
|
443
464
|
policyNftId,
|
444
|
-
|
465
|
+
bundleNftId,
|
445
466
|
payoutAmount);
|
446
467
|
|
447
468
|
// update value locked with staking service
|
469
|
+
TokenHandler poolTokenHandler = instanceReader.getTokenHandler(poolNftId);
|
470
|
+
|
448
471
|
_staking.decreaseTotalValueLocked(
|
449
|
-
|
450
|
-
|
472
|
+
instanceReader.getInstanceNftId(),
|
473
|
+
address(poolTokenHandler.TOKEN()),
|
451
474
|
payoutAmount);
|
475
|
+
|
476
|
+
// interactions
|
477
|
+
_transferTokenAndNotifyPolicyHolder(
|
478
|
+
instanceReader,
|
479
|
+
poolTokenHandler,
|
480
|
+
productNftId,
|
481
|
+
policyNftId,
|
482
|
+
payoutId,
|
483
|
+
payoutAmount,
|
484
|
+
payoutBeneficiary);
|
485
|
+
}
|
486
|
+
|
487
|
+
function _transferTokenAndNotifyPolicyHolder(
|
488
|
+
InstanceReader instanceReader,
|
489
|
+
TokenHandler poolTokenHandler,
|
490
|
+
NftId productNftId,
|
491
|
+
NftId policyNftId,
|
492
|
+
PayoutId payoutId,
|
493
|
+
Amount payoutAmount,
|
494
|
+
address payoutBeneficiary
|
495
|
+
)
|
496
|
+
internal
|
497
|
+
{
|
498
|
+
(
|
499
|
+
Amount netPayoutAmount,
|
500
|
+
Amount processingFeeAmount,
|
501
|
+
address beneficiary
|
502
|
+
) = PoolLib.calculatePayoutAmounts(
|
503
|
+
getRegistry(),
|
504
|
+
instanceReader,
|
505
|
+
productNftId,
|
506
|
+
policyNftId,
|
507
|
+
payoutAmount,
|
508
|
+
payoutBeneficiary);
|
509
|
+
|
510
|
+
// 1st token tx to payout to beneficiary
|
511
|
+
poolTokenHandler.pushToken(
|
512
|
+
beneficiary,
|
513
|
+
netPayoutAmount);
|
514
|
+
|
515
|
+
// 2nd token tx to transfer processing fees to product wallet
|
516
|
+
// if processingFeeAmount > 0
|
517
|
+
if (processingFeeAmount.gtz()) {
|
518
|
+
poolTokenHandler.pushToken(
|
519
|
+
instanceReader.getWallet(productNftId),
|
520
|
+
processingFeeAmount);
|
521
|
+
}
|
522
|
+
|
523
|
+
// callback to policy holder if applicable
|
524
|
+
_policyHolderPayoutExecuted(
|
525
|
+
policyNftId,
|
526
|
+
payoutId,
|
527
|
+
beneficiary,
|
528
|
+
netPayoutAmount);
|
529
|
+
}
|
530
|
+
|
531
|
+
|
532
|
+
/// @inheritdoc IPoolService
|
533
|
+
function withdrawBundleFees(
|
534
|
+
NftId bundleNftId,
|
535
|
+
Amount amount
|
536
|
+
)
|
537
|
+
public
|
538
|
+
virtual
|
539
|
+
restricted()
|
540
|
+
returns (Amount withdrawnAmount)
|
541
|
+
{
|
542
|
+
// checks
|
543
|
+
_checkNftType(bundleNftId, BUNDLE());
|
544
|
+
|
545
|
+
(NftId poolNftId, IInstance instance) = _getAndVerifyActivePool();
|
546
|
+
InstanceReader reader = instance.getInstanceReader();
|
547
|
+
|
548
|
+
// determine withdrawn amount
|
549
|
+
withdrawnAmount = amount;
|
550
|
+
if (withdrawnAmount.gte(AmountLib.max())) {
|
551
|
+
withdrawnAmount = reader.getFeeAmount(bundleNftId);
|
552
|
+
} else {
|
553
|
+
if (withdrawnAmount > reader.getFeeAmount(bundleNftId)) {
|
554
|
+
revert ErrorPoolServiceFeesWithdrawAmountExceedsLimit(withdrawnAmount, reader.getFeeAmount(bundleNftId));
|
555
|
+
}
|
556
|
+
}
|
557
|
+
|
558
|
+
// effects
|
559
|
+
// decrease fee counters by withdrawnAmount
|
560
|
+
{
|
561
|
+
InstanceStore store = instance.getInstanceStore();
|
562
|
+
// decrease fee amount of the bundle
|
563
|
+
_accountingService.decreaseBundleBalanceForPool(store, bundleNftId, AmountLib.zero(), withdrawnAmount);
|
564
|
+
// decrease pool balance
|
565
|
+
_accountingService.decreasePoolBalance(store, poolNftId, withdrawnAmount, AmountLib.zero());
|
566
|
+
}
|
567
|
+
|
568
|
+
// interactions
|
569
|
+
// transfer amount to bundle owner
|
570
|
+
{
|
571
|
+
address bundleOwner = getRegistry().ownerOf(bundleNftId);
|
572
|
+
TokenHandler tokenHandler = reader.getTokenHandler(poolNftId);
|
573
|
+
address token = address(tokenHandler.TOKEN());
|
574
|
+
emit LogPoolServiceFeesWithdrawn(bundleNftId, bundleOwner, token, withdrawnAmount);
|
575
|
+
|
576
|
+
tokenHandler.pushToken(bundleOwner, withdrawnAmount);
|
577
|
+
}
|
452
578
|
}
|
453
579
|
|
454
580
|
|
@@ -456,7 +582,6 @@ contract PoolService is
|
|
456
582
|
/// may only be called by the policy service for unlocked pool components
|
457
583
|
function releaseCollateral(
|
458
584
|
IInstance instance,
|
459
|
-
address token,
|
460
585
|
NftId policyNftId,
|
461
586
|
IPolicy.PolicyInfo memory policyInfo
|
462
587
|
)
|
@@ -469,93 +594,97 @@ contract PoolService is
|
|
469
594
|
Amount remainingCollateralAmount = policyInfo.sumInsuredAmount - policyInfo.claimAmount;
|
470
595
|
|
471
596
|
_bundleService.releaseCollateral(
|
472
|
-
instance,
|
597
|
+
instance.getInstanceStore(),
|
473
598
|
policyNftId,
|
474
599
|
policyInfo.bundleNftId,
|
475
600
|
remainingCollateralAmount);
|
476
601
|
|
477
602
|
// update value locked with staking service
|
603
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
478
604
|
_staking.decreaseTotalValueLocked(
|
479
|
-
|
480
|
-
|
605
|
+
instanceReader.getInstanceNftId(),
|
606
|
+
address(instanceReader.getToken(policyInfo.productNftId)),
|
481
607
|
remainingCollateralAmount);
|
482
608
|
}
|
483
609
|
|
484
610
|
|
485
|
-
function calculateRequiredCollateral(
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
)
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
{
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
611
|
+
// function calculateRequiredCollateral(
|
612
|
+
// InstanceReader instanceReader,
|
613
|
+
// NftId productNftId,
|
614
|
+
// Amount sumInsuredAmount
|
615
|
+
// )
|
616
|
+
// public
|
617
|
+
// view
|
618
|
+
// returns(
|
619
|
+
// NftId poolNftId,
|
620
|
+
// Amount totalCollateralAmount,
|
621
|
+
// Amount localCollateralAmount,
|
622
|
+
// bool poolIsVerifyingApplications
|
623
|
+
// )
|
624
|
+
// {
|
625
|
+
// return CollateralLib.calculateRequiredCollateral(
|
626
|
+
// instanceReader,
|
627
|
+
// productNftId,
|
628
|
+
// sumInsuredAmount);
|
629
|
+
// }
|
630
|
+
|
631
|
+
// _checkNftType(productNftId, PRODUCT());
|
632
|
+
|
633
|
+
// poolNftId = instanceReader.getProductInfo(productNftId).poolNftId;
|
634
|
+
// IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
|
635
|
+
// poolIsVerifyingApplications = poolInfo.isVerifyingApplications;
|
636
|
+
|
637
|
+
// (
|
638
|
+
// totalCollateralAmount,
|
639
|
+
// localCollateralAmount
|
640
|
+
// ) = calculateRequiredCollateral(
|
641
|
+
// poolInfo.collateralizationLevel,
|
642
|
+
// poolInfo.retentionLevel,
|
643
|
+
// sumInsuredAmount);
|
644
|
+
// }
|
645
|
+
|
646
|
+
|
647
|
+
// function calculateRequiredCollateral(
|
648
|
+
// UFixed collateralizationLevel,
|
649
|
+
// UFixed retentionLevel,
|
650
|
+
// Amount sumInsuredAmount
|
651
|
+
// )
|
652
|
+
// public
|
653
|
+
// pure
|
654
|
+
// returns(
|
655
|
+
// Amount totalCollateralAmount,
|
656
|
+
// Amount localCollateralAmount
|
657
|
+
// )
|
658
|
+
// {
|
659
|
+
// // collateralization is applied to sum insured
|
660
|
+
// UFixed totalUFixed = collateralizationLevel * sumInsuredAmount.toUFixed();
|
661
|
+
// totalCollateralAmount = AmountLib.toAmount(totalUFixed.toInt());
|
662
|
+
|
663
|
+
// // retention level defines how much capital is required locally
|
664
|
+
// localCollateralAmount = AmountLib.toAmount(
|
665
|
+
// (retentionLevel * totalUFixed).toInt());
|
666
|
+
// }
|
667
|
+
|
668
|
+
|
669
|
+
|
670
|
+
|
671
|
+
function _policyHolderPayoutExecuted(
|
672
|
+
NftId policyNftId,
|
673
|
+
PayoutId payoutId,
|
674
|
+
address beneficiary,
|
675
|
+
Amount payoutAmount
|
540
676
|
)
|
541
677
|
internal
|
542
|
-
pure
|
543
|
-
returns (Amount stakingNetAmount)
|
544
678
|
{
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
if (FeeLib.gtz(stakingFee)) {
|
549
|
-
(Amount feeAmount, Amount netAmount) = FeeLib.calculateFee(stakingFee, stakingAmount);
|
550
|
-
stakingNetAmount = netAmount;
|
551
|
-
|
552
|
-
// TODO update fee balance for pool
|
679
|
+
IPolicyHolder policyHolder = PoolLib.getPolicyHolder(getRegistry(), policyNftId);
|
680
|
+
if(address(policyHolder) != address(0)) {
|
681
|
+
policyHolder.payoutExecuted(policyNftId, payoutId, payoutAmount, beneficiary);
|
553
682
|
}
|
554
683
|
}
|
555
684
|
|
556
685
|
|
557
|
-
/// @dev
|
558
|
-
function
|
686
|
+
/// @dev Transfers the specified amount from the "from account" to the pool's wallet
|
687
|
+
function _pullStakingAmount(
|
559
688
|
InstanceReader reader,
|
560
689
|
NftId poolNftId,
|
561
690
|
address from,
|
@@ -564,13 +693,13 @@ contract PoolService is
|
|
564
693
|
internal
|
565
694
|
{
|
566
695
|
IComponents.ComponentInfo memory info = reader.getComponentInfo(poolNftId);
|
567
|
-
info.tokenHandler.
|
696
|
+
info.tokenHandler.pullToken(
|
568
697
|
from,
|
569
698
|
amount);
|
570
699
|
}
|
571
700
|
|
572
|
-
/// @dev
|
573
|
-
function
|
701
|
+
/// @dev Transfers the specified amount from the pool's wallet to the "to account"
|
702
|
+
function _pushUnstakingAmount(
|
574
703
|
InstanceReader reader,
|
575
704
|
NftId poolNftId,
|
576
705
|
address to,
|
@@ -579,8 +708,7 @@ contract PoolService is
|
|
579
708
|
internal
|
580
709
|
{
|
581
710
|
IComponents.ComponentInfo memory info = reader.getComponentInfo(poolNftId);
|
582
|
-
info.tokenHandler.
|
583
|
-
info.tokenHandler.getWallet(),
|
711
|
+
info.tokenHandler.pushToken(
|
584
712
|
to,
|
585
713
|
amount);
|
586
714
|
}
|
@@ -595,19 +723,31 @@ contract PoolService is
|
|
595
723
|
IInstance instance
|
596
724
|
)
|
597
725
|
{
|
598
|
-
(
|
599
|
-
IRegistry.ObjectInfo memory info,
|
600
|
-
address instanceAddress
|
601
|
-
) = ContractLib.getAndVerifyComponent(
|
602
|
-
getRegistry(),
|
603
|
-
msg.sender,
|
604
|
-
POOL(),
|
605
|
-
true); // only active pools
|
606
|
-
|
607
|
-
poolNftId = info.nftId;
|
608
|
-
instance = IInstance(instanceAddress);
|
726
|
+
return PoolLib.getAndVerifyActivePool(getRegistry(), msg.sender);
|
609
727
|
}
|
610
728
|
|
729
|
+
// function _getAndVerifyActivePool()
|
730
|
+
// internal
|
731
|
+
// virtual
|
732
|
+
// view
|
733
|
+
// returns (
|
734
|
+
// NftId poolNftId,
|
735
|
+
// IInstance instance
|
736
|
+
// )
|
737
|
+
// {
|
738
|
+
// (
|
739
|
+
// IRegistry.ObjectInfo memory info,
|
740
|
+
// address instanceAddress
|
741
|
+
// ) = ContractLib.getAndVerifyComponent(
|
742
|
+
// getRegistry(),
|
743
|
+
// msg.sender,
|
744
|
+
// POOL(),
|
745
|
+
// true); // only active pools
|
746
|
+
|
747
|
+
// poolNftId = info.nftId;
|
748
|
+
// instance = IInstance(instanceAddress);
|
749
|
+
// }
|
750
|
+
|
611
751
|
|
612
752
|
function _getDomain() internal pure override returns(ObjectType) {
|
613
753
|
return POOL();
|
@@ -17,7 +17,7 @@ contract PoolServiceManager is ProxyManager {
|
|
17
17
|
)
|
18
18
|
{
|
19
19
|
PoolService poolSrv = new PoolService{salt: salt}();
|
20
|
-
bytes memory data = abi.encode(
|
20
|
+
bytes memory data = abi.encode(authority, registry);
|
21
21
|
IVersionable versionable = initialize(
|
22
22
|
registry,
|
23
23
|
address(poolSrv),
|