@etherisc/gif-next 0.0.2-d16f92c-416 → 0.0.2-d1ee1ae-450
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +120 -8
- package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +4 -0
- package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +1023 -0
- package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +752 -0
- package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +4 -0
- package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.json +791 -0
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +4 -0
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +1494 -0
- package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.dbg.json +4 -0
- package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.json +24 -0
- package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.dbg.json +4 -0
- package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.json +673 -0
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +4 -0
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +1403 -0
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +615 -0
- package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +4 -0
- package/artifacts/contracts/authorization/IAccess.sol/IAccess.json +10 -0
- package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +4 -0
- package/artifacts/contracts/{shared → authorization}/IAccessAdmin.sol/IAccessAdmin.json +404 -369
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +382 -0
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +4 -0
- package/artifacts/contracts/{registry → authorization}/IServiceAuthorization.sol/IServiceAuthorization.json +48 -10
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +253 -0
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +4 -0
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +1225 -0
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +4 -0
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +644 -0
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +119 -605
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +487 -269
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +169 -119
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +133 -279
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +311 -67
- package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.json +22 -0
- package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +1461 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +644 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +2018 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +644 -0
- package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.json +376 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +1404 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +644 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +1152 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +1628 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +644 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +2405 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +644 -0
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +4 -0
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +851 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +239 -55
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +155 -116
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +254 -182
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +1581 -253
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +716 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1153 -396
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +175 -341
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +104 -128
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +940 -754
- package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +4 -0
- package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +853 -0
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
- package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +223 -0
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +192 -0
- package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.json +168 -0
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +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/mock/Dip.sol/Dip.json +2 -2
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +4 -0
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +938 -0
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +4 -0
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +632 -0
- package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracle.sol/IOracle.json +43 -1
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +130 -136
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +69 -11
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +121 -413
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +169 -190
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +140 -98
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +4 -0
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +1231 -0
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +644 -0
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +349 -206
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +159 -105
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +212 -35
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +128 -396
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +460 -308
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +125 -684
- package/artifacts/contracts/pool/PoolLib.sol/PoolLib.dbg.json +4 -0
- package/artifacts/contracts/pool/PoolLib.sol/PoolLib.json +472 -0
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +705 -552
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +189 -107
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +208 -176
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +118 -100
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +4 -0
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +1140 -0
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +644 -0
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +431 -234
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +158 -124
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +136 -9
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +308 -16
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +365 -104
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +157 -83
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +270 -268
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +4 -0
- package/artifacts/contracts/product/{IProductService.sol/IProductService.json → IRiskService.sol/IRiskService.json} +88 -8
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +465 -307
- package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.dbg.json +4 -0
- package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.json +727 -0
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +155 -109
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +244 -329
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +126 -140
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +268 -567
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +4 -0
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +688 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +736 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +59 -16
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +367 -63
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +72 -152
- package/artifacts/contracts/registry/IRelease.sol/IRelease.dbg.json +4 -0
- package/artifacts/contracts/registry/IRelease.sol/IRelease.json +24 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +5 -18
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +600 -127
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +666 -549
- package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.json +878 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +109 -292
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +104 -90
- package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +1954 -0
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +205 -0
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +1337 -0
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +101 -16
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +15 -15
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/shared/Component.sol/Component.json +67 -277
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +545 -569
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +152 -132
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +57 -111
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +661 -0
- package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.json +24 -0
- package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.json +30 -0
- package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.json +40 -0
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponent.sol/IComponent.json +80 -100
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +499 -252
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +116 -133
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.json +45 -3
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.json +34 -3
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +16 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +15 -47
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +148 -0
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +55 -2
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +4 -0
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +53 -0
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +106 -366
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +55 -88
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +42 -62
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +4 -0
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +306 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +22 -57
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +19 -141
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +122 -97
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +57 -111
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +585 -12
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +484 -0
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +172 -0
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +196 -143
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +155 -23
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +292 -393
- package/artifacts/contracts/staking/StakingLib.sol/StakingLib.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingLib.sol/StakingLib.json +469 -0
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +205 -0
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +142 -103
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +41 -73
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +224 -171
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +121 -95
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +218 -182
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +94 -48
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.json +2 -2
- package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.json +63 -10
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.json +2 -2
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +28 -4
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +4 -4
- package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/type/Fee.sol/FeeLib.json +98 -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 +4 -0
- package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +33 -0
- package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/NftId.sol/NftIdLib.json +23 -4
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +59 -4
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +19 -19
- package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/type/Referral.sol/ReferralLib.json +4 -4
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +4 -4
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +125 -7
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +181 -14
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +50 -2
- package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
- package/artifacts/contracts/type/Selector.sol/SelectorLib.json +21 -2
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.json +2 -2
- package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/StateId.sol/StateIdLib.json +15 -2
- package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
- package/artifacts/contracts/type/String.sol/StrLib.json +2 -2
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +23 -4
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +126 -33
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -21
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionPartLib.json +120 -2
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +4 -0
- package/artifacts/contracts/{shared → upgradeability}/IVersionable.sol/IVersionable.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +4 -0
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +618 -0
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +142 -0
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +4 -0
- package/artifacts/contracts/{shared → upgradeability}/Versionable.sol/Versionable.json +1 -1
- package/contracts/accounting/AccountingService.sol +261 -0
- package/contracts/accounting/AccountingServiceManager.sol +38 -0
- package/contracts/accounting/IAccountingService.sol +45 -0
- package/contracts/authorization/AccessAdmin.sol +704 -0
- package/contracts/authorization/AccessAdminLib.sol +183 -0
- package/contracts/authorization/AccessManagerCloneable.sol +158 -0
- package/contracts/authorization/Authorization.sol +365 -0
- package/contracts/authorization/IAccess.sol +57 -0
- package/contracts/authorization/IAccessAdmin.sol +170 -0
- package/contracts/authorization/IAuthorization.sol +80 -0
- package/contracts/{registry → authorization}/IServiceAuthorization.sol +11 -6
- package/contracts/{registry → authorization}/ServiceAuthorization.sol +45 -25
- package/contracts/distribution/BasicDistribution.sol +141 -0
- package/contracts/distribution/BasicDistributionAuthorization.sol +60 -0
- package/contracts/distribution/Distribution.sol +124 -139
- package/contracts/distribution/DistributionService.sol +220 -126
- package/contracts/distribution/DistributionServiceManager.sol +8 -11
- package/contracts/distribution/IDistributionComponent.sol +19 -42
- package/contracts/distribution/IDistributionService.sol +44 -22
- package/contracts/examples/fire/DamageLevel.sol +59 -0
- package/contracts/examples/fire/FirePool.sol +86 -0
- package/contracts/examples/fire/FirePoolAuthorization.sol +35 -0
- package/contracts/examples/fire/FireProduct.sol +433 -0
- package/contracts/examples/fire/FireProductAuthorization.sol +45 -0
- package/contracts/examples/fire/FireUSD.sol +26 -0
- package/contracts/examples/unpermissioned/SimpleDistribution.sol +81 -0
- package/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol +28 -0
- package/contracts/examples/unpermissioned/SimpleOracle.sol +133 -0
- package/contracts/examples/unpermissioned/SimplePool.sol +102 -0
- package/contracts/examples/unpermissioned/SimplePoolAuthorization.sol +28 -0
- package/contracts/examples/unpermissioned/SimpleProduct.sol +373 -0
- package/contracts/examples/unpermissioned/SimpleProductAuthorization.sol +28 -0
- package/contracts/instance/BundleSet.sol +130 -0
- package/contracts/instance/IInstance.sol +68 -49
- package/contracts/instance/IInstanceService.sol +34 -43
- package/contracts/instance/Instance.sol +164 -122
- package/contracts/instance/InstanceAdmin.sol +363 -244
- package/contracts/instance/InstanceAuthorizationV3.sol +236 -0
- package/contracts/instance/InstanceReader.sol +306 -48
- package/contracts/instance/InstanceService.sol +223 -200
- package/contracts/instance/InstanceServiceManager.sol +8 -13
- package/contracts/instance/InstanceStore.sol +35 -6
- package/contracts/instance/RiskSet.sol +118 -0
- package/contracts/instance/base/BalanceStore.sol +3 -5
- package/contracts/instance/base/ObjectCounter.sol +1 -2
- package/contracts/instance/base/ObjectLifecycle.sol +113 -0
- package/contracts/instance/base/ObjectSet.sol +77 -0
- package/contracts/instance/base/ObjectSetHelperLib.sol +30 -0
- package/contracts/instance/module/IBundle.sol +6 -5
- package/contracts/instance/module/IComponents.sol +30 -20
- package/contracts/instance/module/IDistribution.sol +21 -9
- package/contracts/instance/module/IPolicy.sol +50 -29
- package/contracts/instance/module/IRisk.sol +5 -0
- package/contracts/mock/Dip.sol +1 -1
- package/contracts/oracle/BasicOracle.sol +45 -0
- package/contracts/oracle/BasicOracleAuthorization.sol +37 -0
- package/contracts/oracle/IOracle.sol +25 -4
- package/contracts/oracle/IOracleComponent.sol +2 -1
- package/contracts/oracle/IOracleService.sol +2 -1
- package/contracts/oracle/Oracle.sol +62 -53
- package/contracts/oracle/OracleService.sol +117 -85
- package/contracts/oracle/OracleServiceManager.sol +8 -11
- package/contracts/pool/BasicPool.sol +173 -0
- package/contracts/pool/BasicPoolAuthorization.sol +76 -0
- package/contracts/pool/BundleService.sol +204 -105
- package/contracts/pool/BundleServiceManager.sol +8 -11
- package/contracts/pool/IBundleService.sol +31 -22
- package/contracts/pool/IPoolComponent.sol +20 -70
- package/contracts/pool/IPoolService.sol +90 -75
- package/contracts/pool/Pool.sol +207 -163
- package/contracts/pool/PoolLib.sol +309 -0
- package/contracts/pool/PoolService.sol +391 -256
- package/contracts/pool/PoolServiceManager.sol +6 -9
- package/contracts/product/ApplicationService.sol +102 -78
- package/contracts/product/ApplicationServiceManager.sol +6 -6
- package/contracts/product/BasicProduct.sol +49 -0
- package/contracts/product/BasicProductAuthorization.sol +58 -0
- package/contracts/product/ClaimService.sol +373 -175
- package/contracts/product/ClaimServiceManager.sol +6 -6
- package/contracts/product/IApplicationService.sol +9 -2
- package/contracts/product/IClaimService.sol +44 -8
- package/contracts/product/IPolicyService.sol +53 -36
- package/contracts/product/IPricingService.sol +11 -10
- package/contracts/product/IProductComponent.sol +29 -9
- package/contracts/product/{IProductService.sol → IRiskService.sol} +8 -8
- package/contracts/product/PolicyService.sol +436 -271
- package/contracts/product/PolicyServiceLib.sol +119 -0
- package/contracts/product/PolicyServiceManager.sol +6 -9
- package/contracts/product/PricingService.sol +69 -60
- package/contracts/product/PricingServiceManager.sol +6 -9
- package/contracts/product/Product.sol +232 -140
- package/contracts/product/RiskService.sol +157 -0
- package/contracts/product/RiskServiceManager.sol +39 -0
- package/contracts/registry/ChainNft.sol +72 -40
- package/contracts/registry/IRegistry.sol +78 -32
- package/contracts/registry/IRegistryService.sol +3 -10
- package/contracts/registry/IRelease.sol +29 -0
- package/contracts/registry/ITransferInterceptor.sol +1 -2
- package/contracts/registry/Registry.sol +368 -220
- package/contracts/registry/RegistryAdmin.sol +174 -249
- package/contracts/registry/RegistryAuthorization.sol +271 -0
- package/contracts/registry/RegistryService.sol +41 -66
- package/contracts/registry/RegistryServiceManager.sol +5 -5
- package/contracts/registry/ReleaseAdmin.sol +253 -0
- package/contracts/registry/ReleaseLifecycle.sol +32 -0
- package/contracts/registry/ReleaseRegistry.sol +517 -0
- package/contracts/registry/ServiceAuthorizationV3.sol +192 -60
- package/contracts/registry/TokenRegistry.sol +12 -11
- package/contracts/shared/Component.sol +65 -136
- package/contracts/shared/ComponentService.sol +425 -381
- package/contracts/shared/ComponentServiceManager.sol +10 -7
- package/contracts/shared/ComponentVerifyingService.sol +29 -18
- package/contracts/shared/ContractLib.sol +347 -0
- package/contracts/shared/IComponent.sol +5 -17
- package/contracts/shared/IComponentService.sol +49 -41
- package/contracts/shared/IInstanceLinkedComponent.sol +10 -26
- package/contracts/shared/IKeyValueStore.sol +1 -0
- package/contracts/shared/ILifecycle.sol +3 -2
- package/contracts/shared/INftOwnable.sol +2 -0
- package/contracts/shared/IPolicyHolder.sol +12 -22
- package/contracts/shared/IRegisterable.sol +23 -1
- package/contracts/shared/IService.sol +4 -6
- package/contracts/shared/{ERC165.sol → InitializableERC165.sol} +11 -3
- package/contracts/shared/InstanceLinkedComponent.sol +95 -45
- package/contracts/shared/KeyValueStore.sol +7 -3
- package/contracts/shared/Lifecycle.sol +30 -72
- package/contracts/shared/{NftIdSetManager.sol → NftIdSet.sol} +1 -1
- package/contracts/shared/NftOwnable.sol +31 -11
- package/contracts/shared/PolicyHolder.sol +17 -57
- package/contracts/shared/Registerable.sol +52 -21
- package/contracts/shared/RegistryLinked.sol +9 -14
- package/contracts/shared/Service.sol +18 -36
- package/contracts/shared/TokenHandler.sol +310 -26
- package/contracts/shared/TokenHandlerDeployerLib.sol +20 -0
- package/contracts/staking/IStaking.sol +26 -15
- package/contracts/staking/IStakingService.sol +31 -9
- package/contracts/staking/Staking.sol +125 -88
- package/contracts/staking/{StakeManagerLib.sol → StakingLib.sol} +95 -45
- package/contracts/staking/StakingLifecycle.sol +23 -0
- package/contracts/staking/StakingManager.sol +10 -12
- package/contracts/staking/StakingReader.sol +26 -33
- package/contracts/staking/StakingService.sol +93 -37
- package/contracts/staking/StakingServiceManager.sol +8 -7
- package/contracts/staking/StakingStore.sol +17 -24
- package/contracts/staking/TargetManagerLib.sol +7 -3
- package/contracts/type/Amount.sol +27 -5
- package/contracts/type/Blocknumber.sol +7 -1
- package/contracts/type/ClaimId.sol +6 -1
- package/contracts/type/Fee.sol +8 -8
- package/contracts/type/Key32.sol +2 -2
- package/contracts/type/Key32Set.sol +62 -0
- package/contracts/type/NftId.sol +7 -0
- package/contracts/type/ObjectType.sol +80 -27
- package/contracts/type/PayoutId.sol +10 -10
- package/contracts/type/Referral.sol +1 -0
- package/contracts/type/RiskId.sol +38 -6
- package/contracts/type/RoleId.sol +75 -94
- package/contracts/type/Seconds.sol +21 -1
- package/contracts/type/Selector.sol +5 -0
- package/contracts/type/StateId.sol +15 -1
- package/contracts/type/Timestamp.sol +10 -5
- package/contracts/type/UFixed.sol +61 -125
- package/contracts/type/Version.sol +57 -6
- package/contracts/{shared → upgradeability}/ProxyManager.sol +82 -47
- package/contracts/{shared → upgradeability}/UpgradableProxyWithAdmin.sol +8 -4
- package/contracts/{shared → upgradeability}/Versionable.sol +2 -2
- package/package.json +9 -6
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +0 -4
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +0 -709
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +0 -4
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +0 -228
- package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.json +0 -187
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +0 -4
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +0 -129
- package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +0 -4
- package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +0 -4
- package/artifacts/contracts/product/ProductService.sol/ProductService.json +0 -708
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +0 -4
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +0 -702
- package/artifacts/contracts/registry/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +0 -4
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +0 -4
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +0 -1218
- package/artifacts/contracts/registry/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +0 -4
- package/artifacts/contracts/registry/ServiceAuthorization.sol/ServiceAuthorization.json +0 -171
- package/artifacts/contracts/shared/AccessAdmin.sol/AccessAdmin.dbg.json +0 -4
- package/artifacts/contracts/shared/AccessAdmin.sol/AccessAdmin.json +0 -1559
- package/artifacts/contracts/shared/AccessManagerCustom.sol/AccessManagerCustom.dbg.json +0 -4
- package/artifacts/contracts/shared/AccessManagerCustom.sol/AccessManagerCustom.json +0 -1193
- package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.dbg.json +0 -4
- package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.json +0 -1747
- package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.dbg.json +0 -4
- package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.json +0 -1760
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.dbg.json +0 -4
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.json +0 -1838
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.dbg.json +0 -4
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.json +0 -1856
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +0 -4
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +0 -73
- package/artifacts/contracts/shared/IAccessAdmin.sol/IAccessAdmin.dbg.json +0 -4
- package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.dbg.json +0 -4
- package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.json +0 -1562
- package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.dbg.json +0 -4
- package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.json +0 -1600
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +0 -4
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +0 -4
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.json +0 -39
- package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.dbg.json +0 -4
- package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.json +0 -306
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +0 -4
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +0 -617
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +0 -4
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +0 -129
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +0 -4
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +0 -4
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +0 -460
- package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +0 -4
- package/artifacts/contracts/type/UFixed.sol/MathLib.json +0 -10
- package/contracts/instance/BundleManager.sol +0 -126
- package/contracts/instance/InstanceAuthorizationsLib.sol +0 -377
- package/contracts/instance/base/ObjectManager.sol +0 -80
- package/contracts/instance/module/IAccess.sol +0 -46
- package/contracts/product/ProductService.sol +0 -124
- package/contracts/product/ProductServiceManager.sol +0 -42
- package/contracts/registry/ReleaseManager.sol +0 -527
- package/contracts/shared/AccessAdmin.sol +0 -759
- package/contracts/shared/AccessManagerCustom.sol +0 -741
- package/contracts/shared/AccessManagerExtended.sol +0 -481
- package/contracts/shared/AccessManagerExtendedInitializeable.sol +0 -13
- package/contracts/shared/AccessManagerExtendedWithDisable.sol +0 -137
- package/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol +0 -14
- package/contracts/shared/IAccessAdmin.sol +0 -168
- package/contracts/shared/IAccessManagerExtended.sol +0 -74
- package/contracts/shared/IAccessManagerExtendedWithDisable.sol +0 -18
- package/contracts/shared/InitializableCustom.sol +0 -177
- /package/contracts/{shared → upgradeability}/IVersionable.sol +0 -0
@@ -11,14 +11,26 @@ type RoleId is uint64;
|
|
11
11
|
using {
|
12
12
|
eqRoleId as ==,
|
13
13
|
neRoleId as !=,
|
14
|
+
RoleIdLib.toInt,
|
14
15
|
RoleIdLib.eqz,
|
15
16
|
RoleIdLib.gtz,
|
16
|
-
RoleIdLib.
|
17
|
+
RoleIdLib.isComponentRole,
|
18
|
+
RoleIdLib.isCustomRole
|
17
19
|
// RoleIdLib.toKey32
|
18
20
|
} for RoleId global;
|
19
21
|
|
20
22
|
// general pure free functions
|
21
23
|
|
24
|
+
// @dev Returns true iff role ids a and b are identical
|
25
|
+
function eqRoleId(RoleId a, RoleId b) pure returns (bool isSame) {
|
26
|
+
return RoleId.unwrap(a) == RoleId.unwrap(b);
|
27
|
+
}
|
28
|
+
|
29
|
+
// @dev Returns true iff role ids a and b are different
|
30
|
+
function neRoleId(RoleId a, RoleId b) pure returns (bool isDifferent) {
|
31
|
+
return RoleId.unwrap(a) != RoleId.unwrap(b);
|
32
|
+
}
|
33
|
+
|
22
34
|
//--- OpenZeppelin provided roles -------------------------------------------//
|
23
35
|
|
24
36
|
/// @dev Role ID needs to match with oz AccessManager.ADMIN_ROLE
|
@@ -27,156 +39,114 @@ function ADMIN_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(type(uin
|
|
27
39
|
/// @dev Role ID needs to match with oz AccessManager.PUBLIC_ROLE
|
28
40
|
function PUBLIC_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(type(uint64).max); }
|
29
41
|
|
30
|
-
|
31
|
-
function MANAGER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(1); }
|
32
|
-
|
33
|
-
//--- Core GIF roles (range: 1-99) ------------------------------------------//
|
42
|
+
//--- GIF roles (range: 1-99) ----------------------------------------------//
|
34
43
|
|
35
44
|
/// @dev cental role for gif release management.
|
36
45
|
/// this role is necessary to call ReleaseManager.createNextRelease/activateNextRelease
|
37
46
|
/// the actual deployment of a release requires the GIF_MANAGER_ROLE.
|
38
47
|
/// GIF_ADMIN_ROLE is the admin of the GIF_MANAGER_ROLE.
|
39
48
|
/// only a single holder may hold this role at any time
|
40
|
-
function GIF_ADMIN_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(
|
49
|
+
function GIF_ADMIN_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(1); }
|
41
50
|
|
42
51
|
/// @dev role for token whith/blacklisting, deploying and registering the services for a new major release
|
43
52
|
/// registering services for a new major release is only possible after a new initial release has been created by the GIF_ADMIN_ROLE
|
44
53
|
/// token white/blacklisting is possible for any active release
|
45
|
-
function GIF_MANAGER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(
|
54
|
+
function GIF_MANAGER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2); }
|
46
55
|
|
47
56
|
/// @dev role for registering remote staking targets and reporting remote total value locked amounts.
|
48
|
-
function GIF_REMOTE_MANAGER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(
|
49
|
-
|
50
|
-
/// @dev required role to own an instance.
|
51
|
-
/// Role is granted by instance service when cloning a new instance.
|
52
|
-
/// allows instance specific target, role and access management
|
53
|
-
function INSTANCE_OWNER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(10); }
|
54
|
-
|
55
|
-
/// @dev instance specific role to register/own a product component
|
56
|
-
function PRODUCT_OWNER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(11); }
|
57
|
+
function GIF_REMOTE_MANAGER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(3); }
|
57
58
|
|
58
|
-
/// @dev
|
59
|
-
function
|
59
|
+
/// @dev role assigned to release registry, release specfic to lock/unlock a release
|
60
|
+
function RELEASE_REGISTRY_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(4); }
|
60
61
|
|
61
|
-
|
62
|
-
function DISTRIBUTION_OWNER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(13); }
|
63
|
-
|
64
|
-
/// @dev instance specific role to register/own a pool component
|
65
|
-
function POOL_OWNER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(14); }
|
66
|
-
|
67
|
-
//--- GIF contract roles (range: 200 - 9900) --------------------------------//
|
62
|
+
//--- GIF core contract roles (range: 200 - 9'900) --------------------------//
|
68
63
|
// created and assigned during initial deployment for registry and staking
|
69
64
|
// granting for instances and components in instance service
|
70
65
|
// object type * 100 + 0, examples:
|
71
66
|
// - registry contract role: 200
|
72
67
|
// - staking contract role: 300
|
73
68
|
// - instance contract role: 1000
|
74
|
-
// - product contract role: 1200
|
75
69
|
|
76
|
-
//--- GIF service roles (range 201 -
|
70
|
+
//--- GIF service roles (range 201 - 9'9xx) ---------------------------------//
|
77
71
|
// created and assigned by release manager contract
|
78
72
|
// object type * 100 + 1/major version, examples:
|
79
|
-
// - registry service role (any version):
|
73
|
+
// - registry service role (any version): 299
|
80
74
|
// - registry service role (version 3): 203
|
81
|
-
// - registry service role (any version):
|
75
|
+
// - registry service role (any version): 399
|
82
76
|
// - staking service role: (version 3): 303
|
83
77
|
// - application service role (version 3): 2003
|
84
78
|
|
85
|
-
//---
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
function INSTANCE_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2000); }
|
99
|
-
|
100
|
-
/// @dev role for creating gif target on instance service
|
101
|
-
function CAN_CREATE_GIF_TARGET__ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(1700); }
|
102
|
-
|
103
|
-
/// @dev role for registering gif components
|
104
|
-
function COMPONENT_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2001); }
|
105
|
-
|
106
|
-
/// @dev instance specific role for distribution service
|
107
|
-
function DISTRIBUTION_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2100); }
|
108
|
-
|
109
|
-
/// @dev instance specific role for oracle service
|
110
|
-
function ORACLE_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2150); }
|
111
|
-
|
112
|
-
/// @dev instance specific role for pool service
|
113
|
-
function POOL_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2200); }
|
114
|
-
|
115
|
-
/// @dev instance specific role for product service
|
116
|
-
function PRODUCT_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2300); }
|
79
|
+
//--- GIF component contract roles (range 12'001 - 19'099) ------------------//
|
80
|
+
// the min value of 12'001 is based on the following calculation:
|
81
|
+
// object type * 1000 + 1 where the lowest object type is 12 (product)
|
82
|
+
// assigned at component registration time
|
83
|
+
// object type * 1000 + instane specific component counter
|
84
|
+
// on any instance a maximum number of 999 components may be deployed
|
85
|
+
// examples:
|
86
|
+
// - 1st pool on instance: 15001
|
87
|
+
// - 1st distribution on instance: 14002
|
88
|
+
// - 1st product on instance: 12003
|
89
|
+
// - 2nd pool on instance: 15004
|
90
|
+
// - 2nd distribution on instance: 14005
|
91
|
+
// - 2nd product on instance: 12006
|
117
92
|
|
118
|
-
/// @dev instance specific role for application service
|
119
|
-
function APPLICATION_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2400); }
|
120
93
|
|
121
|
-
|
122
|
-
function POLICY_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2410); }
|
94
|
+
//--- Custom roles (range >= 1'000'000) -------------------------------------//
|
123
95
|
|
124
|
-
|
125
|
-
function CLAIM_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2420); }
|
96
|
+
function CUSTOM_ROLE_MIN() pure returns (RoleId) { return RoleIdLib.toRoleId(1000000); }
|
126
97
|
|
127
|
-
|
128
|
-
function BUNDLE_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2500); }
|
129
|
-
|
130
|
-
/// @dev instance specific role for pricing service
|
131
|
-
function PRICING_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2800); }
|
132
|
-
|
133
|
-
/// @dev instance specific role for staking service
|
134
|
-
function STAKING_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2900); }
|
135
|
-
|
136
|
-
// @dev Returns true iff role ids a and b are identical
|
137
|
-
function eqRoleId(RoleId a, RoleId b) pure returns (bool isSame) {
|
138
|
-
return RoleId.unwrap(a) == RoleId.unwrap(b);
|
139
|
-
}
|
98
|
+
library RoleIdLib {
|
140
99
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
100
|
+
uint64 public constant ALL_VERSIONS = 99;
|
101
|
+
uint64 public constant SERVICE_DOMAIN_ROLE_FACTOR = 100;
|
102
|
+
uint64 public constant COMPONENT_ROLE_FACTOR = 1000;
|
103
|
+
uint64 public constant COMPONENT_ROLE_MIN_INT = 12000;
|
104
|
+
uint64 public constant COMPONENT_ROLE_MAX_INT = 19000;
|
105
|
+
uint64 public constant CUSTOM_ROLE_MIN_INT = 1000000;
|
145
106
|
|
146
|
-
|
147
|
-
/// @dev Converts the RoleId to a uint.
|
107
|
+
/// @dev Converts the RoleId to a uint.
|
148
108
|
function zero() public pure returns (RoleId) {
|
149
109
|
return RoleId.wrap(0);
|
150
110
|
}
|
151
111
|
|
152
|
-
/// @dev Converts an uint into a
|
153
|
-
function toRoleId(
|
154
|
-
return RoleId.wrap(
|
112
|
+
/// @dev Converts an uint into a role id.
|
113
|
+
function toRoleId(uint64 a) public pure returns (RoleId) {
|
114
|
+
return RoleId.wrap(a);
|
155
115
|
}
|
156
116
|
|
157
|
-
/// @dev Converts
|
117
|
+
/// @dev Converts an uint into a component role id.
|
118
|
+
function toComponentRoleId(ObjectType objectType, uint64 index) public pure returns (RoleId) {
|
119
|
+
return toRoleId(COMPONENT_ROLE_FACTOR * uint64(objectType.toInt()) + index);
|
120
|
+
}
|
121
|
+
|
122
|
+
/// @dev Converts an uint into a custom role id.
|
123
|
+
function toCustomRoleId(uint64 index) public pure returns (RoleId) {
|
124
|
+
return toRoleId(CUSTOM_ROLE_MIN_INT + index);
|
125
|
+
}
|
126
|
+
|
127
|
+
/// @dev Converts the role id to a uint.
|
158
128
|
function toInt(RoleId a) public pure returns (uint64) {
|
159
129
|
return uint64(RoleId.unwrap(a));
|
160
130
|
}
|
161
131
|
|
162
|
-
/// @dev Converts an uint into a
|
132
|
+
/// @dev Converts an uint into a role id.
|
163
133
|
/// Used for GIF core contracts.
|
164
134
|
function roleForType(ObjectType objectType) public pure returns (RoleId) {
|
165
|
-
return RoleId.wrap(
|
135
|
+
return RoleId.wrap(SERVICE_DOMAIN_ROLE_FACTOR * uint64(objectType.toInt()));
|
166
136
|
}
|
167
137
|
|
168
138
|
/// @dev Converts an uint into a RoleId.
|
169
139
|
/// Used for GIF core contracts.
|
170
140
|
function roleForTypeAndVersion(ObjectType objectType, VersionPart majorVersion) public pure returns (RoleId) {
|
171
141
|
return RoleId.wrap(
|
172
|
-
uint64(
|
142
|
+
uint64(SERVICE_DOMAIN_ROLE_FACTOR * objectType.toInt() + majorVersion.toInt()));
|
173
143
|
}
|
174
144
|
|
175
145
|
/// @dev Converts an uint into a RoleId.
|
176
146
|
/// Used for GIF core contracts.
|
177
147
|
function roleForTypeAndAllVersions(ObjectType objectType) public pure returns (RoleId) {
|
178
148
|
return RoleId.wrap(
|
179
|
-
uint64(
|
149
|
+
uint64(SERVICE_DOMAIN_ROLE_FACTOR * objectType.toInt() + ALL_VERSIONS));
|
180
150
|
}
|
181
151
|
|
182
152
|
/// @dev Returns true if the value is non-zero (> 0).
|
@@ -189,6 +159,17 @@ library RoleIdLib {
|
|
189
159
|
return RoleId.unwrap(a) == 0;
|
190
160
|
}
|
191
161
|
|
162
|
+
/// @dev Returns true iff the role id is a component role.
|
163
|
+
function isComponentRole(RoleId roleId) public pure returns (bool) {
|
164
|
+
uint64 roleIdInt = RoleId.unwrap(roleId);
|
165
|
+
return roleIdInt >= COMPONENT_ROLE_MIN_INT && roleIdInt <= COMPONENT_ROLE_MAX_INT;
|
166
|
+
}
|
167
|
+
|
168
|
+
/// @dev Returns true iff the role id is a custom role.
|
169
|
+
function isCustomRole(RoleId roleId) public pure returns (bool) {
|
170
|
+
return RoleId.unwrap(roleId) >= CUSTOM_ROLE_MIN_INT;
|
171
|
+
}
|
172
|
+
|
192
173
|
/// @dev Returns the key32 value for the specified id and object type.
|
193
174
|
function toKey32(RoleId a) public pure returns (Key32 key) {
|
194
175
|
return Key32Lib.toKey32(ROLE(), toKeyId(a));
|
@@ -6,9 +6,14 @@ type Seconds is uint40;
|
|
6
6
|
using {
|
7
7
|
SecondsEq as ==,
|
8
8
|
SecondsGt as >,
|
9
|
+
SecondsAdd as +,
|
9
10
|
SecondsLib.eqz,
|
10
11
|
SecondsLib.gtz,
|
11
|
-
SecondsLib.
|
12
|
+
SecondsLib.eq,
|
13
|
+
SecondsLib.gt,
|
14
|
+
SecondsLib.lt,
|
15
|
+
SecondsLib.toInt,
|
16
|
+
SecondsLib.add
|
12
17
|
} for Seconds global;
|
13
18
|
|
14
19
|
function SecondsEq(Seconds duration1, Seconds duration2) pure returns (bool) {
|
@@ -19,6 +24,11 @@ function SecondsGt(Seconds duration1, Seconds duration2) pure returns (bool) {
|
|
19
24
|
return SecondsLib.gt(duration1, duration2);
|
20
25
|
}
|
21
26
|
|
27
|
+
function SecondsAdd(Seconds duration1, Seconds duration2) pure returns (Seconds) {
|
28
|
+
return SecondsLib.add(duration1, duration2);
|
29
|
+
}
|
30
|
+
|
31
|
+
|
22
32
|
library SecondsLib {
|
23
33
|
|
24
34
|
error ErrorSecondsLibDurationTooBig(uint256 duration);
|
@@ -70,6 +80,16 @@ library SecondsLib {
|
|
70
80
|
return Seconds.unwrap(duration1) > Seconds.unwrap(duration2);
|
71
81
|
}
|
72
82
|
|
83
|
+
/// @dev return true if duration1 is smaller than duration2
|
84
|
+
function lt(Seconds duration1, Seconds duration2) public pure returns (bool) {
|
85
|
+
return Seconds.unwrap(duration1) < Seconds.unwrap(duration2);
|
86
|
+
}
|
87
|
+
|
88
|
+
/// @dev return add duration1 and duration2
|
89
|
+
function add(Seconds duration1, Seconds duration2) public pure returns (Seconds) {
|
90
|
+
return Seconds.wrap(Seconds.unwrap(duration1) + Seconds.unwrap(duration2));
|
91
|
+
}
|
92
|
+
|
73
93
|
function toInt(Seconds duration) public pure returns (uint256) {
|
74
94
|
return uint256(uint40(Seconds.unwrap(duration)));
|
75
95
|
}
|
@@ -8,6 +8,7 @@ using {
|
|
8
8
|
eqSelector as ==,
|
9
9
|
neSelector as !=,
|
10
10
|
SelectorLib.toBytes4,
|
11
|
+
SelectorLib.toString,
|
11
12
|
SelectorLib.eqz
|
12
13
|
} for Selector global;
|
13
14
|
|
@@ -46,6 +47,10 @@ library SelectorLib {
|
|
46
47
|
function toBytes4(Selector s) public pure returns (bytes4) {
|
47
48
|
return Selector.unwrap(s);
|
48
49
|
}
|
50
|
+
|
51
|
+
function toString(Selector s) public pure returns (string memory) {
|
52
|
+
return string(abi.encode(Selector.unwrap(s)));
|
53
|
+
}
|
49
54
|
}
|
50
55
|
|
51
56
|
// selector specific set library
|
@@ -9,6 +9,7 @@ using {
|
|
9
9
|
eqStateId as ==,
|
10
10
|
neStateId as !=,
|
11
11
|
StateIdLib.eqz,
|
12
|
+
StateIdLib.eq,
|
12
13
|
StateIdLib.gtz,
|
13
14
|
StateIdLib.toInt
|
14
15
|
} for StateId global;
|
@@ -27,10 +28,18 @@ function DEPLOYING() pure returns (StateId) {
|
|
27
28
|
return toStateId(3);
|
28
29
|
}
|
29
30
|
|
30
|
-
function
|
31
|
+
function DEPLOYED() pure returns (StateId) {
|
31
32
|
return toStateId(4);
|
32
33
|
}
|
33
34
|
|
35
|
+
function ACTIVE() pure returns (StateId) {
|
36
|
+
return toStateId(5);
|
37
|
+
}
|
38
|
+
|
39
|
+
function SKIPPED() pure returns (StateId) {
|
40
|
+
return toStateId(6);
|
41
|
+
}
|
42
|
+
|
34
43
|
function APPLIED() pure returns (StateId) {
|
35
44
|
return toStateId(10);
|
36
45
|
}
|
@@ -113,6 +122,11 @@ function neStateId(StateId a, StateId b) pure returns (bool isDifferent) {
|
|
113
122
|
|
114
123
|
// library functions that operate on user defined type
|
115
124
|
library StateIdLib {
|
125
|
+
|
126
|
+
function zero() public pure returns (StateId) {
|
127
|
+
return StateId.wrap(0);
|
128
|
+
}
|
129
|
+
|
116
130
|
/// @dev Converts the NftId to a uint256.
|
117
131
|
function toInt(StateId stateId) public pure returns (uint96) {
|
118
132
|
return uint96(StateId.unwrap(stateId));
|
@@ -12,6 +12,12 @@ using {
|
|
12
12
|
lteTimestamp as <=,
|
13
13
|
eqTimestamp as ==,
|
14
14
|
neTimestamp as !=,
|
15
|
+
TimestampLib.eq,
|
16
|
+
TimestampLib.ne,
|
17
|
+
TimestampLib.gt,
|
18
|
+
TimestampLib.gte,
|
19
|
+
TimestampLib.lt,
|
20
|
+
TimestampLib.lte,
|
15
21
|
TimestampLib.gtz,
|
16
22
|
TimestampLib.eqz,
|
17
23
|
TimestampLib.addSeconds,
|
@@ -48,11 +54,6 @@ function neTimestamp(Timestamp a, Timestamp b) pure returns (bool) {
|
|
48
54
|
return Timestamp.unwrap(a) != Timestamp.unwrap(b);
|
49
55
|
}
|
50
56
|
|
51
|
-
/// @dev Converts the uint256 to a Timestamp.
|
52
|
-
function toTimestamp(uint256 timestamp) pure returns (Timestamp) {
|
53
|
-
return Timestamp.wrap(uint40(timestamp));
|
54
|
-
}
|
55
|
-
|
56
57
|
// TODO move to TimestampLib and rename to zero()
|
57
58
|
/// @dev Return the Timestamp zero (0)
|
58
59
|
function zeroTimestamp() pure returns (Timestamp) {
|
@@ -72,6 +73,10 @@ library TimestampLib {
|
|
72
73
|
function blockTimestamp() public view returns (Timestamp) {
|
73
74
|
return Timestamp.wrap(uint40(block.timestamp));
|
74
75
|
}
|
76
|
+
|
77
|
+
function toTimestamp(uint256 timestamp) public pure returns (Timestamp) {
|
78
|
+
return Timestamp.wrap(uint40(timestamp));
|
79
|
+
}
|
75
80
|
|
76
81
|
/// @dev return true if Timestamp a is after Timestamp b
|
77
82
|
function gt(Timestamp a, Timestamp b) public pure returns (bool isAfter) {
|
@@ -1,8 +1,10 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
|
5
|
+
|
6
|
+
/// @dev UFixed is a 160-bit fixed point number with 15 decimals precision.
|
7
|
+
type UFixed is uint160;
|
6
8
|
|
7
9
|
using {
|
8
10
|
addUFixed as +,
|
@@ -15,8 +17,10 @@ using {
|
|
15
17
|
lteUFixed as <=,
|
16
18
|
eqUFixed as ==,
|
17
19
|
neUFixed as !=,
|
20
|
+
UFixedLib.gt,
|
21
|
+
UFixedLib.gtz,
|
18
22
|
UFixedLib.toInt,
|
19
|
-
UFixedLib.
|
23
|
+
UFixedLib.toInt1000
|
20
24
|
} for UFixed global;
|
21
25
|
|
22
26
|
// TODO move to UFixedLib and rename to zero()
|
@@ -29,20 +33,24 @@ function addUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
|
29
33
|
}
|
30
34
|
|
31
35
|
function subUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
32
|
-
|
36
|
+
if (a < b) {
|
37
|
+
revert UFixedLib.UFixedLibNegativeResult();
|
38
|
+
}
|
33
39
|
return UFixed.wrap(UFixed.unwrap(a) - UFixed.unwrap(b));
|
34
40
|
}
|
35
41
|
|
36
42
|
function mulUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
37
43
|
return
|
38
|
-
UFixed.wrap(
|
44
|
+
UFixed.wrap(uint160(Math.mulDiv(UFixed.unwrap(a), UFixed.unwrap(b), 10 ** 15)));
|
39
45
|
}
|
40
46
|
|
41
47
|
function divUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
42
|
-
|
43
|
-
|
48
|
+
if (UFixed.unwrap(b) == 0) {
|
49
|
+
revert UFixedLib.UFixedLibDivisionByZero();
|
50
|
+
}
|
51
|
+
|
44
52
|
return
|
45
|
-
UFixed.wrap(
|
53
|
+
UFixed.wrap(uint160(Math.mulDiv(UFixed.unwrap(a), 10 ** 15, UFixed.unwrap(b))));
|
46
54
|
}
|
47
55
|
|
48
56
|
function gtUFixed(UFixed a, UFixed b) pure returns (bool isGreaterThan) {
|
@@ -85,116 +93,16 @@ function deltaUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
|
85
93
|
return b - a;
|
86
94
|
}
|
87
95
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
enum Rounding {
|
92
|
-
Down, // Toward negative infinity
|
93
|
-
Up, // Toward infinity
|
94
|
-
Zero // Toward zero
|
95
|
-
}
|
96
|
-
|
97
|
-
/**
|
98
|
-
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
|
99
|
-
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
|
100
|
-
* with further edits by Uniswap Labs also under MIT license.
|
101
|
-
*/
|
102
|
-
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
|
103
|
-
unchecked {
|
104
|
-
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
|
105
|
-
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
|
106
|
-
// variables such that product = prod1 * 2^256 + prod0.
|
107
|
-
uint256 prod0; // Least significant 256 bits of the product
|
108
|
-
uint256 prod1; // Most significant 256 bits of the product
|
109
|
-
assembly {
|
110
|
-
let mm := mulmod(x, y, not(0))
|
111
|
-
prod0 := mul(x, y)
|
112
|
-
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
|
113
|
-
}
|
114
|
-
|
115
|
-
// Handle non-overflow cases, 256 by 256 division.
|
116
|
-
if (prod1 == 0) {
|
117
|
-
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
|
118
|
-
// The surrounding unchecked block does not change this fact.
|
119
|
-
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
|
120
|
-
return prod0 / denominator;
|
121
|
-
}
|
122
|
-
|
123
|
-
// Make sure the result is less than 2^256. Also prevents denominator == 0.
|
124
|
-
require(denominator > prod1, "Math: mulDiv overflow");
|
125
|
-
|
126
|
-
///////////////////////////////////////////////
|
127
|
-
// 512 by 256 division.
|
128
|
-
///////////////////////////////////////////////
|
129
|
-
|
130
|
-
// Make division exact by subtracting the remainder from [prod1 prod0].
|
131
|
-
uint256 remainder;
|
132
|
-
assembly {
|
133
|
-
// Compute remainder using mulmod.
|
134
|
-
remainder := mulmod(x, y, denominator)
|
135
|
-
|
136
|
-
// Subtract 256 bit number from 512 bit number.
|
137
|
-
prod1 := sub(prod1, gt(remainder, prod0))
|
138
|
-
prod0 := sub(prod0, remainder)
|
139
|
-
}
|
140
|
-
|
141
|
-
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
|
142
|
-
// See https://cs.stackexchange.com/q/138556/92363.
|
143
|
-
|
144
|
-
// Does not overflow because the denominator cannot be zero at this stage in the function.
|
145
|
-
uint256 twos = denominator & (~denominator + 1);
|
146
|
-
assembly {
|
147
|
-
// Divide denominator by twos.
|
148
|
-
denominator := div(denominator, twos)
|
149
|
-
|
150
|
-
// Divide [prod1 prod0] by twos.
|
151
|
-
prod0 := div(prod0, twos)
|
152
|
-
|
153
|
-
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
|
154
|
-
twos := add(div(sub(0, twos), twos), 1)
|
155
|
-
}
|
156
|
-
|
157
|
-
// Shift in bits from prod1 into prod0.
|
158
|
-
prod0 |= prod1 * twos;
|
159
|
-
|
160
|
-
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
|
161
|
-
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
|
162
|
-
// four bits. That is, denominator * inv = 1 mod 2^4.
|
163
|
-
uint256 inverse = (3 * denominator) ^ 2;
|
164
|
-
|
165
|
-
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
|
166
|
-
// in modular arithmetic, doubling the correct bits in each step.
|
167
|
-
inverse *= 2 - denominator * inverse; // inverse mod 2^8
|
168
|
-
inverse *= 2 - denominator * inverse; // inverse mod 2^16
|
169
|
-
inverse *= 2 - denominator * inverse; // inverse mod 2^32
|
170
|
-
inverse *= 2 - denominator * inverse; // inverse mod 2^64
|
171
|
-
inverse *= 2 - denominator * inverse; // inverse mod 2^128
|
172
|
-
inverse *= 2 - denominator * inverse; // inverse mod 2^256
|
173
|
-
|
174
|
-
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
|
175
|
-
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
|
176
|
-
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
|
177
|
-
// is no longer required.
|
178
|
-
result = prod0 * inverse;
|
179
|
-
return result;
|
180
|
-
}
|
181
|
-
}
|
96
|
+
library UFixedLib {
|
97
|
+
error UFixedLibNegativeResult();
|
98
|
+
error UFixedLibDivisionByZero();
|
182
99
|
|
183
|
-
|
184
|
-
|
185
|
-
*/
|
186
|
-
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
|
187
|
-
uint256 result = mulDiv(x, y, denominator);
|
188
|
-
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
|
189
|
-
result += 1;
|
190
|
-
}
|
191
|
-
return result;
|
192
|
-
}
|
100
|
+
error UFixedLibExponentTooSmall(int8 exp);
|
101
|
+
error UFixedLibExponentTooLarge(int8 exp);
|
193
102
|
|
194
|
-
|
103
|
+
error UFixedLibNumberTooLarge(uint256 number);
|
195
104
|
|
196
|
-
|
197
|
-
int8 public constant EXP = 18;
|
105
|
+
int8 public constant EXP = 15;
|
198
106
|
uint256 public constant MULTIPLIER = 10 ** uint256(int256(EXP));
|
199
107
|
uint256 public constant MULTIPLIER_HALF = MULTIPLIER / 2;
|
200
108
|
|
@@ -213,17 +121,32 @@ library UFixedLib {
|
|
213
121
|
return uint8(2);
|
214
122
|
}
|
215
123
|
|
216
|
-
/// @dev Converts the uint256 to a UFixed.
|
124
|
+
/// @dev Converts the uint256 to a uint160 based UFixed.
|
125
|
+
/// This method reverts if the number is too large to fit in a uint160.
|
217
126
|
function toUFixed(uint256 a) public pure returns (UFixed) {
|
218
|
-
|
127
|
+
uint256 n = a * MULTIPLIER;
|
128
|
+
if (n > type(uint160).max) {
|
129
|
+
revert UFixedLibNumberTooLarge(a);
|
130
|
+
}
|
131
|
+
return UFixed.wrap(uint160(n));
|
219
132
|
}
|
220
133
|
|
221
134
|
/// @dev Converts the uint256 to a UFixed with given exponent.
|
222
135
|
function toUFixed(uint256 a, int8 exp) public pure returns (UFixed) {
|
223
|
-
|
224
|
-
|
136
|
+
if (EXP + exp < 0) {
|
137
|
+
revert UFixedLibExponentTooSmall(exp);
|
138
|
+
}
|
139
|
+
if (EXP + exp > 48) {
|
140
|
+
revert UFixedLibExponentTooLarge(exp);
|
141
|
+
}
|
142
|
+
|
143
|
+
uint256 n = a * 10 ** uint8(EXP + exp);
|
225
144
|
|
226
|
-
|
145
|
+
if (n > type(uint160).max) {
|
146
|
+
revert UFixedLibNumberTooLarge(n);
|
147
|
+
}
|
148
|
+
|
149
|
+
return UFixed.wrap(uint160(n));
|
227
150
|
}
|
228
151
|
|
229
152
|
/// @dev returns the decimals precision of the UFixed type
|
@@ -236,27 +159,32 @@ library UFixedLib {
|
|
236
159
|
return toIntWithRounding(a, ROUNDING_HALF_UP());
|
237
160
|
}
|
238
161
|
|
162
|
+
/// @dev Converts a UFixed to a uint256.
|
163
|
+
function toInt1000(UFixed a) public pure returns (uint256) {
|
164
|
+
return toIntWithRounding(toUFixed(1000) * a, ROUNDING_HALF_UP());
|
165
|
+
}
|
166
|
+
|
239
167
|
/// @dev Converts a UFixed to a uint256 with given rounding mode.
|
240
168
|
function toIntWithRounding(UFixed a, uint8 rounding) public pure returns (uint256) {
|
241
169
|
if (rounding == ROUNDING_HALF_UP()) {
|
242
170
|
return
|
243
|
-
|
171
|
+
Math.mulDiv(
|
244
172
|
UFixed.unwrap(a) + MULTIPLIER_HALF,
|
245
173
|
1,
|
246
174
|
MULTIPLIER,
|
247
|
-
|
175
|
+
Math.Rounding.Floor
|
248
176
|
);
|
249
177
|
} else if (rounding == ROUNDING_DOWN()) {
|
250
178
|
return
|
251
|
-
|
179
|
+
Math.mulDiv(
|
252
180
|
UFixed.unwrap(a),
|
253
181
|
1,
|
254
182
|
MULTIPLIER,
|
255
|
-
|
183
|
+
Math.Rounding.Floor
|
256
184
|
);
|
257
185
|
} else {
|
258
186
|
return
|
259
|
-
|
187
|
+
Math.mulDiv(UFixed.unwrap(a), 1, MULTIPLIER, Math.Rounding.Ceil);
|
260
188
|
}
|
261
189
|
}
|
262
190
|
|
@@ -319,6 +247,14 @@ library UFixedLib {
|
|
319
247
|
return UFixed.wrap(0);
|
320
248
|
}
|
321
249
|
|
250
|
+
function one() public pure returns (UFixed) {
|
251
|
+
return UFixed.wrap(uint160(MULTIPLIER));
|
252
|
+
}
|
253
|
+
|
254
|
+
function max() public pure returns (UFixed) {
|
255
|
+
return UFixed.wrap(type(uint160).max);
|
256
|
+
}
|
257
|
+
|
322
258
|
/// @dev return the absolute delta between two UFixed numbers
|
323
259
|
function delta(UFixed a, UFixed b) public pure returns (UFixed) {
|
324
260
|
return deltaUFixed(a, b);
|