@etherisc/gif-next 0.0.2-b098734-179 → 0.0.2-b09ef6b-888
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 +32 -8
- 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 +551 -245
- 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/AccessAdminLib.sol/AccessAdminLib.dbg.json +4 -0
- package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.json +681 -0
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +202 -5
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +273 -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 +435 -194
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +139 -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 +147 -438
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +261 -27
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +88 -328
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +384 -306
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +141 -115
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +83 -171
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +254 -97
- 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 +1445 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +644 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +2002 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +644 -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 +1388 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +644 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +1152 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +1612 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +644 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +2389 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +644 -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 +275 -46
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +199 -71
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +283 -151
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +990 -419
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +218 -78
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1322 -388
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +216 -245
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +96 -96
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +704 -445
- 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 +123 -322
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +243 -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 +98 -121
- 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 +99 -274
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +153 -190
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +122 -88
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +117 -292
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +261 -27
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +158 -363
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +106 -124
- 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 +119 -153
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +317 -269
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +117 -303
- 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 +490 -505
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +151 -101
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +191 -164
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +106 -88
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +234 -348
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +261 -27
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +407 -242
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +140 -114
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +131 -9
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +293 -17
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +245 -64
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +157 -83
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +231 -193
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +4 -0
- package/artifacts/contracts/product/{IProductService.sol/IProductService.json → IRiskService.sol/IRiskService.json} +88 -8
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +335 -278
- 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 +129 -103
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +247 -313
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +120 -122
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +232 -346
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +4 -0
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +688 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +736 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +59 -16
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +334 -34
- 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 +540 -95
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +680 -339
- package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.json +878 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +109 -292
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +94 -80
- package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +2023 -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 +435 -245
- 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 +81 -227
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +484 -680
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +131 -155
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +57 -111
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +597 -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 +81 -75
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +445 -282
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +98 -121
- 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 +15 -47
- 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/InitializableERC165.sol/InitializableERC165.json +2 -22
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +98 -273
- 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 +22 -57
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +19 -141
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +122 -97
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +57 -111
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +408 -54
- 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 +1 -1
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +188 -109
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +148 -16
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +268 -393
- package/artifacts/contracts/staking/StakingLib.sol/StakingLib.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingLib.sol/StakingLib.json +469 -0
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +46 -5
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +121 -126
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +31 -63
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +201 -164
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +103 -85
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +185 -130
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +65 -24
- 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 +33 -31
- 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 +125 -7
- 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/Seconds.sol/SecondsLib.json +26 -2
- 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 +101 -2
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +71 -70
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
- package/contracts/accounting/AccountingService.sol +262 -0
- package/contracts/accounting/AccountingServiceManager.sol +38 -0
- package/contracts/accounting/IAccountingService.sol +45 -0
- package/contracts/authorization/AccessAdmin.sol +382 -250
- package/contracts/authorization/AccessAdminLib.sol +207 -0
- package/contracts/authorization/AccessManagerCloneable.sol +146 -4
- package/contracts/authorization/Authorization.sol +350 -203
- package/contracts/authorization/IAccess.sol +1 -0
- package/contracts/authorization/IAccessAdmin.sol +76 -37
- package/contracts/authorization/IAuthorization.sol +33 -7
- package/contracts/authorization/IServiceAuthorization.sol +3 -1
- package/contracts/authorization/ServiceAuthorization.sol +26 -10
- package/contracts/distribution/BasicDistribution.sol +20 -17
- package/contracts/distribution/BasicDistributionAuthorization.sol +22 -9
- package/contracts/distribution/Distribution.sol +37 -88
- package/contracts/distribution/DistributionService.sol +152 -89
- package/contracts/distribution/DistributionServiceManager.sol +6 -6
- package/contracts/distribution/IDistributionComponent.sol +1 -10
- package/contracts/distribution/IDistributionService.sol +30 -22
- package/contracts/examples/fire/DamageLevel.sol +59 -0
- package/contracts/examples/fire/FirePool.sol +86 -0
- package/contracts/examples/fire/FirePoolAuthorization.sol +35 -0
- package/contracts/examples/fire/FireProduct.sol +433 -0
- package/contracts/examples/fire/FireProductAuthorization.sol +45 -0
- package/contracts/examples/fire/FireUSD.sol +26 -0
- package/contracts/examples/unpermissioned/SimpleDistribution.sol +81 -0
- package/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol +28 -0
- package/contracts/examples/unpermissioned/SimpleOracle.sol +133 -0
- package/contracts/examples/unpermissioned/SimplePool.sol +102 -0
- package/contracts/examples/unpermissioned/SimplePoolAuthorization.sol +28 -0
- package/contracts/examples/unpermissioned/SimpleProduct.sol +373 -0
- package/contracts/examples/unpermissioned/SimpleProductAuthorization.sol +28 -0
- package/contracts/instance/BundleSet.sol +42 -38
- package/contracts/instance/IInstance.sol +81 -44
- package/contracts/instance/IInstanceService.sol +34 -29
- package/contracts/instance/Instance.sol +164 -94
- package/contracts/instance/InstanceAdmin.sol +325 -109
- package/contracts/instance/InstanceAuthorizationV3.sol +106 -55
- package/contracts/instance/InstanceReader.sol +319 -43
- package/contracts/instance/InstanceService.sol +234 -190
- package/contracts/instance/InstanceServiceManager.sol +6 -7
- package/contracts/instance/InstanceStore.sol +23 -2
- package/contracts/instance/RiskSet.sol +118 -0
- package/contracts/instance/base/ObjectCounter.sol +1 -2
- package/contracts/instance/base/ObjectLifecycle.sol +10 -2
- package/contracts/instance/base/ObjectSet.sol +31 -33
- package/contracts/instance/base/ObjectSetHelperLib.sol +30 -0
- package/contracts/instance/module/IComponents.sol +13 -9
- package/contracts/instance/module/IDistribution.sol +5 -2
- package/contracts/instance/module/IPolicy.sol +25 -24
- package/contracts/instance/module/IRisk.sol +3 -0
- package/contracts/oracle/BasicOracle.sol +1 -4
- package/contracts/oracle/BasicOracleAuthorization.sol +3 -12
- package/contracts/oracle/IOracleService.sol +2 -1
- package/contracts/oracle/Oracle.sol +7 -19
- package/contracts/oracle/OracleService.sol +113 -81
- package/contracts/oracle/OracleServiceManager.sol +6 -6
- package/contracts/pool/BasicPool.sol +32 -25
- package/contracts/pool/BasicPoolAuthorization.sol +27 -9
- package/contracts/pool/BundleService.sol +93 -134
- package/contracts/pool/BundleServiceManager.sol +6 -6
- package/contracts/pool/IBundleService.sol +15 -33
- package/contracts/pool/IPoolComponent.sol +19 -15
- package/contracts/pool/IPoolService.sol +86 -68
- package/contracts/pool/Pool.sol +139 -124
- package/contracts/pool/PoolLib.sol +216 -0
- package/contracts/pool/PoolService.sol +500 -263
- package/contracts/pool/PoolServiceManager.sol +4 -4
- package/contracts/product/ApplicationService.sol +50 -26
- package/contracts/product/ApplicationServiceManager.sol +4 -4
- package/contracts/product/BasicProduct.sol +10 -13
- package/contracts/product/BasicProductAuthorization.sol +24 -11
- package/contracts/product/ClaimService.sol +365 -149
- package/contracts/product/ClaimServiceManager.sol +4 -4
- package/contracts/product/IApplicationService.sol +8 -2
- package/contracts/product/IClaimService.sol +43 -8
- package/contracts/product/IPolicyService.sol +39 -28
- package/contracts/product/IPricingService.sol +11 -10
- package/contracts/product/IProductComponent.sol +27 -5
- package/contracts/product/{IProductService.sol → IRiskService.sol} +8 -9
- package/contracts/product/PolicyService.sol +369 -291
- package/contracts/product/PolicyServiceLib.sol +65 -0
- package/contracts/product/PolicyServiceManager.sol +4 -4
- package/contracts/product/PricingService.sol +66 -61
- package/contracts/product/PricingServiceManager.sol +4 -4
- package/contracts/product/Product.sol +145 -91
- package/contracts/product/RiskService.sol +154 -0
- package/contracts/product/RiskServiceManager.sol +39 -0
- package/contracts/registry/ChainNft.sol +72 -40
- package/contracts/registry/IRegistry.sol +60 -28
- 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 +357 -203
- package/contracts/registry/RegistryAdmin.sol +163 -269
- package/contracts/registry/RegistryAuthorization.sol +267 -0
- package/contracts/registry/RegistryService.sol +37 -48
- package/contracts/registry/RegistryServiceManager.sol +3 -3
- package/contracts/registry/ReleaseAdmin.sol +254 -0
- package/contracts/registry/ReleaseLifecycle.sol +8 -3
- package/contracts/registry/ReleaseRegistry.sol +272 -240
- package/contracts/registry/ServiceAuthorizationV3.sol +187 -52
- package/contracts/registry/TokenRegistry.sol +6 -8
- package/contracts/shared/Component.sol +66 -124
- package/contracts/shared/ComponentService.sol +439 -370
- package/contracts/shared/ComponentServiceManager.sol +8 -5
- package/contracts/shared/ComponentVerifyingService.sol +28 -17
- package/contracts/shared/ContractLib.sol +281 -0
- package/contracts/shared/IComponent.sol +5 -17
- package/contracts/shared/IComponentService.sol +42 -38
- package/contracts/shared/IInstanceLinkedComponent.sol +2 -28
- package/contracts/shared/ILifecycle.sol +3 -1
- package/contracts/shared/INftOwnable.sol +2 -0
- package/contracts/shared/IPolicyHolder.sol +12 -22
- package/contracts/shared/IRegisterable.sol +23 -1
- package/contracts/shared/IService.sol +3 -5
- package/contracts/shared/InitializableERC165.sol +10 -2
- package/contracts/shared/InstanceLinkedComponent.sol +73 -50
- package/contracts/shared/KeyValueStore.sol +1 -1
- package/contracts/shared/Lifecycle.sol +15 -4
- package/contracts/shared/NftOwnable.sol +29 -9
- package/contracts/shared/PolicyHolder.sol +15 -52
- package/contracts/shared/Registerable.sol +52 -21
- package/contracts/shared/RegistryLinked.sol +9 -14
- package/contracts/shared/Service.sol +15 -32
- package/contracts/shared/TokenHandler.sol +282 -71
- package/contracts/shared/TokenHandlerDeployerLib.sol +20 -0
- package/contracts/staking/IStaking.sol +19 -11
- package/contracts/staking/IStakingService.sol +16 -4
- package/contracts/staking/Staking.sol +103 -53
- package/contracts/staking/{StakeManagerLib.sol → StakingLib.sol} +96 -21
- package/contracts/staking/StakingManager.sol +8 -6
- package/contracts/staking/StakingReader.sol +18 -21
- package/contracts/staking/StakingService.sol +82 -25
- package/contracts/staking/StakingServiceManager.sol +6 -5
- package/contracts/staking/StakingStore.sol +2 -1
- package/contracts/staking/TargetManagerLib.sol +7 -3
- 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 +57 -34
- package/contracts/type/PayoutId.sol +10 -10
- package/contracts/type/RiskId.sol +38 -6
- package/contracts/type/RoleId.sol +25 -14
- package/contracts/type/Seconds.sol +8 -0
- package/contracts/type/Selector.sol +5 -0
- package/contracts/type/StateId.sol +15 -1
- package/contracts/type/Timestamp.sol +0 -5
- package/contracts/type/UFixed.sol +13 -119
- package/contracts/type/Version.sol +54 -5
- package/contracts/upgradeability/ProxyManager.sol +68 -34
- package/contracts/upgradeability/Versionable.sol +2 -2
- package/package.json +5 -4
- 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/product/IProductService.sol/IProductService.dbg.json +0 -4
- package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +0 -4
- package/artifacts/contracts/product/ProductService.sol/ProductService.json +0 -708
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +0 -4
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +0 -702
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +0 -4
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.json +0 -39
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +0 -4
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +0 -387
- 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/product/ProductService.sol +0 -99
- package/contracts/product/ProductServiceManager.sol +0 -39
- package/contracts/shared/InitializableCustom.sol +0 -177
@@ -5,13 +5,24 @@ import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/acce
|
|
5
5
|
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
6
6
|
import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
|
7
7
|
|
8
|
-
import {AccessManagerCloneable} from "./AccessManagerCloneable.sol";
|
9
8
|
import {IAccessAdmin} from "./IAccessAdmin.sol";
|
9
|
+
import {IAuthorization} from "./IAuthorization.sol";
|
10
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
11
|
+
|
12
|
+
import {AccessAdminLib} from "./AccessAdminLib.sol";
|
13
|
+
import {AccessManagerCloneable} from "./AccessManagerCloneable.sol";
|
14
|
+
import {ContractLib} from "../shared/ContractLib.sol";
|
15
|
+
import {NftId, NftIdLib} from "../type/NftId.sol";
|
16
|
+
import {ObjectType} from "../type/ObjectType.sol";
|
10
17
|
import {RoleId, RoleIdLib, ADMIN_ROLE, PUBLIC_ROLE} from "../type/RoleId.sol";
|
11
18
|
import {Selector, SelectorLib, SelectorSetLib} from "../type/Selector.sol";
|
12
19
|
import {Str, StrLib} from "../type/String.sol";
|
13
|
-
import {
|
20
|
+
import {TimestampLib} from "../type/Timestamp.sol";
|
21
|
+
import {VersionPart} from "../type/Version.sol";
|
14
22
|
|
23
|
+
interface IAccessManagedChecker {
|
24
|
+
function authority() external view returns (address);
|
25
|
+
}
|
15
26
|
|
16
27
|
/**
|
17
28
|
* @dev A generic access amin contract that implements role based access control based on OpenZeppelin's AccessManager contract.
|
@@ -28,13 +39,23 @@ contract AccessAdmin is
|
|
28
39
|
string public constant ADMIN_ROLE_NAME = "AdminRole";
|
29
40
|
string public constant PUBLIC_ROLE_NAME = "PublicRole";
|
30
41
|
|
31
|
-
/// @dev
|
42
|
+
/// @dev admin name used for logging only
|
43
|
+
string internal _adminName;
|
44
|
+
|
45
|
+
/// @dev the access manager driving the access admin contract
|
46
|
+
/// hold link to registry and release version
|
32
47
|
AccessManagerCloneable internal _authority;
|
33
48
|
|
49
|
+
/// @dev the authorization contract used for initial access control
|
50
|
+
IAuthorization internal _authorization;
|
51
|
+
|
34
52
|
/// @dev stores the deployer address and allows to create initializers
|
35
53
|
/// that are restricted to the deployer address.
|
36
54
|
address internal _deployer;
|
37
55
|
|
56
|
+
/// @dev the linked NFT ID
|
57
|
+
NftId internal _linkedNftId;
|
58
|
+
|
38
59
|
/// @dev store role info per role id
|
39
60
|
mapping(RoleId roleId => RoleInfo info) internal _roleInfo;
|
40
61
|
|
@@ -65,55 +86,126 @@ contract AccessAdmin is
|
|
65
86
|
/// @dev temporary dynamic functions array
|
66
87
|
bytes4[] private _functions;
|
67
88
|
|
89
|
+
|
68
90
|
modifier onlyDeployer() {
|
69
91
|
// special case for cloned AccessAdmin contracts
|
70
|
-
// IMPORTANT cloning and
|
92
|
+
// IMPORTANT cloning and initialize authority needs to be done in a single transaction
|
71
93
|
if (_deployer == address(0)) {
|
72
94
|
_deployer = msg.sender;
|
73
95
|
}
|
74
96
|
|
75
97
|
if (msg.sender != _deployer) {
|
76
|
-
revert
|
98
|
+
revert ErrorAccessAdminNotDeployer();
|
77
99
|
}
|
78
100
|
_;
|
79
101
|
}
|
80
102
|
|
81
|
-
modifier onlyRoleAdmin(RoleId roleId) {
|
82
|
-
if (!roleExists(roleId)) {
|
83
|
-
revert ErrorRoleUnknown(roleId);
|
84
|
-
}
|
85
103
|
|
86
|
-
|
87
|
-
|
104
|
+
modifier onlyExistingRole(
|
105
|
+
RoleId roleId,
|
106
|
+
bool onlyActiveRole,
|
107
|
+
bool allowLockedRoles
|
108
|
+
)
|
109
|
+
{
|
110
|
+
if (!allowLockedRoles) {
|
111
|
+
_checkRoleExists(roleId, onlyActiveRole);
|
88
112
|
}
|
89
113
|
_;
|
90
114
|
}
|
91
115
|
|
92
|
-
modifier onlyRoleMember(RoleId roleId) {
|
93
|
-
if (!hasRole(msg.sender, roleId)) {
|
94
|
-
revert ErrorNotRoleOwner(roleId);
|
95
|
-
}
|
96
|
-
_;
|
97
|
-
}
|
98
116
|
|
99
|
-
modifier
|
100
|
-
|
117
|
+
modifier onlyExistingTarget(address target) {
|
118
|
+
_checkTargetExists(target);
|
101
119
|
_;
|
102
120
|
}
|
103
121
|
|
104
|
-
|
105
|
-
|
106
|
-
|
122
|
+
//-------------- initialization functions ------------------------------//
|
123
|
+
|
124
|
+
// event LogAccessAdminDebug(string message);
|
125
|
+
|
126
|
+
/// @dev Initializes this admin with the provided accessManager (and authorization specification).
|
127
|
+
/// Internally initializes access manager with this admin and creates basic role setup.
|
128
|
+
function initialize(
|
129
|
+
address authority,
|
130
|
+
string memory adminName
|
131
|
+
)
|
132
|
+
public
|
133
|
+
initializer()
|
134
|
+
{
|
135
|
+
__AccessAdmin_init(authority, adminName);
|
107
136
|
}
|
108
137
|
|
109
|
-
|
110
|
-
|
111
|
-
|
138
|
+
|
139
|
+
function __AccessAdmin_init(
|
140
|
+
address authority,
|
141
|
+
string memory adminName
|
142
|
+
)
|
143
|
+
internal
|
144
|
+
onlyInitializing()
|
145
|
+
onlyDeployer()
|
146
|
+
{
|
147
|
+
// checks
|
148
|
+
// check authority is contract
|
149
|
+
if (!ContractLib.isContract(authority)) {
|
150
|
+
revert ErrorAccessAdminAuthorityNotContract(authority);
|
151
|
+
}
|
152
|
+
|
153
|
+
// check name not empty
|
154
|
+
if (bytes(adminName).length == 0) {
|
155
|
+
revert ErrorAccessAdminAccessManagerEmptyName();
|
156
|
+
}
|
157
|
+
|
158
|
+
_authority = AccessManagerCloneable(authority);
|
112
159
|
_authority.initialize(address(this));
|
113
160
|
|
114
|
-
|
115
|
-
|
116
|
-
|
161
|
+
// delayed additional check for authority after its initialization
|
162
|
+
if (!ContractLib.isAuthority(authority)) {
|
163
|
+
revert ErrorAccessAdminAccessManagerNotAccessManager(authority);
|
164
|
+
}
|
165
|
+
|
166
|
+
// effects
|
167
|
+
// set and initialize this access manager contract as
|
168
|
+
// the admin (ADMIN_ROLE) of the provided authority
|
169
|
+
__AccessManaged_init(authority);
|
170
|
+
|
171
|
+
// set name for logging
|
172
|
+
_adminName = adminName;
|
173
|
+
|
174
|
+
// set initial linked NFT ID to zero
|
175
|
+
_linkedNftId = NftIdLib.zero();
|
176
|
+
|
177
|
+
// create admin and public roles
|
178
|
+
_initializeAdminAndPublicRoles();
|
179
|
+
}
|
180
|
+
|
181
|
+
|
182
|
+
function getRelease() public view virtual returns (VersionPart release) {
|
183
|
+
return _authority.getRelease();
|
184
|
+
}
|
185
|
+
|
186
|
+
|
187
|
+
function getRegistry() public view returns (IRegistry registry) {
|
188
|
+
return _authority.getRegistry();
|
189
|
+
}
|
190
|
+
|
191
|
+
|
192
|
+
function getLinkedNftId() external view returns (NftId linkedNftId) {
|
193
|
+
return _linkedNftId;
|
194
|
+
}
|
195
|
+
|
196
|
+
|
197
|
+
function getLinkedOwner() external view returns (address linkedOwner) {
|
198
|
+
return getRegistry().ownerOf(_linkedNftId);
|
199
|
+
}
|
200
|
+
|
201
|
+
|
202
|
+
function getAuthorization() public view returns (IAuthorization authorization) {
|
203
|
+
return _authorization;
|
204
|
+
}
|
205
|
+
|
206
|
+
|
207
|
+
function isLocked() public view returns (bool locked) {
|
208
|
+
return _authority.isLocked();
|
117
209
|
}
|
118
210
|
|
119
211
|
//--- view functions for roles ------------------------------------------//
|
@@ -138,12 +230,20 @@ contract AccessAdmin is
|
|
138
230
|
return _roleInfo[roleId].createdAt.gtz();
|
139
231
|
}
|
140
232
|
|
233
|
+
function getRoleForName(string memory name) external view returns (RoleId roleId) {
|
234
|
+
return _roleForName[StrLib.toStr(name)].roleId;
|
235
|
+
}
|
236
|
+
|
141
237
|
function getRoleInfo(RoleId roleId) external view returns (RoleInfo memory) {
|
142
238
|
return _roleInfo[roleId];
|
143
239
|
}
|
144
240
|
|
145
|
-
function
|
146
|
-
return
|
241
|
+
function isRoleActive(RoleId roleId) external view returns (bool isActive) {
|
242
|
+
return _roleInfo[roleId].pausedAt > TimestampLib.blockTimestamp();
|
243
|
+
}
|
244
|
+
|
245
|
+
function isRoleCustom(RoleId roleId) external view returns (bool isActive) {
|
246
|
+
return _roleInfo[roleId].roleType == RoleType.Custom;
|
147
247
|
}
|
148
248
|
|
149
249
|
function roleMembers(RoleId roleId) external view returns (uint256 numberOfMembers) {
|
@@ -154,20 +254,21 @@ contract AccessAdmin is
|
|
154
254
|
return _roleMembers[roleId].at(idx);
|
155
255
|
}
|
156
256
|
|
157
|
-
|
257
|
+
// TODO false because not role member or because role not exists?
|
258
|
+
function isRoleMember(address account, RoleId roleId) public view returns (bool) {
|
158
259
|
(bool isMember, ) = _authority.hasRole(
|
159
260
|
RoleId.unwrap(roleId),
|
160
261
|
account);
|
161
262
|
return isMember;
|
162
263
|
}
|
163
264
|
|
164
|
-
function
|
265
|
+
function isRoleAdmin(address account, RoleId roleId)
|
165
266
|
public
|
166
267
|
virtual
|
167
268
|
view
|
168
269
|
returns (bool)
|
169
270
|
{
|
170
|
-
return
|
271
|
+
return isRoleMember(account, _roleInfo[roleId].adminRoleId);
|
171
272
|
}
|
172
273
|
|
173
274
|
//--- view functions for targets ----------------------------------------//
|
@@ -219,142 +320,31 @@ contract AccessAdmin is
|
|
219
320
|
selector.toBytes4()));
|
220
321
|
}
|
221
322
|
|
222
|
-
function isAccessManaged(address target) public view returns (bool) {
|
223
|
-
if (!_isContract(target)) {
|
224
|
-
return false;
|
225
|
-
}
|
226
|
-
|
227
|
-
(bool success, ) = target.staticcall(
|
228
|
-
abi.encodeWithSelector(
|
229
|
-
AccessManagedUpgradeable.authority.selector));
|
230
|
-
|
231
|
-
return success;
|
232
|
-
}
|
233
|
-
|
234
|
-
function canCall(address caller, address target, Selector selector) external virtual view returns (bool can) {
|
235
|
-
(can, ) = _authority.canCall(caller, target, selector.toBytes4());
|
236
|
-
}
|
237
|
-
|
238
|
-
function toRole(RoleId adminRoleId, RoleType roleType, uint32 maxMemberCount, string memory name) public view returns (RoleInfo memory) {
|
239
|
-
return RoleInfo({
|
240
|
-
name: StrLib.toStr(name),
|
241
|
-
adminRoleId: adminRoleId,
|
242
|
-
roleType: roleType,
|
243
|
-
maxMemberCount: maxMemberCount,
|
244
|
-
createdAt: TimestampLib.blockTimestamp()
|
245
|
-
});
|
246
|
-
}
|
247
|
-
|
248
|
-
function toFunction(bytes4 selector, string memory name) public view returns (FunctionInfo memory) {
|
249
|
-
return FunctionInfo({
|
250
|
-
name: StrLib.toStr(name),
|
251
|
-
selector: SelectorLib.toSelector(selector),
|
252
|
-
createdAt: TimestampLib.blockTimestamp()});
|
253
|
-
}
|
254
|
-
|
255
323
|
function deployer() public view returns (address) {
|
256
324
|
return _deployer;
|
257
325
|
}
|
258
326
|
|
259
327
|
//--- internal/private functions -------------------------------------------------//
|
260
328
|
|
261
|
-
function
|
262
|
-
|
263
|
-
|
264
|
-
FunctionInfo[] memory functions
|
265
|
-
)
|
266
|
-
internal
|
267
|
-
{
|
268
|
-
if (roleId == getAdminRole()) {
|
269
|
-
revert ErrorAuthorizeForAdminRoleInvalid(target);
|
329
|
+
function _linkToNftOwnable(address registerable) internal {
|
330
|
+
if (!getRegistry().isRegistered(registerable)) {
|
331
|
+
revert ErrorAccessAdminNotRegistered(registerable);
|
270
332
|
}
|
271
333
|
|
272
|
-
|
273
|
-
bytes4[] memory functionSelectors = _processFunctionSelectors(target, functions, addFunctions);
|
274
|
-
|
275
|
-
// apply authz via access manager
|
276
|
-
_grantRoleAccessToFunctions(target, roleId, functionSelectors);
|
334
|
+
_linkedNftId = getRegistry().getNftIdForAddress(registerable);
|
277
335
|
}
|
278
336
|
|
279
|
-
function _unauthorizeTargetFunctions(
|
280
|
-
address target,
|
281
|
-
FunctionInfo[] memory functions
|
282
|
-
)
|
283
|
-
internal
|
284
|
-
{
|
285
|
-
bool addFunctions = false;
|
286
|
-
bytes4[] memory functionSelectors = _processFunctionSelectors(target, functions, addFunctions);
|
287
|
-
_grantRoleAccessToFunctions(target, getAdminRole(), functionSelectors);
|
288
|
-
}
|
289
|
-
|
290
|
-
function _processFunctionSelectors(
|
291
|
-
address target,
|
292
|
-
FunctionInfo[] memory functions,
|
293
|
-
bool addFunctions
|
294
|
-
)
|
295
|
-
internal
|
296
|
-
returns (
|
297
|
-
bytes4[] memory functionSelectors
|
298
|
-
)
|
299
|
-
{
|
300
|
-
uint256 n = functions.length;
|
301
|
-
functionSelectors = new bytes4[](n);
|
302
|
-
FunctionInfo memory func;
|
303
|
-
Selector selector;
|
304
|
-
|
305
|
-
for (uint256 i = 0; i < n; i++) {
|
306
|
-
func = functions[i];
|
307
|
-
selector = func.selector;
|
308
|
-
|
309
|
-
// add function selector to target selector set if not in set
|
310
|
-
if (addFunctions) { SelectorSetLib.add(_targetFunctions[target], selector); }
|
311
|
-
else { SelectorSetLib.remove(_targetFunctions[target], selector); }
|
312
|
-
|
313
|
-
// set function name
|
314
|
-
_functionInfo[target][selector] = func;
|
315
|
-
|
316
|
-
// add bytes4 selector to function selector array
|
317
|
-
functionSelectors[i] = selector.toBytes4();
|
318
|
-
}
|
319
|
-
}
|
320
|
-
|
321
|
-
function _initializeAuthority(
|
322
|
-
address authorityAddress
|
323
|
-
)
|
324
|
-
internal
|
325
|
-
virtual
|
326
|
-
onlyInitializing()
|
327
|
-
onlyDeployer()
|
328
|
-
{
|
329
|
-
if (authority() != address(0)) {
|
330
|
-
revert ErrorAuthorityAlreadySet();
|
331
|
-
}
|
332
|
-
|
333
|
-
_authority = AccessManagerCloneable(authorityAddress);
|
334
|
-
__AccessManaged_init(address(_authority));
|
335
|
-
}
|
336
|
-
|
337
|
-
|
338
337
|
function _initializeAdminAndPublicRoles()
|
339
338
|
internal
|
340
339
|
virtual
|
341
340
|
onlyInitializing()
|
342
|
-
{
|
343
|
-
_createAdminAndPublicRoles();
|
344
|
-
}
|
345
|
-
|
346
|
-
|
347
|
-
/// @dev internal setup function that can be used in both constructor and initializer.
|
348
|
-
function _createAdminAndPublicRoles()
|
349
|
-
internal
|
350
341
|
{
|
351
342
|
RoleId adminRoleId = RoleIdLib.toRoleId(_authority.ADMIN_ROLE());
|
352
|
-
FunctionInfo[] memory functions;
|
353
343
|
|
354
344
|
// setup admin role
|
355
345
|
_createRoleUnchecked(
|
356
346
|
ADMIN_ROLE(),
|
357
|
-
toRole({
|
347
|
+
AccessAdminLib.toRole({
|
358
348
|
adminRoleId: ADMIN_ROLE(),
|
359
349
|
roleType: RoleType.Contract,
|
360
350
|
maxMemberCount: 1,
|
@@ -366,98 +356,195 @@ contract AccessAdmin is
|
|
366
356
|
// setup public role
|
367
357
|
_createRoleUnchecked(
|
368
358
|
PUBLIC_ROLE(),
|
369
|
-
toRole({
|
359
|
+
AccessAdminLib.toRole({
|
370
360
|
adminRoleId: ADMIN_ROLE(),
|
371
361
|
roleType: RoleType.Gif,
|
372
362
|
maxMemberCount: type(uint32).max,
|
373
363
|
name: PUBLIC_ROLE_NAME}));
|
374
364
|
}
|
375
365
|
|
376
|
-
|
377
|
-
|
366
|
+
function _createTargetWithRole(
|
367
|
+
address target,
|
368
|
+
string memory targetName,
|
369
|
+
RoleId targetRoleId
|
370
|
+
)
|
378
371
|
internal
|
379
372
|
{
|
380
|
-
|
381
|
-
|
382
|
-
}
|
373
|
+
_createTarget(target, targetName, true, false);
|
374
|
+
_grantRoleToAccount(targetRoleId, target);
|
383
375
|
}
|
384
376
|
|
377
|
+
function _authorizeTargetFunctions(
|
378
|
+
address target,
|
379
|
+
RoleId roleId,
|
380
|
+
FunctionInfo[] memory functions,
|
381
|
+
bool addFunctions
|
382
|
+
)
|
383
|
+
internal
|
384
|
+
{
|
385
|
+
if (addFunctions && roleId == getAdminRole()) {
|
386
|
+
revert ErrorAccessAdminAuthorizeForAdminRoleInvalid(target);
|
387
|
+
}
|
388
|
+
|
389
|
+
// apply authz via access manager
|
390
|
+
_grantRoleAccessToFunctions(
|
391
|
+
target,
|
392
|
+
roleId,
|
393
|
+
functions,
|
394
|
+
addFunctions); // add functions
|
395
|
+
}
|
396
|
+
|
397
|
+
// function _unauthorizeTargetFunctions(
|
398
|
+
// address target,
|
399
|
+
// FunctionInfo[] memory functions
|
400
|
+
// )
|
401
|
+
// internal
|
402
|
+
// {
|
403
|
+
// _grantRoleAccessToFunctions(
|
404
|
+
// target,
|
405
|
+
// getAdminRole(),
|
406
|
+
// functions,
|
407
|
+
// false); // addFunctions
|
408
|
+
// }
|
409
|
+
|
410
|
+
// function _processFunctionSelectors(
|
411
|
+
// address target,
|
412
|
+
// FunctionInfo[] memory functions,
|
413
|
+
// bool addFunctions
|
414
|
+
// )
|
415
|
+
// internal
|
416
|
+
// onlyExistingTarget(target)
|
417
|
+
// returns (
|
418
|
+
// bytes4[] memory functionSelectors,
|
419
|
+
// string[] memory functionNames
|
420
|
+
// )
|
421
|
+
// {
|
422
|
+
// uint256 n = functions.length;
|
423
|
+
// functionSelectors = new bytes4[](n);
|
424
|
+
// functionNames = new string[](n);
|
425
|
+
// FunctionInfo memory func;
|
426
|
+
// Selector selector;
|
427
|
+
|
428
|
+
// for (uint256 i = 0; i < n; i++) {
|
429
|
+
// func = functions[i];
|
430
|
+
// selector = func.selector;
|
431
|
+
|
432
|
+
// // add function selector to target selector set if not in set
|
433
|
+
// if (addFunctions) { SelectorSetLib.add(_targetFunctions[target], selector); }
|
434
|
+
// else { SelectorSetLib.remove(_targetFunctions[target], selector); }
|
435
|
+
|
436
|
+
// // set function name
|
437
|
+
// _functionInfo[target][selector] = func;
|
438
|
+
|
439
|
+
// // add bytes4 selector to function selector array
|
440
|
+
// functionSelectors[i] = selector.toBytes4();
|
441
|
+
// functionNames[i] = func.name.toString();
|
442
|
+
// }
|
443
|
+
// }
|
444
|
+
|
385
445
|
/// @dev grant the specified role access to all functions in the provided selector list
|
386
446
|
function _grantRoleAccessToFunctions(
|
387
447
|
address target,
|
388
448
|
RoleId roleId,
|
389
|
-
|
449
|
+
FunctionInfo[] memory functions,
|
450
|
+
bool addFunctions
|
390
451
|
)
|
391
452
|
internal
|
453
|
+
onlyExistingTarget(target)
|
454
|
+
onlyExistingRole(roleId, true, !addFunctions)
|
392
455
|
{
|
393
456
|
_authority.setTargetFunctionRole(
|
394
457
|
target,
|
395
|
-
|
458
|
+
AccessAdminLib.getSelectors(functions),
|
396
459
|
RoleId.unwrap(roleId));
|
397
460
|
|
398
|
-
//
|
461
|
+
// update function set and log function grantings
|
462
|
+
for (uint256 i = 0; i < functions.length; i++) {
|
463
|
+
_updateFunctionAccess(
|
464
|
+
target,
|
465
|
+
roleId,
|
466
|
+
functions[i],
|
467
|
+
addFunctions);
|
468
|
+
}
|
399
469
|
}
|
400
470
|
|
471
|
+
|
472
|
+
function _updateFunctionAccess(
|
473
|
+
address target,
|
474
|
+
RoleId roleId,
|
475
|
+
FunctionInfo memory func,
|
476
|
+
bool addFunction
|
477
|
+
)
|
478
|
+
internal
|
479
|
+
{
|
480
|
+
// update functions info
|
481
|
+
Selector selector = func.selector;
|
482
|
+
_functionInfo[target][selector] = func;
|
483
|
+
|
484
|
+
// update function sets
|
485
|
+
if (addFunction) { SelectorSetLib.add(_targetFunctions[target], selector); }
|
486
|
+
else { SelectorSetLib.remove(_targetFunctions[target], selector); }
|
487
|
+
|
488
|
+
// logging
|
489
|
+
emit LogAccessAdminFunctionGranted(
|
490
|
+
_adminName,
|
491
|
+
target,
|
492
|
+
string(abi.encodePacked(
|
493
|
+
func.name.toString(),
|
494
|
+
"(): ",
|
495
|
+
_getRoleName(roleId))));
|
496
|
+
}
|
497
|
+
|
498
|
+
|
401
499
|
/// @dev grant the specified role to the provided account
|
402
500
|
function _grantRoleToAccount(RoleId roleId, address account)
|
403
501
|
internal
|
502
|
+
onlyExistingRole(roleId, true, false)
|
404
503
|
{
|
405
|
-
_checkRoleId(roleId);
|
406
|
-
|
407
504
|
// check max role members will not be exceeded
|
408
505
|
if (_roleMembers[roleId].length() >= _roleInfo[roleId].maxMemberCount) {
|
409
|
-
revert
|
506
|
+
revert ErrorAccessAdminRoleMembersLimitReached(roleId, _roleInfo[roleId].maxMemberCount);
|
410
507
|
}
|
411
508
|
|
412
509
|
// check account is contract for contract role
|
413
|
-
|
414
|
-
|
510
|
+
if (
|
511
|
+
_roleInfo[roleId].roleType == RoleType.Contract &&
|
512
|
+
!ContractLib.isContract(account) // will fail in account's constructor
|
513
|
+
) {
|
514
|
+
revert ErrorAccessAdminRoleMemberNotContract(roleId, account);
|
415
515
|
}
|
416
516
|
|
517
|
+
// TODO check account already have roleId
|
417
518
|
_roleMembers[roleId].add(account);
|
418
519
|
_authority.grantRole(
|
419
520
|
RoleId.unwrap(roleId),
|
420
521
|
account,
|
421
522
|
0);
|
422
523
|
|
423
|
-
|
524
|
+
emit LogAccessAdminRoleGranted(_adminName, account, _getRoleName(roleId));
|
424
525
|
}
|
425
526
|
|
426
527
|
/// @dev revoke the specified role from the provided account
|
427
528
|
function _revokeRoleFromAccount(RoleId roleId, address account)
|
428
529
|
internal
|
530
|
+
onlyExistingRole(roleId, false, false)
|
429
531
|
{
|
430
|
-
_checkRoleId(roleId);
|
431
532
|
|
432
533
|
// check role removal is permitted
|
433
534
|
if (_roleInfo[roleId].roleType == RoleType.Contract) {
|
434
|
-
revert
|
535
|
+
revert ErrorAccessAdminRoleMemberRemovalDisabled(roleId, account);
|
435
536
|
}
|
436
537
|
|
538
|
+
// TODO check account have roleId?
|
437
539
|
_roleMembers[roleId].remove(account);
|
438
540
|
_authority.revokeRole(
|
439
541
|
RoleId.unwrap(roleId),
|
440
542
|
account);
|
441
543
|
|
442
|
-
|
544
|
+
emit LogAccessAdminRoleRevoked(_adminName, account, _roleInfo[roleId].name.toString());
|
443
545
|
}
|
444
546
|
|
445
547
|
|
446
|
-
function _checkRoleId(RoleId roleId)
|
447
|
-
internal
|
448
|
-
{
|
449
|
-
if (_roleInfo[roleId].createdAt.eqz()) {
|
450
|
-
revert ErrorRoleUnknown(roleId);
|
451
|
-
}
|
452
|
-
|
453
|
-
uint64 roleIdInt = RoleId.unwrap(roleId);
|
454
|
-
if (roleIdInt == _authority.ADMIN_ROLE()
|
455
|
-
|| roleIdInt == _authority.PUBLIC_ROLE())
|
456
|
-
{
|
457
|
-
revert ErrorRoleIsLocked(roleId);
|
458
|
-
}
|
459
|
-
}
|
460
|
-
|
461
548
|
/// @dev Creates a role based on the provided parameters.
|
462
549
|
/// Checks that the provided role and role id and role name not already used.
|
463
550
|
function _createRole(
|
@@ -466,32 +553,34 @@ contract AccessAdmin is
|
|
466
553
|
)
|
467
554
|
internal
|
468
555
|
{
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
roleId,
|
473
|
-
_roleInfo[roleId].name.toString());
|
474
|
-
}
|
556
|
+
AccessAdminLib.checkRoleCreation(this, roleId, info);
|
557
|
+
_createRoleUnchecked(roleId, info);
|
558
|
+
}
|
475
559
|
|
476
|
-
// check admin role exists
|
477
|
-
if(!roleExists(info.adminRoleId)) {
|
478
|
-
revert ErrorRoleAdminNotExisting(info.adminRoleId);
|
479
|
-
}
|
480
560
|
|
481
|
-
|
482
|
-
|
483
|
-
|
561
|
+
/// @dev Activates or deactivates role.
|
562
|
+
/// The role activ property is indirectly controlled over the pausedAt timestamp.
|
563
|
+
function _setRoleActive(RoleId roleId, bool active)
|
564
|
+
internal
|
565
|
+
{
|
566
|
+
if (active) {
|
567
|
+
_roleInfo[roleId].pausedAt = TimestampLib.max();
|
568
|
+
} else {
|
569
|
+
_roleInfo[roleId].pausedAt = TimestampLib.blockTimestamp();
|
484
570
|
}
|
571
|
+
}
|
485
572
|
|
486
|
-
// check role name is not used for another role
|
487
|
-
if(_roleForName[info.name].exists) {
|
488
|
-
revert ErrorRoleNameAlreadyExists(
|
489
|
-
roleId,
|
490
|
-
info.name.toString(),
|
491
|
-
_roleForName[info.name].roleId);
|
492
|
-
}
|
493
573
|
|
494
|
-
|
574
|
+
function _createTarget(
|
575
|
+
address target,
|
576
|
+
string memory targetName,
|
577
|
+
bool checkAuthority,
|
578
|
+
bool custom
|
579
|
+
)
|
580
|
+
internal
|
581
|
+
{
|
582
|
+
AccessAdminLib.checkTargetCreation(this, target, targetName, checkAuthority);
|
583
|
+
_createTargetUnchecked(target, targetName, custom);
|
495
584
|
}
|
496
585
|
|
497
586
|
|
@@ -503,6 +592,7 @@ contract AccessAdmin is
|
|
503
592
|
{
|
504
593
|
// create role info
|
505
594
|
info.createdAt = TimestampLib.blockTimestamp();
|
595
|
+
info.pausedAt = TimestampLib.max();
|
506
596
|
_roleInfo[roleId] = info;
|
507
597
|
|
508
598
|
// create role name info
|
@@ -513,54 +603,19 @@ contract AccessAdmin is
|
|
513
603
|
// add role to list of roles
|
514
604
|
_roleIds.push(roleId);
|
515
605
|
|
516
|
-
emit
|
606
|
+
emit LogAccessAdminRoleCreated(_adminName, roleId, info.roleType, info.adminRoleId, info.name.toString());
|
517
607
|
}
|
518
608
|
|
519
609
|
|
520
|
-
function
|
610
|
+
function _createTargetUnchecked(
|
521
611
|
address target,
|
522
612
|
string memory targetName,
|
523
|
-
bool checkAuthority,
|
524
613
|
bool custom
|
525
614
|
)
|
526
615
|
internal
|
527
|
-
nonReentrant()
|
528
616
|
{
|
529
|
-
// check target does not yet exist
|
530
|
-
if(targetExists(target)) {
|
531
|
-
revert ErrorTargetAlreadyCreated(
|
532
|
-
target,
|
533
|
-
_targetInfo[target].name.toString());
|
534
|
-
}
|
535
|
-
|
536
|
-
// check target name is not empty
|
537
|
-
Str name = StrLib.toStr(targetName);
|
538
|
-
if(name.length() == 0) {
|
539
|
-
revert ErrorTargetNameEmpty(target);
|
540
|
-
}
|
541
|
-
|
542
|
-
// check target name is not used for another target
|
543
|
-
if( _targetForName[name] != address(0)) {
|
544
|
-
revert ErrorTargetNameAlreadyExists(
|
545
|
-
target,
|
546
|
-
targetName,
|
547
|
-
_targetForName[name]);
|
548
|
-
}
|
549
|
-
|
550
|
-
// check target is an access managed contract
|
551
|
-
if (!isAccessManaged(target)) {
|
552
|
-
revert ErrorTargetNotAccessManaged(target);
|
553
|
-
}
|
554
|
-
|
555
|
-
// check target shares authority with this contract
|
556
|
-
if (checkAuthority) {
|
557
|
-
address targetAuthority = AccessManagedUpgradeable(target).authority();
|
558
|
-
if (targetAuthority != authority()) {
|
559
|
-
revert ErrorTargetAuthorityMismatch(authority(), targetAuthority);
|
560
|
-
}
|
561
|
-
}
|
562
|
-
|
563
617
|
// create target info
|
618
|
+
Str name = StrLib.toStr(targetName);
|
564
619
|
_targetInfo[target] = TargetInfo({
|
565
620
|
name: name,
|
566
621
|
isCustom: custom,
|
@@ -573,19 +628,96 @@ contract AccessAdmin is
|
|
573
628
|
// add role to list of roles
|
574
629
|
_targets.push(target);
|
575
630
|
|
576
|
-
emit
|
631
|
+
emit LogAccessAdminTargetCreated(_adminName, target, targetName);
|
577
632
|
}
|
578
633
|
|
579
|
-
|
634
|
+
|
635
|
+
function _setTargetLocked(address target, bool locked)
|
580
636
|
internal
|
581
|
-
|
582
|
-
|
637
|
+
onlyExistingTarget(target)
|
638
|
+
{
|
639
|
+
_authority.setTargetClosed(target, locked);
|
640
|
+
}
|
641
|
+
|
642
|
+
|
643
|
+
function _getRoleName(RoleId roleId) internal view returns (string memory) {
|
644
|
+
if (roleExists(roleId)) {
|
645
|
+
return _roleInfo[roleId].name.toString();
|
646
|
+
}
|
647
|
+
return "<unknown-role>";
|
648
|
+
}
|
649
|
+
|
650
|
+
|
651
|
+
function _checkAuthorization(
|
652
|
+
address authorization,
|
653
|
+
ObjectType expectedDomain,
|
654
|
+
VersionPart expectedRelease,
|
655
|
+
bool checkAlreadyInitialized
|
656
|
+
)
|
657
|
+
internal
|
658
|
+
view
|
659
|
+
{
|
660
|
+
AccessAdminLib.checkAuthorization(
|
661
|
+
address(_authorization),
|
662
|
+
authorization,
|
663
|
+
expectedDomain,
|
664
|
+
expectedRelease,
|
665
|
+
checkAlreadyInitialized);
|
666
|
+
}
|
667
|
+
|
668
|
+
|
669
|
+
function _checkRoleExists(
|
670
|
+
RoleId roleId,
|
671
|
+
bool onlyActiveRole
|
672
|
+
)
|
673
|
+
internal
|
674
|
+
view
|
583
675
|
{
|
584
|
-
|
585
|
-
|
586
|
-
|
676
|
+
if (!roleExists(roleId)) {
|
677
|
+
revert ErrorAccessAdminRoleUnknown(roleId);
|
678
|
+
}
|
679
|
+
|
680
|
+
uint64 roleIdInt = RoleId.unwrap(roleId);
|
681
|
+
if (roleIdInt == _authority.ADMIN_ROLE()) {
|
682
|
+
revert ErrorAccessAdminRoleIsLocked(roleId);
|
683
|
+
}
|
684
|
+
|
685
|
+
// check if role is disabled
|
686
|
+
if (onlyActiveRole && _roleInfo[roleId].pausedAt <= TimestampLib.blockTimestamp()) {
|
687
|
+
revert ErrorAccessAdminRoleIsPaused(roleId);
|
688
|
+
}
|
689
|
+
}
|
690
|
+
|
691
|
+
|
692
|
+
|
693
|
+
/// @dev check if target exists and reverts if it doesn't
|
694
|
+
function _checkTargetExists(
|
695
|
+
address target
|
696
|
+
)
|
697
|
+
internal
|
698
|
+
view
|
699
|
+
{
|
700
|
+
// check not yet created
|
701
|
+
if (!targetExists(target)) {
|
702
|
+
revert ErrorAccessAdminTargetNotCreated(target);
|
703
|
+
}
|
704
|
+
}
|
705
|
+
|
706
|
+
|
707
|
+
function _checkIsRegistered(
|
708
|
+
address registry,
|
709
|
+
address target,
|
710
|
+
ObjectType expectedType
|
711
|
+
)
|
712
|
+
internal
|
713
|
+
view
|
714
|
+
{
|
715
|
+
AccessAdminLib.checkIsRegistered(registry, target, expectedType);
|
716
|
+
}
|
717
|
+
|
718
|
+
function _checkRegistry(address registry) internal view {
|
719
|
+
if (!ContractLib.isRegistry(registry)) {
|
720
|
+
revert ErrorAccessAdminNotRegistry(registry);
|
587
721
|
}
|
588
|
-
return size > 0;
|
589
722
|
}
|
590
|
-
|
591
723
|
}
|