@etherisc/gif-next 0.0.2-ac2f4a6-957 → 0.0.2-ac4bee9-682
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/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +2 -2
- 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/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.dbg.json +1 -1
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +32 -110
- 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 +8 -38
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +110 -78
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +78 -46
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +11 -23
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- 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 +38 -147
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +49 -17
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +92 -190
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +2 -2
- 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 +43 -84
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +33 -87
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +155 -141
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +391 -205
- 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/IInstanceService.sol/IInstanceService.json +2 -2
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +18 -2
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +4 -4
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +2 -2
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +69 -74
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +21 -5
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +46 -22
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +36 -46
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
- 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/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
- 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/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +22 -100
- 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 +11 -23
- 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 +8 -38
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +32 -16
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +46 -22
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +8 -53
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +49 -17
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +115 -111
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +67 -51
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +19 -15
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +11 -62
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +77 -75
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +8 -77
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +139 -129
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +53 -33
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +20 -4
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +43 -19
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +13 -38
- 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 +74 -66
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +67 -47
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +7 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +16 -23
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +71 -57
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +55 -35
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +54 -38
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +56 -32
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +13 -38
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +18 -2
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +40 -16
- 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 +24 -0
- 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 +62 -38
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +107 -94
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +32 -16
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +39 -15
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +12 -12
- 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 +8 -38
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +145 -70
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +62 -42
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +21 -2
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponent.sol/IComponent.json +11 -23
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +67 -0
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +11 -23
- 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/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +8 -38
- 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/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 +2 -2
- 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/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +388 -35
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +395 -0
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +88 -24
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +29 -59
- 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 +2 -2
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +80 -152
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +50 -46
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +2 -2
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +36 -20
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +43 -19
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2 -2
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +2 -2
- 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/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- 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/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +2 -2
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
- 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/SelectorSetLib.dbg.json +1 -1
- 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/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 +18 -2
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
- package/contracts/distribution/DistributionService.sol +5 -5
- package/contracts/examples/fire/FirePool.sol +19 -8
- package/contracts/examples/fire/FireProduct.sol +24 -11
- package/contracts/examples/unpermissioned/SimpleDistribution.sol +8 -0
- package/contracts/examples/unpermissioned/SimplePool.sol +34 -2
- package/contracts/examples/unpermissioned/SimpleProduct.sol +15 -21
- package/contracts/instance/IInstanceService.sol +2 -3
- package/contracts/instance/InstanceAdmin.sol +3 -3
- package/contracts/instance/InstanceReader.sol +1 -1
- package/contracts/instance/InstanceService.sol +15 -12
- package/contracts/instance/module/IComponents.sol +1 -2
- package/contracts/instance/module/IPolicy.sol +2 -1
- package/contracts/oracle/OracleService.sol +10 -9
- package/contracts/pool/BasicPool.sol +24 -3
- package/contracts/pool/BasicPoolAuthorization.sol +12 -1
- package/contracts/pool/BundleService.sol +14 -22
- package/contracts/pool/IBundleService.sol +2 -5
- package/contracts/pool/IPoolComponent.sol +1 -7
- package/contracts/pool/IPoolService.sol +23 -18
- package/contracts/pool/Pool.sol +112 -102
- package/contracts/pool/PoolService.sol +150 -74
- package/contracts/product/BasicProduct.sol +7 -11
- package/contracts/product/ClaimService.sol +3 -1
- package/contracts/product/IPolicyService.sol +3 -1
- package/contracts/product/PolicyService.sol +26 -14
- package/contracts/product/PricingService.sol +4 -1
- package/contracts/product/Product.sol +10 -33
- package/contracts/registry/IRegistry.sol +2 -0
- package/contracts/registry/Registry.sol +9 -1
- package/contracts/registry/RegistryAdmin.sol +22 -8
- package/contracts/registry/ReleaseRegistry.sol +2 -18
- package/contracts/registry/ServiceAuthorizationV3.sol +10 -1
- package/contracts/shared/Component.sol +45 -81
- package/contracts/shared/ComponentService.sol +62 -18
- package/contracts/shared/ComponentVerifyingService.sol +15 -13
- package/contracts/shared/ContractLib.sol +17 -1
- package/contracts/shared/IComponent.sol +5 -12
- package/contracts/shared/IComponentService.sol +13 -3
- package/contracts/shared/InstanceLinkedComponent.sol +1 -9
- package/contracts/shared/Registerable.sol +0 -2
- package/contracts/shared/RegistryLinked.sol +6 -12
- package/contracts/shared/TokenHandler.sol +324 -66
- package/contracts/shared/TokenHandlerDeployerLib.sol +10 -2
- package/contracts/staking/IStaking.sol +9 -4
- package/contracts/staking/Staking.sol +29 -21
- package/contracts/staking/StakingService.sol +68 -8
- package/contracts/type/RiskId.sol +1 -1
- package/package.json +3 -3
package/contracts/pool/Pool.sol
CHANGED
@@ -11,12 +11,13 @@ import {IPoolService} from "./IPoolService.sol";
|
|
11
11
|
import {IComponents} from "../instance/module/IComponents.sol";
|
12
12
|
import {IComponentService} from "../shared/IComponentService.sol";
|
13
13
|
import {InstanceLinkedComponent} from "../shared/InstanceLinkedComponent.sol";
|
14
|
+
import {InstanceReader} from "../instance/InstanceReader.sol";
|
14
15
|
import {Fee} from "../type/Fee.sol";
|
15
16
|
import {NftId} from "../type/NftId.sol";
|
16
17
|
import {RoleId, PUBLIC_ROLE} from "../type/RoleId.sol";
|
17
18
|
import {Seconds} from "../type/Seconds.sol";
|
18
19
|
import {Timestamp} from "../type/Timestamp.sol";
|
19
|
-
import {
|
20
|
+
import {UFixed} from "../type/UFixed.sol";
|
20
21
|
|
21
22
|
abstract contract Pool is
|
22
23
|
InstanceLinkedComponent,
|
@@ -26,6 +27,7 @@ abstract contract Pool is
|
|
26
27
|
bytes32 public constant POOL_STORAGE_LOCATION_V1 = 0x25e3e51823fbfffb988e0a2744bb93722d9f3e906c07cc0a9e77884c46c58300;
|
27
28
|
|
28
29
|
struct PoolStorage {
|
30
|
+
IComponents.PoolInfo _poolInfo;
|
29
31
|
IComponentService _componentService;
|
30
32
|
IPoolService _poolService;
|
31
33
|
IBundleService _bundleService;
|
@@ -40,12 +42,16 @@ abstract contract Pool is
|
|
40
42
|
}
|
41
43
|
|
42
44
|
|
45
|
+
// TODO remove function once this is no longer used to produce contract locations on the fly ...
|
46
|
+
function getContractLocation(bytes memory name) external pure returns (bytes32 hash) {
|
47
|
+
return keccak256(abi.encode(uint256(keccak256(name)) - 1)) & ~bytes32(uint256(0xff));
|
48
|
+
}
|
49
|
+
|
50
|
+
|
43
51
|
/// @dev see {IPoolComponent.verifyApplication}
|
44
52
|
function verifyApplication(
|
45
53
|
NftId applicationNftId,
|
46
|
-
bytes memory applicationData,
|
47
54
|
NftId bundleNftId,
|
48
|
-
bytes memory bundleFilter,
|
49
55
|
Amount collateralizationAmount
|
50
56
|
)
|
51
57
|
public
|
@@ -53,11 +59,12 @@ abstract contract Pool is
|
|
53
59
|
restricted()
|
54
60
|
onlyNftOfType(applicationNftId, POLICY())
|
55
61
|
{
|
62
|
+
InstanceReader reader = _getInstanceReader();
|
56
63
|
if(!applicationMatchesBundle(
|
57
64
|
applicationNftId,
|
58
|
-
applicationData,
|
65
|
+
reader.getPolicyInfo(applicationNftId).applicationData,
|
59
66
|
bundleNftId,
|
60
|
-
|
67
|
+
reader.getBundleInfo(bundleNftId).filter,
|
61
68
|
collateralizationAmount)
|
62
69
|
)
|
63
70
|
{
|
@@ -84,8 +91,9 @@ abstract contract Pool is
|
|
84
91
|
|
85
92
|
|
86
93
|
/// @dev see {IPoolComponent.applicationMatchesBundle}
|
87
|
-
///
|
88
|
-
///
|
94
|
+
/// Default implementation always returns true.
|
95
|
+
/// Override this function to implement any custom application verification.
|
96
|
+
/// Calling super.applicationMatchesBundle will ensure validation of application and bundle nft ids.
|
89
97
|
function applicationMatchesBundle(
|
90
98
|
NftId applicationNftId,
|
91
99
|
bytes memory applicationData,
|
@@ -103,18 +111,6 @@ abstract contract Pool is
|
|
103
111
|
return true;
|
104
112
|
}
|
105
113
|
|
106
|
-
/// @inheritdoc IPoolComponent
|
107
|
-
function withdrawBundleFees(NftId bundleNftId, Amount amount)
|
108
|
-
external
|
109
|
-
virtual
|
110
|
-
restricted()
|
111
|
-
onlyBundleOwner(bundleNftId)
|
112
|
-
onlyNftOfType(bundleNftId, BUNDLE())
|
113
|
-
returns (Amount withdrawnAmount)
|
114
|
-
{
|
115
|
-
return _withdrawBundleFees(bundleNftId, amount);
|
116
|
-
}
|
117
|
-
|
118
114
|
|
119
115
|
function getInitialPoolInfo()
|
120
116
|
public
|
@@ -122,16 +118,7 @@ abstract contract Pool is
|
|
122
118
|
view
|
123
119
|
returns (IComponents.PoolInfo memory poolInfo)
|
124
120
|
{
|
125
|
-
return
|
126
|
-
maxBalanceAmount: AmountLib.max(),
|
127
|
-
bundleOwnerRole: PUBLIC_ROLE(),
|
128
|
-
isInterceptingBundleTransfers: isNftInterceptor(),
|
129
|
-
isProcessingConfirmedClaims: false,
|
130
|
-
isExternallyManaged: false,
|
131
|
-
isVerifyingApplications: false,
|
132
|
-
collateralizationLevel: UFixedLib.toUFixed(1),
|
133
|
-
retentionLevel: UFixedLib.toUFixed(1)
|
134
|
-
});
|
121
|
+
return _getPoolStorage()._poolInfo;
|
135
122
|
}
|
136
123
|
|
137
124
|
// Internals
|
@@ -141,8 +128,8 @@ abstract contract Pool is
|
|
141
128
|
NftId productNftId,
|
142
129
|
string memory name,
|
143
130
|
address token,
|
131
|
+
IComponents.PoolInfo memory poolInfo,
|
144
132
|
IAuthorization authorization,
|
145
|
-
bool isInterceptingNftTransfers,
|
146
133
|
address initialOwner,
|
147
134
|
bytes memory componentData // component specifidc data
|
148
135
|
)
|
@@ -157,11 +144,13 @@ abstract contract Pool is
|
|
157
144
|
token,
|
158
145
|
POOL(),
|
159
146
|
authorization,
|
160
|
-
|
147
|
+
poolInfo.isInterceptingBundleTransfers,
|
161
148
|
initialOwner,
|
162
149
|
componentData);
|
163
150
|
|
164
151
|
PoolStorage storage $ = _getPoolStorage();
|
152
|
+
|
153
|
+
$._poolInfo = poolInfo;
|
165
154
|
$._poolService = IPoolService(_getServiceAddress(POOL()));
|
166
155
|
$._bundleService = IBundleService(_getServiceAddress(BUNDLE()));
|
167
156
|
$._componentService = IComponentService(_getServiceAddress(COMPONENT()));
|
@@ -169,6 +158,97 @@ abstract contract Pool is
|
|
169
158
|
_registerInterface(type(IPoolComponent).interfaceId);
|
170
159
|
}
|
171
160
|
|
161
|
+
|
162
|
+
/// @dev Update pool fees to the specified values.
|
163
|
+
/// Pool fee: are deducted from the premium amount and goes to the pool owner.
|
164
|
+
/// Staking fee: are deducted from the staked tokens by a bundle owner and goes to the pool owner.
|
165
|
+
/// Performance fee: when a bundle is closed a bundle specific profit is calculated.
|
166
|
+
/// The performance fee is deducted from this profit and goes to the pool owner.
|
167
|
+
function _setPoolFees(
|
168
|
+
Fee memory poolFee,
|
169
|
+
Fee memory stakingFee,
|
170
|
+
Fee memory performanceFee
|
171
|
+
)
|
172
|
+
internal
|
173
|
+
virtual
|
174
|
+
{
|
175
|
+
_getPoolStorage()._componentService.setPoolFees(poolFee, stakingFee, performanceFee);
|
176
|
+
}
|
177
|
+
|
178
|
+
|
179
|
+
/// @dev Sets the maximum balance amound held by this pool.
|
180
|
+
/// Function may only be called by pool owner.
|
181
|
+
function _setMaxBalanceAmount(Amount maxBalanceAmount)
|
182
|
+
internal
|
183
|
+
virtual
|
184
|
+
{
|
185
|
+
_getPoolStorage()._poolService.setMaxBalanceAmount(maxBalanceAmount);
|
186
|
+
}
|
187
|
+
|
188
|
+
|
189
|
+
/// @dev Fund the pool wallet with the specified amount.
|
190
|
+
/// Function is only available for externally managed pools.
|
191
|
+
function _fundPoolWallet(Amount amount)
|
192
|
+
internal
|
193
|
+
virtual
|
194
|
+
{
|
195
|
+
_getPoolStorage()._poolService.fundPoolWallet(amount);
|
196
|
+
}
|
197
|
+
|
198
|
+
|
199
|
+
/// @dev Withdraw the specified amount from the pool wallet.
|
200
|
+
/// Function is only available for externally managed pools.
|
201
|
+
function _defundPoolWallet(Amount amount)
|
202
|
+
internal
|
203
|
+
virtual
|
204
|
+
{
|
205
|
+
_getPoolStorage()._poolService.defundPoolWallet(amount);
|
206
|
+
}
|
207
|
+
|
208
|
+
|
209
|
+
/// @dev Creates a new empty bundle using the provided parameter values.
|
210
|
+
function _createBundle(
|
211
|
+
address bundleOwner,
|
212
|
+
Fee memory fee,
|
213
|
+
Seconds lifetime,
|
214
|
+
bytes memory filter
|
215
|
+
)
|
216
|
+
internal
|
217
|
+
returns(NftId bundleNftId)
|
218
|
+
{
|
219
|
+
bundleNftId = _getPoolStorage()._bundleService.create(
|
220
|
+
bundleOwner,
|
221
|
+
fee,
|
222
|
+
lifetime,
|
223
|
+
filter);
|
224
|
+
|
225
|
+
// TODO add logging
|
226
|
+
}
|
227
|
+
|
228
|
+
|
229
|
+
/// @dev Sets the fee for the specified bundle.
|
230
|
+
/// The fee is added on top of the poolFee and deducted from the premium amounts
|
231
|
+
/// Via these fees individual bundler owner may earn income per policy in the context of peer to peer pools.
|
232
|
+
function _setBundleFee(
|
233
|
+
NftId bundleNftId,
|
234
|
+
Fee memory fee
|
235
|
+
)
|
236
|
+
internal
|
237
|
+
virtual
|
238
|
+
{
|
239
|
+
_getPoolStorage()._bundleService.setFee(bundleNftId, fee);
|
240
|
+
}
|
241
|
+
|
242
|
+
|
243
|
+
/// @dev Withdraws the specified amount of fees from the bundle.
|
244
|
+
function _withdrawBundleFees(NftId bundleNftId, Amount amount)
|
245
|
+
internal
|
246
|
+
returns (Amount withdrawnAmount)
|
247
|
+
{
|
248
|
+
return _getPoolStorage()._bundleService.withdrawBundleFees(bundleNftId, amount);
|
249
|
+
}
|
250
|
+
|
251
|
+
|
172
252
|
/// @dev increases the staked tokens by the specified amount
|
173
253
|
/// bundle MUST be in active or locked state
|
174
254
|
function _stake(
|
@@ -245,77 +325,6 @@ abstract contract Pool is
|
|
245
325
|
}
|
246
326
|
|
247
327
|
|
248
|
-
/// @dev Sets the fee for the specified bundle.
|
249
|
-
/// The fee is added on top of the poolFee and deducted from the premium amounts
|
250
|
-
/// Via these fees individual bundler owner may earn income per policy in the context of peer to peer pools.
|
251
|
-
function _setBundleFee(
|
252
|
-
NftId bundleNftId,
|
253
|
-
Fee memory fee
|
254
|
-
)
|
255
|
-
internal
|
256
|
-
virtual
|
257
|
-
{
|
258
|
-
_getPoolStorage()._bundleService.setFee(bundleNftId, fee);
|
259
|
-
}
|
260
|
-
|
261
|
-
|
262
|
-
/// @dev Sets the maximum balance amound held by this pool.
|
263
|
-
/// Function may only be called by pool owner.
|
264
|
-
function _setMaxBalanceAmount(Amount maxBalanceAmount)
|
265
|
-
internal
|
266
|
-
virtual
|
267
|
-
{
|
268
|
-
_getPoolStorage()._poolService.setMaxBalanceAmount(maxBalanceAmount);
|
269
|
-
}
|
270
|
-
|
271
|
-
|
272
|
-
/// @dev Update pool fees to the specified values.
|
273
|
-
/// Pool fee: are deducted from the premium amount and goes to the pool owner.
|
274
|
-
/// Staking fee: are deducted from the staked tokens by a bundle owner and goes to the pool owner.
|
275
|
-
/// Performance fee: when a bundle is closed a bundle specific profit is calculated.
|
276
|
-
/// The performance fee is deducted from this profit and goes to the pool owner.
|
277
|
-
function _setPoolFees(
|
278
|
-
Fee memory poolFee,
|
279
|
-
Fee memory stakingFee,
|
280
|
-
Fee memory performanceFee
|
281
|
-
)
|
282
|
-
internal
|
283
|
-
virtual
|
284
|
-
{
|
285
|
-
_getPoolStorage()._componentService.setPoolFees(poolFee, stakingFee, performanceFee);
|
286
|
-
}
|
287
|
-
|
288
|
-
/// @dev Creates a new empty bundle using the provided parameter values.
|
289
|
-
function _createBundle(
|
290
|
-
address bundleOwner,
|
291
|
-
Fee memory fee,
|
292
|
-
Seconds lifetime,
|
293
|
-
bytes memory filter
|
294
|
-
)
|
295
|
-
internal
|
296
|
-
returns(NftId bundleNftId)
|
297
|
-
{
|
298
|
-
bundleNftId = _getPoolStorage()._poolService.createBundle(
|
299
|
-
bundleOwner,
|
300
|
-
fee,
|
301
|
-
lifetime,
|
302
|
-
filter);
|
303
|
-
|
304
|
-
// TODO add logging
|
305
|
-
}
|
306
|
-
|
307
|
-
// TODO remove function once this is no longer used to produce contract locations on the fly ...
|
308
|
-
function getContractLocation(bytes memory name) external pure returns (bytes32 hash) {
|
309
|
-
return keccak256(abi.encode(uint256(keccak256(name)) - 1)) & ~bytes32(uint256(0xff));
|
310
|
-
}
|
311
|
-
|
312
|
-
function _withdrawBundleFees(NftId bundleNftId, Amount amount)
|
313
|
-
internal
|
314
|
-
returns (Amount withdrawnAmount)
|
315
|
-
{
|
316
|
-
return _getPoolStorage()._bundleService.withdrawBundleFees(bundleNftId, amount);
|
317
|
-
}
|
318
|
-
|
319
328
|
function _processFundedClaim(
|
320
329
|
NftId policyNftId,
|
321
330
|
ClaimId claimId,
|
@@ -327,6 +336,7 @@ abstract contract Pool is
|
|
327
336
|
policyNftId, claimId, availableAmount);
|
328
337
|
}
|
329
338
|
|
339
|
+
|
330
340
|
function _getPoolStorage() private pure returns (PoolStorage storage $) {
|
331
341
|
assembly {
|
332
342
|
$.slot := POOL_STORAGE_LOCATION_V1
|
@@ -7,8 +7,9 @@ import {IComponents} from "../instance/module/IComponents.sol";
|
|
7
7
|
import {IComponentService} from "../shared/IComponentService.sol";
|
8
8
|
import {IInstance} from "../instance/IInstance.sol";
|
9
9
|
import {IPolicy} from "../instance/module/IPolicy.sol";
|
10
|
-
import {
|
10
|
+
import {IPoolComponent} from "../pool/IPoolComponent.sol";
|
11
11
|
import {IPoolService} from "./IPoolService.sol";
|
12
|
+
import {IProductComponent} from "../product/IProductComponent.sol";
|
12
13
|
import {IRegistry} from "../registry/IRegistry.sol";
|
13
14
|
import {IStaking} from "../staking/IStaking.sol";
|
14
15
|
|
@@ -74,32 +75,31 @@ contract PoolService is
|
|
74
75
|
emit LogPoolServiceMaxBalanceAmountUpdated(poolNftId, previousMaxBalanceAmount, maxBalanceAmount);
|
75
76
|
}
|
76
77
|
|
77
|
-
|
78
|
-
/// @inheritdoc IPoolService
|
79
|
-
function createBundle(
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
)
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
{
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
}
|
78
|
+
// TODO cleanup
|
79
|
+
// /// @inheritdoc IPoolService
|
80
|
+
// function createBundle(
|
81
|
+
// address bundleOwner, // initial bundle owner
|
82
|
+
// Fee memory fee, // fees deducted from premium that go to bundle owner
|
83
|
+
// Seconds lifetime, // initial duration for which new policies are covered
|
84
|
+
// bytes calldata filter // optional use case specific criteria that define if a policy may be covered by this bundle
|
85
|
+
// )
|
86
|
+
// external
|
87
|
+
// virtual
|
88
|
+
// returns(NftId bundleNftId)
|
89
|
+
// {
|
90
|
+
// (NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
91
|
+
|
92
|
+
// // create the empty bundle
|
93
|
+
// bundleNftId = _bundleService.create(
|
94
|
+
// instance,
|
95
|
+
// poolNftId,
|
96
|
+
// bundleOwner,
|
97
|
+
// fee,
|
98
|
+
// lifetime,
|
99
|
+
// filter);
|
100
|
+
|
101
|
+
// emit LogPoolServiceBundleCreated(instance.getNftId(), poolNftId, bundleNftId);
|
102
|
+
// }
|
103
103
|
|
104
104
|
|
105
105
|
function closeBundle(NftId bundleNftId)
|
@@ -126,7 +126,7 @@ contract PoolService is
|
|
126
126
|
if ((unstakedAmount + feeAmount).gtz()){
|
127
127
|
IComponents.ComponentInfo memory poolComponentInfo = instance.getInstanceReader().getComponentInfo(poolNftId);
|
128
128
|
poolComponentInfo.tokenHandler.distributeTokens(
|
129
|
-
poolComponentInfo.
|
129
|
+
poolComponentInfo.tokenHandler.getWallet(),
|
130
130
|
getRegistry().ownerOf(bundleNftId),
|
131
131
|
unstakedAmount + feeAmount);
|
132
132
|
}
|
@@ -207,7 +207,7 @@ contract PoolService is
|
|
207
207
|
amount);
|
208
208
|
}
|
209
209
|
|
210
|
-
// do all the
|
210
|
+
// do all the book keeping
|
211
211
|
_componentService.increasePoolBalance(
|
212
212
|
instance.getInstanceStore(),
|
213
213
|
poolNftId,
|
@@ -216,18 +216,22 @@ contract PoolService is
|
|
216
216
|
|
217
217
|
_bundleService.stake(instance, bundleNftId, netAmount);
|
218
218
|
|
219
|
-
// collect tokens from bundle owner
|
220
|
-
address bundleOwner = registry.ownerOf(bundleNftId);
|
221
219
|
emit LogPoolServiceBundleStaked(instance.getNftId(), poolNftId, bundleNftId, amount, netAmount);
|
222
220
|
|
223
|
-
//
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
bundleOwner
|
228
|
-
|
221
|
+
// only collect staking amount when pool is not externally managed
|
222
|
+
if (!poolInfo.isExternallyManaged) {
|
223
|
+
|
224
|
+
// collect tokens from bundle owner
|
225
|
+
address bundleOwner = getRegistry().ownerOf(bundleNftId);
|
226
|
+
_collectStakingAmount(
|
227
|
+
instanceReader,
|
228
|
+
poolNftId,
|
229
|
+
bundleOwner,
|
230
|
+
amount);
|
231
|
+
}
|
229
232
|
}
|
230
233
|
|
234
|
+
|
231
235
|
/// @inheritdoc IPoolService
|
232
236
|
function unstake(NftId bundleNftId, Amount amount)
|
233
237
|
external
|
@@ -241,7 +245,7 @@ contract PoolService is
|
|
241
245
|
InstanceReader instanceReader = instance.getInstanceReader();
|
242
246
|
InstanceStore instanceStore = instance.getInstanceStore();
|
243
247
|
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
244
|
-
|
248
|
+
|
245
249
|
if (bundleInfo.poolNftId != poolNftId) {
|
246
250
|
revert ErrorPoolServiceBundlePoolMismatch(bundleNftId, poolNftId);
|
247
251
|
}
|
@@ -253,6 +257,7 @@ contract PoolService is
|
|
253
257
|
// if amount was max, this was set to the available amount
|
254
258
|
|
255
259
|
// TODO: handle performance fees (issue #477)
|
260
|
+
netAmount = unstakedAmount;
|
256
261
|
|
257
262
|
// update pool bookkeeping - performance fees stay in the pool, but as fees
|
258
263
|
_componentService.decreasePoolBalance(
|
@@ -261,42 +266,77 @@ contract PoolService is
|
|
261
266
|
unstakedAmount,
|
262
267
|
AmountLib.zero());
|
263
268
|
|
264
|
-
IComponents.ComponentInfo memory poolComponentInfo = instanceReader.getComponentInfo(poolNftId);
|
265
269
|
|
266
|
-
|
267
|
-
address owner = getRegistry().ownerOf(bundleNftId);
|
268
|
-
emit LogPoolServiceBundleUnstaked(instance.getNftId(), poolNftId, bundleNftId, unstakedAmount);
|
269
|
-
poolComponentInfo.tokenHandler.distributeTokens(
|
270
|
-
poolComponentInfo.wallet,
|
271
|
-
owner,
|
272
|
-
unstakedAmount);
|
270
|
+
emit LogPoolServiceBundleUnstaked(instance.getNftId(), poolNftId, bundleNftId, unstakedAmount, netAmount);
|
273
271
|
|
274
|
-
|
272
|
+
// only distribute staking amount when pool is not externally managed
|
273
|
+
if (!instanceReader.getPoolInfo(poolNftId).isExternallyManaged) {
|
274
|
+
|
275
|
+
// transfer amount to bundle owner
|
276
|
+
address bundleOwner = getRegistry().ownerOf(bundleNftId);
|
277
|
+
_distributeUnstakingAmount(
|
278
|
+
instanceReader,
|
279
|
+
poolNftId,
|
280
|
+
bundleOwner,
|
281
|
+
netAmount);
|
282
|
+
}
|
275
283
|
}
|
276
284
|
|
277
285
|
|
278
|
-
function fundPoolWallet(
|
286
|
+
function fundPoolWallet(Amount amount)
|
279
287
|
external
|
280
288
|
virtual
|
281
|
-
restricted()
|
289
|
+
// restricted()
|
282
290
|
{
|
283
|
-
|
284
|
-
|
285
|
-
|
291
|
+
(
|
292
|
+
NftId poolNftId,,
|
293
|
+
IInstance instance
|
294
|
+
) = _getAndVerifyActiveComponent(POOL());
|
295
|
+
|
296
|
+
// check that pool is externally managed
|
297
|
+
InstanceReader reader = instance.getInstanceReader();
|
298
|
+
if (!reader.getPoolInfo(poolNftId).isExternallyManaged) {
|
299
|
+
revert ErrorPoolServicePoolNotExternallyManaged(poolNftId);
|
300
|
+
}
|
301
|
+
|
302
|
+
address poolOwner = getRegistry().ownerOf(poolNftId);
|
303
|
+
emit LogPoolServiceWalletFunded(poolNftId, poolOwner, amount);
|
304
|
+
|
305
|
+
_collectStakingAmount(
|
306
|
+
reader,
|
307
|
+
poolNftId,
|
308
|
+
poolOwner,
|
309
|
+
amount);
|
286
310
|
}
|
287
311
|
|
288
312
|
|
289
|
-
function defundPoolWallet(
|
313
|
+
function defundPoolWallet(Amount amount)
|
290
314
|
external
|
291
315
|
virtual
|
292
|
-
restricted()
|
316
|
+
// restricted()
|
293
317
|
{
|
294
|
-
|
318
|
+
(
|
319
|
+
NftId poolNftId,,
|
320
|
+
IInstance instance
|
321
|
+
) = _getAndVerifyActiveComponent(POOL());
|
322
|
+
|
323
|
+
// check that pool is externally managed
|
324
|
+
InstanceReader reader = instance.getInstanceReader();
|
325
|
+
if (!reader.getPoolInfo(poolNftId).isExternallyManaged) {
|
326
|
+
revert ErrorPoolServicePoolNotExternallyManaged(poolNftId);
|
327
|
+
}
|
295
328
|
|
296
|
-
|
297
|
-
|
329
|
+
address poolOwner = getRegistry().ownerOf(poolNftId);
|
330
|
+
emit LogPoolServiceWalletDefunded(poolNftId, poolOwner, amount);
|
331
|
+
|
332
|
+
_distributeUnstakingAmount(
|
333
|
+
reader,
|
334
|
+
poolNftId,
|
335
|
+
poolOwner,
|
336
|
+
amount);
|
298
337
|
}
|
299
338
|
|
339
|
+
|
300
340
|
function processSale(
|
301
341
|
NftId bundleNftId,
|
302
342
|
IPolicy.PremiumInfo memory premium
|
@@ -308,9 +348,10 @@ contract PoolService is
|
|
308
348
|
_checkNftType(bundleNftId, BUNDLE());
|
309
349
|
|
310
350
|
IRegistry registry = getRegistry();
|
311
|
-
|
312
|
-
|
313
|
-
|
351
|
+
NftId poolNftId = registry.getObjectInfo(bundleNftId).parentNftId;
|
352
|
+
IInstance instance = _getInstanceForComponent(
|
353
|
+
registry,
|
354
|
+
registry.getObjectInfo(poolNftId).parentNftId);
|
314
355
|
|
315
356
|
Amount poolFeeAmount = premium.poolFeeFixAmount + premium.poolFeeVarAmount;
|
316
357
|
Amount bundleFeeAmount = premium.bundleFeeFixAmount + premium.bundleFeeVarAmount;
|
@@ -319,13 +360,13 @@ contract PoolService is
|
|
319
360
|
InstanceStore instanceStore = instance.getInstanceStore();
|
320
361
|
_componentService.increasePoolBalance(
|
321
362
|
instanceStore,
|
322
|
-
|
363
|
+
poolNftId,
|
323
364
|
bundleNetAmount + bundleFeeAmount,
|
324
365
|
poolFeeAmount);
|
325
366
|
|
326
367
|
_componentService.increaseBundleBalance(
|
327
368
|
instanceStore,
|
328
|
-
|
369
|
+
bundleNftId,
|
329
370
|
bundleNetAmount,
|
330
371
|
bundleFeeAmount);
|
331
372
|
}
|
@@ -351,9 +392,13 @@ contract PoolService is
|
|
351
392
|
_checkNftType(applicationNftId, POLICY());
|
352
393
|
_checkNftType(bundleNftId, BUNDLE());
|
353
394
|
|
395
|
+
NftId poolNftId;
|
396
|
+
bool poolIsVerifyingApplications;
|
354
397
|
(
|
398
|
+
poolNftId,
|
355
399
|
totalCollateralAmount,
|
356
|
-
localCollateralAmount
|
400
|
+
localCollateralAmount,
|
401
|
+
poolIsVerifyingApplications
|
357
402
|
) = calculateRequiredCollateral(
|
358
403
|
instance.getInstanceReader(),
|
359
404
|
productNftId,
|
@@ -371,6 +416,21 @@ contract PoolService is
|
|
371
416
|
instance.getNftId(),
|
372
417
|
token,
|
373
418
|
totalCollateralAmount);
|
419
|
+
|
420
|
+
// pool callback when required
|
421
|
+
if (poolIsVerifyingApplications) {
|
422
|
+
IPoolComponent pool = IPoolComponent(
|
423
|
+
getRegistry().getObjectAddress(poolNftId));
|
424
|
+
|
425
|
+
pool.verifyApplication(
|
426
|
+
applicationNftId,
|
427
|
+
bundleNftId,
|
428
|
+
totalCollateralAmount);
|
429
|
+
|
430
|
+
// TODO add logging
|
431
|
+
}
|
432
|
+
|
433
|
+
// TODO add logging
|
374
434
|
}
|
375
435
|
|
376
436
|
function processPayout(
|
@@ -458,14 +518,17 @@ contract PoolService is
|
|
458
518
|
public
|
459
519
|
view
|
460
520
|
returns(
|
521
|
+
NftId poolNftId,
|
461
522
|
Amount totalCollateralAmount,
|
462
|
-
Amount localCollateralAmount
|
523
|
+
Amount localCollateralAmount,
|
524
|
+
bool poolIsVerifyingApplications
|
463
525
|
)
|
464
526
|
{
|
465
527
|
_checkNftType(productNftId, PRODUCT());
|
466
528
|
|
467
|
-
|
529
|
+
poolNftId = instanceReader.getProductInfo(productNftId).poolNftId;
|
468
530
|
IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
|
531
|
+
poolIsVerifyingApplications = poolInfo.isVerifyingApplications;
|
469
532
|
|
470
533
|
(
|
471
534
|
totalCollateralAmount,
|
@@ -519,25 +582,38 @@ contract PoolService is
|
|
519
582
|
}
|
520
583
|
|
521
584
|
|
522
|
-
/// @dev transfers the specified amount from the
|
585
|
+
/// @dev transfers the specified amount from the "from account" to the pool's wallet
|
523
586
|
function _collectStakingAmount(
|
524
|
-
InstanceReader
|
587
|
+
InstanceReader reader,
|
525
588
|
NftId poolNftId,
|
526
|
-
address
|
589
|
+
address from,
|
527
590
|
Amount amount
|
528
591
|
)
|
529
592
|
internal
|
530
593
|
{
|
594
|
+
IComponents.ComponentInfo memory info = reader.getComponentInfo(poolNftId);
|
595
|
+
info.tokenHandler.collectTokens(
|
596
|
+
from,
|
597
|
+
amount);
|
598
|
+
}
|
531
599
|
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
600
|
+
/// @dev distributes the specified amount from the pool's wallet to the "to account"
|
601
|
+
function _distributeUnstakingAmount(
|
602
|
+
InstanceReader reader,
|
603
|
+
NftId poolNftId,
|
604
|
+
address to,
|
605
|
+
Amount amount
|
606
|
+
)
|
607
|
+
internal
|
608
|
+
{
|
609
|
+
IComponents.ComponentInfo memory info = reader.getComponentInfo(poolNftId);
|
610
|
+
info.tokenHandler.distributeTokens(
|
611
|
+
info.tokenHandler.getWallet(),
|
612
|
+
to,
|
538
613
|
amount);
|
539
614
|
}
|
540
615
|
|
616
|
+
|
541
617
|
function _getDomain() internal pure override returns(ObjectType) {
|
542
618
|
return POOL();
|
543
619
|
}
|