@etherisc/gif-next 0.0.2-da0f894-204 → 0.0.2-da2c7dd-538
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +83 -93
- 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 +4 -0
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +1379 -0
- 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 +4 -0
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +1434 -0
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +542 -0
- package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +4 -0
- package/artifacts/contracts/{instance/module/ISetup.sol/ISetup.json → authorization/IAccess.sol/IAccess.json} +2 -2
- package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +4 -0
- package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +1130 -0
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +350 -0
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +167 -0
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +253 -0
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +4 -0
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +1322 -0
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +4 -0
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +589 -0
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +4 -0
- package/artifacts/contracts/{components → distribution}/Distribution.sol/Distribution.json +263 -526
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +4 -0
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +1509 -0
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +864 -0
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
- package/artifacts/contracts/{components → distribution}/IDistributionComponent.sol/IDistributionComponent.json +365 -279
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +4 -0
- package/artifacts/contracts/{instance/service → distribution}/IDistributionService.sol/IDistributionService.json +408 -258
- 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 +2032 -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 +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +1479 -0
- 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 +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +1195 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +1655 -0
- 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 +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +2432 -0
- 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 +4 -0
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +851 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +357 -2026
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +329 -79
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +442 -2824
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +1929 -0
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +661 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1683 -609
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +352 -373
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +157 -106
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +3718 -0
- 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 +4 -0
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +318 -0
- package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +4 -0
- package/artifacts/contracts/instance/{Cloneable.sol → base/Cloneable.sol}/Cloneable.json +1 -49
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +10 -0
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +223 -0
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +192 -0
- 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 +4 -0
- package/artifacts/contracts/instance/module/{ITreasury.sol/ITreasury.json → IComponents.sol/IComponents.json} +2 -2
- 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 +4 -0
- package/artifacts/contracts/mock/Dip.sol/Dip.json +376 -0
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +4 -0
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +959 -0
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +4 -0
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +569 -0
- package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +4 -0
- package/artifacts/contracts/oracle/IOracle.sol/IOracle.json +52 -0
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +4 -0
- package/artifacts/contracts/{components/Component.sol/Component.json → oracle/IOracleComponent.sol/IOracleComponent.json} +236 -236
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +4 -0
- package/artifacts/contracts/{instance/service/IPolicyService.sol/IPolicyService.json → oracle/IOracleService.sol/IOracleService.json} +364 -150
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +4 -0
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +875 -0
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +4 -0
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +997 -0
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +764 -0
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +4 -0
- package/artifacts/contracts/{components/Pool.sol/Pool.json → pool/BasicPool.sol/BasicPool.json} +320 -519
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +589 -0
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +1261 -0
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +800 -0
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +880 -0
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +4 -0
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +907 -0
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +4 -0
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +1230 -0
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +4 -0
- package/artifacts/contracts/{components/IPoolComponent.sol/IPoolComponent.json → pool/Pool.sol/Pool.json} +437 -439
- 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 +4 -0
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +1574 -0
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +808 -0
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +4 -0
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +813 -0
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +728 -0
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +4 -0
- package/artifacts/contracts/{components/Product.sol/Product.json → product/BasicProduct.sol/BasicProduct.json} +473 -411
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +589 -0
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +4 -0
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +1496 -0
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +848 -0
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/{instance/service → product}/IApplicationService.sol/IApplicationService.json +211 -149
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +4 -0
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +1064 -0
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +981 -0
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +4 -0
- package/artifacts/contracts/{instance/service/IBundleService.sol/IBundleService.json → product/IPricingService.sol/IPricingService.json} +275 -306
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +4 -0
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +1018 -0
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +4 -0
- package/artifacts/contracts/{instance/service/IProductService.sol/IProductService.json → product/IRiskService.sol/IRiskService.json} +140 -65
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +1333 -0
- 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 +4 -0
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +808 -0
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +4 -0
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +930 -0
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +784 -0
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +4 -0
- package/artifacts/contracts/product/Product.sol/Product.json +1119 -0
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +4 -0
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +659 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +732 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +72 -16
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +499 -26
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +277 -124
- 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 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +989 -125
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +1928 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +352 -260
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +164 -99
- 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 +4 -0
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +205 -0
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +1333 -0
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +4 -0
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +272 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +317 -154
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/shared/Component.sol/Component.json +707 -0
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +1571 -0
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +4 -0
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +820 -0
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +4 -0
- package/artifacts/contracts/{instance/base/ComponentService.sol/ComponentService.json → shared/ComponentVerifyingService.sol/ComponentVerifyingService.json} +115 -182
- 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 +4 -0
- package/artifacts/contracts/{components → shared}/IComponent.sol/IComponent.json +267 -82
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +4 -0
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +1203 -0
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +4 -0
- package/artifacts/contracts/{components/IProductComponent.sol/IProductComponent.json → shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json} +279 -242
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/{instance/base → shared}/IKeyValueStore.sol/IKeyValueStore.json +95 -14
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +4 -0
- package/artifacts/contracts/{instance/base → shared}/ILifecycle.sol/ILifecycle.json +35 -4
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +19 -10
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +59 -13
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +144 -3
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.json +0 -13
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +148 -18
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +4 -0
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +53 -0
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +4 -0
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +797 -0
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +538 -0
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +4 -0
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +174 -0
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +4 -0
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +306 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +28 -70
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +35 -85
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +126 -100
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -28
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +134 -106
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +635 -8
- 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 +4 -0
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +172 -0
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +4 -0
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +1447 -0
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +4 -0
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +1096 -0
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +4 -0
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +440 -0
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +4 -0
- package/artifacts/contracts/staking/Staking.sol/Staking.json +1849 -0
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +205 -0
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +788 -0
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +587 -0
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +1301 -0
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +732 -0
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2283 -0
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +4 -0
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +607 -0
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +4 -0
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.json +10 -0
- package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +4 -0
- package/artifacts/contracts/type/Amount.sol/AmountLib.json +398 -0
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +4 -0
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.json +225 -0
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +203 -0
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +4 -0
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +104 -0
- package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +4 -0
- package/artifacts/contracts/type/Fee.sol/FeeLib.json +317 -0
- package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +4 -0
- package/artifacts/contracts/type/Key32.sol/Key32Lib.json +125 -0
- 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 +4 -0
- package/artifacts/contracts/type/NftId.sol/NftIdLib.json +228 -0
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +4 -0
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +33 -0
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +4 -0
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +239 -0
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +209 -0
- package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +4 -0
- package/artifacts/contracts/type/Referral.sol/ReferralLib.json +142 -0
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +204 -0
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +204 -0
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +433 -0
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +4 -0
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +246 -0
- package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +4 -0
- package/artifacts/contracts/type/Selector.sol/SelectorLib.json +148 -0
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +4 -0
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.json +10 -0
- package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/StateId.sol/StateIdLib.json +105 -0
- package/artifacts/contracts/type/String.sol/StrLib.dbg.json +4 -0
- package/artifacts/contracts/type/String.sol/StrLib.json +132 -0
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +4 -0
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +312 -0
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +4 -0
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +548 -0
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +4 -0
- package/artifacts/contracts/type/Version.sol/VersionLib.json +158 -0
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +4 -0
- package/artifacts/contracts/type/Version.sol/VersionPartLib.json +113 -0
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +4 -0
- package/artifacts/contracts/{shared → upgradeability}/IVersionable.sol/IVersionable.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +4 -0
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +618 -0
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +129 -0
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +4 -0
- package/artifacts/contracts/{shared → upgradeability}/Versionable.sol/Versionable.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 +689 -0
- package/contracts/authorization/AccessManagerCloneable.sol +149 -0
- package/contracts/authorization/Authorization.sol +337 -0
- package/contracts/authorization/IAccess.sol +49 -0
- package/contracts/authorization/IAccessAdmin.sol +143 -0
- package/contracts/authorization/IAuthorization.sol +74 -0
- package/contracts/authorization/IServiceAuthorization.sol +40 -0
- package/contracts/authorization/ServiceAuthorization.sol +106 -0
- package/contracts/distribution/BasicDistribution.sol +141 -0
- package/contracts/distribution/BasicDistributionAuthorization.sol +60 -0
- package/contracts/{components → distribution}/Distribution.sol +173 -177
- package/contracts/distribution/DistributionService.sol +358 -0
- package/contracts/distribution/DistributionServiceManager.sol +39 -0
- package/contracts/distribution/IDistributionComponent.sol +52 -0
- package/contracts/distribution/IDistributionService.sol +101 -0
- 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 +437 -0
- package/contracts/examples/fire/FireProductAuthorization.sol +45 -0
- package/contracts/examples/fire/FireUSD.sol +26 -0
- package/contracts/examples/unpermissioned/SimpleDistribution.sol +57 -0
- package/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol +28 -0
- package/contracts/examples/unpermissioned/SimpleOracle.sol +137 -0
- package/contracts/examples/unpermissioned/SimplePool.sol +106 -0
- package/contracts/examples/unpermissioned/SimplePoolAuthorization.sol +28 -0
- package/contracts/examples/unpermissioned/SimpleProduct.sol +377 -0
- package/contracts/examples/unpermissioned/SimpleProductAuthorization.sol +28 -0
- package/contracts/instance/BundleSet.sol +130 -0
- package/contracts/instance/IInstance.sol +50 -72
- package/contracts/instance/IInstanceService.sol +39 -26
- package/contracts/instance/Instance.sol +177 -221
- package/contracts/instance/InstanceAdmin.sol +437 -0
- package/contracts/instance/InstanceAuthorizationV3.sol +213 -0
- package/contracts/instance/InstanceReader.sol +408 -64
- package/contracts/instance/InstanceService.sol +291 -377
- package/contracts/instance/InstanceServiceManager.sol +14 -29
- package/contracts/instance/InstanceStore.sol +298 -0
- package/contracts/instance/RiskSet.sol +118 -0
- package/contracts/instance/base/BalanceStore.sol +123 -0
- package/contracts/instance/{Cloneable.sol → base/Cloneable.sol} +4 -22
- package/contracts/instance/base/ObjectCounter.sol +20 -0
- package/contracts/instance/base/ObjectLifecycle.sol +113 -0
- package/contracts/instance/base/ObjectSet.sol +77 -0
- package/contracts/instance/base/ObjectSetHelperLib.sol +30 -0
- package/contracts/instance/module/IBundle.sol +8 -9
- package/contracts/instance/module/IComponents.sol +51 -0
- package/contracts/instance/module/IDistribution.sol +8 -7
- package/contracts/instance/module/IPolicy.sol +48 -35
- package/contracts/instance/module/IRisk.sol +4 -1
- package/contracts/{test/Usdc.sol → mock/Dip.sol} +6 -6
- package/contracts/oracle/BasicOracle.sol +47 -0
- package/contracts/oracle/BasicOracleAuthorization.sol +37 -0
- package/contracts/oracle/IOracle.sol +36 -0
- package/contracts/oracle/IOracleComponent.sol +33 -0
- package/contracts/oracle/IOracleService.sol +66 -0
- package/contracts/oracle/Oracle.sol +156 -0
- package/contracts/oracle/OracleService.sol +310 -0
- package/contracts/oracle/OracleServiceManager.sol +39 -0
- package/contracts/pool/BasicPool.sol +175 -0
- package/contracts/pool/BasicPoolAuthorization.sol +76 -0
- package/contracts/pool/BundleService.sol +395 -0
- package/contracts/pool/BundleServiceManager.sol +39 -0
- package/contracts/pool/IBundleService.sol +115 -0
- package/contracts/pool/IPoolComponent.sol +62 -0
- package/contracts/pool/IPoolService.sol +165 -0
- package/contracts/pool/Pool.sol +345 -0
- package/contracts/pool/PoolLib.sol +216 -0
- package/contracts/pool/PoolService.sol +757 -0
- package/contracts/pool/PoolServiceManager.sol +39 -0
- package/contracts/product/ApplicationService.sol +259 -0
- package/contracts/{instance/service → product}/ApplicationServiceManager.sol +12 -9
- package/contracts/product/BasicProduct.sol +51 -0
- package/contracts/product/BasicProductAuthorization.sol +56 -0
- package/contracts/product/ClaimService.sol +632 -0
- package/contracts/{instance/service → product}/ClaimServiceManager.sol +12 -9
- package/contracts/{instance/service → product}/IApplicationService.sol +19 -34
- package/contracts/product/IClaimService.sol +135 -0
- package/contracts/product/IPolicyService.sol +95 -0
- package/contracts/product/IPricingService.sol +39 -0
- package/contracts/product/IProductComponent.sol +62 -0
- package/contracts/product/IRiskService.sol +30 -0
- package/contracts/product/PolicyService.sol +682 -0
- package/contracts/product/PolicyServiceLib.sol +65 -0
- package/contracts/product/PolicyServiceManager.sol +39 -0
- package/contracts/product/PricingService.sol +304 -0
- package/contracts/product/PricingServiceManager.sol +39 -0
- package/contracts/product/Product.sol +469 -0
- package/contracts/product/RiskService.sol +144 -0
- package/contracts/product/RiskServiceManager.sol +39 -0
- package/contracts/registry/ChainNft.sol +83 -36
- package/contracts/registry/IRegistry.sol +97 -30
- package/contracts/registry/IRegistryService.sol +36 -41
- package/contracts/registry/IRelease.sol +26 -0
- package/contracts/registry/ITransferInterceptor.sol +1 -1
- package/contracts/registry/Registry.sol +472 -206
- package/contracts/registry/RegistryAdmin.sol +354 -0
- package/contracts/registry/RegistryService.sol +89 -131
- package/contracts/registry/RegistryServiceManager.sol +23 -32
- package/contracts/registry/ReleaseAdmin.sol +245 -0
- package/contracts/registry/ReleaseLifecycle.sol +32 -0
- package/contracts/registry/ReleaseRegistry.sol +511 -0
- package/contracts/registry/ServiceAuthorizationV3.sol +247 -0
- package/contracts/registry/TokenRegistry.sol +261 -64
- package/contracts/shared/Component.sol +227 -0
- package/contracts/shared/ComponentService.sol +692 -0
- package/contracts/shared/ComponentServiceManager.sol +38 -0
- package/contracts/shared/ComponentVerifyingService.sol +128 -0
- package/contracts/shared/ContractLib.sol +253 -0
- package/contracts/shared/IComponent.sol +61 -0
- package/contracts/shared/IComponentService.sol +112 -0
- package/contracts/shared/IInstanceLinkedComponent.sol +30 -0
- package/contracts/{instance/base → shared}/IKeyValueStore.sol +16 -11
- package/contracts/{instance/base → shared}/ILifecycle.sol +5 -4
- package/contracts/shared/INftOwnable.sol +4 -2
- package/contracts/shared/IPolicyHolder.sol +23 -14
- package/contracts/shared/IRegisterable.sol +23 -1
- package/contracts/shared/IRegistryLinked.sol +0 -1
- package/contracts/shared/IService.sol +12 -7
- package/contracts/shared/{ERC165.sol → InitializableERC165.sol} +4 -4
- package/contracts/shared/InstanceLinkedComponent.sol +197 -0
- package/contracts/shared/KeyValueStore.sol +131 -0
- package/contracts/shared/Lifecycle.sol +88 -0
- package/contracts/shared/NftIdSet.sol +65 -0
- package/contracts/shared/NftOwnable.sol +34 -27
- package/contracts/shared/PolicyHolder.sol +22 -41
- package/contracts/shared/Registerable.sol +55 -20
- package/contracts/shared/RegistryLinked.sol +9 -19
- package/contracts/shared/Service.sol +36 -29
- package/contracts/shared/TokenHandler.sol +326 -12
- package/contracts/shared/TokenHandlerDeployerLib.sol +20 -0
- package/contracts/staking/IStaking.sol +165 -0
- package/contracts/staking/IStakingService.sol +165 -0
- package/contracts/staking/StakeManagerLib.sol +224 -0
- package/contracts/staking/Staking.sol +526 -0
- package/contracts/staking/StakingLifecycle.sol +23 -0
- package/contracts/staking/StakingManager.sol +52 -0
- package/contracts/staking/StakingReader.sol +190 -0
- package/contracts/staking/StakingService.sol +430 -0
- package/contracts/staking/StakingServiceManager.sol +45 -0
- package/contracts/staking/StakingStore.sol +605 -0
- package/contracts/staking/TargetManagerLib.sol +211 -0
- package/contracts/{types → type}/AddressSet.sol +1 -1
- package/contracts/type/Amount.sol +150 -0
- package/contracts/{types → type}/Blocknumber.sol +27 -3
- package/contracts/{types → type}/ClaimId.sol +31 -3
- package/contracts/{types → type}/Fee.sol +33 -23
- package/contracts/{types → type}/Key32.sol +2 -2
- package/contracts/type/Key32Set.sol +62 -0
- package/contracts/{types → type}/NftId.sol +28 -15
- package/contracts/{types → type}/NftIdSet.sol +2 -2
- package/contracts/type/ObjectType.sol +303 -0
- package/contracts/type/PayoutId.sol +82 -0
- package/contracts/{types → type}/Referral.sol +6 -1
- package/contracts/type/RequestId.sol +75 -0
- package/contracts/type/RiskId.sol +75 -0
- package/contracts/type/RoleId.sol +182 -0
- package/contracts/type/Seconds.sol +101 -0
- package/contracts/type/Selector.sol +107 -0
- package/contracts/{types → type}/StateId.sol +48 -4
- package/contracts/type/String.sol +53 -0
- package/contracts/{types → type}/Timestamp.sol +21 -6
- package/contracts/{types → type}/UFixed.sol +41 -121
- package/contracts/{types → type}/Version.sol +20 -7
- package/contracts/{shared → upgradeability}/IVersionable.sol +1 -1
- package/contracts/{shared → upgradeability}/ProxyManager.sol +93 -30
- package/contracts/{shared → upgradeability}/UpgradableProxyWithAdmin.sol +1 -3
- package/contracts/{shared → upgradeability}/Versionable.sol +3 -3
- package/package.json +11 -7
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +0 -4
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +0 -4
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +0 -4
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +0 -4
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +0 -4
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +0 -4
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +0 -764
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +0 -4
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +0 -4
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +0 -984
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +0 -4
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +0 -261
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +0 -4
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +0 -4
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +0 -502
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +0 -4
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +0 -169
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +0 -4
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +0 -254
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +0 -4
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +0 -947
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +0 -665
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +0 -1096
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +0 -4
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +0 -661
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +0 -754
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +0 -637
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +0 -1553
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +0 -4
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +0 -793
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +0 -409
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +0 -347
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +0 -1000
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +0 -4
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +0 -689
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +0 -727
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +0 -4
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +0 -649
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +0 -777
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +0 -649
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +0 -4
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +0 -285
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +0 -4
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +0 -547
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +0 -4
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.json +0 -107
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +0 -4
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +0 -73
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +0 -4
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +0 -4
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +0 -582
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +0 -4
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +0 -129
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +0 -4
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +0 -4
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +0 -119
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +0 -4
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +0 -383
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +0 -4
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +0 -116
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +0 -4
- package/artifacts/contracts/test/TestService.sol/TestService.json +0 -521
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +0 -4
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +0 -376
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +0 -4
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +0 -218
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +0 -4
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +0 -104
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +0 -4
- package/artifacts/contracts/test/Usdc.sol/USDC.json +0 -376
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +0 -4
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.json +0 -10
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +0 -4
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +0 -174
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.json +0 -10
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +0 -100
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +0 -4
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +0 -104
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +0 -4
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +0 -257
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +0 -4
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +0 -125
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +0 -153
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +0 -4
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +0 -33
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.json +0 -100
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +0 -4
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +0 -92
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +0 -100
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +0 -4
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +0 -123
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +0 -86
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +0 -156
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +0 -4
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.json +0 -124
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/StateId.sol/StateIdLib.json +0 -92
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +0 -4
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +0 -267
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +0 -4
- package/artifacts/contracts/types/UFixed.sol/MathLib.json +0 -10
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +0 -4
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +0 -479
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +0 -4
- package/artifacts/contracts/types/Version.sol/VersionLib.json +0 -177
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +0 -4
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +0 -49
- package/contracts/components/Component.sol +0 -221
- package/contracts/components/IComponent.sol +0 -68
- package/contracts/components/IDistributionComponent.sol +0 -79
- package/contracts/components/IPoolComponent.sol +0 -151
- package/contracts/components/IProductComponent.sol +0 -40
- package/contracts/components/Pool.sol +0 -378
- package/contracts/components/Product.sol +0 -289
- package/contracts/instance/BundleManager.sol +0 -125
- package/contracts/instance/InstanceAccessManager.sol +0 -297
- package/contracts/instance/ObjectManager.sol +0 -84
- package/contracts/instance/base/ComponentService.sol +0 -134
- package/contracts/instance/base/KeyValueStore.sol +0 -172
- package/contracts/instance/base/Lifecycle.sol +0 -100
- package/contracts/instance/module/IAccess.sol +0 -47
- package/contracts/instance/module/ISetup.sol +0 -46
- package/contracts/instance/module/ITreasury.sol +0 -23
- package/contracts/instance/service/ApplicationService.sol +0 -346
- package/contracts/instance/service/BundleService.sol +0 -299
- package/contracts/instance/service/BundleServiceManager.sol +0 -51
- package/contracts/instance/service/ClaimService.sol +0 -151
- package/contracts/instance/service/DistributionService.sol +0 -394
- package/contracts/instance/service/DistributionServiceManager.sol +0 -51
- package/contracts/instance/service/IBundleService.sol +0 -55
- package/contracts/instance/service/IClaimService.sol +0 -61
- package/contracts/instance/service/IDistributionService.sol +0 -86
- package/contracts/instance/service/IPolicyService.sol +0 -70
- package/contracts/instance/service/IPoolService.sol +0 -20
- package/contracts/instance/service/IProductService.sol +0 -40
- package/contracts/instance/service/PolicyService.sol +0 -404
- package/contracts/instance/service/PolicyServiceManager.sol +0 -54
- package/contracts/instance/service/PoolService.sol +0 -109
- package/contracts/instance/service/PoolServiceManager.sol +0 -51
- package/contracts/instance/service/ProductService.sol +0 -233
- package/contracts/instance/service/ProductServiceManager.sol +0 -54
- package/contracts/registry/RegistryAccessManager.sol +0 -216
- package/contracts/registry/ReleaseManager.sol +0 -322
- package/contracts/shared/ContractDeployerLib.sol +0 -72
- package/contracts/test/TestFee.sol +0 -25
- package/contracts/test/TestRegisterable.sol +0 -18
- package/contracts/test/TestRoleId.sol +0 -14
- package/contracts/test/TestService.sol +0 -25
- package/contracts/test/TestToken.sol +0 -26
- package/contracts/test/TestVersion.sol +0 -44
- package/contracts/test/TestVersionable.sol +0 -17
- package/contracts/types/ChainId.sol +0 -38
- package/contracts/types/NumberId.sol +0 -52
- package/contracts/types/ObjectType.sol +0 -156
- package/contracts/types/PayoutId.sol +0 -54
- package/contracts/types/RiskId.sol +0 -43
- package/contracts/types/RoleId.sol +0 -95
- package/contracts/types/Seconds.sol +0 -54
- /package/contracts/{types → type}/DistributorType.sol +0 -0
@@ -3,318 +3,256 @@ pragma solidity ^0.8.20;
|
|
3
3
|
|
4
4
|
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
|
5
5
|
|
6
|
+
import {IAuthorization} from "../authorization/IAuthorization.sol";
|
7
|
+
import {AccessManagerCloneable} from "../authorization/AccessManagerCloneable.sol";
|
8
|
+
import {Amount} from "../type/Amount.sol";
|
9
|
+
import {BundleSet} from "./BundleSet.sol";
|
10
|
+
import {RiskSet} from "./RiskSet.sol";
|
11
|
+
import {ChainNft} from "../registry/ChainNft.sol";
|
12
|
+
import {NftId} from "../type/NftId.sol";
|
13
|
+
import {RoleId} from "../type/RoleId.sol";
|
14
|
+
import {UFixed} from "../type/UFixed.sol";
|
15
|
+
import {ObjectType, INSTANCE, COMPONENT, INSTANCE, REGISTRY, STAKING} from "../type/ObjectType.sol";
|
16
|
+
|
17
|
+
import {Service} from "../shared/Service.sol";
|
18
|
+
|
19
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
20
|
+
import {IRegistryService} from "../registry/IRegistryService.sol";
|
21
|
+
import {IStakingService} from "../staking/IStakingService.sol";
|
22
|
+
import {TargetManagerLib} from "../staking/TargetManagerLib.sol";
|
23
|
+
|
24
|
+
import {IComponentService} from "../shared/IComponentService.sol";
|
6
25
|
import {Instance} from "./Instance.sol";
|
7
26
|
import {IInstance} from "./IInstance.sol";
|
8
|
-
import {
|
27
|
+
import {InstanceAdmin} from "./InstanceAdmin.sol";
|
9
28
|
import {IInstanceService} from "./IInstanceService.sol";
|
10
29
|
import {InstanceReader} from "./InstanceReader.sol";
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
|
15
|
-
import {Service} from "../../contracts/shared/Service.sol";
|
16
|
-
import {IService} from "../shared/IService.sol";
|
17
|
-
import {NftId} from "../../contracts/types/NftId.sol";
|
18
|
-
import {RoleId} from "../types/RoleId.sol";
|
19
|
-
import {ADMIN_ROLE, DISTRIBUTION_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE, PUBLIC_ROLE, INSTANCE_SERVICE_ROLE, DISTRIBUTION_SERVICE_ROLE, POOL_SERVICE_ROLE, PRODUCT_SERVICE_ROLE, APPLICATION_SERVICE_ROLE, POLICY_SERVICE_ROLE, CLAIM_SERVICE_ROLE, BUNDLE_SERVICE_ROLE} from "../types/RoleId.sol";
|
20
|
-
import {ObjectType, INSTANCE, BUNDLE, APPLICATION, POLICY, CLAIM, PRODUCT, DISTRIBUTION, REGISTRY, POOL} from "../types/ObjectType.sol";
|
21
|
-
import {IDistributionComponent} from "../components/IDistributionComponent.sol";
|
22
|
-
import {IPoolComponent} from "../components/IPoolComponent.sol";
|
23
|
-
import {IProductComponent} from "../components/IProductComponent.sol";
|
30
|
+
import {InstanceStore} from "./InstanceStore.sol";
|
31
|
+
import {Seconds} from "../type/Seconds.sol";
|
32
|
+
import {VersionPart} from "../type/Version.sol";
|
33
|
+
|
24
34
|
|
25
35
|
contract InstanceService is
|
26
36
|
Service,
|
27
37
|
IInstanceService
|
28
38
|
{
|
29
39
|
|
30
|
-
|
40
|
+
// TODO update to real hash when instance is stable
|
41
|
+
bytes32 public constant INSTANCE_CREATION_CODE_HASH = bytes32(0);
|
42
|
+
|
43
|
+
IRegistryService internal _registryService;
|
44
|
+
IStakingService internal _stakingService;
|
45
|
+
IComponentService internal _componentService;
|
46
|
+
|
47
|
+
address internal _masterAccessManager;
|
48
|
+
address internal _masterInstanceAdmin;
|
31
49
|
address internal _masterInstance;
|
32
50
|
address internal _masterInstanceReader;
|
33
|
-
address internal
|
51
|
+
address internal _masterInstanceBundleSet;
|
52
|
+
address internal _masterInstanceRiskSet;
|
53
|
+
address internal _masterInstanceStore;
|
34
54
|
|
35
|
-
// TODO update to real hash when instance is stable
|
36
|
-
bytes32 public constant INSTANCE_CREATION_CODE_HASH = bytes32(0);
|
37
55
|
|
38
|
-
modifier
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
56
|
+
modifier onlyInstance() {
|
57
|
+
address instanceAddress = msg.sender;
|
58
|
+
NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
|
59
|
+
if (instanceNftId.eqz()) {
|
60
|
+
revert ErrorInstanceServiceNotRegistered(instanceAddress);
|
61
|
+
}
|
62
|
+
|
63
|
+
ObjectType objectType = getRegistry().getObjectInfo(instanceNftId).objectType;
|
64
|
+
if (objectType != INSTANCE()) {
|
65
|
+
revert ErrorInstanceServiceNotInstance(instanceAddress, objectType);
|
66
|
+
}
|
67
|
+
|
68
|
+
VersionPart instanceVersion = IInstance(instanceAddress).getRelease();
|
69
|
+
if (instanceVersion != getVersion().toMajorPart()) {
|
70
|
+
revert ErrorInstanceServiceInstanceVersionMismatch(instanceAddress, instanceVersion);
|
71
|
+
}
|
72
|
+
|
73
|
+
_;
|
74
|
+
}
|
75
|
+
|
76
|
+
|
77
|
+
modifier onlyInstanceOwner(NftId instanceNftId) {
|
78
|
+
if(msg.sender != getRegistry().ownerOf(instanceNftId)) {
|
79
|
+
revert ErrorInstanceServiceRequestUnauhorized(msg.sender);
|
44
80
|
}
|
45
81
|
_;
|
46
82
|
}
|
47
83
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
84
|
+
|
85
|
+
// TODO check component - service - instance version match
|
86
|
+
modifier onlyComponent() {
|
87
|
+
if (! getRegistry().isRegisteredComponent(msg.sender)) {
|
88
|
+
revert ErrorInstanceServiceRequestUnauhorized(msg.sender);
|
52
89
|
}
|
53
90
|
_;
|
54
91
|
}
|
55
92
|
|
56
|
-
function
|
93
|
+
function createInstance()
|
57
94
|
external
|
95
|
+
restricted()
|
58
96
|
returns (
|
59
|
-
|
60
|
-
|
61
|
-
NftId clonedInstanceNftId,
|
62
|
-
InstanceReader clonedInstanceReader,
|
63
|
-
BundleManager clonedBundleManager
|
97
|
+
IInstance instance,
|
98
|
+
NftId instanceNftId
|
64
99
|
)
|
65
100
|
{
|
101
|
+
// tx sender will become instance owner
|
66
102
|
address instanceOwner = msg.sender;
|
67
|
-
IRegistry registry = getRegistry();
|
68
|
-
address registryAddress = address(registry);
|
69
|
-
NftId registryNftId = registry.getNftId(registryAddress);
|
70
|
-
address registryServiceAddress = registry.getServiceAddress(REGISTRY(), getMajorVersion());
|
71
|
-
IRegistryService registryService = IRegistryService(registryServiceAddress);
|
72
|
-
|
73
|
-
// initially set the authority of the access managar to this (being the instance service).
|
74
|
-
// This will allow the instance service to bootstrap the authorizations of the instance
|
75
|
-
// and then transfer the ownership of the access manager to the instance owner once everything is setup
|
76
|
-
clonedAccessManager = InstanceAccessManager(Clones.clone(_masterInstanceAccessManager));
|
77
|
-
clonedAccessManager.initialize(address(this));
|
78
|
-
|
79
|
-
clonedInstance = Instance(Clones.clone(_masterInstance));
|
80
|
-
clonedInstance.initialize(address(clonedAccessManager), registryAddress, registryNftId, msg.sender);
|
81
|
-
|
82
|
-
clonedInstanceReader = InstanceReader(Clones.clone(address(_masterInstanceReader)));
|
83
|
-
clonedInstanceReader.initialize(registryAddress, address(clonedInstance));
|
84
|
-
clonedInstance.setInstanceReader(clonedInstanceReader);
|
85
103
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
//
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
//
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
_grantPoolServiceAuthorizations(clonedAccessManager, clonedInstance);
|
111
|
-
_grantProductServiceAuthorizations(clonedAccessManager, clonedInstance);
|
112
|
-
_grantApplicationServiceAuthorizations(clonedAccessManager, clonedInstance);
|
113
|
-
_grantPolicyServiceAuthorizations(clonedAccessManager, clonedInstance);
|
114
|
-
_grantClaimServiceAuthorizations(clonedAccessManager, clonedInstance);
|
115
|
-
_grantBundleServiceAuthorizations(clonedAccessManager, clonedInstance, clonedBundleManager);
|
116
|
-
_grantInstanceServiceAuthorizations(clonedAccessManager, clonedInstance);
|
117
|
-
}
|
118
|
-
|
119
|
-
function _createGifRoles(InstanceAccessManager clonedAccessManager) internal {
|
120
|
-
clonedAccessManager.createGifRole(DISTRIBUTION_OWNER_ROLE(), "DistributionOwnerRole");
|
121
|
-
clonedAccessManager.createGifRole(POOL_OWNER_ROLE(), "PoolOwnerRole");
|
122
|
-
clonedAccessManager.createGifRole(PRODUCT_OWNER_ROLE(), "ProductOwnerRole");
|
123
|
-
|
124
|
-
clonedAccessManager.createGifRole(DISTRIBUTION_SERVICE_ROLE(), "DistributionServiceRole");
|
125
|
-
clonedAccessManager.createGifRole(POOL_SERVICE_ROLE(), "PoolServiceRole");
|
126
|
-
clonedAccessManager.createGifRole(PRODUCT_SERVICE_ROLE(), "ProductServiceRole");
|
127
|
-
clonedAccessManager.createGifRole(APPLICATION_SERVICE_ROLE(), "ApplicationServiceRole");
|
128
|
-
clonedAccessManager.createGifRole(POLICY_SERVICE_ROLE(), "PolicyServiceRole");
|
129
|
-
clonedAccessManager.createGifRole(CLAIM_SERVICE_ROLE(), "ClaimServiceRole");
|
130
|
-
clonedAccessManager.createGifRole(BUNDLE_SERVICE_ROLE(), "BundleServiceRole");
|
131
|
-
clonedAccessManager.createGifRole(INSTANCE_SERVICE_ROLE(), "InstanceServiceRole");
|
104
|
+
// create instance admin and instance
|
105
|
+
InstanceAdmin instanceAdmin = _createInstanceAdmin();
|
106
|
+
instance = _createInstance(instanceAdmin, instanceOwner);
|
107
|
+
|
108
|
+
// register cloned instance with registry
|
109
|
+
instanceNftId = _registryService.registerInstance(
|
110
|
+
instance, instanceOwner).nftId;
|
111
|
+
|
112
|
+
// register cloned instance as staking target
|
113
|
+
_stakingService.createInstanceTarget(
|
114
|
+
instanceNftId,
|
115
|
+
TargetManagerLib.getDefaultLockingPeriod(),
|
116
|
+
TargetManagerLib.getDefaultRewardRate());
|
117
|
+
|
118
|
+
// MUST be set after instance is set up and registered
|
119
|
+
IAuthorization instanceAuthorization = InstanceAdmin(_masterInstanceAdmin).getInstanceAuthorization();
|
120
|
+
VersionPart release = AccessManagerCloneable(authority()).getRelease();
|
121
|
+
instanceAdmin.completeSetup(
|
122
|
+
address(instance),
|
123
|
+
address(instanceAuthorization));
|
124
|
+
|
125
|
+
emit LogInstanceCloned(
|
126
|
+
instanceNftId,
|
127
|
+
address(instance));
|
132
128
|
}
|
133
129
|
|
134
|
-
function _createGifTargets(InstanceAccessManager clonedAccessManager, Instance clonedInstance, BundleManager clonedBundleManager) internal {
|
135
|
-
clonedAccessManager.createGifTarget(address(clonedAccessManager), "InstanceAccessManager");
|
136
|
-
clonedAccessManager.createGifTarget(address(clonedInstance), "Instance");
|
137
|
-
clonedAccessManager.createGifTarget(address(clonedBundleManager), "BundleManager");
|
138
|
-
}
|
139
130
|
|
140
|
-
function
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
instanceDistributionServiceSelectors[4] = clonedInstance.updateDistributorTypeState.selector;
|
151
|
-
instanceDistributionServiceSelectors[5] = clonedInstance.createDistributor.selector;
|
152
|
-
instanceDistributionServiceSelectors[6] = clonedInstance.updateDistributor.selector;
|
153
|
-
instanceDistributionServiceSelectors[7] = clonedInstance.updateDistributorState.selector;
|
154
|
-
instanceDistributionServiceSelectors[8] = clonedInstance.createReferral.selector;
|
155
|
-
instanceDistributionServiceSelectors[9] = clonedInstance.updateReferral.selector;
|
156
|
-
instanceDistributionServiceSelectors[10] = clonedInstance.updateReferralState.selector;
|
157
|
-
clonedAccessManager.setTargetFunctionRole(
|
158
|
-
"Instance",
|
159
|
-
instanceDistributionServiceSelectors,
|
160
|
-
DISTRIBUTION_SERVICE_ROLE());
|
131
|
+
function setStakingLockingPeriod(Seconds stakeLockingPeriod)
|
132
|
+
external
|
133
|
+
virtual
|
134
|
+
restricted()
|
135
|
+
onlyInstance()
|
136
|
+
{
|
137
|
+
NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
|
138
|
+
_stakingService.setInstanceLockingPeriod(
|
139
|
+
instanceNftId,
|
140
|
+
stakeLockingPeriod);
|
161
141
|
}
|
162
142
|
|
163
|
-
function _grantPoolServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
164
|
-
// configure authorization for pool service on instance
|
165
|
-
address poolServiceAddress = getRegistry().getServiceAddress(POOL(), getMajorVersion());
|
166
|
-
clonedAccessManager.grantRole(POOL_SERVICE_ROLE(), address(poolServiceAddress));
|
167
|
-
bytes4[] memory instancePoolServiceSelectors = new bytes4[](4);
|
168
|
-
instancePoolServiceSelectors[0] = clonedInstance.createPoolSetup.selector;
|
169
|
-
instancePoolServiceSelectors[1] = clonedInstance.updatePoolSetup.selector;
|
170
|
-
clonedAccessManager.setTargetFunctionRole(
|
171
|
-
"Instance",
|
172
|
-
instancePoolServiceSelectors,
|
173
|
-
POOL_SERVICE_ROLE());
|
174
|
-
}
|
175
143
|
|
176
|
-
function
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
clonedAccessManager.setTargetFunctionRole(
|
187
|
-
"Instance",
|
188
|
-
instanceProductServiceSelectors,
|
189
|
-
PRODUCT_SERVICE_ROLE());
|
144
|
+
function setStakingRewardRate(UFixed rewardRate)
|
145
|
+
external
|
146
|
+
virtual
|
147
|
+
restricted()
|
148
|
+
onlyInstance()
|
149
|
+
{
|
150
|
+
NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
|
151
|
+
_stakingService.setInstanceRewardRate(
|
152
|
+
instanceNftId,
|
153
|
+
rewardRate);
|
190
154
|
}
|
191
155
|
|
192
|
-
function _grantApplicationServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
193
|
-
// configure authorization for application services on instance
|
194
|
-
address applicationServiceAddress = getRegistry().getServiceAddress(APPLICATION(), getMajorVersion());
|
195
|
-
clonedAccessManager.grantRole(APPLICATION_SERVICE_ROLE(), applicationServiceAddress);
|
196
|
-
bytes4[] memory instanceApplicationServiceSelectors = new bytes4[](3);
|
197
|
-
instanceApplicationServiceSelectors[0] = clonedInstance.createApplication.selector;
|
198
|
-
instanceApplicationServiceSelectors[1] = clonedInstance.updateApplication.selector;
|
199
|
-
instanceApplicationServiceSelectors[2] = clonedInstance.updateApplicationState.selector;
|
200
|
-
clonedAccessManager.setTargetFunctionRole(
|
201
|
-
"Instance",
|
202
|
-
instanceApplicationServiceSelectors,
|
203
|
-
APPLICATION_SERVICE_ROLE());
|
204
|
-
}
|
205
156
|
|
206
|
-
function
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
157
|
+
function refillStakingRewardReserves(address rewardProvider, Amount dipAmount)
|
158
|
+
external
|
159
|
+
virtual
|
160
|
+
restricted()
|
161
|
+
onlyInstance()
|
162
|
+
{
|
163
|
+
NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
|
164
|
+
_stakingService.refillInstanceRewardReserves(
|
165
|
+
instanceNftId,
|
166
|
+
rewardProvider,
|
167
|
+
dipAmount);
|
217
168
|
}
|
218
169
|
|
219
|
-
function _grantClaimServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
220
|
-
// configure authorization for claim/payout services on instance
|
221
|
-
address claimServiceAddress = getRegistry().getServiceAddress(CLAIM(), getMajorVersion());
|
222
|
-
clonedAccessManager.grantRole(POLICY_SERVICE_ROLE(), claimServiceAddress);
|
223
|
-
// TODO add claims function authz
|
224
|
-
bytes4[] memory instanceClaimServiceSelectors = new bytes4[](0);
|
225
|
-
// instanceClaimServiceSelectors[0] = clonedInstance.updatePolicy.selector;
|
226
|
-
// instanceClaimServiceSelectors[1] = clonedInstance.updatePolicyState.selector;
|
227
|
-
clonedAccessManager.setTargetFunctionRole(
|
228
|
-
"Instance",
|
229
|
-
instanceClaimServiceSelectors,
|
230
|
-
CLAIM_SERVICE_ROLE());
|
231
|
-
}
|
232
170
|
|
233
|
-
function
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
// configure authorization for bundle service on bundle manager
|
246
|
-
bytes4[] memory bundleManagerBundleServiceSelectors = new bytes4[](5);
|
247
|
-
bundleManagerBundleServiceSelectors[0] = clonedBundleManager.linkPolicy.selector;
|
248
|
-
bundleManagerBundleServiceSelectors[1] = clonedBundleManager.unlinkPolicy.selector;
|
249
|
-
bundleManagerBundleServiceSelectors[2] = clonedBundleManager.add.selector;
|
250
|
-
bundleManagerBundleServiceSelectors[3] = clonedBundleManager.lock.selector;
|
251
|
-
bundleManagerBundleServiceSelectors[4] = clonedBundleManager.unlock.selector;
|
252
|
-
clonedAccessManager.setTargetFunctionRole(
|
253
|
-
"BundleManager",
|
254
|
-
bundleManagerBundleServiceSelectors,
|
255
|
-
BUNDLE_SERVICE_ROLE());
|
171
|
+
function withdrawStakingRewardReserves(Amount dipAmount)
|
172
|
+
external
|
173
|
+
virtual
|
174
|
+
restricted()
|
175
|
+
onlyInstance()
|
176
|
+
returns (Amount newBalance)
|
177
|
+
{
|
178
|
+
NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
|
179
|
+
_stakingService.withdrawInstanceRewardReserves(
|
180
|
+
instanceNftId,
|
181
|
+
dipAmount);
|
256
182
|
}
|
257
183
|
|
258
|
-
function
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
"InstanceAccessManager",
|
273
|
-
instanceAccessManagerInstanceServiceSelectors,
|
274
|
-
INSTANCE_SERVICE_ROLE());
|
184
|
+
function upgradeInstanceReader(NftId instanceNftId)
|
185
|
+
external
|
186
|
+
nonReentrant()
|
187
|
+
restricted()
|
188
|
+
onlyInstanceOwner(instanceNftId)
|
189
|
+
onlyNftOfType(instanceNftId, INSTANCE())
|
190
|
+
{
|
191
|
+
IRegistry registry = getRegistry();
|
192
|
+
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
|
193
|
+
Instance instance = Instance(instanceInfo.objectAddress);
|
194
|
+
|
195
|
+
InstanceReader upgradedInstanceReaderClone = InstanceReader(Clones.clone(address(_masterInstanceReader)));
|
196
|
+
upgradedInstanceReaderClone.initializeWithInstance(address(instance));
|
197
|
+
instance.setInstanceReader(upgradedInstanceReaderClone);
|
275
198
|
}
|
276
199
|
|
277
|
-
function setAndRegisterMasterInstance(address instanceAddress)
|
278
|
-
|
279
|
-
|
280
|
-
|
200
|
+
function setAndRegisterMasterInstance(address instanceAddress)
|
201
|
+
external
|
202
|
+
onlyOwner()
|
203
|
+
returns(NftId masterInstanceNftId)
|
281
204
|
{
|
282
205
|
if(_masterInstance != address(0)) { revert ErrorInstanceServiceMasterInstanceAlreadySet(); }
|
283
|
-
if(
|
284
|
-
if(
|
285
|
-
|
206
|
+
if(_masterInstanceAdmin != address(0)) { revert ErrorInstanceServiceMasterInstanceAdminAlreadySet(); }
|
207
|
+
if(_masterInstanceBundleSet != address(0)) { revert ErrorInstanceServiceMasterBundleSetAlreadySet(); }
|
208
|
+
if(_masterInstanceRiskSet != address(0)) { revert ErrorInstanceServiceMasterRiskSetAlreadySet(); }
|
286
209
|
if(instanceAddress == address(0)) { revert ErrorInstanceServiceInstanceAddressZero(); }
|
287
210
|
|
288
211
|
IInstance instance = IInstance(instanceAddress);
|
289
|
-
|
290
|
-
|
212
|
+
address accessManagerAddress = instance.authority();
|
213
|
+
InstanceAdmin instanceAdmin = instance.getInstanceAdmin();
|
214
|
+
address instanceAdminAddress = address(instanceAdmin);
|
291
215
|
InstanceReader instanceReader = instance.getInstanceReader();
|
292
216
|
address instanceReaderAddress = address(instanceReader);
|
293
|
-
|
294
|
-
address
|
217
|
+
BundleSet bundleSet = instance.getBundleSet();
|
218
|
+
address bundleSetAddress = address(bundleSet);
|
219
|
+
RiskSet riskSet = instance.getRiskSet();
|
220
|
+
address riskSetAddress = address(riskSet);
|
221
|
+
InstanceStore instanceStore = instance.getInstanceStore();
|
222
|
+
address instanceStoreAddress = address(instanceStore);
|
295
223
|
|
296
224
|
if(accessManagerAddress == address(0)) { revert ErrorInstanceServiceAccessManagerZero(); }
|
225
|
+
if(instanceAdminAddress == address(0)) { revert ErrorInstanceServiceInstanceAdminZero(); }
|
297
226
|
if(instanceReaderAddress == address(0)) { revert ErrorInstanceServiceInstanceReaderZero(); }
|
298
|
-
if(
|
227
|
+
if(bundleSetAddress == address(0)) { revert ErrorInstanceServiceBundleSetZero(); }
|
228
|
+
if(riskSetAddress == address(0)) { revert ErrorInstanceServiceRiskSetZero(); }
|
229
|
+
if(instanceStoreAddress == address(0)) { revert ErrorInstanceServiceInstanceStoreZero(); }
|
299
230
|
|
300
|
-
if(instance.authority() !=
|
231
|
+
if(instance.authority() != instanceAdmin.authority()) { revert ErrorInstanceServiceInstanceAuthorityMismatch(); }
|
232
|
+
if(bundleSet.authority() != instanceAdmin.authority()) { revert ErrorInstanceServiceBundleSetAuthorityMismatch(); }
|
233
|
+
if(riskSet.authority() != instanceAdmin.authority()) { revert ErrorInstanceServiceRiskSetAuthorityMismatch(); }
|
234
|
+
if(instanceStore.authority() != instanceAdmin.authority()) { revert ErrorInstanceServiceInstanceStoreAuthorityMismatch(); }
|
235
|
+
if(bundleSet.getInstanceAddress() != address(instance)) { revert ErrorInstanceServiceBundleSetInstanceMismatch(); }
|
236
|
+
if(riskSet.getInstanceAddress() != address(instance)) { revert ErrorInstanceServiceRiskSetInstanceMismatch(); }
|
301
237
|
if(instanceReader.getInstance() != instance) { revert ErrorInstanceServiceInstanceReaderInstanceMismatch2(); }
|
302
|
-
if(bundleManager.getInstance() != instance) { revert ErrorInstanceServiceBundleMangerInstanceMismatch(); }
|
303
238
|
|
304
|
-
|
239
|
+
_masterAccessManager = accessManagerAddress;
|
240
|
+
_masterInstanceAdmin = instanceAdminAddress;
|
305
241
|
_masterInstance = instanceAddress;
|
306
242
|
_masterInstanceReader = instanceReaderAddress;
|
307
|
-
|
243
|
+
_masterInstanceBundleSet = bundleSetAddress;
|
244
|
+
_masterInstanceRiskSet = riskSetAddress;
|
245
|
+
_masterInstanceStore = instanceStoreAddress;
|
308
246
|
|
309
|
-
IRegistryService registryService = IRegistryService(getRegistry().getServiceAddress(REGISTRY(), getMajorVersion()));
|
310
247
|
IInstance masterInstance = IInstance(_masterInstance);
|
311
|
-
IRegistry.ObjectInfo memory info =
|
248
|
+
IRegistry.ObjectInfo memory info = _registryService.registerInstance(masterInstance, getOwner());
|
312
249
|
masterInstanceNftId = info.nftId;
|
313
|
-
|
314
|
-
// masterInstance.linkToRegisteredNftId();
|
315
250
|
}
|
316
251
|
|
317
|
-
function
|
252
|
+
function upgradeMasterInstanceReader(address instanceReaderAddress)
|
253
|
+
external
|
254
|
+
onlyOwner
|
255
|
+
{
|
318
256
|
if(_masterInstanceReader == address(0)) { revert ErrorInstanceServiceMasterInstanceReaderNotSet(); }
|
319
257
|
if(instanceReaderAddress == address(0)) { revert ErrorInstanceServiceInstanceReaderAddressZero(); }
|
320
258
|
if(instanceReaderAddress == _masterInstanceReader) { revert ErrorInstanceServiceInstanceReaderSameAsMasterInstanceReader(); }
|
@@ -325,41 +263,87 @@ contract InstanceService is
|
|
325
263
|
_masterInstanceReader = instanceReaderAddress;
|
326
264
|
}
|
327
265
|
|
328
|
-
// TODO access restriction
|
329
|
-
function upgradeInstanceReader(NftId instanceNftId) external {
|
330
|
-
IRegistry registry = getRegistry();
|
331
|
-
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
|
332
|
-
Instance instance = Instance(instanceInfo.objectAddress);
|
333
|
-
address owner = instance.getOwner();
|
334
|
-
|
335
|
-
if (msg.sender != owner) {
|
336
|
-
revert ErrorInstanceServiceRequestUnauhorized(msg.sender);
|
337
|
-
}
|
338
|
-
|
339
|
-
InstanceReader upgradedInstanceReaderClone = InstanceReader(Clones.clone(address(_masterInstanceReader)));
|
340
|
-
upgradedInstanceReaderClone.initialize(address(registry), address(instance));
|
341
|
-
instance.setInstanceReader(upgradedInstanceReaderClone);
|
342
|
-
}
|
343
|
-
|
344
266
|
function getMasterInstanceReader() external view returns (address) {
|
345
267
|
return _masterInstanceReader;
|
346
268
|
}
|
347
269
|
|
348
|
-
|
349
|
-
|
270
|
+
/// @dev create new cloned instance admin
|
271
|
+
/// function used to setup a new instance
|
272
|
+
function _createInstanceAdmin()
|
273
|
+
internal
|
274
|
+
virtual
|
275
|
+
returns (InstanceAdmin clonedInstanceAdmin)
|
276
|
+
{
|
277
|
+
// start with setting up a new OZ access manager
|
278
|
+
// TODO consider _masterInstanceAdmin.authority() instead of _masterAccessManager
|
279
|
+
AccessManagerCloneable clonedAccessManager = AccessManagerCloneable(
|
280
|
+
Clones.clone(_masterAccessManager));
|
281
|
+
|
282
|
+
// set up the instance admin
|
283
|
+
clonedInstanceAdmin = InstanceAdmin(Clones.clone(_masterInstanceAdmin));
|
284
|
+
clonedInstanceAdmin.initialize(
|
285
|
+
clonedAccessManager,
|
286
|
+
getRegistry(),
|
287
|
+
getRelease());
|
350
288
|
}
|
351
289
|
|
352
|
-
function getMasterInstanceAccessManager() external view returns (address) {
|
353
|
-
return _masterInstanceAccessManager;
|
354
|
-
}
|
355
290
|
|
356
|
-
|
357
|
-
|
291
|
+
/// @dev create new cloned instance
|
292
|
+
/// function used to setup a new instance
|
293
|
+
function _createInstance(
|
294
|
+
InstanceAdmin instanceAdmin,
|
295
|
+
address instanceOwner
|
296
|
+
)
|
297
|
+
internal
|
298
|
+
virtual
|
299
|
+
returns (IInstance)
|
300
|
+
{
|
301
|
+
InstanceStore clonedInstanceStore = InstanceStore(Clones.clone(address(_masterInstanceStore)));
|
302
|
+
BundleSet clonedBundleSet = BundleSet(Clones.clone(_masterInstanceBundleSet));
|
303
|
+
RiskSet clonedRiskSet = RiskSet(Clones.clone(_masterInstanceRiskSet));
|
304
|
+
InstanceReader clonedInstanceReader = InstanceReader(Clones.clone(address(_masterInstanceReader)));
|
305
|
+
|
306
|
+
// clone instance
|
307
|
+
Instance clonedInstance = Instance(Clones.clone(_masterInstance));
|
308
|
+
clonedInstance.initialize(
|
309
|
+
instanceAdmin,
|
310
|
+
clonedInstanceStore,
|
311
|
+
clonedBundleSet,
|
312
|
+
clonedRiskSet,
|
313
|
+
clonedInstanceReader,
|
314
|
+
getRegistry(),
|
315
|
+
instanceOwner);
|
316
|
+
return clonedInstance;
|
358
317
|
}
|
359
318
|
|
360
|
-
|
361
|
-
|
362
|
-
|
319
|
+
|
320
|
+
/// all gif targets MUST be children of instanceNftId
|
321
|
+
function _createGifTarget(
|
322
|
+
NftId instanceNftId,
|
323
|
+
address targetAddress,
|
324
|
+
string memory targetName,
|
325
|
+
RoleId[] memory roles,
|
326
|
+
bytes4[][] memory selectors
|
327
|
+
)
|
328
|
+
internal
|
329
|
+
virtual
|
330
|
+
{
|
331
|
+
// TODO instanceAdmin will check target instance match anyway
|
332
|
+
(
|
333
|
+
IInstance instance, // or instanceInfo
|
334
|
+
// or targetInfo
|
335
|
+
) = _validateInstanceAndComponent(instanceNftId, targetAddress);
|
336
|
+
|
337
|
+
InstanceAdmin instanceAdmin = instance.getInstanceAdmin();
|
338
|
+
|
339
|
+
// TODO refactor/implement
|
340
|
+
// instanceAdmin.createGifTarget(targetAddress, targetName);
|
341
|
+
|
342
|
+
// set proposed target config
|
343
|
+
for(uint roleIdx = 0; roleIdx < roles.length; roleIdx++) {
|
344
|
+
// TODO refactor/implement
|
345
|
+
// instanceAdmin.setTargetFunctionRoleByService(targetName, selectors[roleIdx], roles[roleIdx]);
|
346
|
+
}
|
363
347
|
}
|
364
348
|
|
365
349
|
/// @dev top level initializer
|
@@ -368,123 +352,53 @@ contract InstanceService is
|
|
368
352
|
bytes memory data
|
369
353
|
)
|
370
354
|
internal
|
371
|
-
initializer
|
372
355
|
virtual override
|
356
|
+
initializer()
|
373
357
|
{
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
// owner is InstanceServiceManager deployer
|
379
|
-
initializeService(registryAddress, owner);
|
380
|
-
registerInterface(type(IInstanceService).interfaceId);
|
381
|
-
}
|
382
|
-
|
383
|
-
function hasRole(address account, RoleId role, address instanceAddress) public view returns (bool) {
|
384
|
-
Instance instance = Instance(instanceAddress);
|
385
|
-
InstanceAccessManager accessManager = InstanceAccessManager(instance.authority());
|
386
|
-
return accessManager.hasRole(role, account);
|
387
|
-
}
|
388
|
-
|
389
|
-
function createGifTarget(NftId instanceNftId, address targetAddress, string memory targetName) external onlyRegisteredService {
|
390
|
-
IRegistry registry = getRegistry();
|
391
|
-
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
|
392
|
-
Instance instance = Instance(instanceInfo.objectAddress);
|
393
|
-
InstanceAccessManager accessManager = InstanceAccessManager(instance.authority());
|
394
|
-
accessManager.createGifTarget(targetAddress, targetName);
|
395
|
-
}
|
396
|
-
|
397
|
-
function grantDistributionDefaultPermissions(NftId instanceNftId, address distributionAddress, string memory distributionName) external onlyRegisteredService {
|
398
|
-
IRegistry registry = getRegistry();
|
399
|
-
IRegistry.ObjectInfo memory distributionInfo = registry.getObjectInfo(distributionAddress);
|
400
|
-
|
401
|
-
if (distributionInfo.objectType != DISTRIBUTION()) {
|
402
|
-
revert ErrorInstanceServiceInvalidComponentType(distributionAddress, DISTRIBUTION(), distributionInfo.objectType);
|
403
|
-
}
|
358
|
+
(
|
359
|
+
address authority,
|
360
|
+
address registry
|
361
|
+
) = abi.decode(data, (address, address));
|
404
362
|
|
405
|
-
|
406
|
-
Instance instance = Instance(instanceInfo.objectAddress);
|
407
|
-
InstanceAccessManager instanceAccessManager = InstanceAccessManager(instance.authority());
|
363
|
+
__Service_init(authority, registry, owner);
|
408
364
|
|
409
|
-
|
410
|
-
|
411
|
-
|
365
|
+
_registryService = IRegistryService(_getServiceAddress(REGISTRY()));
|
366
|
+
_stakingService = IStakingService(_getServiceAddress(STAKING()));
|
367
|
+
_componentService = IComponentService(_getServiceAddress(COMPONENT()));
|
412
368
|
|
413
|
-
|
414
|
-
fctSelectors2[0] = IDistributionComponent.processSale.selector;
|
415
|
-
fctSelectors2[1] = IDistributionComponent.processRenewal.selector;
|
416
|
-
instanceAccessManager.setTargetFunctionRole(distributionName, fctSelectors2, PRODUCT_SERVICE_ROLE());
|
369
|
+
_registerInterface(type(IInstanceService).interfaceId);
|
417
370
|
}
|
418
371
|
|
419
|
-
function grantPoolDefaultPermissions(NftId instanceNftId, address poolAddress, string memory poolName) external onlyRegisteredService {
|
420
|
-
IRegistry registry = getRegistry();
|
421
|
-
IRegistry.ObjectInfo memory poolInfo = registry.getObjectInfo(poolAddress);
|
422
|
-
|
423
|
-
if (poolInfo.objectType != POOL()) {
|
424
|
-
revert ErrorInstanceServiceInvalidComponentType(poolAddress, POOL(), poolInfo.objectType);
|
425
|
-
}
|
426
|
-
|
427
|
-
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
|
428
|
-
Instance instance = Instance(instanceInfo.objectAddress);
|
429
|
-
InstanceAccessManager instanceAccessManager = InstanceAccessManager(instance.authority());
|
430
|
-
|
431
|
-
bytes4[] memory fctSelectors = new bytes4[](1);
|
432
|
-
fctSelectors[0] = IPoolComponent.setFees.selector;
|
433
|
-
instanceAccessManager.setTargetFunctionRole(poolName, fctSelectors, POOL_OWNER_ROLE());
|
434
|
-
|
435
|
-
bytes4[] memory fctSelectors2 = new bytes4[](1);
|
436
|
-
fctSelectors2[0] = IPoolComponent.verifyApplication.selector;
|
437
|
-
instanceAccessManager.setTargetFunctionRole(poolName, fctSelectors2, POLICY_SERVICE_ROLE());
|
438
|
-
|
439
|
-
// bundle owner specific functions
|
440
|
-
bytes4[] memory fctSelectors3 = new bytes4[](7);
|
441
|
-
fctSelectors3[0] = IPoolComponent.stake.selector;
|
442
|
-
fctSelectors3[1] = IPoolComponent.unstake.selector;
|
443
|
-
fctSelectors3[2] = IPoolComponent.extend.selector;
|
444
|
-
fctSelectors3[3] = IPoolComponent.lockBundle.selector;
|
445
|
-
fctSelectors3[4] = IPoolComponent.unlockBundle.selector;
|
446
|
-
fctSelectors3[5] = IPoolComponent.close.selector;
|
447
|
-
fctSelectors3[6] = IPoolComponent.setBundleFee.selector;
|
448
|
-
instanceAccessManager.setTargetFunctionRole(
|
449
|
-
poolName,
|
450
|
-
fctSelectors3,
|
451
|
-
IPoolComponent(poolAddress).getBundleOwnerRole());
|
452
|
-
}
|
453
372
|
|
454
|
-
function
|
373
|
+
function _validateInstanceAndComponent(NftId instanceNftId, address componentAddress)
|
374
|
+
internal
|
375
|
+
view
|
376
|
+
returns (IInstance instance, NftId componentNftId)
|
377
|
+
{
|
455
378
|
IRegistry registry = getRegistry();
|
456
|
-
IRegistry.ObjectInfo memory productInfo = registry.getObjectInfo(productAddress);
|
457
|
-
|
458
|
-
if (productInfo.objectType != PRODUCT()) {
|
459
|
-
revert ErrorInstanceServiceInvalidComponentType(productAddress, PRODUCT(), productInfo.objectType);
|
460
|
-
}
|
461
|
-
|
462
379
|
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
bytes4[] memory fctSelectors = new bytes4[](1);
|
467
|
-
fctSelectors[0] = IProductComponent.setFees.selector;
|
468
|
-
instanceAccessManager.setTargetFunctionRole(productName, fctSelectors, PRODUCT_OWNER_ROLE());
|
469
|
-
}
|
470
|
-
|
471
|
-
function setTargetLocked(string memory targetName, bool locked) external {
|
472
|
-
address componentAddress = msg.sender;
|
473
|
-
IRegistry registry = getRegistry();
|
474
|
-
IRegistry.ObjectInfo memory componentInfo = registry.getObjectInfo(componentAddress);
|
475
|
-
if (componentInfo.nftId.eqz()) {
|
476
|
-
revert ErrorInstanceServiceComponentNotRegistered(componentAddress);
|
380
|
+
if(instanceInfo.objectType != INSTANCE()) {
|
381
|
+
revert ErrorInstanceServiceNotInstanceNftId(instanceNftId);
|
477
382
|
}
|
478
383
|
|
479
|
-
|
384
|
+
if (registry.getNftIdForAddress(componentAddress).gtz()) {
|
385
|
+
IRegistry.ObjectInfo memory componentInfo = registry.getObjectInfo(componentAddress);
|
480
386
|
|
387
|
+
if(componentInfo.parentNftId != instanceNftId) {
|
388
|
+
revert ErrorInstanceServiceInstanceComponentMismatch(instanceNftId, componentInfo.nftId);
|
389
|
+
}
|
481
390
|
|
482
|
-
|
483
|
-
|
391
|
+
componentNftId = componentInfo.nftId;
|
392
|
+
} else {
|
393
|
+
|
394
|
+
}
|
484
395
|
|
485
|
-
|
486
|
-
|
396
|
+
instance = Instance(instanceInfo.objectAddress);
|
397
|
+
|
487
398
|
}
|
488
|
-
|
489
|
-
}
|
490
399
|
|
400
|
+
// From IService
|
401
|
+
function _getDomain() internal pure override returns(ObjectType) {
|
402
|
+
return INSTANCE();
|
403
|
+
}
|
404
|
+
}
|