@etherisc/gif-next 0.0.2-fe77319 → 0.0.2-ff1bf36-818
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 +406 -9
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +4 -0
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +1253 -0
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +4 -0
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +1206 -0
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +358 -0
- package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +4 -0
- package/artifacts/contracts/{instance/access → authorization}/IAccess.sol/IAccess.json +1 -1
- package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +4 -0
- package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +1032 -0
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +258 -0
- package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.json +290 -0
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +148 -0
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +390 -0
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +4 -0
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +190 -0
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +4 -0
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +1489 -0
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +4 -0
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +410 -0
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +4 -0
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +1159 -0
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +4 -0
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +1502 -0
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +842 -0
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +906 -0
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +4 -0
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +914 -0
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +4 -0
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +703 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +295 -535
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +757 -0
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +486 -591
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +1626 -0
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +601 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1693 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +1160 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +734 -0
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +3469 -0
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +4 -0
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +318 -0
- package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +4 -0
- package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.json +137 -0
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +10 -0
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +182 -0
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +181 -0
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +129 -0
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +4 -0
- package/artifacts/contracts/instance/{pool/IPoolModule.sol/IPool.json → module/IBundle.sol/IBundle.json} +2 -2
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
- package/artifacts/contracts/instance/{component/IComponent.sol/IComponent.json → module/IComponents.sol/IComponents.json} +2 -2
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.json +10 -0
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +4 -0
- package/artifacts/contracts/instance/{policy → module}/IPolicy.sol/IPolicy.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.json +10 -0
- package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +4 -0
- package/artifacts/contracts/mock/Dip.sol/Dip.json +376 -0
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +4 -0
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +1126 -0
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +4 -0
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +418 -0
- package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +4 -0
- package/artifacts/contracts/oracle/IOracle.sol/IOracle.json +52 -0
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +4 -0
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +765 -0
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +4 -0
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +675 -0
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +4 -0
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +1018 -0
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +4 -0
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +1034 -0
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +730 -0
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +4 -0
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +1395 -0
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +410 -0
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +1466 -0
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +818 -0
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +907 -0
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +4 -0
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +909 -0
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +4 -0
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +1218 -0
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +4 -0
- package/artifacts/contracts/pool/Pool.sol/Pool.json +1181 -0
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +4 -0
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +1625 -0
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +758 -0
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +4 -0
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +852 -0
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +722 -0
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +4 -0
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +1243 -0
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +410 -0
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +4 -0
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +1331 -0
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +822 -0
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +517 -0
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +4 -0
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +788 -0
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +800 -0
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +4 -0
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +549 -0
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +4 -0
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +948 -0
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +4 -0
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.json +400 -0
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +1263 -0
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +782 -0
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +4 -0
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +1017 -0
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +786 -0
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +4 -0
- package/artifacts/contracts/product/Product.sol/Product.json +1201 -0
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +4 -0
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +695 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +702 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +4 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +784 -0
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +743 -104
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +940 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +4 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +52 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +1083 -114
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +1746 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +1452 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +721 -0
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +164 -0
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +1159 -0
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +4 -0
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +214 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +4 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +661 -0
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/shared/Component.sol/Component.json +832 -0
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +1680 -0
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +4 -0
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +804 -0
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +4 -0
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +539 -0
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/shared/IComponent.sol/IComponent.json +605 -0
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +4 -0
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +1033 -0
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +4 -0
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +700 -0
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.json +474 -0
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +4 -0
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.json +110 -0
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +4 -0
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +131 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +207 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +4 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +181 -0
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/{instance/access/IAccess.sol/IAccessCheckRole.json → shared/IRegistryLinked.sol/IRegistryLinked.json} +11 -11
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +4 -0
- package/artifacts/contracts/shared/IService.sol/IService.json +346 -0
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +4 -0
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.json +39 -0
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +4 -0
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +73 -0
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +4 -0
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +940 -0
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +497 -0
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +4 -0
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +133 -0
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +4 -0
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +306 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +4 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +244 -0
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +320 -0
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +4 -0
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +353 -0
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +71 -0
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +4 -0
- package/artifacts/contracts/shared/Service.sol/Service.json +507 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +469 -0
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +108 -0
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +4 -0
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +1412 -0
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +4 -0
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +1035 -0
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +4 -0
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +387 -0
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +4 -0
- package/artifacts/contracts/staking/Staking.sol/Staking.json +1941 -0
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +164 -0
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +761 -0
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +592 -0
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +1343 -0
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +718 -0
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2242 -0
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +4 -0
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +576 -0
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +4 -0
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.json +10 -0
- package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +4 -0
- package/artifacts/contracts/type/Amount.sol/AmountLib.json +374 -0
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +4 -0
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.json +225 -0
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +179 -0
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +4 -0
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +104 -0
- package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +4 -0
- package/artifacts/contracts/type/Fee.sol/FeeLib.json +317 -0
- package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +4 -0
- package/artifacts/contracts/type/Key32.sol/Key32Lib.json +125 -0
- package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/NftId.sol/NftIdLib.json +209 -0
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +4 -0
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +33 -0
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +4 -0
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +239 -0
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +209 -0
- package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +4 -0
- package/artifacts/contracts/type/Referral.sol/ReferralLib.json +142 -0
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +204 -0
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +86 -0
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +369 -0
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +4 -0
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +222 -0
- package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +4 -0
- package/artifacts/contracts/type/Selector.sol/SelectorLib.json +129 -0
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +4 -0
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.json +10 -0
- package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/StateId.sol/StateIdLib.json +92 -0
- package/artifacts/contracts/type/String.sol/StrLib.dbg.json +4 -0
- package/artifacts/contracts/type/String.sol/StrLib.json +132 -0
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +4 -0
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +312 -0
- package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +4 -0
- package/artifacts/contracts/type/UFixed.sol/MathLib.json +16 -0
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +4 -0
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +535 -0
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +4 -0
- package/artifacts/contracts/type/Version.sol/VersionLib.json +177 -0
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +4 -0
- package/artifacts/contracts/type/Version.sol/VersionPartLib.json +68 -0
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +4 -0
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.json +55 -0
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +4 -0
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +617 -0
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +129 -0
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +4 -0
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.json +78 -0
- package/contracts/authorization/AccessAdmin.sol +591 -0
- package/contracts/authorization/AccessManagerCloneable.sol +16 -0
- package/contracts/authorization/Authorization.sol +217 -0
- package/contracts/authorization/IAccess.sol +48 -0
- package/contracts/authorization/IAccessAdmin.sol +136 -0
- package/contracts/authorization/IAuthorization.sol +54 -0
- package/contracts/authorization/IModuleAuthorization.sol +21 -0
- package/contracts/authorization/IServiceAuthorization.sol +38 -0
- package/contracts/authorization/ModuleAuthorization.sol +78 -0
- package/contracts/authorization/ServiceAuthorization.sol +90 -0
- package/contracts/distribution/BasicDistribution.sol +138 -0
- package/contracts/distribution/BasicDistributionAuthorization.sol +47 -0
- package/contracts/distribution/Distribution.sol +295 -0
- package/contracts/distribution/DistributionService.sol +322 -0
- package/contracts/distribution/DistributionServiceManager.sol +39 -0
- package/contracts/distribution/IDistributionComponent.sol +52 -0
- package/contracts/distribution/IDistributionService.sol +95 -0
- package/contracts/instance/BundleSet.sol +126 -0
- package/contracts/instance/IInstance.sol +58 -15
- package/contracts/instance/IInstanceService.sol +92 -0
- package/contracts/instance/Instance.sol +211 -45
- package/contracts/instance/InstanceAdmin.sol +285 -0
- package/contracts/instance/InstanceAuthorizationV3.sol +204 -0
- package/contracts/instance/InstanceReader.sol +408 -0
- package/contracts/instance/InstanceService.sol +467 -0
- package/contracts/instance/InstanceServiceManager.sol +40 -0
- package/contracts/instance/InstanceStore.sol +277 -0
- package/contracts/instance/base/BalanceStore.sol +123 -0
- package/contracts/instance/base/Cloneable.sol +28 -0
- package/contracts/instance/base/ObjectCounter.sol +21 -0
- package/contracts/instance/base/ObjectLifecycle.sol +105 -0
- package/contracts/instance/base/ObjectSet.sol +79 -0
- package/contracts/instance/module/IAccess.sol +46 -0
- package/contracts/instance/module/IBundle.sol +20 -0
- package/contracts/instance/module/IComponents.sol +46 -0
- package/contracts/instance/module/IDistribution.sol +41 -0
- package/contracts/instance/module/IPolicy.sol +84 -0
- package/contracts/instance/module/IRisk.sol +11 -0
- package/contracts/mock/Dip.sol +26 -0
- package/contracts/oracle/BasicOracle.sol +48 -0
- package/contracts/oracle/BasicOracleAuthorization.sol +46 -0
- package/contracts/oracle/IOracle.sol +36 -0
- package/contracts/oracle/IOracleComponent.sol +33 -0
- package/contracts/oracle/IOracleService.sol +65 -0
- package/contracts/oracle/Oracle.sol +166 -0
- package/contracts/oracle/OracleService.sol +278 -0
- package/contracts/oracle/OracleServiceManager.sol +39 -0
- package/contracts/pool/BasicPool.sol +166 -0
- package/contracts/pool/BasicPoolAuthorization.sol +58 -0
- package/contracts/pool/BundleService.sol +436 -0
- package/contracts/pool/BundleServiceManager.sol +39 -0
- package/contracts/pool/IBundleService.sol +134 -0
- package/contracts/pool/IPoolComponent.sol +58 -0
- package/contracts/pool/IPoolService.sol +163 -0
- package/contracts/pool/Pool.sol +328 -0
- package/contracts/pool/PoolService.sol +541 -0
- package/contracts/pool/PoolServiceManager.sol +39 -0
- package/contracts/product/ApplicationService.sol +250 -0
- package/contracts/product/ApplicationServiceManager.sol +38 -0
- package/contracts/product/BasicProduct.sol +52 -0
- package/contracts/product/BasicProductAuthorization.sol +43 -0
- package/contracts/product/ClaimService.sol +416 -0
- package/contracts/product/ClaimServiceManager.sol +38 -0
- package/contracts/product/IApplicationService.sol +63 -0
- package/contracts/product/IClaimService.sol +100 -0
- package/contracts/product/IPolicyService.sol +84 -0
- package/contracts/product/IPricingService.sol +39 -0
- package/contracts/product/IProductComponent.sol +40 -0
- package/contracts/product/IRiskService.sol +33 -0
- package/contracts/product/PolicyService.sol +584 -0
- package/contracts/product/PolicyServiceManager.sol +39 -0
- package/contracts/product/PricingService.sol +304 -0
- package/contracts/product/PricingServiceManager.sol +39 -0
- package/contracts/product/Product.sol +410 -0
- package/contracts/product/RiskService.sol +97 -0
- package/contracts/product/RiskServiceManager.sol +39 -0
- package/contracts/registry/ChainNft.sol +217 -0
- package/contracts/registry/IRegistry.sol +120 -52
- package/contracts/registry/IRegistryService.sol +69 -0
- package/contracts/registry/ITransferInterceptor.sol +7 -0
- package/contracts/registry/Registry.sol +504 -125
- package/contracts/registry/RegistryAdmin.sol +374 -0
- package/contracts/registry/RegistryService.sol +252 -0
- package/contracts/registry/RegistryServiceManager.sol +53 -0
- package/contracts/registry/ReleaseLifecycle.sol +27 -0
- package/contracts/registry/ReleaseRegistry.sol +485 -0
- package/contracts/registry/ServiceAuthorizationV3.sol +200 -0
- package/contracts/registry/TokenRegistry.sol +315 -0
- package/contracts/shared/Component.sol +268 -0
- package/contracts/shared/ComponentService.sol +641 -0
- package/contracts/shared/ComponentServiceManager.sol +35 -0
- package/contracts/shared/ComponentVerifyingService.sol +117 -0
- package/contracts/shared/IComponent.sol +70 -0
- package/contracts/shared/IComponentService.sol +108 -0
- package/contracts/shared/IInstanceLinkedComponent.sol +49 -0
- package/contracts/shared/IKeyValueStore.sol +54 -0
- package/contracts/shared/ILifecycle.sol +29 -0
- package/contracts/shared/INftOwnable.sol +23 -0
- package/contracts/shared/IPolicyHolder.sol +45 -0
- package/contracts/shared/IRegisterable.sol +15 -0
- package/contracts/shared/IRegistryLinked.sol +11 -0
- package/contracts/shared/IService.sol +25 -0
- package/contracts/shared/InitializableCustom.sol +177 -0
- package/contracts/shared/InitializableERC165.sol +27 -0
- package/contracts/shared/InstanceLinkedComponent.sol +172 -0
- package/contracts/shared/KeyValueStore.sol +131 -0
- package/contracts/shared/Lifecycle.sol +77 -0
- package/contracts/shared/NftIdSet.sol +65 -0
- package/contracts/shared/NftOwnable.sol +107 -0
- package/contracts/shared/PolicyHolder.sol +99 -0
- package/contracts/shared/Registerable.sol +75 -0
- package/contracts/shared/RegistryLinked.sol +43 -0
- package/contracts/shared/Service.sol +82 -0
- package/contracts/shared/TokenHandler.sol +139 -0
- package/contracts/shared/TokenHandlerDeployerLib.sol +12 -0
- package/contracts/staking/IStaking.sol +167 -0
- package/contracts/staking/IStakingService.sol +160 -0
- package/contracts/staking/StakeManagerLib.sol +206 -0
- package/contracts/staking/Staking.sol +497 -0
- package/contracts/staking/StakingLifecycle.sol +23 -0
- package/contracts/staking/StakingManager.sol +50 -0
- package/contracts/staking/StakingReader.sol +183 -0
- package/contracts/staking/StakingService.sol +407 -0
- package/contracts/staking/StakingServiceManager.sol +44 -0
- package/contracts/staking/StakingStore.sol +605 -0
- package/contracts/staking/TargetManagerLib.sol +207 -0
- package/contracts/type/AddressSet.sol +58 -0
- package/contracts/type/Amount.sol +135 -0
- package/contracts/type/Blocknumber.sol +142 -0
- package/contracts/type/ClaimId.sol +75 -0
- package/contracts/type/DistributorType.sol +55 -0
- package/contracts/type/Fee.sol +66 -0
- package/contracts/type/Key32.sol +50 -0
- package/contracts/type/NftId.sol +78 -0
- package/contracts/type/NftIdSet.sol +62 -0
- package/contracts/type/ObjectType.sol +271 -0
- package/contracts/type/PayoutId.sol +82 -0
- package/contracts/type/Referral.sol +90 -0
- package/contracts/type/RequestId.sol +75 -0
- package/contracts/type/RiskId.sol +43 -0
- package/contracts/type/RoleId.sol +174 -0
- package/contracts/type/Seconds.sol +93 -0
- package/contracts/type/Selector.sol +102 -0
- package/contracts/type/StateId.sol +135 -0
- package/contracts/type/String.sol +53 -0
- package/contracts/type/Timestamp.sol +146 -0
- package/contracts/type/UFixed.sol +351 -0
- package/contracts/type/Version.sol +110 -0
- package/contracts/upgradeability/IVersionable.sol +53 -0
- package/contracts/upgradeability/ProxyManager.sol +198 -0
- package/contracts/upgradeability/UpgradableProxyWithAdmin.sol +14 -0
- package/contracts/upgradeability/Versionable.sol +59 -0
- package/package.json +25 -7
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +0 -4
- package/artifacts/contracts/components/Component.sol/Component.json +0 -179
- package/artifacts/contracts/components/Component.sol/InstanceLinked.dbg.json +0 -4
- package/artifacts/contracts/components/Component.sol/InstanceLinked.json +0 -35
- package/artifacts/contracts/components/IPool.sol/IPoolComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IPool.sol/IPoolComponent.json +0 -179
- package/artifacts/contracts/components/IProduct.sol/IProductComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IProduct.sol/IProductComponent.json +0 -192
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +0 -4
- package/artifacts/contracts/components/Pool.sol/Pool.json +0 -195
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +0 -4
- package/artifacts/contracts/components/Product.sol/Product.json +0 -213
- package/artifacts/contracts/experiment/A.sol/A.dbg.json +0 -4
- package/artifacts/contracts/experiment/A.sol/A.json +0 -128
- package/artifacts/contracts/experiment/A.sol/AShared.dbg.json +0 -4
- package/artifacts/contracts/experiment/A.sol/AShared.json +0 -42
- package/artifacts/contracts/experiment/B.sol/B.dbg.json +0 -4
- package/artifacts/contracts/experiment/B.sol/B.json +0 -76
- package/artifacts/contracts/experiment/C.sol/C.dbg.json +0 -4
- package/artifacts/contracts/experiment/C.sol/C.json +0 -89
- package/artifacts/contracts/experiment/IA.sol/IA.dbg.json +0 -4
- package/artifacts/contracts/experiment/IA.sol/IA.json +0 -128
- package/artifacts/contracts/experiment/IA.sol/ISharedA.dbg.json +0 -4
- package/artifacts/contracts/experiment/IA.sol/ISharedA.json +0 -37
- package/artifacts/contracts/experiment/IB.sol/IB.dbg.json +0 -4
- package/artifacts/contracts/experiment/IB.sol/IB.json +0 -50
- package/artifacts/contracts/experiment/IC.sol/IC.dbg.json +0 -4
- package/artifacts/contracts/experiment/IC.sol/IC.json +0 -63
- package/artifacts/contracts/instance/access/Access.sol/AccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/access/Access.sol/AccessModule.json +0 -400
- package/artifacts/contracts/instance/access/IAccess.sol/IAccess.dbg.json +0 -4
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessCheckRole.dbg.json +0 -4
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessComponentTypeRoles.dbg.json +0 -4
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessComponentTypeRoles.json +0 -50
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessModule.json +0 -336
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentModule.json +0 -327
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.json +0 -105
- package/artifacts/contracts/instance/component/IComponent.sol/IComponent.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentContract.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentContract.json +0 -179
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.json +0 -245
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.json +0 -94
- package/artifacts/contracts/instance/component/IComponent.sol/IInstanceLinked.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IInstanceLinked.json +0 -24
- package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicy.dbg.json +0 -4
- package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicyModule.json +0 -231
- package/artifacts/contracts/instance/policy/PolicyModule.sol/PolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/policy/PolicyModule.sol/PolicyModule.json +0 -231
- package/artifacts/contracts/instance/pool/IPoolModule.sol/IPool.dbg.json +0 -4
- package/artifacts/contracts/instance/pool/IPoolModule.sol/IPoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/pool/IPoolModule.sol/IPoolModule.json +0 -149
- package/artifacts/contracts/instance/pool/PoolModule.sol/PoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/pool/PoolModule.sol/PoolModule.json +0 -162
- package/artifacts/contracts/instance/product/IProductService.sol/IProductModule.dbg.json +0 -4
- package/artifacts/contracts/instance/product/IProductService.sol/IProductModule.json +0 -75
- package/artifacts/contracts/instance/product/IProductService.sol/IProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/product/IProductService.sol/IProductService.json +0 -114
- package/artifacts/contracts/instance/product/ProductService.sol/ProductModule.dbg.json +0 -4
- package/artifacts/contracts/instance/product/ProductService.sol/ProductModule.json +0 -75
- package/artifacts/contracts/instance/product/ProductService.sol/ProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/product/ProductService.sol/ProductService.json +0 -125
- package/artifacts/contracts/registry/IRegistry.sol/IOwnable.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistry.sol/IOwnable.json +0 -24
- package/artifacts/contracts/registry/IRegistry.sol/IRegisterable.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistry.sol/IRegisterable.json +0 -166
- package/artifacts/contracts/registry/IRegistry.sol/IRegistryLinked.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistry.sol/IRegistryLinked.json +0 -49
- package/artifacts/contracts/registry/Registry.sol/Registerable.dbg.json +0 -4
- package/artifacts/contracts/registry/Registry.sol/Registerable.json +0 -166
- package/artifacts/contracts/registry/Registry.sol/RegistryLinked.dbg.json +0 -4
- package/artifacts/contracts/registry/Registry.sol/RegistryLinked.json +0 -60
- package/contracts/components/Component.sol +0 -62
- package/contracts/components/IPool.sol +0 -9
- package/contracts/components/IProduct.sol +0 -11
- package/contracts/components/Pool.sol +0 -29
- package/contracts/components/Product.sol +0 -65
- package/contracts/experiment/A.sol +0 -56
- package/contracts/experiment/B.sol +0 -23
- package/contracts/experiment/C.sol +0 -28
- package/contracts/experiment/IA.sol +0 -18
- package/contracts/experiment/IB.sol +0 -9
- package/contracts/experiment/IC.sol +0 -11
- package/contracts/instance/access/Access.sol +0 -218
- package/contracts/instance/access/IAccess.sol +0 -83
- package/contracts/instance/component/ComponentModule.sol +0 -259
- package/contracts/instance/component/IComponent.sol +0 -94
- package/contracts/instance/policy/IPolicy.sol +0 -66
- package/contracts/instance/policy/PolicyModule.sol +0 -106
- package/contracts/instance/pool/IPoolModule.sol +0 -40
- package/contracts/instance/pool/PoolModule.sol +0 -83
- package/contracts/instance/product/IProductService.sol +0 -45
- package/contracts/instance/product/ProductService.sol +0 -105
@@ -0,0 +1,146 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {Seconds} from "./Seconds.sol";
|
5
|
+
|
6
|
+
type Timestamp is uint40;
|
7
|
+
|
8
|
+
using {
|
9
|
+
gtTimestamp as >,
|
10
|
+
gteTimestamp as >=,
|
11
|
+
ltTimestamp as <,
|
12
|
+
lteTimestamp as <=,
|
13
|
+
eqTimestamp as ==,
|
14
|
+
neTimestamp as !=,
|
15
|
+
TimestampLib.eq,
|
16
|
+
TimestampLib.ne,
|
17
|
+
TimestampLib.gt,
|
18
|
+
TimestampLib.gte,
|
19
|
+
TimestampLib.lt,
|
20
|
+
TimestampLib.lte,
|
21
|
+
TimestampLib.gtz,
|
22
|
+
TimestampLib.eqz,
|
23
|
+
TimestampLib.addSeconds,
|
24
|
+
TimestampLib.toInt
|
25
|
+
} for Timestamp global;
|
26
|
+
|
27
|
+
/// @dev return true if Timestamp a is after Timestamp b
|
28
|
+
function gtTimestamp(Timestamp a, Timestamp b) pure returns (bool) {
|
29
|
+
return Timestamp.unwrap(a) > Timestamp.unwrap(b);
|
30
|
+
}
|
31
|
+
|
32
|
+
/// @dev return true if Timestamp a is after or equal to Timestamp b
|
33
|
+
function gteTimestamp(Timestamp a, Timestamp b) pure returns (bool) {
|
34
|
+
return Timestamp.unwrap(a) >= Timestamp.unwrap(b);
|
35
|
+
}
|
36
|
+
|
37
|
+
/// @dev return true if Timestamp a is before Timestamp b
|
38
|
+
function ltTimestamp(Timestamp a, Timestamp b) pure returns (bool) {
|
39
|
+
return Timestamp.unwrap(a) < Timestamp.unwrap(b);
|
40
|
+
}
|
41
|
+
|
42
|
+
/// @dev return true if Timestamp a is before or equal to Timestamp b
|
43
|
+
function lteTimestamp(Timestamp a, Timestamp b) pure returns (bool) {
|
44
|
+
return Timestamp.unwrap(a) <= Timestamp.unwrap(b);
|
45
|
+
}
|
46
|
+
|
47
|
+
/// @dev return true if Timestamp a is equal to Timestamp b
|
48
|
+
function eqTimestamp(Timestamp a, Timestamp b) pure returns (bool) {
|
49
|
+
return Timestamp.unwrap(a) == Timestamp.unwrap(b);
|
50
|
+
}
|
51
|
+
|
52
|
+
/// @dev return true if Timestamp a is not equal to Timestamp b
|
53
|
+
function neTimestamp(Timestamp a, Timestamp b) pure returns (bool) {
|
54
|
+
return Timestamp.unwrap(a) != Timestamp.unwrap(b);
|
55
|
+
}
|
56
|
+
|
57
|
+
/// @dev Converts the uint256 to a Timestamp.
|
58
|
+
function toTimestamp(uint256 timestamp) pure returns (Timestamp) {
|
59
|
+
return TimestampLib.toTimestamp(timestamp);
|
60
|
+
}
|
61
|
+
|
62
|
+
// TODO move to TimestampLib and rename to zero()
|
63
|
+
/// @dev Return the Timestamp zero (0)
|
64
|
+
function zeroTimestamp() pure returns (Timestamp) {
|
65
|
+
return Timestamp.wrap(0);
|
66
|
+
}
|
67
|
+
|
68
|
+
library TimestampLib {
|
69
|
+
|
70
|
+
function zero() public pure returns (Timestamp) {
|
71
|
+
return Timestamp.wrap(0);
|
72
|
+
}
|
73
|
+
|
74
|
+
function max() public pure returns (Timestamp) {
|
75
|
+
return Timestamp.wrap(type(uint40).max);
|
76
|
+
}
|
77
|
+
|
78
|
+
function blockTimestamp() public view returns (Timestamp) {
|
79
|
+
return Timestamp.wrap(uint40(block.timestamp));
|
80
|
+
}
|
81
|
+
|
82
|
+
function toTimestamp(uint256 timestamp) public pure returns (Timestamp) {
|
83
|
+
return Timestamp.wrap(uint40(timestamp));
|
84
|
+
}
|
85
|
+
|
86
|
+
/// @dev return true if Timestamp a is after Timestamp b
|
87
|
+
function gt(Timestamp a, Timestamp b) public pure returns (bool isAfter) {
|
88
|
+
return gtTimestamp(a, b);
|
89
|
+
}
|
90
|
+
|
91
|
+
/// @dev return true if Timestamp a is after or the same than Timestamp b
|
92
|
+
function gte(
|
93
|
+
Timestamp a,
|
94
|
+
Timestamp b
|
95
|
+
) public pure returns (bool isAfterOrSame) {
|
96
|
+
return gteTimestamp(a, b);
|
97
|
+
}
|
98
|
+
|
99
|
+
/// @dev return true if Timestamp a is before Timestamp b
|
100
|
+
function lt(Timestamp a, Timestamp b) public pure returns (bool isBefore) {
|
101
|
+
return ltTimestamp(a, b);
|
102
|
+
}
|
103
|
+
|
104
|
+
/// @dev return true if Timestamp a is before or the same than Timestamp b
|
105
|
+
function lte(
|
106
|
+
Timestamp a,
|
107
|
+
Timestamp b
|
108
|
+
) public pure returns (bool isBeforeOrSame) {
|
109
|
+
return lteTimestamp(a, b);
|
110
|
+
}
|
111
|
+
|
112
|
+
/// @dev return true if Timestamp a is equal to Timestamp b
|
113
|
+
function eq(Timestamp a, Timestamp b) public pure returns (bool isSame) {
|
114
|
+
return eqTimestamp(a, b);
|
115
|
+
}
|
116
|
+
|
117
|
+
/// @dev return true if Timestamp a is not equal to Timestamp b
|
118
|
+
function ne(
|
119
|
+
Timestamp a,
|
120
|
+
Timestamp b
|
121
|
+
) public pure returns (bool isDifferent) {
|
122
|
+
return neTimestamp(a, b);
|
123
|
+
}
|
124
|
+
|
125
|
+
/// @dev return true if Timestamp equals 0
|
126
|
+
function eqz(Timestamp timestamp) public pure returns (bool) {
|
127
|
+
return Timestamp.unwrap(timestamp) == 0;
|
128
|
+
}
|
129
|
+
|
130
|
+
/// @dev return true if Timestamp is larger than 0
|
131
|
+
function gtz(Timestamp timestamp) public pure returns (bool) {
|
132
|
+
return Timestamp.unwrap(timestamp) > 0;
|
133
|
+
}
|
134
|
+
|
135
|
+
/// @dev return true if Timestamp a is not equal to Timestamp b
|
136
|
+
function addSeconds(
|
137
|
+
Timestamp timestamp,
|
138
|
+
Seconds duration
|
139
|
+
) public pure returns (Timestamp) {
|
140
|
+
return toTimestamp(Timestamp.unwrap(timestamp) + duration.toInt());
|
141
|
+
}
|
142
|
+
|
143
|
+
function toInt(Timestamp timestamp) public pure returns (uint256) {
|
144
|
+
return uint256(uint40(Timestamp.unwrap(timestamp)));
|
145
|
+
}
|
146
|
+
}
|
@@ -0,0 +1,351 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
/// @dev UFixed is a fixed point number with 18 decimals precision.
|
5
|
+
type UFixed is uint256;
|
6
|
+
|
7
|
+
using {
|
8
|
+
addUFixed as +,
|
9
|
+
subUFixed as -,
|
10
|
+
mulUFixed as *,
|
11
|
+
divUFixed as /,
|
12
|
+
gtUFixed as >,
|
13
|
+
gteUFixed as >=,
|
14
|
+
ltUFixed as <,
|
15
|
+
lteUFixed as <=,
|
16
|
+
eqUFixed as ==,
|
17
|
+
neUFixed as !=,
|
18
|
+
UFixedLib.gt,
|
19
|
+
UFixedLib.gtz,
|
20
|
+
UFixedLib.toInt,
|
21
|
+
UFixedLib.toInt1000
|
22
|
+
} for UFixed global;
|
23
|
+
|
24
|
+
// TODO move to UFixedLib and rename to zero()
|
25
|
+
function zeroUFixed() pure returns (UFixed zero) {
|
26
|
+
return UFixed.wrap(0);
|
27
|
+
}
|
28
|
+
|
29
|
+
function addUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
30
|
+
return UFixed.wrap(UFixed.unwrap(a) + UFixed.unwrap(b));
|
31
|
+
}
|
32
|
+
|
33
|
+
function subUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
34
|
+
if (a < b) {
|
35
|
+
revert UFixedLib.UFixedLibNegativeResult();
|
36
|
+
}
|
37
|
+
return UFixed.wrap(UFixed.unwrap(a) - UFixed.unwrap(b));
|
38
|
+
}
|
39
|
+
|
40
|
+
function mulUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
41
|
+
return
|
42
|
+
UFixed.wrap(MathLib.mulDiv(UFixed.unwrap(a), UFixed.unwrap(b), 10 ** 18));
|
43
|
+
}
|
44
|
+
|
45
|
+
function divUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
46
|
+
if (UFixed.unwrap(b) == 0) {
|
47
|
+
revert UFixedLib.UFixedLibDivisionByZero();
|
48
|
+
}
|
49
|
+
|
50
|
+
return
|
51
|
+
UFixed.wrap(MathLib.mulDiv(UFixed.unwrap(a), 10 ** 18, UFixed.unwrap(b)));
|
52
|
+
}
|
53
|
+
|
54
|
+
function gtUFixed(UFixed a, UFixed b) pure returns (bool isGreaterThan) {
|
55
|
+
return UFixed.unwrap(a) > UFixed.unwrap(b);
|
56
|
+
}
|
57
|
+
|
58
|
+
function gteUFixed(UFixed a, UFixed b) pure returns (bool isGreaterThan) {
|
59
|
+
return UFixed.unwrap(a) >= UFixed.unwrap(b);
|
60
|
+
}
|
61
|
+
|
62
|
+
function ltUFixed(UFixed a, UFixed b) pure returns (bool isGreaterThan) {
|
63
|
+
return UFixed.unwrap(a) < UFixed.unwrap(b);
|
64
|
+
}
|
65
|
+
|
66
|
+
function lteUFixed(UFixed a, UFixed b) pure returns (bool isGreaterThan) {
|
67
|
+
return UFixed.unwrap(a) <= UFixed.unwrap(b);
|
68
|
+
}
|
69
|
+
|
70
|
+
function eqUFixed(UFixed a, UFixed b) pure returns (bool isEqual) {
|
71
|
+
return UFixed.unwrap(a) == UFixed.unwrap(b);
|
72
|
+
}
|
73
|
+
|
74
|
+
function neUFixed(UFixed a, UFixed b) pure returns (bool isEqual) {
|
75
|
+
return UFixed.unwrap(a) != UFixed.unwrap(b);
|
76
|
+
}
|
77
|
+
|
78
|
+
function gtzUFixed(UFixed a) pure returns (bool isZero) {
|
79
|
+
return UFixed.unwrap(a) > 0;
|
80
|
+
}
|
81
|
+
|
82
|
+
function eqzUFixed(UFixed a) pure returns (bool isZero) {
|
83
|
+
return UFixed.unwrap(a) == 0;
|
84
|
+
}
|
85
|
+
|
86
|
+
function deltaUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
87
|
+
if (a > b) {
|
88
|
+
return a - b;
|
89
|
+
}
|
90
|
+
|
91
|
+
return b - a;
|
92
|
+
}
|
93
|
+
|
94
|
+
/// @dev copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.3/contracts/utils/math/Math.sol
|
95
|
+
library MathLib {
|
96
|
+
|
97
|
+
error MathLigMulDivOverflow();
|
98
|
+
|
99
|
+
enum Rounding {
|
100
|
+
Down, // Toward negative infinity
|
101
|
+
Up, // Toward infinity
|
102
|
+
Zero // Toward zero
|
103
|
+
}
|
104
|
+
|
105
|
+
/**
|
106
|
+
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
|
107
|
+
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
|
108
|
+
* with further edits by Uniswap Labs also under MIT license.
|
109
|
+
*/
|
110
|
+
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
|
111
|
+
unchecked {
|
112
|
+
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
|
113
|
+
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
|
114
|
+
// variables such that product = prod1 * 2^256 + prod0.
|
115
|
+
uint256 prod0; // Least significant 256 bits of the product
|
116
|
+
uint256 prod1; // Most significant 256 bits of the product
|
117
|
+
assembly {
|
118
|
+
let mm := mulmod(x, y, not(0))
|
119
|
+
prod0 := mul(x, y)
|
120
|
+
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
|
121
|
+
}
|
122
|
+
|
123
|
+
// Handle non-overflow cases, 256 by 256 division.
|
124
|
+
if (prod1 == 0) {
|
125
|
+
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
|
126
|
+
// The surrounding unchecked block does not change this fact.
|
127
|
+
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
|
128
|
+
return prod0 / denominator;
|
129
|
+
}
|
130
|
+
|
131
|
+
// Make sure the result is less than 2^256. Also prevents denominator == 0.
|
132
|
+
if (denominator <= prod1) {
|
133
|
+
revert MathLigMulDivOverflow();
|
134
|
+
}
|
135
|
+
|
136
|
+
///////////////////////////////////////////////
|
137
|
+
// 512 by 256 division.
|
138
|
+
///////////////////////////////////////////////
|
139
|
+
|
140
|
+
// Make division exact by subtracting the remainder from [prod1 prod0].
|
141
|
+
uint256 remainder;
|
142
|
+
assembly {
|
143
|
+
// Compute remainder using mulmod.
|
144
|
+
remainder := mulmod(x, y, denominator)
|
145
|
+
|
146
|
+
// Subtract 256 bit number from 512 bit number.
|
147
|
+
prod1 := sub(prod1, gt(remainder, prod0))
|
148
|
+
prod0 := sub(prod0, remainder)
|
149
|
+
}
|
150
|
+
|
151
|
+
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
|
152
|
+
// See https://cs.stackexchange.com/q/138556/92363.
|
153
|
+
|
154
|
+
// Does not overflow because the denominator cannot be zero at this stage in the function.
|
155
|
+
uint256 twos = denominator & (~denominator + 1);
|
156
|
+
assembly {
|
157
|
+
// Divide denominator by twos.
|
158
|
+
denominator := div(denominator, twos)
|
159
|
+
|
160
|
+
// Divide [prod1 prod0] by twos.
|
161
|
+
prod0 := div(prod0, twos)
|
162
|
+
|
163
|
+
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
|
164
|
+
twos := add(div(sub(0, twos), twos), 1)
|
165
|
+
}
|
166
|
+
|
167
|
+
// Shift in bits from prod1 into prod0.
|
168
|
+
prod0 |= prod1 * twos;
|
169
|
+
|
170
|
+
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
|
171
|
+
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
|
172
|
+
// four bits. That is, denominator * inv = 1 mod 2^4.
|
173
|
+
uint256 inverse = (3 * denominator) ^ 2;
|
174
|
+
|
175
|
+
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
|
176
|
+
// in modular arithmetic, doubling the correct bits in each step.
|
177
|
+
inverse *= 2 - denominator * inverse; // inverse mod 2^8
|
178
|
+
inverse *= 2 - denominator * inverse; // inverse mod 2^16
|
179
|
+
inverse *= 2 - denominator * inverse; // inverse mod 2^32
|
180
|
+
inverse *= 2 - denominator * inverse; // inverse mod 2^64
|
181
|
+
inverse *= 2 - denominator * inverse; // inverse mod 2^128
|
182
|
+
inverse *= 2 - denominator * inverse; // inverse mod 2^256
|
183
|
+
|
184
|
+
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
|
185
|
+
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
|
186
|
+
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
|
187
|
+
// is no longer required.
|
188
|
+
result = prod0 * inverse;
|
189
|
+
return result;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
/**
|
194
|
+
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
|
195
|
+
*/
|
196
|
+
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
|
197
|
+
uint256 result = mulDiv(x, y, denominator);
|
198
|
+
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
|
199
|
+
result += 1;
|
200
|
+
}
|
201
|
+
return result;
|
202
|
+
}
|
203
|
+
|
204
|
+
}
|
205
|
+
|
206
|
+
library UFixedLib {
|
207
|
+
error UFixedLibNegativeResult();
|
208
|
+
error UFixedLibDivisionByZero();
|
209
|
+
|
210
|
+
error UFixedLibExponentTooSmall(int8 exp);
|
211
|
+
error UFixedLibExponentTooLarge(int8 exp);
|
212
|
+
|
213
|
+
int8 public constant EXP = 18;
|
214
|
+
uint256 public constant MULTIPLIER = 10 ** uint256(int256(EXP));
|
215
|
+
uint256 public constant MULTIPLIER_HALF = MULTIPLIER / 2;
|
216
|
+
|
217
|
+
/// @dev returns the rounding mode DOWN - 0.4 becomes 0, 0.5 becomes 0, 0.6 becomes 0
|
218
|
+
function ROUNDING_DOWN() public pure returns (uint8) {
|
219
|
+
return uint8(0);
|
220
|
+
}
|
221
|
+
|
222
|
+
/// @dev returns the rounding mode UP - 0.4 becomes 1, 0.5 becomes 1, 0.6 becomes 1
|
223
|
+
function ROUNDING_UP() public pure returns (uint8) {
|
224
|
+
return uint8(1);
|
225
|
+
}
|
226
|
+
|
227
|
+
/// @dev returns the rounding mode HALF_UP - 0.4 becomes 0, 0.5 becomes 1, 0.6 becomes 1
|
228
|
+
function ROUNDING_HALF_UP() public pure returns (uint8) {
|
229
|
+
return uint8(2);
|
230
|
+
}
|
231
|
+
|
232
|
+
/// @dev Converts the uint256 to a UFixed.
|
233
|
+
function toUFixed(uint256 a) public pure returns (UFixed) {
|
234
|
+
return UFixed.wrap(a * MULTIPLIER);
|
235
|
+
}
|
236
|
+
|
237
|
+
/// @dev Converts the uint256 to a UFixed with given exponent.
|
238
|
+
function toUFixed(uint256 a, int8 exp) public pure returns (UFixed) {
|
239
|
+
if (EXP + exp < 0) {
|
240
|
+
revert UFixedLibExponentTooSmall(exp);
|
241
|
+
}
|
242
|
+
if (EXP + exp > 64) {
|
243
|
+
revert UFixedLibExponentTooLarge(exp);
|
244
|
+
}
|
245
|
+
|
246
|
+
return UFixed.wrap(a * 10 ** uint8(EXP + exp));
|
247
|
+
}
|
248
|
+
|
249
|
+
/// @dev returns the decimals precision of the UFixed type
|
250
|
+
function decimals() public pure returns (uint256) {
|
251
|
+
return uint8(EXP);
|
252
|
+
}
|
253
|
+
|
254
|
+
/// @dev Converts a UFixed to a uint256.
|
255
|
+
function toInt(UFixed a) public pure returns (uint256) {
|
256
|
+
return toIntWithRounding(a, ROUNDING_HALF_UP());
|
257
|
+
}
|
258
|
+
|
259
|
+
/// @dev Converts a UFixed to a uint256.
|
260
|
+
function toInt1000(UFixed a) public pure returns (uint256) {
|
261
|
+
return toIntWithRounding(toUFixed(1000) * a, ROUNDING_HALF_UP());
|
262
|
+
}
|
263
|
+
|
264
|
+
/// @dev Converts a UFixed to a uint256 with given rounding mode.
|
265
|
+
function toIntWithRounding(UFixed a, uint8 rounding) public pure returns (uint256) {
|
266
|
+
if (rounding == ROUNDING_HALF_UP()) {
|
267
|
+
return
|
268
|
+
MathLib.mulDiv(
|
269
|
+
UFixed.unwrap(a) + MULTIPLIER_HALF,
|
270
|
+
1,
|
271
|
+
MULTIPLIER,
|
272
|
+
MathLib.Rounding.Down
|
273
|
+
);
|
274
|
+
} else if (rounding == ROUNDING_DOWN()) {
|
275
|
+
return
|
276
|
+
MathLib.mulDiv(
|
277
|
+
UFixed.unwrap(a),
|
278
|
+
1,
|
279
|
+
MULTIPLIER,
|
280
|
+
MathLib.Rounding.Down
|
281
|
+
);
|
282
|
+
} else {
|
283
|
+
return
|
284
|
+
MathLib.mulDiv(UFixed.unwrap(a), 1, MULTIPLIER, MathLib.Rounding.Up);
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
/// @dev adds two UFixed numbers
|
289
|
+
function add(UFixed a, UFixed b) public pure returns (UFixed) {
|
290
|
+
return addUFixed(a, b);
|
291
|
+
}
|
292
|
+
|
293
|
+
/// @dev subtracts two UFixed numbers
|
294
|
+
function sub(UFixed a, UFixed b) public pure returns (UFixed) {
|
295
|
+
return subUFixed(a, b);
|
296
|
+
}
|
297
|
+
|
298
|
+
/// @dev multiplies two UFixed numbers
|
299
|
+
function mul(UFixed a, UFixed b) public pure returns (UFixed) {
|
300
|
+
return mulUFixed(a, b);
|
301
|
+
}
|
302
|
+
|
303
|
+
/// @dev divides two UFixed numbers
|
304
|
+
function div(UFixed a, UFixed b) public pure returns (UFixed) {
|
305
|
+
return divUFixed(a, b);
|
306
|
+
}
|
307
|
+
|
308
|
+
/// @dev return true if UFixed a is greater than UFixed b
|
309
|
+
function gt(UFixed a, UFixed b) public pure returns (bool isGreaterThan) {
|
310
|
+
return gtUFixed(a, b);
|
311
|
+
}
|
312
|
+
|
313
|
+
/// @dev return true if UFixed a is greater than or equal to UFixed b
|
314
|
+
function gte(UFixed a, UFixed b) public pure returns (bool isGreaterThan) {
|
315
|
+
return gteUFixed(a, b);
|
316
|
+
}
|
317
|
+
|
318
|
+
/// @dev return true if UFixed a is less than UFixed b
|
319
|
+
function lt(UFixed a, UFixed b) public pure returns (bool isGreaterThan) {
|
320
|
+
return ltUFixed(a, b);
|
321
|
+
}
|
322
|
+
|
323
|
+
/// @dev return true if UFixed a is less than or equal to UFixed b
|
324
|
+
function lte(UFixed a, UFixed b) public pure returns (bool isGreaterThan) {
|
325
|
+
return lteUFixed(a, b);
|
326
|
+
}
|
327
|
+
|
328
|
+
/// @dev return true if UFixed a is equal to UFixed b
|
329
|
+
function eq(UFixed a, UFixed b) public pure returns (bool isEqual) {
|
330
|
+
return eqUFixed(a, b);
|
331
|
+
}
|
332
|
+
|
333
|
+
/// @dev return true if UFixed a is not zero
|
334
|
+
function gtz(UFixed a) public pure returns (bool isZero) {
|
335
|
+
return gtzUFixed(a);
|
336
|
+
}
|
337
|
+
|
338
|
+
/// @dev return true if UFixed a is zero
|
339
|
+
function eqz(UFixed a) public pure returns (bool isZero) {
|
340
|
+
return eqzUFixed(a);
|
341
|
+
}
|
342
|
+
|
343
|
+
function zero() public pure returns (UFixed) {
|
344
|
+
return UFixed.wrap(0);
|
345
|
+
}
|
346
|
+
|
347
|
+
/// @dev return the absolute delta between two UFixed numbers
|
348
|
+
function delta(UFixed a, UFixed b) public pure returns (UFixed) {
|
349
|
+
return deltaUFixed(a, b);
|
350
|
+
}
|
351
|
+
}
|
@@ -0,0 +1,110 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
type VersionPart is uint8;
|
5
|
+
|
6
|
+
using {
|
7
|
+
versionPartGt as >,
|
8
|
+
versionPartEq as ==,
|
9
|
+
versionPartNe as !=,
|
10
|
+
VersionPartLib.eqz,
|
11
|
+
VersionPartLib.toInt
|
12
|
+
}
|
13
|
+
for VersionPart global;
|
14
|
+
|
15
|
+
function versionPartGt(VersionPart a, VersionPart b) pure returns(bool isGreaterThan) { return VersionPart.unwrap(a) > VersionPart.unwrap(b); }
|
16
|
+
function versionPartEq(VersionPart a, VersionPart b) pure returns(bool isSame) { return VersionPart.unwrap(a) == VersionPart.unwrap(b); }
|
17
|
+
function versionPartNe(VersionPart a, VersionPart b) pure returns(bool isSame) { return VersionPart.unwrap(a) != VersionPart.unwrap(b); }
|
18
|
+
|
19
|
+
library VersionPartLib {
|
20
|
+
function eqz(VersionPart a) external pure returns(bool) { return VersionPart.unwrap(a) == 0; }
|
21
|
+
function toInt(VersionPart a) external pure returns(uint256) { return VersionPart.unwrap(a); }
|
22
|
+
function toVersionPart(uint256 a) external pure returns(VersionPart) { return VersionPart.wrap(uint8(a)); }
|
23
|
+
}
|
24
|
+
|
25
|
+
type Version is uint24; // contains major,minor,patch version parts
|
26
|
+
|
27
|
+
using {
|
28
|
+
versionGt as >,
|
29
|
+
versionEq as ==,
|
30
|
+
VersionLib.toInt,
|
31
|
+
VersionLib.toUint64,
|
32
|
+
VersionLib.toMajorPart,
|
33
|
+
VersionLib.toVersionParts
|
34
|
+
}
|
35
|
+
for Version global;
|
36
|
+
|
37
|
+
function versionGt(Version a, Version b) pure returns(bool isGreaterThan) { return Version.unwrap(a) > Version.unwrap(b); }
|
38
|
+
function versionEq(Version a, Version b) pure returns(bool isSame) { return Version.unwrap(a) == Version.unwrap(b); }
|
39
|
+
|
40
|
+
library VersionLib {
|
41
|
+
function toInt(Version version) external pure returns(uint) { return Version.unwrap(version); }
|
42
|
+
|
43
|
+
function toUint64(Version version) external pure returns(uint64) { return Version.unwrap(version); }
|
44
|
+
|
45
|
+
function toMajorPart(Version version)
|
46
|
+
external
|
47
|
+
pure
|
48
|
+
returns(VersionPart major)
|
49
|
+
{
|
50
|
+
uint24 versionInt = Version.unwrap(version);
|
51
|
+
uint8 majorInt = uint8(versionInt >> 16);
|
52
|
+
return VersionPart.wrap(majorInt);
|
53
|
+
}
|
54
|
+
|
55
|
+
function toVersionParts(Version version)
|
56
|
+
external
|
57
|
+
pure
|
58
|
+
returns(
|
59
|
+
VersionPart major,
|
60
|
+
VersionPart minor,
|
61
|
+
VersionPart patch
|
62
|
+
)
|
63
|
+
{
|
64
|
+
uint24 versionInt = Version.unwrap(version);
|
65
|
+
uint8 majorInt = uint8(versionInt >> 16);
|
66
|
+
|
67
|
+
versionInt -= majorInt << 16;
|
68
|
+
uint8 minorInt = uint8(versionInt >> 8);
|
69
|
+
uint8 patchInt = uint8(versionInt - (minorInt << 8));
|
70
|
+
|
71
|
+
return (
|
72
|
+
VersionPart.wrap(majorInt),
|
73
|
+
VersionPart.wrap(minorInt),
|
74
|
+
VersionPart.wrap(patchInt)
|
75
|
+
);
|
76
|
+
}
|
77
|
+
|
78
|
+
function toVersionPart(uint256 versionPart) external pure returns(VersionPart) {
|
79
|
+
return VersionPart.wrap(uint8(versionPart));
|
80
|
+
}
|
81
|
+
|
82
|
+
function toVersion(
|
83
|
+
uint256 major,
|
84
|
+
uint256 minor,
|
85
|
+
uint256 patch
|
86
|
+
)
|
87
|
+
external
|
88
|
+
pure
|
89
|
+
returns(Version)
|
90
|
+
{
|
91
|
+
require(
|
92
|
+
major < 256 && minor < 256 && patch < 256,
|
93
|
+
"ERROR:VRS-010:VERSION_PART_TOO_BIG");
|
94
|
+
|
95
|
+
return Version.wrap(
|
96
|
+
uint24(
|
97
|
+
(major << 16) + (minor << 8) + patch));
|
98
|
+
}
|
99
|
+
|
100
|
+
// TODO check for overflow?
|
101
|
+
function toVersion(uint64 versionNumber) external pure returns(Version) {
|
102
|
+
//assert(versionNumber <= type(Version).max);
|
103
|
+
return Version.wrap(uint24(versionNumber));
|
104
|
+
}
|
105
|
+
|
106
|
+
// TODO rename to zero()
|
107
|
+
function zeroVersion() external pure returns(Version) {
|
108
|
+
return Version.wrap(0);
|
109
|
+
}
|
110
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {Version} from "../type/Version.sol";
|
5
|
+
|
6
|
+
/// IMPORTANT
|
7
|
+
// Upgradeable contract MUST:
|
8
|
+
// 1) inherit from Versionable
|
9
|
+
// 2) implement version() function
|
10
|
+
// 3) implement internal _initialize() function with onlyInitializing modifier
|
11
|
+
// 4) implement internal _upgrade() function with onlyInitializing modifier (1st version MUST revert)
|
12
|
+
// 5) have onlyInitialising modifier for each function callable inside _initialize()/_upgrade() (MUST use different functions for initialization/upgrade and normal operations)
|
13
|
+
// 6) use default empty constructor -> _disableInitializer() is called from Versionable contructor
|
14
|
+
// 7) use namespace storage (should this be needed)
|
15
|
+
// 8) since now inheritance is used for upgradability, contract MUST BE inherited ONLY by the next version
|
16
|
+
// Upgradeable contract SHOULD:
|
17
|
+
// 9) define all non private methods as virtual (in order to be able to upgrade them latter)
|
18
|
+
// otherwise, it is still possible to upgrade contract, but everyone who is using it will have to switch to a new fucntions
|
19
|
+
// in some cases this ok but not in the others...
|
20
|
+
//
|
21
|
+
// IMPORTANT
|
22
|
+
// If introducting/amending storage related to Versionable version MUST:
|
23
|
+
// 1) define namespace storage struct if accessing storage
|
24
|
+
// - DO NOT use structs inside, except
|
25
|
+
// - CAN use structs ONLY inside mappings
|
26
|
+
// 2) ALWAYS define private getter if accessing storage
|
27
|
+
// - MUST use default implementation, CAN change ONLY return type
|
28
|
+
|
29
|
+
interface IVersionable {
|
30
|
+
|
31
|
+
/**
|
32
|
+
* @dev IMPORTANT
|
33
|
+
* implementation MUST be guarded by initializer modifier
|
34
|
+
* new version MUST inherit from previous version
|
35
|
+
*/
|
36
|
+
function initializeVersionable(address activatedBy, bytes memory activationData) external;
|
37
|
+
|
38
|
+
/**
|
39
|
+
* @dev
|
40
|
+
* implementation MUST be guarded by reinitializer(version().toUint64()) modifier
|
41
|
+
* new version MUST inherit from previous version
|
42
|
+
* the first verion MUST revert
|
43
|
+
*/
|
44
|
+
function upgradeVersionable(bytes memory upgradeData) external;
|
45
|
+
|
46
|
+
/**
|
47
|
+
* @dev returns version of this contract
|
48
|
+
* each new implementation MUST implement this function
|
49
|
+
* version number MUST increase
|
50
|
+
*/
|
51
|
+
function getVersion() external pure returns(Version);
|
52
|
+
|
53
|
+
}
|