@etherisc/gif-next 0.0.2-a2def05-550 → 0.0.2-a307d03-692
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 +27 -6
- package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +4 -0
- package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +1007 -0
- package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +744 -0
- package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +4 -0
- package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.json +791 -0
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +203 -77
- package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.dbg.json +4 -0
- package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.json +24 -0
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +233 -5
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +200 -16
- 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 +142 -44
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +107 -15
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +19 -0
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +68 -5
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +194 -214
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +206 -27
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +132 -128
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +280 -171
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +146 -69
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +119 -110
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +148 -72
- package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.json +22 -0
- package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +1475 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +589 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +2040 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +589 -0
- package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.json +376 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +234 -166
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +589 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +175 -151
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +321 -183
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +589 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +778 -330
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +589 -0
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +193 -45
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +176 -57
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +105 -103
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +229 -82
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +457 -143
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +150 -90
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +781 -202
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +134 -157
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +110 -49
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +473 -342
- package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +4 -0
- package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +853 -0
- 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 +46 -5
- 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 +151 -171
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +180 -29
- 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 +113 -104
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +69 -11
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +127 -123
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +156 -81
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +130 -45
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +146 -142
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +206 -27
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +161 -262
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +114 -85
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +84 -111
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +133 -135
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +279 -247
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +146 -153
- 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 +495 -390
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +168 -55
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +135 -54
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +106 -45
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +260 -195
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +206 -27
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +319 -148
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +145 -72
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +89 -9
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +199 -21
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +244 -48
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +105 -52
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +246 -176
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.json +55 -2
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +377 -148
- 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 +153 -60
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +185 -115
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +123 -54
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +256 -191
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +117 -63
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +115 -42
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +117 -17
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +144 -41
- 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/ITransferInterceptor.sol/ITransferInterceptor.json +5 -18
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +161 -53
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +326 -259
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +112 -183
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +102 -37
- package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +1849 -0
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +47 -6
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +414 -250
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +66 -8
- 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 +105 -83
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +375 -533
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +136 -81
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +60 -2
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +541 -0
- package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.json +24 -0
- package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.json +30 -0
- 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 +92 -65
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +301 -268
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +113 -104
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.json +36 -0
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.json +36 -0
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +16 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +16 -6
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +148 -0
- 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 +55 -2
- 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 +126 -122
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +42 -1
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +42 -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 +18 -2
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +18 -8
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +152 -38
- 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 +60 -2
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +327 -73
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +484 -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 +110 -101
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +77 -16
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +33 -33
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +192 -171
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +46 -5
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +127 -53
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +7 -12
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +125 -55
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +107 -42
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +171 -130
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +23 -23
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.json +33 -9
- 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 +28 -4
- 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 +3 -3
- 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 +4 -0
- package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +33 -0
- package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/NftId.sol/NftIdLib.json +23 -4
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +19 -19
- 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 +118 -5
- 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/StateId.sol/StateIdLib.json +15 -2
- package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +2 -2
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +16 -3
- 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 +47 -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 +79 -27
- 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 +262 -0
- package/contracts/accounting/AccountingServiceManager.sol +38 -0
- package/contracts/accounting/IAccountingService.sol +45 -0
- package/contracts/authorization/AccessAdmin.sol +231 -131
- package/contracts/authorization/AccessManagerCloneable.sol +136 -3
- package/contracts/authorization/Authorization.sol +321 -201
- package/contracts/authorization/IAccess.sol +1 -0
- package/contracts/authorization/IAccessAdmin.sol +17 -10
- package/contracts/authorization/IAuthorization.sol +27 -7
- package/contracts/authorization/IServiceAuthorization.sol +3 -1
- package/contracts/authorization/ServiceAuthorization.sol +26 -10
- package/contracts/distribution/BasicDistribution.sol +15 -12
- package/contracts/distribution/BasicDistributionAuthorization.sol +22 -9
- package/contracts/distribution/Distribution.sol +41 -47
- package/contracts/distribution/DistributionService.sol +104 -82
- package/contracts/distribution/DistributionServiceManager.sol +6 -6
- package/contracts/distribution/IDistributionComponent.sol +1 -1
- package/contracts/distribution/IDistributionService.sol +19 -19
- package/contracts/examples/fire/DamageLevel.sol +59 -0
- package/contracts/examples/fire/FirePool.sol +90 -0
- package/contracts/examples/fire/FirePoolAuthorization.sol +35 -0
- package/contracts/examples/fire/FireProduct.sol +438 -0
- package/contracts/examples/fire/FireProductAuthorization.sol +45 -0
- package/contracts/examples/fire/FireUSD.sol +26 -0
- package/contracts/examples/unpermissioned/SimpleDistribution.sol +11 -4
- package/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol +28 -0
- package/contracts/examples/unpermissioned/SimpleOracle.sol +4 -4
- package/contracts/examples/unpermissioned/SimplePool.sol +37 -7
- package/contracts/examples/unpermissioned/SimplePoolAuthorization.sol +28 -0
- package/contracts/examples/unpermissioned/SimpleProduct.sol +49 -23
- package/contracts/examples/unpermissioned/SimpleProductAuthorization.sol +28 -0
- package/contracts/instance/BundleSet.sol +42 -38
- package/contracts/instance/IInstance.sol +18 -10
- package/contracts/instance/IInstanceService.sol +9 -29
- package/contracts/instance/Instance.sol +62 -35
- package/contracts/instance/InstanceAdmin.sol +265 -101
- package/contracts/instance/InstanceAuthorizationV3.sol +57 -45
- package/contracts/instance/InstanceReader.sol +246 -39
- package/contracts/instance/InstanceService.sol +86 -149
- package/contracts/instance/InstanceServiceManager.sol +6 -7
- package/contracts/instance/InstanceStore.sol +13 -2
- package/contracts/instance/RiskSet.sol +118 -0
- package/contracts/instance/base/ObjectCounter.sol +1 -2
- package/contracts/instance/base/ObjectLifecycle.sol +4 -2
- package/contracts/instance/base/ObjectSet.sol +31 -33
- package/contracts/instance/base/ObjectSetHelperLib.sol +30 -0
- package/contracts/instance/module/IComponents.sol +13 -8
- package/contracts/instance/module/IDistribution.sol +2 -1
- package/contracts/instance/module/IPolicy.sol +4 -3
- package/contracts/instance/module/IRisk.sol +3 -0
- package/contracts/oracle/BasicOracle.sol +0 -1
- package/contracts/oracle/BasicOracleAuthorization.sol +3 -12
- package/contracts/oracle/IOracleService.sol +2 -1
- package/contracts/oracle/Oracle.sol +5 -16
- package/contracts/oracle/OracleService.sol +111 -80
- package/contracts/oracle/OracleServiceManager.sol +6 -6
- package/contracts/pool/BasicPool.sol +33 -24
- package/contracts/pool/BasicPoolAuthorization.sol +27 -9
- package/contracts/pool/BundleService.sol +91 -134
- package/contracts/pool/BundleServiceManager.sol +6 -6
- package/contracts/pool/IBundleService.sol +15 -34
- package/contracts/pool/IPoolComponent.sol +19 -15
- package/contracts/pool/IPoolService.sol +70 -65
- package/contracts/pool/Pool.sol +136 -117
- package/contracts/pool/PoolLib.sol +216 -0
- package/contracts/pool/PoolService.sol +484 -236
- package/contracts/pool/PoolServiceManager.sol +4 -4
- package/contracts/product/ApplicationService.sol +32 -21
- package/contracts/product/ApplicationServiceManager.sol +4 -4
- package/contracts/product/BasicProduct.sol +10 -12
- package/contracts/product/BasicProductAuthorization.sol +24 -11
- package/contracts/product/ClaimService.sol +300 -155
- package/contracts/product/ClaimServiceManager.sol +4 -4
- package/contracts/product/IApplicationService.sol +5 -2
- package/contracts/product/IClaimService.sol +17 -4
- package/contracts/product/IPolicyService.sol +33 -11
- package/contracts/product/IPricingService.sol +9 -9
- package/contracts/product/IProductComponent.sol +27 -4
- package/contracts/product/PolicyService.sol +343 -234
- package/contracts/product/PolicyServiceLib.sol +65 -0
- package/contracts/product/PolicyServiceManager.sol +4 -4
- package/contracts/product/PricingService.sol +31 -28
- package/contracts/product/PricingServiceManager.sol +4 -4
- package/contracts/product/Product.sol +125 -72
- package/contracts/product/RiskService.sol +75 -27
- package/contracts/product/RiskServiceManager.sol +4 -4
- package/contracts/registry/ChainNft.sol +10 -11
- package/contracts/registry/IRegistry.sol +16 -18
- package/contracts/registry/IRegistryService.sol +5 -12
- package/contracts/registry/IRelease.sol +26 -0
- package/contracts/registry/ITransferInterceptor.sol +1 -2
- package/contracts/registry/Registry.sol +36 -8
- package/contracts/registry/RegistryAdmin.sol +132 -242
- package/contracts/registry/RegistryService.sol +36 -47
- package/contracts/registry/RegistryServiceManager.sol +3 -3
- package/contracts/registry/ReleaseAdmin.sol +245 -0
- package/contracts/registry/ReleaseLifecycle.sol +8 -3
- package/contracts/registry/ReleaseRegistry.sol +257 -237
- package/contracts/registry/ServiceAuthorizationV3.sol +177 -50
- package/contracts/registry/TokenRegistry.sol +6 -8
- package/contracts/shared/Component.sol +67 -109
- package/contracts/shared/ComponentService.sol +369 -386
- package/contracts/shared/ComponentServiceManager.sol +8 -5
- package/contracts/shared/ComponentVerifyingService.sol +27 -16
- package/contracts/shared/ContractLib.sol +253 -0
- package/contracts/shared/IComponent.sol +8 -17
- package/contracts/shared/IComponentService.sol +30 -38
- package/contracts/shared/IInstanceLinkedComponent.sol +3 -22
- package/contracts/shared/ILifecycle.sol +3 -1
- package/contracts/shared/INftOwnable.sol +2 -0
- package/contracts/shared/IPolicyHolder.sol +12 -13
- package/contracts/shared/IRegisterable.sol +23 -1
- package/contracts/shared/IService.sol +3 -5
- package/contracts/shared/InstanceLinkedComponent.sol +69 -44
- package/contracts/shared/KeyValueStore.sol +1 -1
- package/contracts/shared/Lifecycle.sol +15 -4
- package/contracts/shared/NftOwnable.sol +26 -6
- package/contracts/shared/PolicyHolder.sol +12 -6
- package/contracts/shared/Registerable.sol +53 -19
- package/contracts/shared/RegistryLinked.sol +7 -13
- package/contracts/shared/Service.sol +13 -30
- package/contracts/shared/TokenHandler.sol +274 -72
- package/contracts/shared/TokenHandlerDeployerLib.sol +10 -2
- package/contracts/staking/IStaking.sol +5 -8
- package/contracts/staking/IStakingService.sol +8 -3
- package/contracts/staking/StakeManagerLib.sol +1 -1
- package/contracts/staking/Staking.sol +64 -36
- package/contracts/staking/StakingManager.sol +8 -6
- package/contracts/staking/StakingReader.sol +13 -6
- package/contracts/staking/StakingService.sol +45 -22
- package/contracts/staking/StakingServiceManager.sol +6 -5
- package/contracts/type/Amount.sol +15 -0
- package/contracts/type/ClaimId.sol +6 -1
- package/contracts/type/Key32.sol +2 -2
- package/contracts/type/Key32Set.sol +62 -0
- package/contracts/type/NftId.sol +7 -0
- package/contracts/type/ObjectType.sol +49 -21
- package/contracts/type/PayoutId.sol +10 -10
- package/contracts/type/RiskId.sol +35 -4
- package/contracts/type/RoleId.sol +23 -15
- package/contracts/type/Selector.sol +5 -0
- package/contracts/type/StateId.sol +14 -1
- package/contracts/type/Timestamp.sol +0 -5
- package/contracts/type/UFixed.sol +13 -119
- package/contracts/type/Version.sol +15 -5
- package/contracts/upgradeability/ProxyManager.sol +68 -34
- package/contracts/upgradeability/Versionable.sol +2 -2
- package/package.json +4 -3
- package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +0 -4
- package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.json +0 -290
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +0 -4
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +0 -390
- 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/shared/InitializableCustom.sol/InitializableCustom.dbg.json +0 -4
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.json +0 -39
- package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +0 -4
- package/artifacts/contracts/type/UFixed.sol/MathLib.json +0 -16
- package/contracts/authorization/IModuleAuthorization.sol +0 -21
- package/contracts/authorization/ModuleAuthorization.sol +0 -78
- package/contracts/instance/module/IAccess.sol +0 -46
- package/contracts/shared/InitializableCustom.sol +0 -177
@@ -1,42 +1,44 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {
|
5
|
-
|
6
|
-
import {
|
4
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
|
+
|
6
|
+
import {IAccountingService} from "../accounting/IAccountingService.sol";
|
7
|
+
import {IComponent} from "../shared/IComponent.sol";
|
7
8
|
import {IComponents} from "../instance/module/IComponents.sol";
|
8
9
|
import {IComponentService} from "./IComponentService.sol";
|
9
10
|
import {IInstance} from "../instance/IInstance.sol";
|
10
11
|
import {IInstanceLinkedComponent} from "./IInstanceLinkedComponent.sol";
|
12
|
+
import {InstanceAdmin} from "../instance/InstanceAdmin.sol";
|
11
13
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
12
14
|
import {InstanceStore} from "../instance/InstanceStore.sol";
|
13
15
|
import {IInstanceService} from "../instance/IInstanceService.sol";
|
14
16
|
import {IPoolComponent} from "../pool/IPoolComponent.sol";
|
15
17
|
import {IProductComponent} from "../product/IProductComponent.sol";
|
18
|
+
import {IRegisterable} from "../shared/IRegisterable.sol";
|
16
19
|
import {IRegistry} from "../registry/IRegistry.sol";
|
17
20
|
import {IRegistryService} from "../registry/IRegistryService.sol";
|
21
|
+
|
22
|
+
import {Amount, AmountLib} from "../type/Amount.sol";
|
23
|
+
import {ContractLib} from "../shared/ContractLib.sol";
|
24
|
+
import {Fee, FeeLib} from "../type/Fee.sol";
|
18
25
|
import {KEEP_STATE} from "../type/StateId.sol";
|
19
|
-
import {NftId} from "../type/NftId.sol";
|
20
|
-
import {ObjectType, REGISTRY, COMPONENT, DISTRIBUTION, INSTANCE, ORACLE, POOL, PRODUCT} from "../type/ObjectType.sol";
|
21
|
-
import {
|
26
|
+
import {NftId, NftIdLib} from "../type/NftId.sol";
|
27
|
+
import {ObjectType, ACCOUNTING, REGISTRY, COMPONENT, DISTRIBUTION, INSTANCE, ORACLE, POOL, PRODUCT} from "../type/ObjectType.sol";
|
28
|
+
import {Service} from "../shared/Service.sol";
|
29
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
22
30
|
import {TokenHandlerDeployerLib} from "../shared/TokenHandlerDeployerLib.sol";
|
31
|
+
import {VersionPart} from "../type/Version.sol";
|
32
|
+
|
23
33
|
|
24
34
|
contract ComponentService is
|
25
|
-
|
35
|
+
Service,
|
26
36
|
IComponentService
|
27
37
|
{
|
28
|
-
error ErrorComponentServiceAlreadyRegistered(address component);
|
29
|
-
error ErrorComponentServiceNotComponent(address component);
|
30
|
-
error ErrorComponentServiceInvalidType(address component, ObjectType requiredType, ObjectType componentType);
|
31
|
-
error ErrorComponentServiceSenderNotOwner(address component, address initialOwner, address sender);
|
32
|
-
error ErrorComponentServiceExpectedRoleMissing(NftId instanceNftId, RoleId requiredRole, address sender);
|
33
|
-
error ErrorComponentServiceComponentLocked(address component);
|
34
|
-
error ErrorComponentServiceSenderNotService(address sender);
|
35
|
-
error ErrorComponentServiceComponentTypeInvalid(address component, ObjectType expectedType, ObjectType foundType);
|
36
|
-
|
37
38
|
bool private constant INCREASE = true;
|
38
39
|
bool private constant DECREASE = false;
|
39
40
|
|
41
|
+
IAccountingService private _accountingService;
|
40
42
|
IRegistryService private _registryService;
|
41
43
|
IInstanceService private _instanceService;
|
42
44
|
|
@@ -48,13 +50,14 @@ contract ComponentService is
|
|
48
50
|
virtual override
|
49
51
|
initializer()
|
50
52
|
{
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
53
|
+
(
|
54
|
+
address authority,
|
55
|
+
address registry
|
56
|
+
) = abi.decode(data, (address, address));
|
55
57
|
|
56
|
-
|
58
|
+
__Service_init(authority, registry, owner);
|
57
59
|
|
60
|
+
_accountingService = IAccountingService(_getServiceAddress(ACCOUNTING()));
|
58
61
|
_registryService = IRegistryService(_getServiceAddress(REGISTRY()));
|
59
62
|
_instanceService = IInstanceService(_getServiceAddress(INSTANCE()));
|
60
63
|
|
@@ -63,91 +66,181 @@ contract ComponentService is
|
|
63
66
|
|
64
67
|
//-------- component ----------------------------------------------------//
|
65
68
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
69
|
+
/// @inheritdoc IComponentService
|
70
|
+
function registerComponent(address componentAddress)
|
71
|
+
external
|
72
|
+
virtual
|
73
|
+
restricted()
|
74
|
+
returns (NftId componentNftId)
|
75
|
+
{
|
76
|
+
(NftId productNftId, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
|
77
|
+
|
78
|
+
(
|
79
|
+
IInstanceLinkedComponent component,
|
80
|
+
IRegistry.ObjectInfo memory componentInfo // initial component info
|
81
|
+
) = _getAndVerifyRegisterableComponent(
|
82
|
+
componentAddress,
|
83
|
+
productNftId);
|
84
|
+
ObjectType componentType = componentInfo.objectType;
|
70
85
|
|
71
|
-
if (
|
72
|
-
|
86
|
+
if (componentType == POOL()) {
|
87
|
+
IPoolComponent pool = IPoolComponent(componentAddress);
|
88
|
+
return _registerPool(instance, productNftId, pool, componentInfo);
|
73
89
|
}
|
74
|
-
|
75
|
-
|
76
|
-
revert ErrorComponentServiceWalletAddressZero();
|
90
|
+
if (componentType == DISTRIBUTION()) {
|
91
|
+
return _registerDistribution(instance, productNftId, component, componentInfo);
|
77
92
|
}
|
78
|
-
|
79
|
-
|
80
|
-
revert ErrorComponentServiceWalletAddressIsSameAsCurrent();
|
93
|
+
if (componentType == ORACLE()) {
|
94
|
+
return _registerOracle(instance, productNftId, component, componentInfo);
|
81
95
|
}
|
82
96
|
|
83
|
-
|
84
|
-
|
85
|
-
|
97
|
+
// fail
|
98
|
+
revert ErrorComponentServiceComponentTypeNotSupported(componentAddress, componentType);
|
99
|
+
}
|
100
|
+
|
101
|
+
/// @inheritdoc IComponentService
|
102
|
+
function approveTokenHandler(
|
103
|
+
IERC20Metadata token,
|
104
|
+
Amount amount
|
105
|
+
)
|
106
|
+
external
|
107
|
+
virtual
|
108
|
+
restricted()
|
109
|
+
{
|
110
|
+
// checks
|
111
|
+
(NftId componentNftId, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
|
112
|
+
TokenHandler tokenHandler = instance.getInstanceReader().getComponentInfo(
|
113
|
+
componentNftId).tokenHandler;
|
114
|
+
|
115
|
+
// effects
|
116
|
+
tokenHandler.approve(token, amount);
|
86
117
|
}
|
87
118
|
|
88
|
-
|
89
|
-
function
|
119
|
+
/// @inheritdoc IComponentService
|
120
|
+
function setWallet(address newWallet)
|
121
|
+
external
|
122
|
+
virtual
|
123
|
+
restricted()
|
124
|
+
{
|
125
|
+
// checks
|
126
|
+
(NftId componentNftId, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
|
127
|
+
TokenHandler tokenHandler = instance.getInstanceReader().getComponentInfo(
|
128
|
+
componentNftId).tokenHandler;
|
129
|
+
|
130
|
+
// effects
|
131
|
+
tokenHandler.setWallet(newWallet);
|
132
|
+
}
|
90
133
|
|
91
|
-
|
92
|
-
function
|
134
|
+
/// @inheritdoc IComponentService
|
135
|
+
function setComponentLocked(address componentAddress, bool locked)
|
136
|
+
external
|
137
|
+
virtual
|
138
|
+
restricted()
|
139
|
+
{
|
140
|
+
// TODO inactive component can lock/unlock other components?
|
141
|
+
(, IInstance instance) = _getAndVerifyComponent(COMPONENT(), false);
|
142
|
+
instance.setLockedFromService(componentAddress, locked);
|
143
|
+
}
|
93
144
|
|
145
|
+
/// @inheritdoc IComponentService
|
94
146
|
function withdrawFees(Amount amount)
|
95
147
|
external
|
96
148
|
virtual
|
149
|
+
restricted()
|
97
150
|
returns (Amount withdrawnAmount)
|
98
151
|
{
|
99
|
-
|
100
|
-
|
101
|
-
|
152
|
+
// checks
|
153
|
+
(NftId componentNftId, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
|
154
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
102
155
|
|
103
156
|
// determine withdrawn amount
|
157
|
+
Amount maxAvailableAmount = instanceReader.getFeeAmount(componentNftId);
|
104
158
|
withdrawnAmount = amount;
|
105
|
-
|
106
|
-
|
107
|
-
|
159
|
+
|
160
|
+
// max amount -> withraw all available fees
|
161
|
+
if (amount == AmountLib.max()) {
|
162
|
+
withdrawnAmount = maxAvailableAmount;
|
163
|
+
}
|
164
|
+
|
165
|
+
// check modified withdrawn amount
|
166
|
+
if (withdrawnAmount.eqz()) {
|
108
167
|
revert ErrorComponentServiceWithdrawAmountIsZero();
|
109
|
-
} else {
|
110
|
-
|
111
|
-
if (withdrawnAmount.gt(withdrawLimit)) {
|
112
|
-
revert ErrorComponentServiceWithdrawAmountExceedsLimit(withdrawnAmount, withdrawLimit);
|
113
|
-
}
|
168
|
+
} else if (withdrawnAmount > maxAvailableAmount) {
|
169
|
+
revert ErrorComponentServiceWithdrawAmountExceedsLimit(withdrawnAmount, maxAvailableAmount);
|
114
170
|
}
|
115
171
|
|
172
|
+
// effects
|
116
173
|
// decrease fee counters by withdrawnAmount
|
117
|
-
|
174
|
+
_accountingService.decreaseComponentFees(
|
175
|
+
instance.getInstanceStore(),
|
176
|
+
componentNftId,
|
177
|
+
withdrawnAmount);
|
118
178
|
|
119
179
|
// transfer amount to component owner
|
120
180
|
address componentOwner = getRegistry().ownerOf(componentNftId);
|
121
|
-
|
122
|
-
|
181
|
+
TokenHandler tokenHandler = instanceReader.getTokenHandler(componentNftId);
|
182
|
+
emit LogComponentServiceComponentFeesWithdrawn(
|
183
|
+
componentNftId,
|
184
|
+
componentOwner,
|
185
|
+
address(tokenHandler.TOKEN()),
|
186
|
+
withdrawnAmount);
|
187
|
+
|
188
|
+
// interactions
|
189
|
+
// transfer amount to component owner
|
190
|
+
tokenHandler.pushFeeToken(
|
191
|
+
componentOwner,
|
192
|
+
withdrawnAmount);
|
123
193
|
}
|
124
194
|
|
125
195
|
|
126
196
|
//-------- product ------------------------------------------------------//
|
127
197
|
|
128
|
-
function registerProduct()
|
198
|
+
function registerProduct(address productAddress)
|
129
199
|
external
|
130
200
|
virtual
|
201
|
+
restricted()
|
202
|
+
nonReentrant()
|
203
|
+
returns (NftId productNftId)
|
131
204
|
{
|
132
|
-
|
205
|
+
// TODO proper instance verification, will be done in next PR
|
206
|
+
//(NftId instanceNftId,, IInstance instance) = _getAndVerifyCallingInstance();
|
207
|
+
NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
|
208
|
+
IInstance instance = IInstance(msg.sender);
|
133
209
|
|
134
|
-
// register/create component setup
|
135
210
|
(
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
211
|
+
,
|
212
|
+
IRegistry.ObjectInfo memory productInfo // initial product info
|
213
|
+
) = _getAndVerifyRegisterableComponent(
|
214
|
+
productAddress,
|
215
|
+
instanceNftId);
|
216
|
+
|
217
|
+
if(productInfo.objectType != PRODUCT()) {
|
218
|
+
revert ErrorComponentServiceComponentTypeNotSupported(productAddress, productInfo.objectType);
|
219
|
+
}
|
220
|
+
|
221
|
+
InstanceAdmin instanceAdmin = instance.getInstanceAdmin();
|
222
|
+
InstanceStore instanceStore = instance.getInstanceStore();
|
147
223
|
|
148
|
-
//
|
149
|
-
|
150
|
-
|
224
|
+
// register/create component info
|
225
|
+
IProductComponent product = IProductComponent(productAddress);
|
226
|
+
productNftId = _register(instanceAdmin, instanceStore, product, productInfo);
|
227
|
+
|
228
|
+
// create product in instance instanceStore
|
229
|
+
IComponents.ProductInfo memory initialProductInfo = product.getInitialProductInfo();
|
230
|
+
// force initialization of linked components with empty values to
|
231
|
+
// ensure no components are linked upon initialization of the product
|
232
|
+
initialProductInfo.poolNftId = NftIdLib.zero();
|
233
|
+
initialProductInfo.distributionNftId = NftIdLib.zero();
|
234
|
+
initialProductInfo.oracleNftId = new NftId[](initialProductInfo.expectedNumberOfOracles);
|
235
|
+
|
236
|
+
// create info
|
237
|
+
instanceStore.createProduct(
|
238
|
+
productNftId,
|
239
|
+
initialProductInfo);
|
240
|
+
|
241
|
+
instanceStore.createFee(
|
242
|
+
productNftId,
|
243
|
+
product.getInitialFeeInfo());
|
151
244
|
}
|
152
245
|
|
153
246
|
|
@@ -157,68 +250,66 @@ contract ComponentService is
|
|
157
250
|
)
|
158
251
|
external
|
159
252
|
virtual
|
253
|
+
restricted()
|
254
|
+
nonReentrant()
|
160
255
|
{
|
161
|
-
(NftId productNftId
|
162
|
-
IComponents.
|
256
|
+
(NftId productNftId, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
|
257
|
+
IComponents.FeeInfo memory feeInfo = instance.getInstanceReader().getFeeInfo(productNftId);
|
163
258
|
bool feesChanged = false;
|
164
259
|
|
165
260
|
// update product fee if required
|
166
|
-
if(!FeeLib.eq(
|
167
|
-
_logUpdateFee(productNftId, "ProductFee",
|
168
|
-
|
261
|
+
if(!FeeLib.eq(feeInfo.productFee, productFee)) {
|
262
|
+
_logUpdateFee(productNftId, "ProductFee", feeInfo.productFee, productFee);
|
263
|
+
feeInfo.productFee = productFee;
|
169
264
|
feesChanged = true;
|
170
265
|
}
|
171
266
|
|
172
267
|
// update processing fee if required
|
173
|
-
if(!FeeLib.eq(
|
174
|
-
_logUpdateFee(productNftId, "ProcessingFee",
|
175
|
-
|
268
|
+
if(!FeeLib.eq(feeInfo.processingFee, processingFee)) {
|
269
|
+
_logUpdateFee(productNftId, "ProcessingFee", feeInfo.processingFee, processingFee);
|
270
|
+
feeInfo.processingFee = processingFee;
|
176
271
|
feesChanged = true;
|
177
272
|
}
|
178
273
|
|
179
274
|
if(feesChanged) {
|
180
|
-
instance.getInstanceStore().
|
275
|
+
instance.getInstanceStore().updateFee(productNftId, feeInfo);
|
181
276
|
emit LogComponentServiceProductFeesUpdated(productNftId);
|
182
277
|
}
|
183
278
|
}
|
184
279
|
|
185
|
-
function increaseProductFees(
|
186
|
-
InstanceStore instanceStore,
|
187
|
-
NftId productNftId,
|
188
|
-
Amount feeAmount
|
189
|
-
)
|
190
|
-
external
|
191
|
-
virtual
|
192
|
-
// TODO re-enable once role granting is stable and fixed
|
193
|
-
// restricted()
|
194
|
-
{
|
195
|
-
_changeTargetBalance(INCREASE, instanceStore, productNftId, AmountLib.zero(), feeAmount);
|
196
|
-
}
|
197
|
-
|
198
|
-
|
199
|
-
function decreaseProductFees(InstanceStore instanceStore, NftId productNftId, Amount feeAmount)
|
200
|
-
external
|
201
|
-
virtual
|
202
|
-
// TODO re-enable once role granting is stable and fixed
|
203
|
-
// restricted()
|
204
|
-
{
|
205
|
-
_changeTargetBalance(DECREASE, instanceStore, productNftId, AmountLib.zero(), feeAmount);
|
206
|
-
}
|
207
|
-
|
208
280
|
//-------- distribution -------------------------------------------------//
|
209
281
|
|
210
282
|
/// @dev registers the sending component as a distribution component
|
211
|
-
function
|
212
|
-
|
283
|
+
function _registerDistribution(
|
284
|
+
IInstance instance,
|
285
|
+
NftId productNftId,
|
286
|
+
IInstanceLinkedComponent distribution,
|
287
|
+
IRegistry.ObjectInfo memory info
|
288
|
+
)
|
289
|
+
internal
|
213
290
|
virtual
|
291
|
+
nonReentrant()
|
292
|
+
returns (NftId distributionNftId)
|
214
293
|
{
|
215
|
-
|
294
|
+
InstanceReader reader = instance.getInstanceReader();
|
295
|
+
InstanceAdmin instanceAdmin = instance.getInstanceAdmin();
|
296
|
+
InstanceStore instanceStore = instance.getInstanceStore();
|
216
297
|
|
217
298
|
// register/create component info
|
218
|
-
_register(
|
219
|
-
|
220
|
-
|
221
|
-
|
299
|
+
distributionNftId = _register(instanceAdmin, instanceStore, distribution, info);
|
300
|
+
|
301
|
+
// check product is still expecting a distribution registration
|
302
|
+
IComponents.ProductInfo memory productInfo = reader.getProductInfo(productNftId);
|
303
|
+
if (!productInfo.hasDistribution) {
|
304
|
+
revert ErrorProductServiceNoDistributionExpected(productNftId);
|
305
|
+
}
|
306
|
+
if (productInfo.distributionNftId.gtz()) {
|
307
|
+
revert ErrorProductServiceDistributionAlreadyRegistered(productNftId, productInfo.distributionNftId);
|
308
|
+
}
|
309
|
+
|
310
|
+
// set distribution in product info
|
311
|
+
productInfo.distributionNftId = distributionNftId;
|
312
|
+
instanceStore.updateProduct(productNftId, productInfo, KEEP_STATE());
|
222
313
|
}
|
223
314
|
|
224
315
|
|
@@ -228,133 +319,100 @@ contract ComponentService is
|
|
228
319
|
)
|
229
320
|
external
|
230
321
|
virtual
|
322
|
+
restricted()
|
231
323
|
{
|
232
|
-
(NftId distributionNftId
|
233
|
-
(NftId productNftId, IComponents.
|
324
|
+
(NftId distributionNftId, IInstance instance) = _getAndVerifyActiveComponent(DISTRIBUTION());
|
325
|
+
(NftId productNftId, IComponents.FeeInfo memory feeInfo) = _getLinkedFeeInfo(
|
234
326
|
instance.getInstanceReader(), distributionNftId);
|
235
327
|
bool feesChanged = false;
|
236
328
|
|
237
329
|
// update distributino fee if required
|
238
|
-
if(!FeeLib.eq(
|
239
|
-
_logUpdateFee(productNftId, "DistributionFee",
|
240
|
-
|
330
|
+
if(!FeeLib.eq(feeInfo.distributionFee, distributionFee)) {
|
331
|
+
_logUpdateFee(productNftId, "DistributionFee", feeInfo.distributionFee, distributionFee);
|
332
|
+
feeInfo.distributionFee = distributionFee;
|
241
333
|
feesChanged = true;
|
242
334
|
}
|
243
335
|
|
244
336
|
// update min distribution owner fee if required
|
245
|
-
if(!FeeLib.eq(
|
246
|
-
_logUpdateFee(productNftId, "MinDistributionOwnerFee",
|
247
|
-
|
337
|
+
if(!FeeLib.eq(feeInfo.minDistributionOwnerFee, minDistributionOwnerFee)) {
|
338
|
+
_logUpdateFee(productNftId, "MinDistributionOwnerFee", feeInfo.minDistributionOwnerFee, minDistributionOwnerFee);
|
339
|
+
feeInfo.minDistributionOwnerFee = minDistributionOwnerFee;
|
248
340
|
feesChanged = true;
|
249
341
|
}
|
250
342
|
|
251
343
|
if(feesChanged) {
|
252
|
-
instance.getInstanceStore().
|
344
|
+
instance.getInstanceStore().updateFee(productNftId, feeInfo);
|
253
345
|
emit LogComponentServiceDistributionFeesUpdated(distributionNftId);
|
254
346
|
}
|
255
347
|
}
|
256
348
|
|
257
|
-
|
258
|
-
InstanceStore instanceStore,
|
259
|
-
NftId distributionNftId,
|
260
|
-
Amount amount,
|
261
|
-
Amount feeAmount
|
262
|
-
)
|
263
|
-
external
|
264
|
-
virtual
|
265
|
-
// TODO re-enable once role granting is stable and fixed
|
266
|
-
// restricted()
|
267
|
-
{
|
268
|
-
_changeTargetBalance(INCREASE, instanceStore, distributionNftId, amount, feeAmount);
|
269
|
-
}
|
270
|
-
|
271
|
-
|
272
|
-
function decreaseDistributionBalance(
|
273
|
-
InstanceStore instanceStore,
|
274
|
-
NftId distributionNftId,
|
275
|
-
Amount amount,
|
276
|
-
Amount feeAmount
|
277
|
-
)
|
278
|
-
external
|
279
|
-
virtual
|
280
|
-
// TODO re-enable once role granting is stable and fixed
|
281
|
-
// restricted()
|
282
|
-
{
|
283
|
-
_changeTargetBalance(DECREASE, instanceStore, distributionNftId, amount, feeAmount);
|
284
|
-
}
|
285
|
-
|
286
|
-
//-------- distributor -------------------------------------------------------//
|
287
|
-
|
288
|
-
function increaseDistributorBalance(
|
289
|
-
InstanceStore instanceStore,
|
290
|
-
NftId distributorNftId,
|
291
|
-
Amount amount,
|
292
|
-
Amount feeAmount
|
293
|
-
)
|
294
|
-
external
|
295
|
-
virtual
|
296
|
-
// TODO re-enable once role granting is stable and fixed
|
297
|
-
// restricted()
|
298
|
-
{
|
299
|
-
_changeTargetBalance(INCREASE, instanceStore, distributorNftId, amount, feeAmount);
|
300
|
-
}
|
349
|
+
//-------- oracle -------------------------------------------------------//
|
301
350
|
|
302
|
-
function
|
303
|
-
|
304
|
-
NftId
|
305
|
-
|
306
|
-
|
351
|
+
function _registerOracle(
|
352
|
+
IInstance instance,
|
353
|
+
NftId productNftId,
|
354
|
+
IInstanceLinkedComponent oracle,
|
355
|
+
IRegistry.ObjectInfo memory info
|
307
356
|
)
|
308
|
-
|
357
|
+
internal
|
309
358
|
virtual
|
310
|
-
|
311
|
-
// restricted()
|
359
|
+
returns (NftId oracleNftId)
|
312
360
|
{
|
313
|
-
|
314
|
-
|
361
|
+
InstanceReader reader = instance.getInstanceReader();
|
362
|
+
InstanceAdmin instanceAdmin = instance.getInstanceAdmin();
|
363
|
+
InstanceStore instanceStore = instance.getInstanceStore();
|
315
364
|
|
316
|
-
|
365
|
+
// register/create component info
|
366
|
+
oracleNftId = _register(instanceAdmin, instanceStore, oracle, info);
|
317
367
|
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
368
|
+
// check product is still expecting an oracle registration
|
369
|
+
IComponents.ProductInfo memory productInfo = reader.getProductInfo(productNftId);
|
370
|
+
if (productInfo.expectedNumberOfOracles == 0) {
|
371
|
+
revert ErrorProductServiceNoOraclesExpected(productNftId);
|
372
|
+
}
|
373
|
+
if (productInfo.numberOfOracles == productInfo.expectedNumberOfOracles) {
|
374
|
+
revert ErrorProductServiceOraclesAlreadyRegistered(productNftId, productInfo.expectedNumberOfOracles);
|
375
|
+
}
|
323
376
|
|
324
|
-
//
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
NftId componentNftId
|
329
|
-
) = _register(
|
330
|
-
contractAddress,
|
331
|
-
ORACLE(),
|
332
|
-
ORACLE_OWNER_ROLE());
|
377
|
+
// update/add oracle to product info
|
378
|
+
productInfo.oracleNftId[productInfo.numberOfOracles] = oracleNftId;
|
379
|
+
productInfo.numberOfOracles++;
|
380
|
+
instanceStore.updateProduct(productNftId, productInfo, KEEP_STATE());
|
333
381
|
}
|
334
382
|
|
335
383
|
//-------- pool ---------------------------------------------------------//
|
336
384
|
|
337
|
-
function
|
338
|
-
|
385
|
+
function _registerPool(
|
386
|
+
IInstance instance,
|
387
|
+
NftId productNftId,
|
388
|
+
IPoolComponent pool,
|
389
|
+
IRegistry.ObjectInfo memory info
|
390
|
+
)
|
391
|
+
internal
|
339
392
|
virtual
|
393
|
+
returns (NftId poolNftId)
|
340
394
|
{
|
341
|
-
|
395
|
+
InstanceReader reader = instance.getInstanceReader();
|
396
|
+
InstanceAdmin instanceAdmin = instance.getInstanceAdmin();
|
397
|
+
InstanceStore instanceStore = instance.getInstanceStore();
|
342
398
|
|
343
|
-
// register/create component
|
344
|
-
(
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
)
|
349
|
-
|
350
|
-
|
351
|
-
POOL_OWNER_ROLE());
|
399
|
+
// register/create component info
|
400
|
+
poolNftId = _register(instanceAdmin, instanceStore, pool, info);
|
401
|
+
|
402
|
+
// check product is still expecting a pool registration
|
403
|
+
IComponents.ProductInfo memory productInfo = reader.getProductInfo(productNftId);
|
404
|
+
if (productInfo.poolNftId.gtz()) {
|
405
|
+
revert ErrorProductServicePoolAlreadyRegistered(productNftId, productInfo.poolNftId);
|
406
|
+
}
|
352
407
|
|
353
408
|
// create info
|
354
409
|
instanceStore.createPool(
|
355
|
-
|
356
|
-
|
357
|
-
|
410
|
+
poolNftId,
|
411
|
+
pool.getInitialPoolInfo());
|
412
|
+
|
413
|
+
// update pool in product info
|
414
|
+
productInfo.poolNftId = poolNftId;
|
415
|
+
instanceStore.updateProduct(productNftId, productInfo, KEEP_STATE());
|
358
416
|
}
|
359
417
|
|
360
418
|
|
@@ -364,192 +422,86 @@ contract ComponentService is
|
|
364
422
|
Fee memory performanceFee // pool fee on profits from capital investors
|
365
423
|
)
|
366
424
|
external
|
425
|
+
restricted()
|
367
426
|
virtual
|
368
427
|
{
|
369
|
-
(NftId poolNftId
|
370
|
-
|
428
|
+
(NftId poolNftId, IInstance instance) = _getAndVerifyActiveComponent(POOL());
|
429
|
+
|
430
|
+
(NftId productNftId, IComponents.FeeInfo memory feeInfo) = _getLinkedFeeInfo(
|
371
431
|
instance.getInstanceReader(), poolNftId);
|
372
432
|
bool feesChanged = false;
|
373
433
|
|
374
434
|
// update pool fee if required
|
375
|
-
if(!FeeLib.eq(
|
376
|
-
_logUpdateFee(productNftId, "PoolFee",
|
377
|
-
|
435
|
+
if(!FeeLib.eq(feeInfo.poolFee, poolFee)) {
|
436
|
+
_logUpdateFee(productNftId, "PoolFee", feeInfo.poolFee, poolFee);
|
437
|
+
feeInfo.poolFee = poolFee;
|
378
438
|
feesChanged = true;
|
379
439
|
}
|
380
440
|
|
381
441
|
// update staking fee if required
|
382
|
-
if(!FeeLib.eq(
|
383
|
-
_logUpdateFee(productNftId, "StakingFee",
|
384
|
-
|
442
|
+
if(!FeeLib.eq(feeInfo.stakingFee, stakingFee)) {
|
443
|
+
_logUpdateFee(productNftId, "StakingFee", feeInfo.stakingFee, stakingFee);
|
444
|
+
feeInfo.stakingFee = stakingFee;
|
385
445
|
feesChanged = true;
|
386
446
|
}
|
387
447
|
|
388
448
|
// update performance fee if required
|
389
|
-
if(!FeeLib.eq(
|
390
|
-
_logUpdateFee(productNftId, "PerformanceFee",
|
391
|
-
|
449
|
+
if(!FeeLib.eq(feeInfo.performanceFee, performanceFee)) {
|
450
|
+
_logUpdateFee(productNftId, "PerformanceFee", feeInfo.performanceFee, performanceFee);
|
451
|
+
feeInfo.performanceFee = performanceFee;
|
392
452
|
feesChanged = true;
|
393
453
|
}
|
394
454
|
|
395
455
|
if(feesChanged) {
|
396
|
-
instance.getInstanceStore().
|
456
|
+
instance.getInstanceStore().updateFee(productNftId, feeInfo);
|
397
457
|
emit LogComponentServicePoolFeesUpdated(poolNftId);
|
398
458
|
}
|
399
459
|
}
|
400
460
|
|
401
|
-
|
402
|
-
InstanceStore instanceStore,
|
403
|
-
NftId poolNftId,
|
404
|
-
Amount amount,
|
405
|
-
Amount feeAmount
|
406
|
-
)
|
407
|
-
public
|
408
|
-
virtual
|
409
|
-
// TODO re-enable once role granting is stable and fixed
|
410
|
-
// restricted()
|
411
|
-
{
|
412
|
-
_changeTargetBalance(INCREASE, instanceStore, poolNftId, amount, feeAmount);
|
413
|
-
}
|
414
|
-
|
415
|
-
function decreasePoolBalance(
|
416
|
-
InstanceStore instanceStore,
|
417
|
-
NftId poolNftId,
|
418
|
-
Amount amount,
|
419
|
-
Amount feeAmount
|
420
|
-
)
|
421
|
-
public
|
422
|
-
virtual
|
423
|
-
// TODO re-enable once role granting is stable and fixed
|
424
|
-
// restricted()
|
425
|
-
{
|
426
|
-
_changeTargetBalance(DECREASE, instanceStore, poolNftId, amount, feeAmount);
|
427
|
-
}
|
428
|
-
|
429
|
-
//-------- bundle -------------------------------------------------------//
|
430
|
-
|
431
|
-
function increaseBundleBalance(
|
432
|
-
InstanceStore instanceStore,
|
433
|
-
NftId bundleNftId,
|
434
|
-
Amount amount,
|
435
|
-
Amount feeAmount
|
436
|
-
)
|
437
|
-
external
|
438
|
-
virtual
|
439
|
-
// TODO re-enable once role granting is stable and fixed
|
440
|
-
// restricted()
|
441
|
-
{
|
442
|
-
_changeTargetBalance(INCREASE, instanceStore, bundleNftId, amount, feeAmount);
|
443
|
-
}
|
444
|
-
|
445
|
-
function decreaseBundleBalance(
|
446
|
-
InstanceStore instanceStore,
|
447
|
-
NftId bundleNftId,
|
448
|
-
Amount amount,
|
449
|
-
Amount feeAmount
|
450
|
-
)
|
451
|
-
external
|
452
|
-
virtual
|
453
|
-
// TODO re-enable once role granting is stable and fixed
|
454
|
-
// restricted()
|
455
|
-
{
|
456
|
-
_changeTargetBalance(DECREASE, instanceStore, bundleNftId, amount, feeAmount);
|
457
|
-
}
|
458
|
-
|
459
|
-
|
460
|
-
//-------- internal functions ------------------------------------------//
|
461
|
-
|
462
|
-
function _changeTargetBalance(
|
463
|
-
bool increase,
|
464
|
-
InstanceStore instanceStore,
|
465
|
-
NftId targetNftId,
|
466
|
-
Amount amount,
|
467
|
-
Amount feeAmount
|
468
|
-
)
|
469
|
-
internal
|
470
|
-
virtual
|
471
|
-
{
|
472
|
-
Amount totalAmount = amount + feeAmount;
|
473
|
-
|
474
|
-
if(increase) {
|
475
|
-
if(totalAmount.gtz()) { instanceStore.increaseBalance(targetNftId, totalAmount); }
|
476
|
-
if(feeAmount.gtz()) { instanceStore.increaseFees(targetNftId, feeAmount); }
|
477
|
-
} else {
|
478
|
-
if(totalAmount.gtz()) { instanceStore.decreaseBalance(targetNftId, totalAmount); }
|
479
|
-
if(feeAmount.gtz()) { instanceStore.decreaseFees(targetNftId, feeAmount); }
|
480
|
-
}
|
481
|
-
}
|
482
|
-
|
483
|
-
/// @dev registers the component represented by the provided address
|
461
|
+
/// @dev Registers the component represented by the provided address.
|
484
462
|
function _register(
|
485
|
-
|
486
|
-
|
487
|
-
|
463
|
+
InstanceAdmin instanceAdmin,
|
464
|
+
InstanceStore instanceStore,
|
465
|
+
IInstanceLinkedComponent component,
|
466
|
+
IRegistry.ObjectInfo memory info
|
488
467
|
)
|
489
468
|
internal
|
490
469
|
virtual
|
491
|
-
returns (
|
492
|
-
InstanceReader instanceReader,
|
493
|
-
InstanceStore instanceStore,
|
494
|
-
NftId componentNftId
|
495
|
-
)
|
470
|
+
returns (NftId componentNftId)
|
496
471
|
{
|
497
|
-
(
|
498
|
-
IInstance instance,
|
499
|
-
IInstanceLinkedComponent component,
|
500
|
-
address owner
|
501
|
-
) = _getAndVerifyRegisterableComponent(
|
502
|
-
componentAddress,
|
503
|
-
requiredType,
|
504
|
-
requiredRole);
|
505
|
-
|
506
472
|
// register component with registry
|
507
|
-
componentNftId =
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
component.linkToRegisteredNftId();
|
513
|
-
|
514
|
-
// save amended component info with instance
|
515
|
-
instanceReader = instance.getInstanceReader();
|
516
|
-
instanceStore = instance.getInstanceStore();
|
473
|
+
componentNftId =
|
474
|
+
info.objectType == PRODUCT() ?
|
475
|
+
_registryService.registerProduct(component, info.initialOwner).nftId :
|
476
|
+
_registryService.registerProductLinkedComponent(component, info.objectType, info.initialOwner).nftId;
|
517
477
|
|
478
|
+
// deploy and wire token handler
|
479
|
+
// TODO deploy token handler in instance contract ?!
|
518
480
|
IComponents.ComponentInfo memory componentInfo = component.getInitialComponentInfo();
|
481
|
+
IERC20Metadata token = componentInfo.token;
|
519
482
|
componentInfo.tokenHandler = TokenHandlerDeployerLib.deployTokenHandler(
|
520
|
-
address(
|
521
|
-
address(
|
522
|
-
|
483
|
+
address(getRegistry()),
|
484
|
+
address(component), // initially, component is its own wallet
|
485
|
+
address(token),
|
486
|
+
address(instanceAdmin.authority()));
|
487
|
+
|
488
|
+
// register component with instance
|
523
489
|
instanceStore.createComponent(
|
524
|
-
|
490
|
+
componentNftId,
|
525
491
|
componentInfo);
|
526
492
|
|
527
|
-
//
|
528
|
-
|
529
|
-
instance.getNftId(),
|
530
|
-
component);
|
531
|
-
|
532
|
-
// TODO add logging
|
533
|
-
}
|
493
|
+
// link component contract to nft id
|
494
|
+
component.linkToRegisteredNftId();
|
534
495
|
|
496
|
+
// authorize
|
497
|
+
instanceAdmin.initializeComponentAuthorization(component);
|
535
498
|
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
)
|
543
|
-
internal
|
544
|
-
{
|
545
|
-
// only link components that are registered
|
546
|
-
if(componentNftId.eqz()) {
|
547
|
-
return;
|
548
|
-
}
|
549
|
-
|
550
|
-
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(componentNftId);
|
551
|
-
componentInfo.productNftId = productNftId;
|
552
|
-
instanceStore.updateComponent(componentNftId, componentInfo, KEEP_STATE());
|
499
|
+
emit LogComponentServiceRegistered(
|
500
|
+
componentNftId,
|
501
|
+
info.objectType,
|
502
|
+
address(component),
|
503
|
+
address(token),
|
504
|
+
info.initialOwner);
|
553
505
|
}
|
554
506
|
|
555
507
|
|
@@ -568,13 +520,7 @@ contract ComponentService is
|
|
568
520
|
}
|
569
521
|
|
570
522
|
|
571
|
-
function
|
572
|
-
selectors = new bytes4[](1);
|
573
|
-
selectors[0] = selector;
|
574
|
-
}
|
575
|
-
|
576
|
-
|
577
|
-
function _getLinkedProductInfo(
|
523
|
+
function _getLinkedFeeInfo(
|
578
524
|
InstanceReader instanceReader,
|
579
525
|
NftId componentNftId
|
580
526
|
)
|
@@ -582,57 +528,94 @@ contract ComponentService is
|
|
582
528
|
view
|
583
529
|
returns(
|
584
530
|
NftId productNftId,
|
585
|
-
IComponents.
|
531
|
+
IComponents.FeeInfo memory info
|
586
532
|
)
|
587
533
|
{
|
588
|
-
productNftId =
|
589
|
-
info = instanceReader.
|
534
|
+
productNftId = getRegistry().getParentNftId(componentNftId);
|
535
|
+
info = instanceReader.getFeeInfo(productNftId);
|
590
536
|
}
|
591
537
|
|
592
|
-
|
593
|
-
///
|
594
|
-
/// the function reverts iff:
|
595
|
-
/// - the component has already been registered
|
538
|
+
/// @dev Based on the provided component address required type the component
|
539
|
+
/// and related instance contract this function reverts iff:
|
596
540
|
/// - the component contract does not support IInstanceLinkedComponent
|
597
|
-
/// - the component
|
598
|
-
/// - the
|
541
|
+
/// - the component parent does not match with the required parent
|
542
|
+
/// - the component version does not match with the service release
|
543
|
+
/// - the component has already been registered
|
599
544
|
function _getAndVerifyRegisterableComponent(
|
600
545
|
address componentAddress,
|
601
|
-
|
602
|
-
RoleId requiredRole
|
546
|
+
NftId requiredParent
|
603
547
|
)
|
604
548
|
internal
|
605
549
|
view
|
606
550
|
returns (
|
607
|
-
IInstance instance,
|
608
551
|
IInstanceLinkedComponent component,
|
609
|
-
|
552
|
+
IRegistry.ObjectInfo memory info
|
610
553
|
)
|
611
554
|
{
|
612
|
-
// check
|
555
|
+
// check component interface
|
556
|
+
if (!ContractLib.supportsInterface(componentAddress, type(IInstanceLinkedComponent).interfaceId)) {
|
557
|
+
revert ErrorComponentServiceNotInstanceLinkedComponent(componentAddress);
|
558
|
+
}
|
559
|
+
|
613
560
|
component = IInstanceLinkedComponent(componentAddress);
|
614
|
-
|
615
|
-
|
561
|
+
info = component.getInitialInfo();
|
562
|
+
|
563
|
+
// check component parent
|
564
|
+
if(info.parentNftId != requiredParent) {
|
565
|
+
revert ErrorComponentServiceComponentParentInvalid(componentAddress, requiredParent, info.parentNftId);
|
616
566
|
}
|
617
567
|
|
618
|
-
// check component
|
619
|
-
|
620
|
-
if(info.
|
621
|
-
|
568
|
+
// check component release
|
569
|
+
// TODO check version with registry
|
570
|
+
//if(info.version != getRelease()) {
|
571
|
+
if(component.getRelease() != getRelease()) {
|
572
|
+
revert ErrorComponentServiceComponentReleaseMismatch(componentAddress, getRelease(), component.getRelease());
|
622
573
|
}
|
623
574
|
|
624
575
|
// check component has not already been registered
|
625
576
|
if (getRegistry().getNftIdForAddress(componentAddress).gtz()) {
|
626
|
-
revert
|
577
|
+
revert ErrorComponentServiceComponentAlreadyRegistered(componentAddress);
|
627
578
|
}
|
579
|
+
}
|
628
580
|
|
629
|
-
|
630
|
-
|
631
|
-
|
581
|
+
function _getAndVerifyActiveComponent(ObjectType expectedType)
|
582
|
+
internal
|
583
|
+
view
|
584
|
+
returns (
|
585
|
+
NftId componentNftId,
|
586
|
+
IInstance instance
|
587
|
+
)
|
588
|
+
{
|
589
|
+
return _getAndVerifyComponent(expectedType, true); // only active
|
590
|
+
}
|
632
591
|
|
633
|
-
|
634
|
-
|
592
|
+
function _getAndVerifyComponent(ObjectType expectedType, bool isActive)
|
593
|
+
internal
|
594
|
+
view
|
595
|
+
returns (
|
596
|
+
NftId componentNftId,
|
597
|
+
IInstance instance
|
598
|
+
)
|
599
|
+
{
|
600
|
+
IRegistry.ObjectInfo memory info;
|
601
|
+
address instanceAddress;
|
602
|
+
|
603
|
+
if (expectedType != COMPONENT()) {
|
604
|
+
(info, instanceAddress) = ContractLib.getAndVerifyComponent(
|
605
|
+
getRegistry(),
|
606
|
+
msg.sender, // caller
|
607
|
+
expectedType,
|
608
|
+
isActive);
|
609
|
+
} else {
|
610
|
+
(info, instanceAddress) = ContractLib.getAndVerifyAnyComponent(
|
611
|
+
getRegistry(),
|
612
|
+
msg.sender,
|
613
|
+
isActive);
|
635
614
|
}
|
615
|
+
|
616
|
+
// get component nft id and instance
|
617
|
+
componentNftId = info.nftId;
|
618
|
+
instance = IInstance(instanceAddress);
|
636
619
|
}
|
637
620
|
|
638
621
|
function _getDomain() internal pure virtual override returns(ObjectType) {
|