@etherisc/gif-next 0.0.2-ccfa4c7-304 → 0.0.2-cd48412-522
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 +63 -1
- package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +1 -1
- package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +106 -38
- package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +91 -45
- package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +1 -1
- package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.json +58 -6
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +272 -102
- package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.json +662 -46
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +2 -2
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +227 -52
- 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 +180 -32
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +90 -17
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +246 -16
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +420 -27
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +64 -152
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +226 -65
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +21 -98
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +378 -149
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +140 -78
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +20 -97
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +232 -19
- package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +109 -110
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +225 -64
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +145 -134
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +225 -64
- package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +83 -177
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +225 -64
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +37 -71
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +130 -148
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +225 -64
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +333 -190
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +225 -64
- package/artifacts/contracts/instance/BaseStore.sol/BaseStore.dbg.json +4 -0
- package/artifacts/contracts/{shared/IKeyValueStore.sol/IKeyValueStore.json → instance/BaseStore.sol/BaseStore.json} +51 -229
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
- package/artifacts/contracts/instance/IBaseStore.sol/IBaseStore.dbg.json +4 -0
- package/artifacts/contracts/instance/IBaseStore.sol/IBaseStore.json +304 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +368 -34
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +295 -5
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +419 -96
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +591 -343
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +194 -73
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +569 -513
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +321 -31
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +80 -42
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +1316 -2015
- package/artifacts/contracts/instance/ProductStore.sol/ProductStore.dbg.json +4 -0
- package/artifacts/contracts/instance/ProductStore.sol/ProductStore.json +3427 -0
- package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +1 -1
- package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +101 -88
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +8 -8
- package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
- package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.json +20 -20
- 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 +29 -41
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +239 -61
- 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 +19 -31
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +29 -0
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +19 -31
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +83 -38
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +96 -50
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +59 -79
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +225 -64
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +300 -123
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +124 -58
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +186 -33
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +29 -41
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +238 -19
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +29 -41
- package/artifacts/contracts/pool/PoolLib.sol/PoolLib.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolLib.sol/PoolLib.json +100 -34
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +338 -79
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +121 -63
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +238 -52
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +96 -42
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +46 -58
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +225 -64
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +142 -102
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +113 -75
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +187 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +50 -10
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +55 -0
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +50 -0
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +40 -52
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.json +224 -18
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +157 -86
- package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.json +511 -21
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +118 -72
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +114 -112
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +99 -69
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +40 -52
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +258 -44
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +84 -42
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +33 -22
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +29 -0
- package/artifacts/contracts/registry/IRelease.sol/IRelease.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +71 -60
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +385 -243
- package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.json +266 -70
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +41 -12
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +76 -38
- package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +389 -191
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +149 -97
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +437 -26
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +119 -59
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/shared/Component.sol/Component.json +19 -31
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +209 -190
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +113 -63
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +76 -41
- package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +1 -1
- package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +1 -1
- package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.dbg.json +1 -1
- package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.json +2 -2
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponent.sol/IComponent.json +19 -31
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +118 -123
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +19 -31
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +19 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +19 -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 +29 -0
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +19 -31
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +21 -2
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +19 -0
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +29 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +2 -2
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +2 -2
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +1385 -150
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +97 -117
- package/artifacts/contracts/staking/ITargetLimitHandler.sol/ITargetLimitHandler.dbg.json +4 -0
- package/artifacts/contracts/staking/ITargetLimitHandler.sol/ITargetLimitHandler.json +50 -0
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +1471 -213
- package/artifacts/contracts/staking/StakingLib.sol/StakingLib.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingLib.sol/StakingLib.json +77 -76
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +123 -72
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +296 -152
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +131 -167
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +84 -54
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +1615 -815
- package/artifacts/contracts/staking/TargetHandler.sol/TargetHandler.dbg.json +4 -0
- package/artifacts/contracts/staking/TargetHandler.sol/TargetHandler.json +309 -0
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +153 -91
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.json +10 -10
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.json +45 -19
- package/artifacts/contracts/type/ChainId.sol/ChainIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/ChainId.sol/ChainIdLib.json +193 -0
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/type/Fee.sol/FeeLib.json +93 -37
- package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.dbg.json +1 -1
- package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +2 -2
- package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +6 -6
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
- package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +2 -2
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +39 -218
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +45 -2
- package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
- package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
- package/artifacts/contracts/type/String.sol/StrLib.json +50 -2
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +3 -3
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +60 -36
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.json +10 -0
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +65 -27
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +15 -2
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.json +10 -0
- package/contracts/accounting/AccountingService.sol +15 -3
- package/contracts/accounting/IAccountingService.sol +4 -2
- package/contracts/authorization/AccessAdmin.sol +264 -188
- package/contracts/authorization/AccessAdminLib.sol +222 -9
- package/contracts/authorization/Authorization.sol +38 -234
- package/contracts/authorization/IAccess.sol +25 -7
- package/contracts/authorization/IAccessAdmin.sol +19 -45
- package/contracts/authorization/IAuthorization.sol +3 -57
- package/contracts/authorization/IServiceAuthorization.sol +55 -17
- package/contracts/authorization/ServiceAuthorization.sol +248 -34
- package/contracts/distribution/BasicDistribution.sol +7 -8
- package/contracts/distribution/BasicDistributionAuthorization.sol +11 -4
- package/contracts/distribution/Distribution.sol +12 -56
- package/contracts/distribution/DistributionService.sol +126 -63
- package/contracts/distribution/IDistributionComponent.sol +3 -10
- package/contracts/distribution/IDistributionService.sol +20 -8
- package/contracts/examples/fire/FirePool.sol +0 -4
- package/contracts/examples/fire/FireProduct.sol +6 -10
- package/contracts/examples/unpermissioned/SimpleDistribution.sol +4 -8
- package/contracts/examples/unpermissioned/SimpleOracle.sol +4 -8
- package/contracts/examples/unpermissioned/SimplePool.sol +0 -4
- package/contracts/examples/unpermissioned/SimpleProduct.sol +83 -23
- package/contracts/instance/BaseStore.sol +93 -0
- package/contracts/instance/IBaseStore.sol +37 -0
- package/contracts/instance/IInstance.sol +57 -6
- package/contracts/instance/IInstanceService.sol +42 -7
- package/contracts/instance/Instance.sol +112 -57
- package/contracts/instance/InstanceAdmin.sol +164 -235
- package/contracts/instance/InstanceAuthorizationV3.sol +101 -61
- package/contracts/instance/InstanceReader.sol +354 -392
- package/contracts/instance/InstanceService.sol +186 -134
- package/contracts/instance/InstanceStore.sol +153 -128
- package/contracts/instance/ProductStore.sol +290 -0
- package/contracts/instance/RiskSet.sol +10 -2
- package/contracts/instance/TargetNames.sol +10 -0
- package/contracts/instance/base/BalanceStore.sol +4 -6
- package/contracts/instance/base/ObjectLifecycle.sol +2 -6
- package/contracts/instance/module/IBundle.sol +6 -5
- package/contracts/instance/module/IComponents.sol +15 -6
- package/contracts/instance/module/IDistribution.sol +17 -7
- package/contracts/instance/module/IPolicy.sol +28 -8
- package/contracts/instance/module/IRisk.sol +2 -0
- package/contracts/oracle/BasicOracle.sol +3 -6
- package/contracts/oracle/BasicOracleAuthorization.sol +18 -2
- package/contracts/oracle/IOracle.sol +9 -4
- package/contracts/oracle/Oracle.sol +4 -8
- package/contracts/oracle/OracleService.sol +8 -8
- package/contracts/pool/BasicPool.sol +4 -18
- package/contracts/pool/BasicPoolAuthorization.sol +10 -5
- package/contracts/pool/BundleService.sol +34 -43
- package/contracts/pool/IBundleService.sol +14 -13
- package/contracts/pool/IPoolService.sol +7 -2
- package/contracts/pool/Pool.sol +6 -20
- package/contracts/pool/PoolLib.sol +127 -2
- package/contracts/pool/PoolService.sol +41 -184
- package/contracts/product/ApplicationService.sol +69 -11
- package/contracts/product/BasicProduct.sol +2 -5
- package/contracts/product/BasicProductAuthorization.sol +11 -4
- package/contracts/product/ClaimService.sol +99 -105
- package/contracts/product/IApplicationService.sol +23 -2
- package/contracts/product/IClaimService.sol +5 -4
- package/contracts/product/IPolicyService.sol +9 -2
- package/contracts/product/IPricingService.sol +1 -0
- package/contracts/product/IRiskService.sol +21 -3
- package/contracts/product/PolicyService.sol +40 -59
- package/contracts/product/PolicyServiceLib.sol +79 -5
- package/contracts/product/PricingService.sol +33 -31
- package/contracts/product/Product.sol +40 -18
- package/contracts/product/RiskService.sol +57 -12
- package/contracts/registry/IRegistry.sol +15 -9
- package/contracts/registry/IRelease.sol +6 -3
- package/contracts/registry/Registry.sol +15 -9
- package/contracts/registry/RegistryAdmin.sol +33 -100
- package/contracts/registry/RegistryAuthorization.sol +121 -52
- package/contracts/registry/RegistryService.sol +1 -1
- package/contracts/registry/ReleaseAdmin.sol +42 -100
- package/contracts/registry/ReleaseRegistry.sol +20 -12
- package/contracts/registry/ServiceAuthorizationV3.sol +43 -32
- package/contracts/registry/TokenRegistry.sol +56 -52
- package/contracts/shared/Component.sol +16 -33
- package/contracts/shared/ComponentService.sol +249 -247
- package/contracts/shared/ContractLib.sol +106 -75
- package/contracts/shared/IComponent.sol +1 -4
- package/contracts/shared/IComponentService.sol +17 -16
- package/contracts/shared/INftOwnable.sol +2 -0
- package/contracts/shared/IRegisterable.sol +0 -1
- package/contracts/shared/InstanceLinkedComponent.sol +6 -11
- package/contracts/shared/NftOwnable.sol +3 -1
- package/contracts/shared/PolicyHolder.sol +3 -2
- package/contracts/shared/Service.sol +6 -4
- package/contracts/staking/IStaking.sol +262 -70
- package/contracts/staking/IStakingService.sol +39 -84
- package/contracts/staking/ITargetLimitHandler.sol +17 -0
- package/contracts/staking/Staking.sol +470 -219
- package/contracts/staking/StakingLib.sol +38 -124
- package/contracts/staking/StakingManager.sol +4 -3
- package/contracts/staking/StakingReader.sol +62 -71
- package/contracts/staking/StakingService.sol +42 -185
- package/contracts/staking/StakingServiceManager.sol +1 -0
- package/contracts/staking/StakingStore.sol +1093 -331
- package/contracts/staking/TargetHandler.sol +132 -0
- package/contracts/staking/TargetManagerLib.sol +69 -46
- package/contracts/type/Amount.sol +4 -0
- package/contracts/type/Blocknumber.sol +15 -15
- package/contracts/type/ChainId.sol +101 -0
- package/contracts/type/Fee.sol +8 -8
- package/contracts/type/NftId.sol +3 -3
- package/contracts/type/ObjectType.sol +16 -3
- package/contracts/type/RoleId.sol +57 -59
- package/contracts/type/Seconds.sol +19 -0
- package/contracts/type/String.sol +12 -0
- package/contracts/type/Timestamp.sol +4 -2
- package/contracts/type/UFixed.sol +28 -10
- package/contracts/upgradeability/IVersionable.sol +3 -0
- package/contracts/upgradeability/ProxyManager.sol +25 -11
- package/contracts/upgradeability/UpgradableProxyWithAdmin.sol +12 -2
- package/contracts/upgradeability/Versionable.sol +6 -3
- package/package.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.dbg.json +0 -4
- package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.json +0 -24
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +0 -4
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +0 -485
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +0 -4
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +0 -4
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +0 -538
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +0 -4
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +0 -205
- package/contracts/shared/ComponentVerifyingService.sol +0 -128
- package/contracts/shared/IKeyValueStore.sol +0 -54
- package/contracts/shared/KeyValueStore.sol +0 -131
- package/contracts/staking/StakingLifecycle.sol +0 -23
@@ -6,19 +6,57 @@ import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/acce
|
|
6
6
|
import {IAccess} from "./IAccess.sol";
|
7
7
|
import {IAccessAdmin} from "./IAccessAdmin.sol";
|
8
8
|
import {IAuthorization} from "./IAuthorization.sol";
|
9
|
+
import {IComponent} from "../shared/IComponent.sol";
|
9
10
|
import {IRegistry} from "../registry/IRegistry.sol";
|
11
|
+
import {IService} from "../shared/IService.sol";
|
12
|
+
import {IServiceAuthorization} from "./IServiceAuthorization.sol";
|
10
13
|
|
11
14
|
import {ContractLib} from "../shared/ContractLib.sol";
|
12
15
|
import {ObjectType} from "../type/ObjectType.sol";
|
13
|
-
import {RoleId} from "../type/RoleId.sol";
|
16
|
+
import {RoleId, RoleIdLib} from "../type/RoleId.sol";
|
14
17
|
import {SelectorLib} from "../type/Selector.sol";
|
15
18
|
import {Str, StrLib} from "../type/String.sol";
|
16
19
|
import {TimestampLib} from "../type/Timestamp.sol";
|
17
|
-
import {VersionPart} from "../type/Version.sol";
|
20
|
+
import {VersionPart, VersionPartLib} from "../type/Version.sol";
|
18
21
|
|
19
22
|
|
20
23
|
library AccessAdminLib { // ACCESS_ADMIN_LIB
|
21
24
|
|
25
|
+
string public constant TOKEN_HANDLER_SUFFIX = "Th";
|
26
|
+
string public constant ROLE_SUFFIX = "_Role";
|
27
|
+
|
28
|
+
uint64 public constant SERVICE_DOMAIN_ROLE_FACTOR = 100;
|
29
|
+
uint64 public constant COMPONENT_ROLE_FACTOR = 1000;
|
30
|
+
uint64 public constant COMPONENT_ROLE_MAX = 19000;
|
31
|
+
|
32
|
+
uint64 public constant CORE_ROLE_MIN = 100;
|
33
|
+
uint64 public constant SERVICE_ROLE_MIN = 1000; // + service domain * SERVICE_ROLE_FACTOR + release
|
34
|
+
uint64 public constant SERVICE_ROLE_FACTOR = 1000;
|
35
|
+
uint64 public constant INSTANCE_ROLE_MIN = 100000;
|
36
|
+
|
37
|
+
// MUST match with Authorization.COMPONENT_ROLE_MIN
|
38
|
+
uint64 public constant COMPONENT_ROLE_MIN = 110000;
|
39
|
+
|
40
|
+
uint64 public constant CUSTOM_ROLE_MIN = 1000000;
|
41
|
+
|
42
|
+
|
43
|
+
function getSelectors(
|
44
|
+
IAccess.FunctionInfo[] memory functions
|
45
|
+
)
|
46
|
+
public
|
47
|
+
pure
|
48
|
+
returns (
|
49
|
+
bytes4[] memory selectors
|
50
|
+
)
|
51
|
+
{
|
52
|
+
uint256 n = functions.length;
|
53
|
+
selectors = new bytes4[](n);
|
54
|
+
for (uint256 i = 0; i < n; i++) {
|
55
|
+
selectors[i] = functions[i].selector.toBytes4();
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
|
22
60
|
function checkRoleCreation(
|
23
61
|
IAccessAdmin accessAdmin,
|
24
62
|
RoleId roleId,
|
@@ -54,6 +92,7 @@ library AccessAdminLib { // ACCESS_ADMIN_LIB
|
|
54
92
|
}
|
55
93
|
}
|
56
94
|
|
95
|
+
|
57
96
|
function checkTargetCreation(
|
58
97
|
IAccessAdmin accessAdmin,
|
59
98
|
address target,
|
@@ -97,7 +136,6 @@ library AccessAdminLib { // ACCESS_ADMIN_LIB
|
|
97
136
|
revert IAccessAdmin.ErrorAccessAdminTargetAuthorityMismatch(accessAdmin.authority(), targetAuthority);
|
98
137
|
}
|
99
138
|
}
|
100
|
-
|
101
139
|
}
|
102
140
|
|
103
141
|
|
@@ -106,6 +144,7 @@ library AccessAdminLib { // ACCESS_ADMIN_LIB
|
|
106
144
|
address authorization,
|
107
145
|
ObjectType expectedDomain,
|
108
146
|
VersionPart expectedRelease,
|
147
|
+
bool expectServiceAuthorization,
|
109
148
|
bool checkAlreadyInitialized
|
110
149
|
)
|
111
150
|
public
|
@@ -118,8 +157,14 @@ library AccessAdminLib { // ACCESS_ADMIN_LIB
|
|
118
157
|
}
|
119
158
|
|
120
159
|
// check contract type matches
|
121
|
-
if (
|
122
|
-
|
160
|
+
if (expectServiceAuthorization) {
|
161
|
+
if (!ContractLib.supportsInterface(authorization, type(IServiceAuthorization).interfaceId)) {
|
162
|
+
revert IAccessAdmin.ErrorAccessAdminNotServiceAuthorization(authorization);
|
163
|
+
}
|
164
|
+
} else {
|
165
|
+
if (!ContractLib.supportsInterface(authorization, type(IAuthorization).interfaceId)) {
|
166
|
+
revert IAccessAdmin.ErrorAccessAdminNotAuthorization(authorization);
|
167
|
+
}
|
123
168
|
}
|
124
169
|
|
125
170
|
// check domain matches
|
@@ -144,6 +189,8 @@ library AccessAdminLib { // ACCESS_ADMIN_LIB
|
|
144
189
|
public
|
145
190
|
view
|
146
191
|
{
|
192
|
+
checkRegistry(registry);
|
193
|
+
|
147
194
|
ObjectType tagetType = IRegistry(registry).getObjectInfo(target).objectType;
|
148
195
|
if (tagetType.eqz()) {
|
149
196
|
revert IAccessAdmin.ErrorAccessAdminNotRegistered(target);
|
@@ -154,7 +201,161 @@ library AccessAdminLib { // ACCESS_ADMIN_LIB
|
|
154
201
|
}
|
155
202
|
}
|
156
203
|
|
157
|
-
|
204
|
+
|
205
|
+
function checkRegistry(
|
206
|
+
address registry
|
207
|
+
)
|
208
|
+
public
|
209
|
+
view
|
210
|
+
{
|
211
|
+
if (!ContractLib.isRegistry(registry)) {
|
212
|
+
revert IAccessAdmin.ErrorAccessAdminNotRegistry(registry);
|
213
|
+
}
|
214
|
+
}
|
215
|
+
|
216
|
+
|
217
|
+
function getServiceRoleId(
|
218
|
+
address serviceAddress,
|
219
|
+
IAccess.TargetType serviceTargetType
|
220
|
+
)
|
221
|
+
public
|
222
|
+
view
|
223
|
+
returns (RoleId serviceRoleId)
|
224
|
+
{
|
225
|
+
IService service = IService(serviceAddress);
|
226
|
+
|
227
|
+
if (serviceTargetType == IAccess.TargetType.Service) {
|
228
|
+
return RoleIdLib.toServiceRoleId(service.getDomain(), service.getRelease());
|
229
|
+
} else if (serviceTargetType == IAccess.TargetType.GenericService) {
|
230
|
+
return RoleIdLib.toGenericServiceRoleId(service.getDomain());
|
231
|
+
}
|
232
|
+
|
233
|
+
revert IAccessAdmin.ErrorAccessAdminInvalidServiceType(serviceAddress, serviceTargetType);
|
234
|
+
}
|
235
|
+
|
236
|
+
|
237
|
+
function getVersionedServiceRoleId(
|
238
|
+
ObjectType serviceDomain,
|
239
|
+
VersionPart release
|
240
|
+
)
|
241
|
+
public
|
242
|
+
pure
|
243
|
+
returns (RoleId serviceRoleId)
|
244
|
+
{
|
245
|
+
return RoleIdLib.toRoleId(
|
246
|
+
SERVICE_ROLE_MIN + SERVICE_ROLE_FACTOR * serviceDomain.toInt() + release.toInt());
|
247
|
+
}
|
248
|
+
|
249
|
+
|
250
|
+
function getGenericServiceRoleId(
|
251
|
+
ObjectType serviceDomain
|
252
|
+
)
|
253
|
+
public
|
254
|
+
pure
|
255
|
+
returns (RoleId serviceRoleId)
|
256
|
+
{
|
257
|
+
return RoleIdLib.toRoleId(
|
258
|
+
SERVICE_ROLE_MIN + SERVICE_ROLE_FACTOR * serviceDomain.toInt() + VersionPartLib.releaseMax().toInt());
|
259
|
+
}
|
260
|
+
|
261
|
+
|
262
|
+
function getCustomRoleId(uint64 index)
|
263
|
+
public
|
264
|
+
pure
|
265
|
+
returns (RoleId customRoleId)
|
266
|
+
{
|
267
|
+
return RoleIdLib.toRoleId(CUSTOM_ROLE_MIN + index);
|
268
|
+
}
|
269
|
+
|
270
|
+
|
271
|
+
function isCustomRole(RoleId roleId)
|
272
|
+
public
|
273
|
+
pure
|
274
|
+
returns (bool)
|
275
|
+
{
|
276
|
+
return roleId.toInt() >= CUSTOM_ROLE_MIN;
|
277
|
+
}
|
278
|
+
|
279
|
+
|
280
|
+
function getTargetRoleId(
|
281
|
+
address target,
|
282
|
+
IAccess.TargetType targetType,
|
283
|
+
uint64 index
|
284
|
+
)
|
285
|
+
public
|
286
|
+
view
|
287
|
+
returns (RoleId targetRoleId)
|
288
|
+
{
|
289
|
+
if (targetType == IAccess.TargetType.Core) {
|
290
|
+
return RoleIdLib.toRoleId(CORE_ROLE_MIN + index);
|
291
|
+
}
|
292
|
+
|
293
|
+
if (targetType == IAccess.TargetType.Service || targetType == IAccess.TargetType.GenericService ) {
|
294
|
+
return getServiceRoleId(target, targetType);
|
295
|
+
}
|
296
|
+
|
297
|
+
if (targetType == IAccess.TargetType.Instance) {
|
298
|
+
return RoleIdLib.toRoleId(INSTANCE_ROLE_MIN + index);
|
299
|
+
}
|
300
|
+
|
301
|
+
if (targetType == IAccess.TargetType.Component) {
|
302
|
+
return RoleIdLib.toRoleId(COMPONENT_ROLE_MIN + index);
|
303
|
+
}
|
304
|
+
|
305
|
+
if (targetType == IAccess.TargetType.Custom) {
|
306
|
+
return RoleIdLib.toRoleId(CUSTOM_ROLE_MIN + index);
|
307
|
+
}
|
308
|
+
|
309
|
+
revert IAccessAdmin.ErrorAccessAdminInvalidTargetType(target, targetType);
|
310
|
+
}
|
311
|
+
|
312
|
+
|
313
|
+
function getTokenHandler(
|
314
|
+
address target,
|
315
|
+
string memory targetName,
|
316
|
+
IAccess.TargetType targetType
|
317
|
+
)
|
318
|
+
public
|
319
|
+
view
|
320
|
+
returns (
|
321
|
+
address tokenHandler,
|
322
|
+
string memory tokenHandlerName
|
323
|
+
)
|
324
|
+
{
|
325
|
+
// not component or core (we need to check core because of staking)
|
326
|
+
if (targetType != IAccess.TargetType.Component && targetType != IAccess.TargetType.Core) {
|
327
|
+
return (address(0), "");
|
328
|
+
}
|
329
|
+
|
330
|
+
// not contract
|
331
|
+
if (!ContractLib.isContract(target)) {
|
332
|
+
return (address(0), "");
|
333
|
+
}
|
334
|
+
|
335
|
+
// not component
|
336
|
+
if (!ContractLib.supportsInterface(target, type(IComponent).interfaceId)) {
|
337
|
+
return (address(0), "");
|
338
|
+
}
|
339
|
+
|
340
|
+
tokenHandler = address(IComponent(target).getTokenHandler());
|
341
|
+
tokenHandlerName = string(abi.encodePacked(targetName, TOKEN_HANDLER_SUFFIX));
|
342
|
+
}
|
343
|
+
|
344
|
+
|
345
|
+
function toRoleName(string memory name) public pure returns (string memory) {
|
346
|
+
return string(
|
347
|
+
abi.encodePacked(
|
348
|
+
name,
|
349
|
+
ROLE_SUFFIX));
|
350
|
+
}
|
351
|
+
|
352
|
+
|
353
|
+
function toRole(
|
354
|
+
RoleId adminRoleId,
|
355
|
+
IAccessAdmin.RoleType roleType,
|
356
|
+
uint32 maxMemberCount,
|
357
|
+
string memory name
|
358
|
+
)
|
158
359
|
public
|
159
360
|
view
|
160
361
|
returns (IAccess.RoleInfo memory)
|
@@ -164,20 +365,32 @@ library AccessAdminLib { // ACCESS_ADMIN_LIB
|
|
164
365
|
adminRoleId: adminRoleId,
|
165
366
|
roleType: roleType,
|
166
367
|
maxMemberCount: maxMemberCount,
|
167
|
-
createdAt: TimestampLib.
|
368
|
+
createdAt: TimestampLib.current(),
|
168
369
|
pausedAt: TimestampLib.max()
|
169
370
|
});
|
170
371
|
}
|
171
372
|
|
172
|
-
|
373
|
+
|
374
|
+
function toFunction(
|
375
|
+
bytes4 selector,
|
376
|
+
string memory name
|
377
|
+
)
|
173
378
|
public
|
174
379
|
view
|
175
380
|
returns (IAccess.FunctionInfo memory)
|
176
381
|
{
|
382
|
+
if(selector == bytes4(0)) {
|
383
|
+
revert IAccessAdmin.ErrorAccessAdminSelectorZero();
|
384
|
+
}
|
385
|
+
|
386
|
+
if(bytes(name).length == 0) {
|
387
|
+
revert IAccessAdmin.ErrorAccessAdminFunctionNameEmpty();
|
388
|
+
}
|
389
|
+
|
177
390
|
return IAccess.FunctionInfo({
|
178
391
|
name: StrLib.toStr(name),
|
179
392
|
selector: SelectorLib.toSelector(selector),
|
180
|
-
createdAt: TimestampLib.
|
393
|
+
createdAt: TimestampLib.current()});
|
181
394
|
}
|
182
395
|
|
183
396
|
}
|
@@ -1,78 +1,47 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {IAccess} from "./IAccess.sol";
|
5
4
|
import {IAuthorization} from "./IAuthorization.sol";
|
6
5
|
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import {SelectorLib} from "../type/Selector.sol";
|
6
|
+
import {ObjectType} from "../type/ObjectType.sol";
|
7
|
+
import {RoleId, RoleIdLib} from "../type/RoleId.sol";
|
8
|
+
import {ServiceAuthorization} from "../authorization/ServiceAuthorization.sol";
|
11
9
|
import {Str, StrLib} from "../type/String.sol";
|
12
|
-
|
13
|
-
import {VersionPart, VersionPartLib} from "../type/Version.sol";
|
10
|
+
|
14
11
|
|
15
12
|
contract Authorization is
|
16
|
-
|
13
|
+
ServiceAuthorization,
|
17
14
|
IAuthorization
|
18
15
|
{
|
19
|
-
uint256 public constant GIF_RELEASE = 3;
|
20
16
|
|
21
|
-
|
22
|
-
|
17
|
+
// MUST match with AccessAdminLib.COMPONENT_ROLE_MIN
|
18
|
+
uint64 public constant COMPONENT_ROLE_MIN = 110000;
|
23
19
|
|
24
20
|
uint64 internal _nextGifContractRoleId;
|
25
|
-
ObjectType[] internal _serviceDomains;
|
26
|
-
mapping(ObjectType domain => Str target) internal _serviceTarget;
|
27
|
-
|
28
|
-
string internal _mainTargetName = "Component";
|
29
|
-
string internal _tokenHandlerName = "ComponentTH";
|
30
21
|
|
31
|
-
|
32
|
-
Str internal _mainTarget;
|
22
|
+
string internal _tokenHandlerName = "ComponentTh";
|
33
23
|
Str internal _tokenHandlerTarget;
|
34
|
-
Str[] internal _targets;
|
35
|
-
|
36
|
-
mapping(Str target => RoleId roleid) internal _targetRole;
|
37
|
-
mapping(Str target => bool exists) internal _targetExists;
|
38
|
-
|
39
|
-
RoleId[] internal _roles;
|
40
|
-
mapping(RoleId role => RoleInfo info) internal _roleInfo;
|
41
|
-
|
42
|
-
mapping(Str target => RoleId[] authorizedRoles) internal _authorizedRoles;
|
43
|
-
mapping(Str target => mapping(RoleId authorizedRole => IAccess.FunctionInfo[] functions)) internal _authorizedFunctions;
|
44
24
|
|
45
25
|
|
46
26
|
constructor(
|
47
27
|
string memory mainTargetName,
|
48
|
-
ObjectType
|
28
|
+
ObjectType domain,
|
29
|
+
uint8 release,
|
30
|
+
string memory commitHash,
|
49
31
|
bool isComponent,
|
50
32
|
bool includeTokenHandler
|
51
33
|
)
|
34
|
+
ServiceAuthorization(mainTargetName, domain, release, commitHash)
|
52
35
|
{
|
53
|
-
// checks
|
54
|
-
if (bytes(mainTargetName).length == 0) {
|
55
|
-
revert ErrorAuthorizationMainTargetNameEmpty();
|
56
|
-
}
|
57
|
-
|
58
|
-
if (targetDomain == ObjectTypeLib.zero()) {
|
59
|
-
revert ErrorAuthorizationTargetDomainZero();
|
60
|
-
}
|
61
|
-
|
62
|
-
// effects
|
63
|
-
_initializeERC165();
|
64
|
-
|
65
|
-
_domain = targetDomain;
|
66
|
-
_mainTargetName = mainTargetName;
|
67
|
-
_mainTarget = StrLib.toStr(mainTargetName);
|
68
36
|
_nextGifContractRoleId = 10;
|
69
37
|
|
38
|
+
// setup main target
|
70
39
|
if (isComponent) {
|
71
|
-
if (
|
40
|
+
if (domain.eqz()) {
|
72
41
|
revert ErrorAuthorizationTargetDomainZero();
|
73
42
|
}
|
74
43
|
|
75
|
-
RoleId mainRoleId = RoleIdLib.
|
44
|
+
RoleId mainRoleId = RoleIdLib.toRoleId(COMPONENT_ROLE_MIN);
|
76
45
|
string memory mainRolName = _toTargetRoleName(_mainTargetName);
|
77
46
|
|
78
47
|
_addTargetWithRole(
|
@@ -80,8 +49,9 @@ contract Authorization is
|
|
80
49
|
mainRoleId,
|
81
50
|
mainRolName);
|
82
51
|
} else {
|
83
|
-
|
52
|
+
_addGifTarget(_mainTargetName);
|
84
53
|
}
|
54
|
+
|
85
55
|
// setup use case specific parts
|
86
56
|
_setupServiceTargets();
|
87
57
|
_setupRoles(); // not including main target role
|
@@ -90,7 +60,7 @@ contract Authorization is
|
|
90
60
|
|
91
61
|
// setup component token handler
|
92
62
|
if (includeTokenHandler) {
|
93
|
-
_tokenHandlerName = string(abi.encodePacked(mainTargetName, "
|
63
|
+
_tokenHandlerName = string(abi.encodePacked(mainTargetName, "Th"));
|
94
64
|
_tokenHandlerTarget = StrLib.toStr(_tokenHandlerName);
|
95
65
|
_addTarget(_tokenHandlerName);
|
96
66
|
_setupTokenHandlerAuthorizations();
|
@@ -99,47 +69,6 @@ contract Authorization is
|
|
99
69
|
_registerInterfaceNotInitializing(type(IAuthorization).interfaceId);
|
100
70
|
}
|
101
71
|
|
102
|
-
function getDomain() external view returns(ObjectType targetDomain) {
|
103
|
-
return _domain;
|
104
|
-
}
|
105
|
-
|
106
|
-
function getServiceDomains() external view returns(ObjectType[] memory serviceDomains) {
|
107
|
-
return _serviceDomains;
|
108
|
-
}
|
109
|
-
|
110
|
-
function getComponentRole(ObjectType componentDomain) public view returns(RoleId roleId) {
|
111
|
-
return RoleIdLib.toComponentRoleId(componentDomain, 0);
|
112
|
-
}
|
113
|
-
|
114
|
-
function getServiceRole(ObjectType serviceDomain) public virtual pure returns (RoleId serviceRoleId) {
|
115
|
-
return RoleIdLib.roleForTypeAndVersion(
|
116
|
-
serviceDomain,
|
117
|
-
getRelease());
|
118
|
-
}
|
119
|
-
|
120
|
-
function getServiceTarget(ObjectType serviceDomain) external view returns(Str serviceTarget) {
|
121
|
-
return _serviceTarget[serviceDomain];
|
122
|
-
}
|
123
|
-
|
124
|
-
function getRoles() external view returns(RoleId[] memory roles) {
|
125
|
-
return _roles;
|
126
|
-
}
|
127
|
-
|
128
|
-
function roleExists(RoleId roleId) public view returns(bool exists) {
|
129
|
-
return _roleInfo[roleId].roleType != RoleType.Undefined;
|
130
|
-
}
|
131
|
-
|
132
|
-
function getRoleInfo(RoleId roleId) external view returns (RoleInfo memory info) {
|
133
|
-
return _roleInfo[roleId];
|
134
|
-
}
|
135
|
-
|
136
|
-
function getMainTargetName() public virtual view returns (string memory name) {
|
137
|
-
return _mainTargetName;
|
138
|
-
}
|
139
|
-
|
140
|
-
function getMainTarget() public view returns(Str) {
|
141
|
-
return _mainTarget;
|
142
|
-
}
|
143
72
|
|
144
73
|
function getTokenHandlerName() public view returns(string memory) {
|
145
74
|
return _tokenHandlerName;
|
@@ -149,7 +78,7 @@ contract Authorization is
|
|
149
78
|
return _tokenHandlerTarget;
|
150
79
|
}
|
151
80
|
|
152
|
-
function getTarget(string memory targetName) public
|
81
|
+
function getTarget(string memory targetName) public pure returns(Str target) {
|
153
82
|
return StrLib.toStr(targetName);
|
154
83
|
}
|
155
84
|
|
@@ -161,111 +90,31 @@ contract Authorization is
|
|
161
90
|
return target == _mainTarget || _targetExists[target];
|
162
91
|
}
|
163
92
|
|
164
|
-
function getTargetRole(Str target) public view returns(RoleId roleId) {
|
165
|
-
return _targetRole[target];
|
166
|
-
}
|
167
|
-
|
168
|
-
function getAuthorizedRoles(Str target) external view returns(RoleId[] memory roleIds) {
|
169
|
-
return _authorizedRoles[target];
|
170
|
-
}
|
171
|
-
|
172
|
-
function getAuthorizedFunctions(Str target, RoleId roleId) external view returns(IAccess.FunctionInfo[] memory authorizatedFunctions) {
|
173
|
-
return _authorizedFunctions[target][roleId];
|
174
|
-
}
|
175
|
-
|
176
|
-
function getRelease() public virtual pure returns(VersionPart release) {
|
177
|
-
return VersionPartLib.toVersionPart(GIF_RELEASE);
|
178
|
-
}
|
179
|
-
|
180
93
|
/// @dev Sets up the relevant service targets for the component.
|
181
94
|
/// Overwrite this function for use case specific authorizations.
|
95
|
+
// solhint-disable-next-line no-empty-blocks
|
182
96
|
function _setupServiceTargets() internal virtual { }
|
183
97
|
|
184
98
|
/// @dev Sets up the relevant (non-service) targets for the component.
|
185
99
|
/// Overwrite this function for use case specific authorizations.
|
100
|
+
// solhint-disable-next-line no-empty-blocks
|
186
101
|
function _setupTargets() internal virtual { }
|
187
102
|
|
188
103
|
/// @dev Sets up the relevant roles for the component.
|
189
104
|
/// Overwrite this function for use case specific authorizations.
|
105
|
+
// solhint-disable-next-line no-empty-blocks
|
190
106
|
function _setupRoles() internal virtual {}
|
191
107
|
|
192
108
|
/// @dev Sets up the relevant component's token handler authorizations.
|
193
109
|
/// Overwrite this function for use case specific authorizations.
|
110
|
+
// solhint-disable-next-line no-empty-blocks
|
194
111
|
function _setupTokenHandlerAuthorizations() internal virtual {}
|
195
112
|
|
196
113
|
/// @dev Sets up the relevant target authorizations for the component.
|
197
114
|
/// Overwrite this function for use case specific authorizations.
|
115
|
+
// solhint-disable-next-line no-empty-blocks
|
198
116
|
function _setupTargetAuthorizations() internal virtual {}
|
199
117
|
|
200
|
-
function _addGifContractTarget(string memory contractName) internal {
|
201
|
-
|
202
|
-
RoleId contractRoleId = RoleIdLib.toRoleId(_nextGifContractRoleId++);
|
203
|
-
string memory contractRoleName = string(
|
204
|
-
abi.encodePacked(
|
205
|
-
contractName,
|
206
|
-
ROLE_NAME_SUFFIX));
|
207
|
-
|
208
|
-
_addTargetWithRole(
|
209
|
-
contractName,
|
210
|
-
contractRoleId,
|
211
|
-
contractRoleName);
|
212
|
-
}
|
213
|
-
|
214
|
-
/// @dev Add the service target role for the specified service domain
|
215
|
-
function _addServiceTargetWithRole(ObjectType serviceDomain) internal {
|
216
|
-
// add service domain
|
217
|
-
_serviceDomains.push(serviceDomain);
|
218
|
-
|
219
|
-
// get versioned target name
|
220
|
-
string memory serviceTargetName = ObjectTypeLib.toVersionedName(
|
221
|
-
ObjectTypeLib.toName(serviceDomain),
|
222
|
-
"Service",
|
223
|
-
getRelease());
|
224
|
-
|
225
|
-
_serviceTarget[serviceDomain] = StrLib.toStr(serviceTargetName);
|
226
|
-
|
227
|
-
RoleId serviceRoleId = getServiceRole(serviceDomain);
|
228
|
-
string memory serviceRoleName = ObjectTypeLib.toVersionedName(
|
229
|
-
ObjectTypeLib.toName(serviceDomain),
|
230
|
-
"ServiceRole",
|
231
|
-
getRelease());
|
232
|
-
|
233
|
-
_addTargetWithRole(
|
234
|
-
serviceTargetName,
|
235
|
-
serviceRoleId,
|
236
|
-
serviceRoleName);
|
237
|
-
}
|
238
|
-
|
239
|
-
|
240
|
-
/// @dev Use this method to to add an authorized role.
|
241
|
-
function _addRole(RoleId roleId, RoleInfo memory info) internal {
|
242
|
-
_roles.push(roleId);
|
243
|
-
_roleInfo[roleId] = info;
|
244
|
-
}
|
245
|
-
|
246
|
-
|
247
|
-
/// @dev Add a contract role for the provided role id and name.
|
248
|
-
function _addContractRole(RoleId roleId, string memory name) internal {
|
249
|
-
_addRole(
|
250
|
-
roleId,
|
251
|
-
_toRoleInfo(
|
252
|
-
ADMIN_ROLE(),
|
253
|
-
RoleType.Contract,
|
254
|
-
1,
|
255
|
-
name));
|
256
|
-
}
|
257
|
-
|
258
|
-
|
259
|
-
/// @dev Add the versioned service role for the specified service domain
|
260
|
-
function _addServiceRole(ObjectType serviceDomain) internal {
|
261
|
-
_addContractRole(
|
262
|
-
getServiceRole(serviceDomain),
|
263
|
-
ObjectTypeLib.toVersionedName(
|
264
|
-
ObjectTypeLib.toName(serviceDomain),
|
265
|
-
SERVICE_ROLE_NAME_SUFFIX,
|
266
|
-
getRelease()));
|
267
|
-
}
|
268
|
-
|
269
118
|
|
270
119
|
/// @dev Add a contract role for the provided role id and name.
|
271
120
|
function _addCustomRole(RoleId roleId, RoleId adminRoleId, uint32 maxMemberCount, string memory name) internal {
|
@@ -278,31 +127,18 @@ contract Authorization is
|
|
278
127
|
name));
|
279
128
|
}
|
280
129
|
|
130
|
+
/// @dev Add a gif target with its corresponding contract role
|
131
|
+
function _addGifTarget(string memory contractName) internal {
|
132
|
+
RoleId contractRoleId = RoleIdLib.toRoleId(_nextGifContractRoleId++);
|
133
|
+
string memory contractRoleName = string(
|
134
|
+
abi.encodePacked(
|
135
|
+
contractName,
|
136
|
+
ROLE_NAME_SUFFIX));
|
281
137
|
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
string memory roleName
|
287
|
-
)
|
288
|
-
internal
|
289
|
-
{
|
290
|
-
// add target
|
291
|
-
Str target = StrLib.toStr(targetName);
|
292
|
-
_targets.push(target);
|
293
|
-
|
294
|
-
_targetExists[target] = true;
|
295
|
-
|
296
|
-
// link role to target if defined
|
297
|
-
if (roleId != RoleIdLib.zero()) {
|
298
|
-
// add role if new
|
299
|
-
if (!roleExists(roleId)) {
|
300
|
-
_addContractRole(roleId, roleName);
|
301
|
-
}
|
302
|
-
|
303
|
-
// link target to role
|
304
|
-
_targetRole[target] = roleId;
|
305
|
-
}
|
138
|
+
_addTargetWithRole(
|
139
|
+
contractName,
|
140
|
+
contractRoleId,
|
141
|
+
contractRoleName);
|
306
142
|
}
|
307
143
|
|
308
144
|
|
@@ -312,54 +148,22 @@ contract Authorization is
|
|
312
148
|
}
|
313
149
|
|
314
150
|
|
315
|
-
/// @dev
|
316
|
-
function _authorizeForTarget(string memory target, RoleId authorizedRoleId)
|
317
|
-
internal
|
318
|
-
returns (IAccess.FunctionInfo[] storage authorizatedFunctions)
|
319
|
-
{
|
320
|
-
Str targetStr = StrLib.toStr(target);
|
321
|
-
_authorizedRoles[targetStr].push(authorizedRoleId);
|
322
|
-
return _authorizedFunctions[targetStr][authorizedRoleId];
|
323
|
-
}
|
324
|
-
|
325
|
-
|
326
|
-
/// @dev Use this method to authorize a specific function authorization
|
327
|
-
function _authorize(IAccess.FunctionInfo[] storage functions, bytes4 selector, string memory name) internal {
|
328
|
-
functions.push(
|
329
|
-
IAccess.FunctionInfo({
|
330
|
-
selector: SelectorLib.toSelector(selector),
|
331
|
-
name: StrLib.toStr(name),
|
332
|
-
createdAt: TimestampLib.blockTimestamp()}));
|
333
|
-
}
|
334
|
-
|
335
|
-
|
336
|
-
/// @dev role id for targets registry, staking and instance
|
151
|
+
/// @dev Role id for targets registry, staking and instance
|
337
152
|
function _toTargetRoleId(ObjectType targetDomain)
|
338
153
|
internal
|
339
154
|
pure
|
340
155
|
returns (RoleId targetRoleId)
|
341
156
|
{
|
342
|
-
return RoleIdLib.
|
157
|
+
return RoleIdLib.toRoleId(100 * targetDomain.toInt());
|
343
158
|
}
|
344
159
|
|
345
160
|
|
161
|
+
/// @dev Returns the role name for the specified target name
|
346
162
|
function _toTargetRoleName(string memory targetName) internal pure returns (string memory) {
|
347
163
|
return string(
|
348
164
|
abi.encodePacked(
|
349
165
|
targetName,
|
350
166
|
ROLE_NAME_SUFFIX));
|
351
167
|
}
|
352
|
-
|
353
|
-
|
354
|
-
/// @dev creates a role info object from the provided parameters
|
355
|
-
function _toRoleInfo(RoleId adminRoleId, RoleType roleType, uint32 maxMemberCount, string memory name) internal view returns (RoleInfo memory info) {
|
356
|
-
return RoleInfo({
|
357
|
-
name: StrLib.toStr(name),
|
358
|
-
adminRoleId: adminRoleId,
|
359
|
-
roleType: roleType,
|
360
|
-
maxMemberCount: maxMemberCount,
|
361
|
-
createdAt: TimestampLib.blockTimestamp(),
|
362
|
-
pausedAt: TimestampLib.max()});
|
363
|
-
}
|
364
168
|
}
|
365
169
|
|