@etherisc/gif-next 0.0.2-91b514c-961 → 0.0.2-9272c43-568
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 +1 -1
- package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +1 -1
- package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +34 -18
- package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +18 -10
- package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +267 -97
- package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.json +652 -36
- 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 +222 -47
- 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 +175 -27
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +85 -12
- 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 +23 -7
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +221 -60
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +203 -118
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +88 -44
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +29 -0
- 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 +20 -4
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +220 -59
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +34 -18
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +220 -59
- 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 +27 -11
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +220 -59
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +2 -2
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +24 -8
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +220 -59
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +24 -8
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +220 -59
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +310 -32
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +182 -0
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +322 -72
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +608 -295
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +242 -56
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +477 -289
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +208 -26
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +14 -14
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +68 -12
- package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +1 -1
- package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +2 -2
- 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 +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 +2 -2
- 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 +2 -2
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +234 -56
- 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/IOracleService.sol/IOracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +54 -38
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +28 -20
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +220 -59
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +122 -90
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +62 -30
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolLib.sol/PoolLib.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolLib.sol/PoolLib.json +104 -22
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +98 -66
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +50 -34
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +50 -58
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +26 -14
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +220 -59
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +92 -76
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +47 -39
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +94 -86
- package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.json +508 -18
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +48 -44
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +64 -72
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +33 -21
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +2 -2
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +2 -2
- 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/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- 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 +2 -2
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +378 -249
- package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.json +243 -68
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +18 -18
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +10 -10
- package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +384 -186
- 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 +128 -76
- 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 +2 -2
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +54 -54
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +28 -28
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +16 -45
- 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/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
- package/artifacts/contracts/shared/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 +2 -2
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +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/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +3 -3
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +22 -6
- package/artifacts/contracts/staking/StakingLib.sol/StakingLib.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingLib.sol/StakingLib.json +2 -2
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +12 -4
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +2 -2
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +31 -15
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +15 -7
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2 -2
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +3 -3
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/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/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/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/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +2 -2
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
- package/contracts/accounting/AccountingService.sol +2 -3
- package/contracts/authorization/AccessAdmin.sol +261 -185
- package/contracts/authorization/AccessAdminLib.sol +220 -7
- package/contracts/authorization/Authorization.sol +38 -229
- package/contracts/authorization/IAccess.sol +14 -4
- package/contracts/authorization/IAccessAdmin.sol +19 -45
- package/contracts/authorization/IAuthorization.sol +3 -56
- package/contracts/authorization/IServiceAuthorization.sol +55 -17
- package/contracts/authorization/ServiceAuthorization.sol +247 -33
- package/contracts/distribution/BasicDistributionAuthorization.sol +11 -4
- package/contracts/distribution/Distribution.sol +2 -1
- package/contracts/distribution/DistributionService.sol +76 -28
- package/contracts/distribution/IDistributionComponent.sol +3 -1
- package/contracts/distribution/IDistributionService.sol +10 -4
- package/contracts/instance/IInstance.sol +43 -4
- package/contracts/instance/IInstanceService.sol +28 -3
- package/contracts/instance/Instance.sol +80 -39
- package/contracts/instance/InstanceAdmin.sol +162 -229
- package/contracts/instance/InstanceAuthorizationV3.sol +58 -28
- package/contracts/instance/InstanceReader.sol +371 -389
- package/contracts/instance/InstanceService.sol +105 -53
- package/contracts/instance/base/BalanceStore.sol +3 -5
- package/contracts/oracle/BasicOracleAuthorization.sol +18 -2
- package/contracts/oracle/OracleService.sol +4 -4
- package/contracts/pool/BasicPoolAuthorization.sol +9 -3
- package/contracts/pool/BundleService.sol +9 -10
- package/contracts/pool/PoolLib.sol +138 -1
- package/contracts/pool/PoolService.sol +13 -186
- package/contracts/product/ApplicationService.sol +30 -5
- package/contracts/product/BasicProductAuthorization.sol +9 -4
- package/contracts/product/ClaimService.sol +19 -20
- package/contracts/product/IPolicyService.sol +0 -1
- package/contracts/product/PolicyService.sol +18 -45
- package/contracts/product/PolicyServiceLib.sol +75 -1
- package/contracts/product/PricingService.sol +22 -25
- package/contracts/registry/RegistryAdmin.sol +27 -97
- package/contracts/registry/RegistryAuthorization.sol +35 -25
- package/contracts/registry/ReleaseAdmin.sol +42 -100
- package/contracts/registry/ReleaseRegistry.sol +12 -9
- package/contracts/registry/ServiceAuthorizationV3.sol +33 -20
- package/contracts/registry/TokenRegistry.sol +2 -4
- package/contracts/shared/ComponentService.sol +29 -5
- package/contracts/shared/ContractLib.sol +9 -45
- package/contracts/shared/IRegisterable.sol +0 -1
- package/contracts/shared/NftOwnable.sol +1 -1
- package/contracts/shared/PolicyHolder.sol +3 -2
- package/contracts/shared/Service.sol +6 -4
- package/contracts/staking/IStakingService.sol +3 -0
- package/contracts/staking/Staking.sol +4 -5
- package/contracts/staking/StakingService.sol +3 -0
- package/contracts/staking/TargetManagerLib.sol +1 -1
- package/contracts/type/ObjectType.sol +16 -3
- package/contracts/type/RoleId.sol +57 -59
- package/contracts/type/String.sol +12 -0
- package/contracts/upgradeability/ProxyManager.sol +2 -2
- package/contracts/upgradeability/Versionable.sol +4 -1
- 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/contracts/shared/ComponentVerifyingService.sol +0 -128
@@ -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)
|
@@ -169,11 +370,23 @@ library AccessAdminLib { // ACCESS_ADMIN_LIB
|
|
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),
|
@@ -4,75 +4,49 @@ pragma solidity ^0.8.20;
|
|
4
4
|
import {IAccess} from "./IAccess.sol";
|
5
5
|
import {IAuthorization} from "./IAuthorization.sol";
|
6
6
|
|
7
|
-
import {
|
7
|
+
import {ADMIN_ROLE_NAME, PUBLIC_ROLE_NAME} from "./AccessAdmin.sol";
|
8
8
|
import {ObjectType, ObjectTypeLib} from "../type/ObjectType.sol";
|
9
|
-
import {RoleId, RoleIdLib, ADMIN_ROLE} from "../type/RoleId.sol";
|
9
|
+
import {RoleId, RoleIdLib, ADMIN_ROLE, PUBLIC_ROLE} from "../type/RoleId.sol";
|
10
10
|
import {SelectorLib} from "../type/Selector.sol";
|
11
|
+
import {ServiceAuthorization} from "../authorization/ServiceAuthorization.sol";
|
11
12
|
import {Str, StrLib} from "../type/String.sol";
|
12
13
|
import {TimestampLib} from "../type/Timestamp.sol";
|
13
14
|
import {VersionPart, VersionPartLib} from "../type/Version.sol";
|
14
15
|
|
16
|
+
|
15
17
|
contract Authorization is
|
16
|
-
|
18
|
+
ServiceAuthorization,
|
17
19
|
IAuthorization
|
18
20
|
{
|
19
|
-
uint256 public constant GIF_RELEASE = 3;
|
20
21
|
|
21
|
-
|
22
|
-
|
22
|
+
// MUST match with AccessAdminLib.COMPONENT_ROLE_MIN
|
23
|
+
uint64 public constant COMPONENT_ROLE_MIN = 110000;
|
23
24
|
|
24
25
|
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
26
|
|
31
|
-
|
32
|
-
Str internal _mainTarget;
|
27
|
+
string internal _tokenHandlerName = "ComponentTh";
|
33
28
|
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
29
|
|
45
30
|
|
46
31
|
constructor(
|
47
32
|
string memory mainTargetName,
|
48
|
-
ObjectType
|
33
|
+
ObjectType domain,
|
34
|
+
uint8 release,
|
35
|
+
string memory commitHash,
|
49
36
|
bool isComponent,
|
50
37
|
bool includeTokenHandler
|
51
38
|
)
|
39
|
+
ServiceAuthorization(mainTargetName, domain, release, commitHash)
|
52
40
|
{
|
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
41
|
_nextGifContractRoleId = 10;
|
69
42
|
|
43
|
+
// setup main target
|
70
44
|
if (isComponent) {
|
71
|
-
if (
|
45
|
+
if (domain.eqz()) {
|
72
46
|
revert ErrorAuthorizationTargetDomainZero();
|
73
47
|
}
|
74
48
|
|
75
|
-
RoleId mainRoleId = RoleIdLib.
|
49
|
+
RoleId mainRoleId = RoleIdLib.toRoleId(COMPONENT_ROLE_MIN);
|
76
50
|
string memory mainRolName = _toTargetRoleName(_mainTargetName);
|
77
51
|
|
78
52
|
_addTargetWithRole(
|
@@ -80,8 +54,9 @@ contract Authorization is
|
|
80
54
|
mainRoleId,
|
81
55
|
mainRolName);
|
82
56
|
} else {
|
83
|
-
|
57
|
+
_addGifTarget(_mainTargetName);
|
84
58
|
}
|
59
|
+
|
85
60
|
// setup use case specific parts
|
86
61
|
_setupServiceTargets();
|
87
62
|
_setupRoles(); // not including main target role
|
@@ -90,7 +65,7 @@ contract Authorization is
|
|
90
65
|
|
91
66
|
// setup component token handler
|
92
67
|
if (includeTokenHandler) {
|
93
|
-
_tokenHandlerName = string(abi.encodePacked(mainTargetName, "
|
68
|
+
_tokenHandlerName = string(abi.encodePacked(mainTargetName, "Th"));
|
94
69
|
_tokenHandlerTarget = StrLib.toStr(_tokenHandlerName);
|
95
70
|
_addTarget(_tokenHandlerName);
|
96
71
|
_setupTokenHandlerAuthorizations();
|
@@ -99,47 +74,6 @@ contract Authorization is
|
|
99
74
|
_registerInterfaceNotInitializing(type(IAuthorization).interfaceId);
|
100
75
|
}
|
101
76
|
|
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
77
|
|
144
78
|
function getTokenHandlerName() public view returns(string memory) {
|
145
79
|
return _tokenHandlerName;
|
@@ -149,7 +83,7 @@ contract Authorization is
|
|
149
83
|
return _tokenHandlerTarget;
|
150
84
|
}
|
151
85
|
|
152
|
-
function getTarget(string memory targetName) public
|
86
|
+
function getTarget(string memory targetName) public pure returns(Str target) {
|
153
87
|
return StrLib.toStr(targetName);
|
154
88
|
}
|
155
89
|
|
@@ -161,111 +95,31 @@ contract Authorization is
|
|
161
95
|
return target == _mainTarget || _targetExists[target];
|
162
96
|
}
|
163
97
|
|
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
98
|
/// @dev Sets up the relevant service targets for the component.
|
181
99
|
/// Overwrite this function for use case specific authorizations.
|
100
|
+
// solhint-disable-next-line no-empty-blocks
|
182
101
|
function _setupServiceTargets() internal virtual { }
|
183
102
|
|
184
103
|
/// @dev Sets up the relevant (non-service) targets for the component.
|
185
104
|
/// Overwrite this function for use case specific authorizations.
|
105
|
+
// solhint-disable-next-line no-empty-blocks
|
186
106
|
function _setupTargets() internal virtual { }
|
187
107
|
|
188
108
|
/// @dev Sets up the relevant roles for the component.
|
189
109
|
/// Overwrite this function for use case specific authorizations.
|
110
|
+
// solhint-disable-next-line no-empty-blocks
|
190
111
|
function _setupRoles() internal virtual {}
|
191
112
|
|
192
113
|
/// @dev Sets up the relevant component's token handler authorizations.
|
193
114
|
/// Overwrite this function for use case specific authorizations.
|
115
|
+
// solhint-disable-next-line no-empty-blocks
|
194
116
|
function _setupTokenHandlerAuthorizations() internal virtual {}
|
195
117
|
|
196
118
|
/// @dev Sets up the relevant target authorizations for the component.
|
197
119
|
/// Overwrite this function for use case specific authorizations.
|
120
|
+
// solhint-disable-next-line no-empty-blocks
|
198
121
|
function _setupTargetAuthorizations() internal virtual {}
|
199
122
|
|
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
123
|
|
270
124
|
/// @dev Add a contract role for the provided role id and name.
|
271
125
|
function _addCustomRole(RoleId roleId, RoleId adminRoleId, uint32 maxMemberCount, string memory name) internal {
|
@@ -278,31 +132,18 @@ contract Authorization is
|
|
278
132
|
name));
|
279
133
|
}
|
280
134
|
|
135
|
+
/// @dev Add a gif target with its corresponding contract role
|
136
|
+
function _addGifTarget(string memory contractName) internal {
|
137
|
+
RoleId contractRoleId = RoleIdLib.toRoleId(_nextGifContractRoleId++);
|
138
|
+
string memory contractRoleName = string(
|
139
|
+
abi.encodePacked(
|
140
|
+
contractName,
|
141
|
+
ROLE_NAME_SUFFIX));
|
281
142
|
|
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
|
-
}
|
143
|
+
_addTargetWithRole(
|
144
|
+
contractName,
|
145
|
+
contractRoleId,
|
146
|
+
contractRoleName);
|
306
147
|
}
|
307
148
|
|
308
149
|
|
@@ -312,54 +153,22 @@ contract Authorization is
|
|
312
153
|
}
|
313
154
|
|
314
155
|
|
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
|
156
|
+
/// @dev Role id for targets registry, staking and instance
|
337
157
|
function _toTargetRoleId(ObjectType targetDomain)
|
338
158
|
internal
|
339
159
|
pure
|
340
160
|
returns (RoleId targetRoleId)
|
341
161
|
{
|
342
|
-
return RoleIdLib.
|
162
|
+
return RoleIdLib.toRoleId(100 * targetDomain.toInt());
|
343
163
|
}
|
344
164
|
|
345
165
|
|
166
|
+
/// @dev Returns the role name for the specified target name
|
346
167
|
function _toTargetRoleName(string memory targetName) internal pure returns (string memory) {
|
347
168
|
return string(
|
348
169
|
abi.encodePacked(
|
349
170
|
targetName,
|
350
171
|
ROLE_NAME_SUFFIX));
|
351
172
|
}
|
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
173
|
}
|
365
174
|
|