@etherisc/gif-next 0.0.2-e5ea33d → 0.0.2-e63124b-662
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +376 -20
- 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 +1505 -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 +1191 -0
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +4 -0
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +1394 -0
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +826 -0
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +900 -0
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +4 -0
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +843 -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 +289 -529
- 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 +446 -609
- 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 +1735 -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 +3591 -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 +1155 -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 +772 -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 +1063 -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 +1477 -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 +1134 -0
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +754 -0
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +703 -0
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +4 -0
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +959 -0
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +4 -0
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +1078 -0
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +4 -0
- package/artifacts/contracts/pool/Pool.sol/Pool.json +1269 -0
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +4 -0
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +1453 -0
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +742 -0
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +4 -0
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +863 -0
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +730 -0
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +4 -0
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +1299 -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 +1315 -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 +512 -0
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +4 -0
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +772 -0
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +720 -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 +966 -0
- package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +4 -0
- package/artifacts/contracts/product/IProductService.sol/IProductService.json +400 -0
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +1183 -0
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +766 -0
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +4 -0
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +1012 -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 +1257 -0
- package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +4 -0
- package/artifacts/contracts/product/ProductService.sol/ProductService.json +708 -0
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +702 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +252 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +733 -102
- 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 +1031 -120
- 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 +896 -0
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +1487 -0
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +4 -0
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +784 -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/ERC165.sol/ERC165.dbg.json +4 -0
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +73 -0
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/shared/IComponent.sol/IComponent.json +631 -0
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +4 -0
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +880 -0
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +4 -0
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +718 -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/{registry/Registry.sol/Registerable.json → shared/INftOwnable.sol/INftOwnable.json} +42 -77
- 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/{instance/pool/PoolModule.sol/PoolModule.json → shared/IRegisterable.sol/IRegisterable.json} +98 -79
- 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/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +4 -0
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +996 -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 +150 -0
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +4 -0
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +1438 -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 +460 -0
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +4 -0
- package/artifacts/contracts/staking/Staking.sol/Staking.json +2005 -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 +2237 -0
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +4 -0
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +571 -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 +345 -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 +312 -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 +198 -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 +293 -0
- package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +4 -0
- package/artifacts/contracts/type/UFixed.sol/MathLib.json +10 -0
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +4 -0
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +498 -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 +218 -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 +149 -0
- package/contracts/distribution/BasicDistributionAuthorization.sol +43 -0
- package/contracts/distribution/Distribution.sol +283 -0
- package/contracts/distribution/DistributionService.sol +288 -0
- package/contracts/distribution/DistributionServiceManager.sol +39 -0
- package/contracts/distribution/IDistributionComponent.sol +48 -0
- package/contracts/distribution/IDistributionService.sol +85 -0
- package/contracts/instance/BundleSet.sol +126 -0
- package/contracts/instance/IInstance.sol +85 -17
- package/contracts/instance/IInstanceService.sol +92 -0
- package/contracts/instance/Instance.sol +246 -56
- package/contracts/instance/InstanceAdmin.sol +266 -0
- package/contracts/instance/InstanceAuthorizationV3.sol +202 -0
- package/contracts/instance/InstanceReader.sol +405 -0
- package/contracts/instance/InstanceService.sol +443 -0
- package/contracts/instance/InstanceServiceManager.sol +40 -0
- package/contracts/instance/InstanceStore.sol +276 -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 +106 -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 +52 -0
- package/contracts/instance/module/IDistribution.sol +42 -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 +32 -0
- package/contracts/oracle/IOracleService.sol +65 -0
- package/contracts/oracle/Oracle.sol +157 -0
- package/contracts/oracle/OracleService.sol +278 -0
- package/contracts/oracle/OracleServiceManager.sol +39 -0
- package/contracts/pool/BasicPool.sol +164 -0
- package/contracts/pool/BasicPoolAuthorization.sol +49 -0
- package/contracts/pool/BundleService.sol +284 -0
- package/contracts/pool/BundleServiceManager.sol +39 -0
- package/contracts/pool/IBundleService.sol +106 -0
- package/contracts/pool/IPoolComponent.sol +52 -0
- package/contracts/pool/IPoolService.sol +150 -0
- package/contracts/pool/Pool.sol +311 -0
- package/contracts/pool/PoolService.sol +436 -0
- package/contracts/pool/PoolServiceManager.sol +39 -0
- package/contracts/product/ApplicationService.sol +230 -0
- package/contracts/product/ApplicationServiceManager.sol +38 -0
- package/contracts/product/BasicProduct.sol +82 -0
- package/contracts/product/BasicProductAuthorization.sol +40 -0
- package/contracts/product/ClaimService.sol +416 -0
- package/contracts/product/ClaimServiceManager.sol +38 -0
- package/contracts/product/IApplicationService.sol +62 -0
- package/contracts/product/IClaimService.sol +99 -0
- package/contracts/product/IPolicyService.sol +78 -0
- package/contracts/product/IPricingService.sol +39 -0
- package/contracts/product/IProductComponent.sol +39 -0
- package/contracts/product/IProductService.sol +33 -0
- package/contracts/product/PolicyService.sol +475 -0
- package/contracts/product/PolicyServiceManager.sol +39 -0
- package/contracts/product/PricingService.sol +300 -0
- package/contracts/product/PricingServiceManager.sol +39 -0
- package/contracts/product/Product.sol +392 -0
- package/contracts/product/ProductService.sol +99 -0
- package/contracts/product/ProductServiceManager.sol +39 -0
- package/contracts/registry/ChainNft.sol +144 -62
- package/contracts/registry/IRegistry.sol +105 -51
- package/contracts/registry/IRegistryService.sol +69 -0
- package/contracts/registry/ITransferInterceptor.sol +7 -0
- package/contracts/registry/Registry.sol +509 -142
- package/contracts/registry/RegistryAdmin.sol +365 -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 +487 -0
- package/contracts/registry/ServiceAuthorizationV3.sol +200 -0
- package/contracts/registry/TokenRegistry.sol +315 -0
- package/contracts/shared/Component.sol +281 -0
- package/contracts/shared/ComponentService.sol +581 -0
- package/contracts/shared/ComponentServiceManager.sol +35 -0
- package/contracts/shared/ComponentVerifyingService.sol +117 -0
- package/contracts/shared/ERC165.sol +27 -0
- package/contracts/shared/IComponent.sol +70 -0
- package/contracts/shared/IComponentService.sol +102 -0
- package/contracts/shared/IInstanceLinkedComponent.sol +50 -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/InstanceLinkedComponent.sol +151 -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 +102 -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 +58 -0
- package/contracts/staking/IStaking.sol +167 -0
- package/contracts/staking/IStakingService.sol +160 -0
- package/contracts/staking/StakeManagerLib.sol +231 -0
- package/contracts/staking/Staking.sol +510 -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 +411 -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 +128 -0
- package/contracts/{types → type}/Blocknumber.sol +21 -3
- 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 +89 -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 +81 -0
- package/contracts/type/Selector.sol +102 -0
- package/contracts/type/StateId.sol +135 -0
- package/contracts/type/String.sol +53 -0
- package/contracts/{types → type}/Timestamp.sol +41 -7
- package/contracts/type/UFixed.sol +332 -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 +21 -8
- 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 -213
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +0 -4
- package/artifacts/contracts/components/Product.sol/Product.json +0 -231
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +0 -4
- package/artifacts/contracts/experiment/errors/Require.sol/Require.json +0 -105
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +0 -4
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.json +0 -105
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/A.sol/A.json +0 -128
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.json +0 -42
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/B.sol/B.json +0 -76
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/C.sol/C.json +0 -89
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.json +0 -128
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.json +0 -37
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.json +0 -50
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.json +0 -63
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +0 -4
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.json +0 -10
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +0 -4
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.json +0 -10
- 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 -147
- 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/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 -167
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +0 -4
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.json +0 -452
- 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/RegistryLinked.dbg.json +0 -4
- package/artifacts/contracts/registry/Registry.sol/RegistryLinked.json +0 -60
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +0 -4
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +0 -174
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.json +0 -10
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +0 -92
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +0 -4
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +0 -174
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +0 -4
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.json +0 -453
- package/contracts/components/Component.sol +0 -60
- package/contracts/components/IPool.sol +0 -9
- package/contracts/components/IProduct.sol +0 -9
- package/contracts/components/Pool.sol +0 -22
- package/contracts/components/Product.sol +0 -55
- package/contracts/experiment/errors/Require.sol +0 -38
- package/contracts/experiment/errors/Revert.sol +0 -44
- package/contracts/experiment/inheritance/A.sol +0 -53
- package/contracts/experiment/inheritance/B.sol +0 -28
- package/contracts/experiment/inheritance/C.sol +0 -34
- package/contracts/experiment/inheritance/IA.sol +0 -13
- package/contracts/experiment/inheritance/IB.sol +0 -10
- package/contracts/experiment/inheritance/IC.sol +0 -12
- package/contracts/experiment/types/TypeA.sol +0 -47
- package/contracts/experiment/types/TypeB.sol +0 -29
- package/contracts/instance/access/Access.sol +0 -165
- package/contracts/instance/access/IAccess.sol +0 -63
- package/contracts/instance/component/ComponentModule.sol +0 -213
- package/contracts/instance/component/IComponent.sol +0 -73
- package/contracts/instance/policy/IPolicy.sol +0 -51
- package/contracts/instance/policy/PolicyModule.sol +0 -91
- package/contracts/instance/pool/IPoolModule.sol +0 -29
- package/contracts/instance/pool/PoolModule.sol +0 -73
- package/contracts/instance/product/IProductService.sol +0 -36
- package/contracts/instance/product/ProductService.sol +0 -112
- package/contracts/registry/IChainNft.sol +0 -21
- package/contracts/types/ChainId.sol +0 -38
- package/contracts/types/NftId.sol +0 -51
- package/contracts/types/UFixed.sol +0 -205
@@ -0,0 +1,332 @@
|
|
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.toInt,
|
19
|
+
UFixedLib.toInt1000,
|
20
|
+
UFixedLib.gtz
|
21
|
+
} for UFixed global;
|
22
|
+
|
23
|
+
// TODO move to UFixedLib and rename to zero()
|
24
|
+
function zeroUFixed() pure returns (UFixed zero) {
|
25
|
+
return UFixed.wrap(0);
|
26
|
+
}
|
27
|
+
|
28
|
+
function addUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
29
|
+
return UFixed.wrap(UFixed.unwrap(a) + UFixed.unwrap(b));
|
30
|
+
}
|
31
|
+
|
32
|
+
function subUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
33
|
+
require(a >= b, "ERROR:UFM-010:NEGATIVE_RESULT");
|
34
|
+
return UFixed.wrap(UFixed.unwrap(a) - UFixed.unwrap(b));
|
35
|
+
}
|
36
|
+
|
37
|
+
function mulUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
38
|
+
return
|
39
|
+
UFixed.wrap(MathLib.mulDiv(UFixed.unwrap(a), UFixed.unwrap(b), 10 ** 18));
|
40
|
+
}
|
41
|
+
|
42
|
+
function divUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
43
|
+
require(UFixed.unwrap(b) > 0, "ERROR:UFM-020:DIVISOR_ZERO");
|
44
|
+
|
45
|
+
return
|
46
|
+
UFixed.wrap(MathLib.mulDiv(UFixed.unwrap(a), 10 ** 18, UFixed.unwrap(b)));
|
47
|
+
}
|
48
|
+
|
49
|
+
function gtUFixed(UFixed a, UFixed b) pure returns (bool isGreaterThan) {
|
50
|
+
return UFixed.unwrap(a) > UFixed.unwrap(b);
|
51
|
+
}
|
52
|
+
|
53
|
+
function gteUFixed(UFixed a, UFixed b) pure returns (bool isGreaterThan) {
|
54
|
+
return UFixed.unwrap(a) >= UFixed.unwrap(b);
|
55
|
+
}
|
56
|
+
|
57
|
+
function ltUFixed(UFixed a, UFixed b) pure returns (bool isGreaterThan) {
|
58
|
+
return UFixed.unwrap(a) < UFixed.unwrap(b);
|
59
|
+
}
|
60
|
+
|
61
|
+
function lteUFixed(UFixed a, UFixed b) pure returns (bool isGreaterThan) {
|
62
|
+
return UFixed.unwrap(a) <= UFixed.unwrap(b);
|
63
|
+
}
|
64
|
+
|
65
|
+
function eqUFixed(UFixed a, UFixed b) pure returns (bool isEqual) {
|
66
|
+
return UFixed.unwrap(a) == UFixed.unwrap(b);
|
67
|
+
}
|
68
|
+
|
69
|
+
function neUFixed(UFixed a, UFixed b) pure returns (bool isEqual) {
|
70
|
+
return UFixed.unwrap(a) != UFixed.unwrap(b);
|
71
|
+
}
|
72
|
+
|
73
|
+
function gtzUFixed(UFixed a) pure returns (bool isZero) {
|
74
|
+
return UFixed.unwrap(a) > 0;
|
75
|
+
}
|
76
|
+
|
77
|
+
function eqzUFixed(UFixed a) pure returns (bool isZero) {
|
78
|
+
return UFixed.unwrap(a) == 0;
|
79
|
+
}
|
80
|
+
|
81
|
+
function deltaUFixed(UFixed a, UFixed b) pure returns (UFixed) {
|
82
|
+
if (a > b) {
|
83
|
+
return a - b;
|
84
|
+
}
|
85
|
+
|
86
|
+
return b - a;
|
87
|
+
}
|
88
|
+
|
89
|
+
/// @dev copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.3/contracts/utils/math/Math.sol
|
90
|
+
library MathLib {
|
91
|
+
|
92
|
+
enum Rounding {
|
93
|
+
Down, // Toward negative infinity
|
94
|
+
Up, // Toward infinity
|
95
|
+
Zero // Toward zero
|
96
|
+
}
|
97
|
+
|
98
|
+
/**
|
99
|
+
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
|
100
|
+
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
|
101
|
+
* with further edits by Uniswap Labs also under MIT license.
|
102
|
+
*/
|
103
|
+
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
|
104
|
+
unchecked {
|
105
|
+
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
|
106
|
+
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
|
107
|
+
// variables such that product = prod1 * 2^256 + prod0.
|
108
|
+
uint256 prod0; // Least significant 256 bits of the product
|
109
|
+
uint256 prod1; // Most significant 256 bits of the product
|
110
|
+
assembly {
|
111
|
+
let mm := mulmod(x, y, not(0))
|
112
|
+
prod0 := mul(x, y)
|
113
|
+
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
|
114
|
+
}
|
115
|
+
|
116
|
+
// Handle non-overflow cases, 256 by 256 division.
|
117
|
+
if (prod1 == 0) {
|
118
|
+
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
|
119
|
+
// The surrounding unchecked block does not change this fact.
|
120
|
+
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
|
121
|
+
return prod0 / denominator;
|
122
|
+
}
|
123
|
+
|
124
|
+
// Make sure the result is less than 2^256. Also prevents denominator == 0.
|
125
|
+
require(denominator > prod1, "Math: mulDiv overflow");
|
126
|
+
|
127
|
+
///////////////////////////////////////////////
|
128
|
+
// 512 by 256 division.
|
129
|
+
///////////////////////////////////////////////
|
130
|
+
|
131
|
+
// Make division exact by subtracting the remainder from [prod1 prod0].
|
132
|
+
uint256 remainder;
|
133
|
+
assembly {
|
134
|
+
// Compute remainder using mulmod.
|
135
|
+
remainder := mulmod(x, y, denominator)
|
136
|
+
|
137
|
+
// Subtract 256 bit number from 512 bit number.
|
138
|
+
prod1 := sub(prod1, gt(remainder, prod0))
|
139
|
+
prod0 := sub(prod0, remainder)
|
140
|
+
}
|
141
|
+
|
142
|
+
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
|
143
|
+
// See https://cs.stackexchange.com/q/138556/92363.
|
144
|
+
|
145
|
+
// Does not overflow because the denominator cannot be zero at this stage in the function.
|
146
|
+
uint256 twos = denominator & (~denominator + 1);
|
147
|
+
assembly {
|
148
|
+
// Divide denominator by twos.
|
149
|
+
denominator := div(denominator, twos)
|
150
|
+
|
151
|
+
// Divide [prod1 prod0] by twos.
|
152
|
+
prod0 := div(prod0, twos)
|
153
|
+
|
154
|
+
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
|
155
|
+
twos := add(div(sub(0, twos), twos), 1)
|
156
|
+
}
|
157
|
+
|
158
|
+
// Shift in bits from prod1 into prod0.
|
159
|
+
prod0 |= prod1 * twos;
|
160
|
+
|
161
|
+
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
|
162
|
+
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
|
163
|
+
// four bits. That is, denominator * inv = 1 mod 2^4.
|
164
|
+
uint256 inverse = (3 * denominator) ^ 2;
|
165
|
+
|
166
|
+
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
|
167
|
+
// in modular arithmetic, doubling the correct bits in each step.
|
168
|
+
inverse *= 2 - denominator * inverse; // inverse mod 2^8
|
169
|
+
inverse *= 2 - denominator * inverse; // inverse mod 2^16
|
170
|
+
inverse *= 2 - denominator * inverse; // inverse mod 2^32
|
171
|
+
inverse *= 2 - denominator * inverse; // inverse mod 2^64
|
172
|
+
inverse *= 2 - denominator * inverse; // inverse mod 2^128
|
173
|
+
inverse *= 2 - denominator * inverse; // inverse mod 2^256
|
174
|
+
|
175
|
+
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
|
176
|
+
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
|
177
|
+
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
|
178
|
+
// is no longer required.
|
179
|
+
result = prod0 * inverse;
|
180
|
+
return result;
|
181
|
+
}
|
182
|
+
}
|
183
|
+
|
184
|
+
/**
|
185
|
+
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
|
186
|
+
*/
|
187
|
+
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
|
188
|
+
uint256 result = mulDiv(x, y, denominator);
|
189
|
+
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
|
190
|
+
result += 1;
|
191
|
+
}
|
192
|
+
return result;
|
193
|
+
}
|
194
|
+
|
195
|
+
}
|
196
|
+
|
197
|
+
library UFixedLib {
|
198
|
+
int8 public constant EXP = 18;
|
199
|
+
uint256 public constant MULTIPLIER = 10 ** uint256(int256(EXP));
|
200
|
+
uint256 public constant MULTIPLIER_HALF = MULTIPLIER / 2;
|
201
|
+
|
202
|
+
/// @dev returns the rounding mode DOWN - 0.4 becomes 0, 0.5 becomes 0, 0.6 becomes 0
|
203
|
+
function ROUNDING_DOWN() public pure returns (uint8) {
|
204
|
+
return uint8(0);
|
205
|
+
}
|
206
|
+
|
207
|
+
/// @dev returns the rounding mode UP - 0.4 becomes 1, 0.5 becomes 1, 0.6 becomes 1
|
208
|
+
function ROUNDING_UP() public pure returns (uint8) {
|
209
|
+
return uint8(1);
|
210
|
+
}
|
211
|
+
|
212
|
+
/// @dev returns the rounding mode HALF_UP - 0.4 becomes 0, 0.5 becomes 1, 0.6 becomes 1
|
213
|
+
function ROUNDING_HALF_UP() public pure returns (uint8) {
|
214
|
+
return uint8(2);
|
215
|
+
}
|
216
|
+
|
217
|
+
/// @dev Converts the uint256 to a UFixed.
|
218
|
+
function toUFixed(uint256 a) public pure returns (UFixed) {
|
219
|
+
return UFixed.wrap(a * MULTIPLIER);
|
220
|
+
}
|
221
|
+
|
222
|
+
/// @dev Converts the uint256 to a UFixed with given exponent.
|
223
|
+
function toUFixed(uint256 a, int8 exp) public pure returns (UFixed) {
|
224
|
+
require(EXP + exp >= 0, "ERROR:FM-010:EXPONENT_TOO_SMALL");
|
225
|
+
require(EXP + exp <= 64, "ERROR:FM-011:EXPONENT_TOO_LARGE");
|
226
|
+
|
227
|
+
return UFixed.wrap(a * 10 ** uint8(EXP + exp));
|
228
|
+
}
|
229
|
+
|
230
|
+
/// @dev returns the decimals precision of the UFixed type
|
231
|
+
function decimals() public pure returns (uint256) {
|
232
|
+
return uint8(EXP);
|
233
|
+
}
|
234
|
+
|
235
|
+
/// @dev Converts a UFixed to a uint256.
|
236
|
+
function toInt(UFixed a) public pure returns (uint256) {
|
237
|
+
return toIntWithRounding(a, ROUNDING_HALF_UP());
|
238
|
+
}
|
239
|
+
|
240
|
+
/// @dev Converts a UFixed to a uint256.
|
241
|
+
function toInt1000(UFixed a) public pure returns (uint256) {
|
242
|
+
return toIntWithRounding(toUFixed(1000) * a, ROUNDING_HALF_UP());
|
243
|
+
}
|
244
|
+
|
245
|
+
/// @dev Converts a UFixed to a uint256 with given rounding mode.
|
246
|
+
function toIntWithRounding(UFixed a, uint8 rounding) public pure returns (uint256) {
|
247
|
+
if (rounding == ROUNDING_HALF_UP()) {
|
248
|
+
return
|
249
|
+
MathLib.mulDiv(
|
250
|
+
UFixed.unwrap(a) + MULTIPLIER_HALF,
|
251
|
+
1,
|
252
|
+
MULTIPLIER,
|
253
|
+
MathLib.Rounding.Down
|
254
|
+
);
|
255
|
+
} else if (rounding == ROUNDING_DOWN()) {
|
256
|
+
return
|
257
|
+
MathLib.mulDiv(
|
258
|
+
UFixed.unwrap(a),
|
259
|
+
1,
|
260
|
+
MULTIPLIER,
|
261
|
+
MathLib.Rounding.Down
|
262
|
+
);
|
263
|
+
} else {
|
264
|
+
return
|
265
|
+
MathLib.mulDiv(UFixed.unwrap(a), 1, MULTIPLIER, MathLib.Rounding.Up);
|
266
|
+
}
|
267
|
+
}
|
268
|
+
|
269
|
+
/// @dev adds two UFixed numbers
|
270
|
+
function add(UFixed a, UFixed b) public pure returns (UFixed) {
|
271
|
+
return addUFixed(a, b);
|
272
|
+
}
|
273
|
+
|
274
|
+
/// @dev subtracts two UFixed numbers
|
275
|
+
function sub(UFixed a, UFixed b) public pure returns (UFixed) {
|
276
|
+
return subUFixed(a, b);
|
277
|
+
}
|
278
|
+
|
279
|
+
/// @dev multiplies two UFixed numbers
|
280
|
+
function mul(UFixed a, UFixed b) public pure returns (UFixed) {
|
281
|
+
return mulUFixed(a, b);
|
282
|
+
}
|
283
|
+
|
284
|
+
/// @dev divides two UFixed numbers
|
285
|
+
function div(UFixed a, UFixed b) public pure returns (UFixed) {
|
286
|
+
return divUFixed(a, b);
|
287
|
+
}
|
288
|
+
|
289
|
+
/// @dev return true if UFixed a is greater than UFixed b
|
290
|
+
function gt(UFixed a, UFixed b) public pure returns (bool isGreaterThan) {
|
291
|
+
return gtUFixed(a, b);
|
292
|
+
}
|
293
|
+
|
294
|
+
/// @dev return true if UFixed a is greater than or equal to UFixed b
|
295
|
+
function gte(UFixed a, UFixed b) public pure returns (bool isGreaterThan) {
|
296
|
+
return gteUFixed(a, b);
|
297
|
+
}
|
298
|
+
|
299
|
+
/// @dev return true if UFixed a is less than UFixed b
|
300
|
+
function lt(UFixed a, UFixed b) public pure returns (bool isGreaterThan) {
|
301
|
+
return ltUFixed(a, b);
|
302
|
+
}
|
303
|
+
|
304
|
+
/// @dev return true if UFixed a is less than or equal to UFixed b
|
305
|
+
function lte(UFixed a, UFixed b) public pure returns (bool isGreaterThan) {
|
306
|
+
return lteUFixed(a, b);
|
307
|
+
}
|
308
|
+
|
309
|
+
/// @dev return true if UFixed a is equal to UFixed b
|
310
|
+
function eq(UFixed a, UFixed b) public pure returns (bool isEqual) {
|
311
|
+
return eqUFixed(a, b);
|
312
|
+
}
|
313
|
+
|
314
|
+
/// @dev return true if UFixed a is not zero
|
315
|
+
function gtz(UFixed a) public pure returns (bool isZero) {
|
316
|
+
return gtzUFixed(a);
|
317
|
+
}
|
318
|
+
|
319
|
+
/// @dev return true if UFixed a is zero
|
320
|
+
function eqz(UFixed a) public pure returns (bool isZero) {
|
321
|
+
return eqzUFixed(a);
|
322
|
+
}
|
323
|
+
|
324
|
+
function zero() public pure returns (UFixed) {
|
325
|
+
return UFixed.wrap(0);
|
326
|
+
}
|
327
|
+
|
328
|
+
/// @dev return the absolute delta between two UFixed numbers
|
329
|
+
function delta(UFixed a, UFixed b) public pure returns (UFixed) {
|
330
|
+
return deltaUFixed(a, b);
|
331
|
+
}
|
332
|
+
}
|
@@ -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
|
+
}
|
@@ -0,0 +1,198 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
|
5
|
+
import {ITransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
|
6
|
+
|
7
|
+
import {Blocknumber, blockNumber} from "../type/Blocknumber.sol";
|
8
|
+
import {IVersionable} from "./IVersionable.sol";
|
9
|
+
import {NftId} from "../type/NftId.sol";
|
10
|
+
import {NftOwnable} from "../shared/NftOwnable.sol";
|
11
|
+
import {Timestamp, TimestampLib} from "../type/Timestamp.sol";
|
12
|
+
import {UpgradableProxyWithAdmin} from "./UpgradableProxyWithAdmin.sol";
|
13
|
+
import {Version, VersionLib} from "../type/Version.sol";
|
14
|
+
|
15
|
+
/// @dev manages proxy deployments for upgradable contracs of type IVersionable
|
16
|
+
contract ProxyManager is
|
17
|
+
NftOwnable
|
18
|
+
{
|
19
|
+
|
20
|
+
struct VersionInfo {
|
21
|
+
Version version;
|
22
|
+
address implementation;
|
23
|
+
address activatedBy;
|
24
|
+
Timestamp activatedAt;
|
25
|
+
Blocknumber activatedIn;
|
26
|
+
}
|
27
|
+
|
28
|
+
event LogProxyManagerVersionableDeployed(address indexed proxy, address initialImplementation);
|
29
|
+
event LogProxyManagerVersionableUpgraded(address indexed proxy, address upgradedImplementation);
|
30
|
+
|
31
|
+
error ErrorProxyManagerAlreadyDeployed();
|
32
|
+
error ErrorProxyManagerNotYetDeployed();
|
33
|
+
|
34
|
+
error ErrorProxyManagerZeroVersion();
|
35
|
+
error ErrorProxyManagerNextVersionNotIncreasing(Version nextVersion);
|
36
|
+
|
37
|
+
UpgradableProxyWithAdmin internal _proxy;
|
38
|
+
|
39
|
+
// state to keep version history
|
40
|
+
mapping(Version version => VersionInfo info) _versionHistory;
|
41
|
+
Version [] _versions;
|
42
|
+
|
43
|
+
/// @dev only used to capture proxy owner
|
44
|
+
constructor(address registry)
|
45
|
+
{
|
46
|
+
initializeProxyManager(registry);
|
47
|
+
}
|
48
|
+
|
49
|
+
function initializeProxyManager(address registry)
|
50
|
+
public
|
51
|
+
initializer()
|
52
|
+
{
|
53
|
+
initializeNftOwnable(msg.sender, registry);
|
54
|
+
}
|
55
|
+
|
56
|
+
/// @dev deploy initial contract
|
57
|
+
function deploy(address initialImplementation, bytes memory initializationData)
|
58
|
+
public
|
59
|
+
virtual
|
60
|
+
onlyOwner()
|
61
|
+
returns (IVersionable versionable)
|
62
|
+
{
|
63
|
+
if (_versions.length > 0) {
|
64
|
+
revert ErrorProxyManagerAlreadyDeployed();
|
65
|
+
}
|
66
|
+
|
67
|
+
address currentProxyOwner = getOwner(); // used by implementation
|
68
|
+
address initialProxyAdminOwner = address(this); // used by proxy
|
69
|
+
|
70
|
+
_proxy = new UpgradableProxyWithAdmin(
|
71
|
+
initialImplementation,
|
72
|
+
initialProxyAdminOwner,
|
73
|
+
getDeployData(currentProxyOwner, initializationData)
|
74
|
+
);
|
75
|
+
|
76
|
+
versionable = IVersionable(address(_proxy));
|
77
|
+
_updateVersionHistory(versionable.getVersion(), initialImplementation, currentProxyOwner);
|
78
|
+
|
79
|
+
emit LogProxyManagerVersionableDeployed(address(_proxy), initialImplementation);
|
80
|
+
}
|
81
|
+
|
82
|
+
function deployDetermenistic(address initialImplementation, bytes memory initializationData, bytes32 salt)
|
83
|
+
public
|
84
|
+
virtual
|
85
|
+
onlyOwner()
|
86
|
+
returns (IVersionable versionable)
|
87
|
+
{
|
88
|
+
if (_versions.length > 0) {
|
89
|
+
revert ErrorProxyManagerAlreadyDeployed();
|
90
|
+
}
|
91
|
+
|
92
|
+
address currentProxyOwner = getOwner();
|
93
|
+
address initialProxyAdminOwner = address(this);
|
94
|
+
|
95
|
+
_proxy = new UpgradableProxyWithAdmin{salt: salt}(
|
96
|
+
initialImplementation,
|
97
|
+
initialProxyAdminOwner,
|
98
|
+
getDeployData(currentProxyOwner, initializationData)
|
99
|
+
);
|
100
|
+
|
101
|
+
versionable = IVersionable(address(_proxy));
|
102
|
+
_updateVersionHistory(versionable.getVersion(), initialImplementation, currentProxyOwner);
|
103
|
+
|
104
|
+
emit LogProxyManagerVersionableDeployed(address(_proxy), initialImplementation);
|
105
|
+
}
|
106
|
+
|
107
|
+
/// @dev upgrade existing contract
|
108
|
+
function upgrade(address newImplementation, bytes memory upgradeData)
|
109
|
+
public
|
110
|
+
virtual
|
111
|
+
onlyOwner()
|
112
|
+
returns (IVersionable versionable)
|
113
|
+
{
|
114
|
+
if (_versions.length == 0) {
|
115
|
+
revert ErrorProxyManagerNotYetDeployed();
|
116
|
+
}
|
117
|
+
|
118
|
+
address currentProxyOwner = getOwner();
|
119
|
+
ProxyAdmin proxyAdmin = getProxy().getProxyAdmin();
|
120
|
+
ITransparentUpgradeableProxy proxy = ITransparentUpgradeableProxy(address(_proxy));
|
121
|
+
|
122
|
+
proxyAdmin.upgradeAndCall(
|
123
|
+
proxy,
|
124
|
+
newImplementation,
|
125
|
+
getUpgradeData(upgradeData));
|
126
|
+
|
127
|
+
versionable = IVersionable(address(_proxy));
|
128
|
+
_updateVersionHistory(versionable.getVersion(), newImplementation, currentProxyOwner);
|
129
|
+
|
130
|
+
emit LogProxyManagerVersionableUpgraded(address(_proxy), newImplementation);
|
131
|
+
|
132
|
+
}
|
133
|
+
|
134
|
+
function linkToProxy() public returns (NftId) {
|
135
|
+
return _linkToNftOwnable(address(_proxy));
|
136
|
+
}
|
137
|
+
|
138
|
+
function getDeployData(address proxyOwner, bytes memory deployData) public pure returns (bytes memory data) {
|
139
|
+
return abi.encodeWithSelector(
|
140
|
+
IVersionable.initializeVersionable.selector,
|
141
|
+
proxyOwner,
|
142
|
+
deployData);
|
143
|
+
}
|
144
|
+
|
145
|
+
function getUpgradeData(bytes memory upgradeData) public pure returns (bytes memory data) {
|
146
|
+
return abi.encodeWithSelector(
|
147
|
+
IVersionable.upgradeVersionable.selector,
|
148
|
+
upgradeData);
|
149
|
+
}
|
150
|
+
|
151
|
+
function getProxy() public view returns (UpgradableProxyWithAdmin) {
|
152
|
+
return _proxy;
|
153
|
+
}
|
154
|
+
|
155
|
+
function getVersion() external view virtual returns(Version) {
|
156
|
+
return IVersionable(address(_proxy)).getVersion();
|
157
|
+
}
|
158
|
+
|
159
|
+
function getVersionCount() external view returns(uint256) {
|
160
|
+
return _versions.length;
|
161
|
+
}
|
162
|
+
|
163
|
+
function getVersion(uint256 idx) external view returns(Version) {
|
164
|
+
return _versions[idx];
|
165
|
+
}
|
166
|
+
|
167
|
+
function getVersionInfo(Version _version) external view returns(VersionInfo memory) {
|
168
|
+
return _versionHistory[_version];
|
169
|
+
}
|
170
|
+
|
171
|
+
function _updateVersionHistory(
|
172
|
+
Version newVersion,
|
173
|
+
address implementation,
|
174
|
+
address activatedBy
|
175
|
+
)
|
176
|
+
private
|
177
|
+
{
|
178
|
+
if(newVersion == VersionLib.zeroVersion()) {
|
179
|
+
revert ErrorProxyManagerZeroVersion();
|
180
|
+
}
|
181
|
+
|
182
|
+
if(_versions.length > 0) {
|
183
|
+
if(newVersion.toInt() <= _versions[_versions.length-1].toInt()) {
|
184
|
+
revert ErrorProxyManagerNextVersionNotIncreasing(newVersion);
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
// update version history
|
189
|
+
_versions.push(newVersion);
|
190
|
+
_versionHistory[newVersion] = VersionInfo(
|
191
|
+
newVersion,
|
192
|
+
implementation,
|
193
|
+
activatedBy,
|
194
|
+
TimestampLib.blockTimestamp(),
|
195
|
+
blockNumber()
|
196
|
+
);
|
197
|
+
}
|
198
|
+
}
|