@etherisc/gif-next 0.0.2-e6ad61d-739 → 0.0.2-e769e2e-077
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +337 -19
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +4 -0
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +1410 -0
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +4 -0
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +1343 -0
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +760 -0
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +969 -0
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +4 -0
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +808 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +4 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +778 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +312 -1138
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +660 -0
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +439 -1219
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +1348 -0
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +132 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1570 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +1039 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +664 -0
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +3500 -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 +190 -0
- package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.json +256 -0
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +237 -0
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +4 -0
- package/artifacts/contracts/instance/{access/IAccess.sol/IAccess.json → module/IBundle.sol/IBundle.json} +2 -2
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
- package/artifacts/contracts/instance/{treasury/ITreasury.sol/ITreasury.json → module/IComponents.sol/IComponents.json} +2 -2
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +4 -0
- package/artifacts/contracts/instance/{component/IComponent.sol/IComponent.json → module/IDistribution.sol/IDistribution.json} +2 -2
- 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/{pool/IPoolModule.sol/IPool.json → module/IRisk.sol/IRisk.json} +2 -2
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +1091 -0
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +684 -0
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +684 -0
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +4 -0
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +1148 -0
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +4 -0
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +1044 -0
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +4 -0
- package/artifacts/contracts/pool/Pool.sol/Pool.json +1559 -0
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +4 -0
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +1411 -0
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +680 -0
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +4 -0
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +820 -0
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +660 -0
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +4 -0
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +1264 -0
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +748 -0
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +493 -0
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +4 -0
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +753 -0
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +701 -0
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +4 -0
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +530 -0
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +4 -0
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +989 -0
- package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +4 -0
- package/artifacts/contracts/product/IProductService.sol/IProductService.json +381 -0
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +1132 -0
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +692 -0
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +4 -0
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +969 -0
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +716 -0
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +4 -0
- package/artifacts/contracts/product/Product.sol/Product.json +1391 -0
- package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +4 -0
- package/artifacts/contracts/product/ProductService.sol/ProductService.json +673 -0
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +636 -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 +648 -27
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +990 -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 +846 -97
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +308 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +1290 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +661 -0
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +688 -0
- package/artifacts/contracts/registry/ServiceAuthorizationsLib.sol/ServiceAuthorizationsLib.dbg.json +4 -0
- package/artifacts/contracts/registry/ServiceAuthorizationsLib.sol/ServiceAuthorizationsLib.json +137 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +4 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +611 -0
- package/artifacts/contracts/shared/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/shared/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/shared/Component.sol/Component.json +890 -0
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +1461 -0
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +4 -0
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +736 -0
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +4 -0
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +520 -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 +625 -0
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +4 -0
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +854 -0
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +4 -0
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +699 -0
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.json +478 -0
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +4 -0
- package/artifacts/contracts/{instance/lifecycle/ILifecycle.sol/ILifecycleModule.json → shared/ILifecycle.sol/ILifecycle.json} +10 -77
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +4 -0
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +125 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +189 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +4 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +175 -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 +327 -0
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +4 -0
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +55 -0
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +4 -0
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +1030 -0
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +581 -0
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +4 -0
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +194 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +4 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +238 -0
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +302 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +4 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +569 -0
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +4 -0
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +347 -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/{registry/IChainNft.sol/IChainNft.json → shared/Service.sol/Service.json} +256 -220
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +150 -0
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +129 -0
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +4 -0
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +78 -0
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +4 -0
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +1607 -0
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +4 -0
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +545 -0
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +4 -0
- package/artifacts/contracts/staking/Staking.sol/Staking.json +2074 -0
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +676 -0
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +805 -0
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +636 -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 +281 -0
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +4 -0
- package/artifacts/contracts/{types → type}/Blocknumber.sol/BlocknumberLib.json +16 -3
- 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 +185 -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/{types → type}/ObjectType.sol/ObjectTypeLib.json +3 -3
- 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/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 +156 -0
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +4 -0
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +124 -0
- package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +4 -0
- package/artifacts/contracts/{types → type}/StateId.sol/StateIdLib.json +3 -3
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +4 -0
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +280 -0
- package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +4 -0
- package/artifacts/contracts/{types/ChainId.sol/ChainIdLib.json → type/UFixed.sol/MathLib.json} +4 -4
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +4 -0
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +479 -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 +49 -0
- package/contracts/distribution/Distribution.sol +263 -0
- package/contracts/distribution/DistributionService.sol +297 -0
- package/contracts/distribution/DistributionServiceManager.sol +51 -0
- package/contracts/distribution/IDistributionComponent.sol +66 -0
- package/contracts/distribution/IDistributionService.sol +81 -0
- package/contracts/instance/BundleManager.sol +126 -0
- package/contracts/instance/IInstance.sol +74 -22
- package/contracts/instance/IInstanceService.sol +83 -0
- package/contracts/instance/Instance.sol +209 -53
- package/contracts/instance/InstanceAccessManager.sol +543 -0
- package/contracts/instance/InstanceAuthorizationsLib.sol +336 -0
- package/contracts/instance/InstanceReader.sol +366 -0
- package/contracts/instance/InstanceService.sol +348 -0
- package/contracts/instance/InstanceServiceManager.sol +54 -0
- package/contracts/instance/InstanceStore.sol +259 -0
- package/contracts/instance/base/BalanceStore.sol +118 -0
- package/contracts/instance/base/Cloneable.sol +51 -0
- package/contracts/instance/base/ObjectManager.sol +82 -0
- package/contracts/instance/module/IAccess.sol +54 -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/pool/BundleService.sol +313 -0
- package/contracts/pool/BundleServiceManager.sol +51 -0
- package/contracts/pool/IBundleService.sol +106 -0
- package/contracts/pool/IPoolComponent.sol +112 -0
- package/contracts/pool/IPoolService.sol +147 -0
- package/contracts/pool/Pool.sol +299 -0
- package/contracts/pool/PoolService.sol +421 -0
- package/contracts/pool/PoolServiceManager.sol +51 -0
- package/contracts/product/ApplicationService.sol +253 -0
- package/contracts/product/ApplicationServiceManager.sol +35 -0
- package/contracts/product/ClaimService.sol +436 -0
- package/contracts/product/ClaimServiceManager.sol +35 -0
- package/contracts/product/IApplicationService.sol +62 -0
- package/contracts/product/IClaimService.sol +93 -0
- package/contracts/product/IPolicyService.sol +78 -0
- package/contracts/product/IPricingService.sol +39 -0
- package/contracts/product/IProductComponent.sol +42 -0
- package/contracts/product/IProductService.sol +33 -0
- package/contracts/product/PolicyService.sol +471 -0
- package/contracts/product/PolicyServiceManager.sol +54 -0
- package/contracts/product/PricingService.sol +300 -0
- package/contracts/product/PricingServiceManager.sol +51 -0
- package/contracts/product/Product.sol +377 -0
- package/contracts/product/ProductService.sol +122 -0
- package/contracts/product/ProductServiceManager.sol +54 -0
- package/contracts/registry/ChainNft.sol +143 -62
- package/contracts/registry/IRegistry.sol +84 -40
- package/contracts/registry/IRegistryService.sol +79 -0
- package/contracts/registry/ITransferInterceptor.sol +7 -0
- package/contracts/registry/Registry.sol +475 -128
- package/contracts/registry/RegistryAccessManager.sol +213 -0
- package/contracts/registry/RegistryService.sol +327 -0
- package/contracts/registry/RegistryServiceManager.sol +60 -0
- package/contracts/registry/ReleaseManager.sol +375 -0
- package/contracts/registry/ServiceAuthorizationsLib.sol +173 -0
- package/contracts/registry/TokenRegistry.sol +187 -0
- package/contracts/shared/AccessManagerUpgradeableInitializeable.sol +13 -0
- package/contracts/shared/Component.sol +286 -0
- package/contracts/shared/ComponentService.sol +596 -0
- package/contracts/shared/ComponentServiceManager.sol +35 -0
- package/contracts/shared/ComponentVerifyingService.sol +111 -0
- package/contracts/shared/ERC165.sol +27 -0
- package/contracts/shared/IComponent.sol +74 -0
- package/contracts/shared/IComponentService.sol +91 -0
- package/contracts/shared/IInstanceLinkedComponent.sol +46 -0
- package/contracts/shared/IKeyValueStore.sol +53 -0
- package/contracts/shared/ILifecycle.sol +30 -0
- package/contracts/shared/INftOwnable.sol +23 -0
- package/contracts/shared/IPolicyHolder.sol +40 -0
- package/contracts/shared/IRegisterable.sol +15 -0
- package/contracts/shared/IRegistryLinked.sol +11 -0
- package/contracts/shared/IService.sol +18 -0
- package/contracts/shared/IVersionable.sol +53 -0
- package/contracts/shared/InstanceLinkedComponent.sol +145 -0
- package/contracts/shared/KeyValueStore.sol +169 -0
- package/contracts/shared/Lifecycle.sol +121 -0
- package/contracts/shared/NftOwnable.sol +118 -0
- package/contracts/shared/PolicyHolder.sol +94 -0
- package/contracts/shared/ProxyManager.sol +169 -0
- package/contracts/shared/Registerable.sol +75 -0
- package/contracts/shared/RegistryLinked.sol +43 -0
- package/contracts/shared/Service.sol +77 -0
- package/contracts/shared/TokenHandler.sol +58 -0
- package/contracts/shared/UpgradableProxyWithAdmin.sol +16 -0
- package/contracts/shared/Versionable.sol +59 -0
- package/contracts/staking/IStaking.sol +77 -0
- package/contracts/staking/IStakingService.sol +105 -0
- package/contracts/staking/Staking.sol +212 -0
- package/contracts/staking/StakingManager.sol +46 -0
- package/contracts/staking/StakingService.sol +200 -0
- package/contracts/staking/StakingServiceManager.sol +41 -0
- package/contracts/type/AddressSet.sol +58 -0
- package/contracts/type/Amount.sol +114 -0
- package/contracts/{types → type}/Blocknumber.sol +7 -1
- 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/{types → type}/NftId.sol +34 -12
- package/contracts/type/NftIdSet.sol +62 -0
- package/contracts/{types → type}/ObjectType.sol +73 -15
- package/contracts/type/PayoutId.sol +82 -0
- package/contracts/type/Referral.sol +89 -0
- package/contracts/type/RiskId.sol +43 -0
- package/contracts/type/RoleId.sol +138 -0
- package/contracts/type/Seconds.sol +54 -0
- package/contracts/{types → type}/StateId.sol +23 -4
- package/contracts/{types → type}/Timestamp.sol +36 -6
- package/contracts/type/UFixed.sol +326 -0
- package/contracts/type/Version.sol +108 -0
- package/package.json +12 -5
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +0 -4
- package/artifacts/contracts/components/Component.sol/Component.json +0 -205
- 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 -255
- package/artifacts/contracts/components/IProduct.sol/IProductComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IProduct.sol/IProductComponent.json +0 -74
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +0 -4
- package/artifacts/contracts/components/Pool.sol/Pool.json +0 -328
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +0 -4
- package/artifacts/contracts/components/Product.sol/Product.json +0 -346
- 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/statemachine/Dummy.sol/LifeCycleModule.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +0 -59
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.json +0 -124
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.json +0 -74
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +0 -124
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +0 -207
- 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 -299
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.json +0 -202
- 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 -205
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.json +0 -217
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.json +0 -141
- 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/lifecycle/ILifecycle.sol/ILifecycle.dbg.json +0 -4
- package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycle.json +0 -134
- package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/lifecycle/LifecycleModule.sol/LifecycleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/lifecycle/LifecycleModule.sol/LifecycleModule.json +0 -221
- 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 -254
- package/artifacts/contracts/instance/policy/PolicyModule.sol/PolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/policy/PolicyModule.sol/PolicyModule.json +0 -254
- 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 -129
- package/artifacts/contracts/instance/pool/PoolModule.sol/PoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/pool/PoolModule.sol/PoolModule.json +0 -155
- 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 -127
- 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 -196
- package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasury.dbg.json +0 -4
- package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasuryModule.json +0 -490
- package/artifacts/contracts/instance/treasury/TokenHandler.sol/TokenHandler.dbg.json +0 -4
- package/artifacts/contracts/instance/treasury/TokenHandler.sol/TokenHandler.json +0 -45
- package/artifacts/contracts/instance/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/instance/treasury/TreasuryModule.sol/TreasuryModule.json +0 -490
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +0 -4
- 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/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +0 -4
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +0 -4
- 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/ObjectType.sol/ObjectTypeLib.dbg.json +0 -4
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +0 -4
- 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 -479
- package/contracts/components/Component.sol +0 -77
- package/contracts/components/IPool.sol +0 -15
- package/contracts/components/IProduct.sol +0 -16
- package/contracts/components/Pool.sol +0 -52
- package/contracts/components/Product.sol +0 -89
- 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/statemachine/Dummy.sol +0 -27
- package/contracts/experiment/statemachine/ISM.sol +0 -25
- package/contracts/experiment/statemachine/README.md +0 -112
- package/contracts/experiment/statemachine/SM.sol +0 -57
- package/contracts/experiment/statemachine/SimpleStateMachine.sol +0 -31
- 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 -274
- package/contracts/instance/component/IComponent.sol +0 -74
- package/contracts/instance/lifecycle/ILifecycle.sol +0 -47
- package/contracts/instance/lifecycle/LifecycleModule.sol +0 -88
- package/contracts/instance/policy/IPolicy.sol +0 -50
- package/contracts/instance/policy/PolicyModule.sol +0 -114
- package/contracts/instance/pool/IPoolModule.sol +0 -23
- package/contracts/instance/pool/PoolModule.sol +0 -81
- package/contracts/instance/product/IProductService.sol +0 -36
- package/contracts/instance/product/ProductService.sol +0 -136
- package/contracts/instance/treasury/ITreasury.sol +0 -91
- package/contracts/instance/treasury/TokenHandler.sol +0 -24
- package/contracts/instance/treasury/TreasuryModule.sol +0 -168
- package/contracts/registry/IChainNft.sol +0 -21
- package/contracts/types/ChainId.sol +0 -38
- package/contracts/types/Fee.sol +0 -32
- package/contracts/types/UFixed.sol +0 -210
@@ -0,0 +1,212 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
|
5
|
+
import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
6
|
+
|
7
|
+
import {ObjectType, REGISTRY, STAKING} from "../type/ObjectType.sol";
|
8
|
+
import {NftId} from "../type/NftId.sol";
|
9
|
+
import {Version, VersionLib, VersionPartLib} from "../type/Version.sol";
|
10
|
+
|
11
|
+
import {Amount} from "../type/Amount.sol";
|
12
|
+
import {Component} from "../shared/Component.sol";
|
13
|
+
import {IStaking} from "./IStaking.sol";
|
14
|
+
import {IVersionable} from "../shared/IVersionable.sol";
|
15
|
+
import {KeyValueStore} from "../shared/KeyValueStore.sol";
|
16
|
+
import {Timestamp} from "../type/Timestamp.sol";
|
17
|
+
import {UFixed} from "../type/UFixed.sol";
|
18
|
+
import {Versionable} from "../shared/Versionable.sol";
|
19
|
+
|
20
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
21
|
+
|
22
|
+
contract Staking is
|
23
|
+
KeyValueStore,
|
24
|
+
Component,
|
25
|
+
Versionable,
|
26
|
+
IStaking
|
27
|
+
{
|
28
|
+
string public constant CONTRACT_NAME = "Staking";
|
29
|
+
uint8 private constant GIF_MAJOR_VERSION = 3;
|
30
|
+
|
31
|
+
// keccak256(abi.encode(uint256(keccak256("gif-next.contracts.component.Staking.sol")) - 1)) & ~bytes32(uint256(0xff));
|
32
|
+
bytes32 public constant STAKING_LOCATION_V1 = 0xafe8d4462b2ed26a47154f4b8f6d1497d2f772496965791d25bd456e342b7f00;
|
33
|
+
|
34
|
+
struct StakingStorage {
|
35
|
+
mapping(uint256 chainId => mapping(address token => UFixed stakingRate)) _stakingRate;
|
36
|
+
mapping(NftId targetNftId => UFixed rewardRate) _rewardRate;
|
37
|
+
mapping(NftId targetNftId => Amount reserveAmount) _rewardReserveAmount;
|
38
|
+
mapping(NftId targetNftId => Amount stakedAmount) _stakedAmount;
|
39
|
+
mapping(NftId targetNftId => mapping(address token => Amount tvlAmount)) _tvlAmount;
|
40
|
+
}
|
41
|
+
|
42
|
+
function _getStakingStorage() private pure returns (StakingStorage storage $) {
|
43
|
+
assembly {
|
44
|
+
$.slot := STAKING_LOCATION_V1
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
// from Versionable
|
49
|
+
function getVersion()
|
50
|
+
public
|
51
|
+
pure
|
52
|
+
virtual override (IVersionable, Versionable)
|
53
|
+
returns(Version)
|
54
|
+
{
|
55
|
+
return VersionLib.toVersion(GIF_MAJOR_VERSION,0,0);
|
56
|
+
}
|
57
|
+
|
58
|
+
function _initialize(
|
59
|
+
address owner,
|
60
|
+
bytes memory data
|
61
|
+
)
|
62
|
+
internal
|
63
|
+
virtual override
|
64
|
+
initializer
|
65
|
+
{
|
66
|
+
(
|
67
|
+
address initialAuthority,
|
68
|
+
address registryAddress,
|
69
|
+
address dipTokenAddress,
|
70
|
+
address initialOwner
|
71
|
+
) = abi.decode(data, (address, address, address, address));
|
72
|
+
|
73
|
+
initializeComponent(
|
74
|
+
initialAuthority,
|
75
|
+
registryAddress,
|
76
|
+
IRegistry(registryAddress).getNftId(),
|
77
|
+
CONTRACT_NAME,
|
78
|
+
dipTokenAddress,
|
79
|
+
STAKING(),
|
80
|
+
false, // is interceptor
|
81
|
+
initialOwner,
|
82
|
+
"", // registry data
|
83
|
+
""); // component data
|
84
|
+
|
85
|
+
// create the staking token handler
|
86
|
+
_createAndSetTokenHandler();
|
87
|
+
|
88
|
+
registerInterface(type(IStaking).interfaceId);
|
89
|
+
}
|
90
|
+
|
91
|
+
// rate management
|
92
|
+
function setStakingRate(uint256 chainId, address token, UFixed stakingRate)
|
93
|
+
external
|
94
|
+
virtual
|
95
|
+
onlyOwner
|
96
|
+
{
|
97
|
+
|
98
|
+
}
|
99
|
+
|
100
|
+
// reward management
|
101
|
+
function setRewardRate(NftId targetNftId, UFixed rewardRate)
|
102
|
+
external
|
103
|
+
virtual
|
104
|
+
// onlyNftOwner(targetNftId)
|
105
|
+
{
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
function refillRewardReserves(NftId targetNftId, Amount dipAmount)
|
110
|
+
external
|
111
|
+
virtual
|
112
|
+
{
|
113
|
+
|
114
|
+
}
|
115
|
+
|
116
|
+
function withdrawRewardReserves(NftId targetNftId, Amount dipAmount)
|
117
|
+
external
|
118
|
+
virtual
|
119
|
+
// onlyNftOwner(targetNftId)
|
120
|
+
{
|
121
|
+
|
122
|
+
}
|
123
|
+
|
124
|
+
// target management
|
125
|
+
function registerTarget(NftId targetNftId)
|
126
|
+
external
|
127
|
+
virtual
|
128
|
+
// restricted // service to service access
|
129
|
+
{
|
130
|
+
|
131
|
+
}
|
132
|
+
|
133
|
+
function increaseTvl(NftId targetNftId, address token, Amount amount)
|
134
|
+
external
|
135
|
+
virtual
|
136
|
+
// restricted // service to service access
|
137
|
+
{
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
function decreaseTvl(NftId targetNftId, address token, Amount amount)
|
142
|
+
external
|
143
|
+
virtual
|
144
|
+
// restricted // service to service access
|
145
|
+
{
|
146
|
+
|
147
|
+
}
|
148
|
+
|
149
|
+
|
150
|
+
function registerRemoteTarget(NftId targetNftId, TargetInfo memory targetInfo)
|
151
|
+
external
|
152
|
+
virtual
|
153
|
+
onlyOwner // or CCIP
|
154
|
+
{
|
155
|
+
|
156
|
+
}
|
157
|
+
|
158
|
+
function updateRemoteTvl(NftId targetNftId, address token, Amount amount)
|
159
|
+
external
|
160
|
+
virtual
|
161
|
+
onlyOwner // or CCIP
|
162
|
+
{
|
163
|
+
|
164
|
+
}
|
165
|
+
|
166
|
+
// staking functions
|
167
|
+
function createStake(NftId targetNftId, Amount dipAmount) external returns(NftId stakeNftId) {}
|
168
|
+
function stake(NftId stakeNftId, Amount dipAmount) external {}
|
169
|
+
function restakeRewards(NftId stakeNftId) external {}
|
170
|
+
function restakeToNewTarget(NftId stakeNftId, NftId newTarget) external {}
|
171
|
+
function unstake(NftId stakeNftId) external {}
|
172
|
+
function unstake(NftId stakeNftId, Amount dipAmount) external {}
|
173
|
+
function claimRewards(NftId stakeNftId) external {}
|
174
|
+
|
175
|
+
// view and pure functions (staking reader?)
|
176
|
+
function getStakingRate(uint256 chainId, address token) external view returns (UFixed stakingRate) {
|
177
|
+
return _getStakingStorage()._stakingRate[chainId][token];
|
178
|
+
}
|
179
|
+
|
180
|
+
function getRewardRate(NftId targetNftId) external view returns (UFixed rewardRate) {
|
181
|
+
return _getStakingStorage()._rewardRate[targetNftId];
|
182
|
+
}
|
183
|
+
|
184
|
+
function getRewardReserves(NftId targetNftId) external view returns (Amount rewardReserveAmount) {
|
185
|
+
return _getStakingStorage()._rewardReserveAmount[targetNftId];
|
186
|
+
}
|
187
|
+
|
188
|
+
|
189
|
+
function getStakeInfo() external view returns (NftId stakeNftId) {}
|
190
|
+
function getTargetInfo() external view returns (NftId stakeNftId) {}
|
191
|
+
|
192
|
+
function getTvlAmount(NftId targetNftId, address token) external view returns (Amount tvlAmount) {
|
193
|
+
return _getStakingStorage()._tvlAmount[targetNftId][token];
|
194
|
+
}
|
195
|
+
|
196
|
+
function getStakedAmount(NftId targetNftId) external view returns (Amount stakeAmount) {
|
197
|
+
return _getStakingStorage()._stakedAmount[targetNftId];
|
198
|
+
}
|
199
|
+
|
200
|
+
function calculateRewardIncrementAmount(
|
201
|
+
NftId targetNftId,
|
202
|
+
Timestamp rewardsLastUpdatedAt
|
203
|
+
)
|
204
|
+
public
|
205
|
+
virtual
|
206
|
+
view
|
207
|
+
returns (Amount rewardIncrementAmount)
|
208
|
+
{
|
209
|
+
|
210
|
+
}
|
211
|
+
|
212
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {IVersionable} from "../shared/IVersionable.sol";
|
5
|
+
import {ProxyManager} from "../shared/ProxyManager.sol";
|
6
|
+
import {Staking} from "./Staking.sol";
|
7
|
+
|
8
|
+
contract StakingManager is
|
9
|
+
ProxyManager
|
10
|
+
{
|
11
|
+
|
12
|
+
Staking private _staking;
|
13
|
+
|
14
|
+
/// @dev initializes proxy manager with service implementation
|
15
|
+
constructor(
|
16
|
+
address initialAuthority,
|
17
|
+
address registryAddress,
|
18
|
+
address dipTokenAddress
|
19
|
+
)
|
20
|
+
ProxyManager(registryAddress)
|
21
|
+
{
|
22
|
+
Staking stk = new Staking();
|
23
|
+
address initialOwner = msg.sender;
|
24
|
+
|
25
|
+
bytes memory data = abi.encode(
|
26
|
+
initialAuthority,
|
27
|
+
registryAddress,
|
28
|
+
dipTokenAddress,
|
29
|
+
initialOwner);
|
30
|
+
|
31
|
+
IVersionable versionable = deploy(
|
32
|
+
address(stk),
|
33
|
+
data);
|
34
|
+
|
35
|
+
_staking = Staking(address(versionable));
|
36
|
+
}
|
37
|
+
|
38
|
+
//--- view functions ----------------------------------------------------//
|
39
|
+
function getStaking()
|
40
|
+
external
|
41
|
+
view
|
42
|
+
returns (Staking)
|
43
|
+
{
|
44
|
+
return _staking;
|
45
|
+
}
|
46
|
+
}
|
@@ -0,0 +1,200 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {Amount} from "../type/Amount.sol";
|
5
|
+
import {IPoolService} from "../pool/IPoolService.sol";
|
6
|
+
import {IRegisterable} from "../shared/IRegisterable.sol";
|
7
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
8
|
+
import {IRegistryService} from "../registry/IRegistryService.sol";
|
9
|
+
import {IStaking} from "./IStaking.sol";
|
10
|
+
import {IStakingService} from "./IStakingService.sol";
|
11
|
+
import {NftId} from "../type/NftId.sol";
|
12
|
+
import {ObjectType, POOL, REGISTRY, STAKE, STAKING} from "../type/ObjectType.sol";
|
13
|
+
import {Service} from "../shared/Service.sol";
|
14
|
+
import {Timestamp} from "../type/Timestamp.sol";
|
15
|
+
|
16
|
+
|
17
|
+
contract StakingService is
|
18
|
+
Service,
|
19
|
+
IStakingService
|
20
|
+
{
|
21
|
+
// TODO decide and implement string spec for location calculation
|
22
|
+
// keccak256(abi.encode(uint256(keccak256("gif-next.contracts.shared.StakingService.sol")) - 1)) & ~bytes32(uint256(0xff));
|
23
|
+
bytes32 public constant STAKING_SERVICE_LOCATION_V1 = 0x6548005c3f4340f82f348c576c0ff69f7f529cadd5ad41f96aae61abceeaa300;
|
24
|
+
|
25
|
+
struct StakingServiceStorage {
|
26
|
+
IStaking _staking;
|
27
|
+
}
|
28
|
+
|
29
|
+
function getDomain() public pure override returns(ObjectType) {
|
30
|
+
return STAKING();
|
31
|
+
}
|
32
|
+
|
33
|
+
|
34
|
+
function create(
|
35
|
+
NftId targetNftId,
|
36
|
+
Amount amount
|
37
|
+
)
|
38
|
+
external
|
39
|
+
virtual
|
40
|
+
returns (
|
41
|
+
NftId stakeNftId
|
42
|
+
)
|
43
|
+
{
|
44
|
+
|
45
|
+
}
|
46
|
+
|
47
|
+
|
48
|
+
function stake(
|
49
|
+
NftId stakeNftId,
|
50
|
+
Amount amount
|
51
|
+
)
|
52
|
+
external
|
53
|
+
virtual
|
54
|
+
{
|
55
|
+
|
56
|
+
}
|
57
|
+
|
58
|
+
|
59
|
+
function unstake(
|
60
|
+
NftId stakeNftId,
|
61
|
+
Amount amount
|
62
|
+
)
|
63
|
+
external
|
64
|
+
virtual
|
65
|
+
{
|
66
|
+
|
67
|
+
}
|
68
|
+
|
69
|
+
function close(
|
70
|
+
NftId stakeNftId
|
71
|
+
)
|
72
|
+
external
|
73
|
+
virtual
|
74
|
+
{
|
75
|
+
|
76
|
+
}
|
77
|
+
|
78
|
+
function reStake(
|
79
|
+
NftId stakeNftId,
|
80
|
+
NftId newTargetNftId
|
81
|
+
)
|
82
|
+
external
|
83
|
+
virtual
|
84
|
+
returns (
|
85
|
+
NftId newStakeNftId,
|
86
|
+
Timestamp unlockedAt
|
87
|
+
)
|
88
|
+
{
|
89
|
+
|
90
|
+
}
|
91
|
+
|
92
|
+
|
93
|
+
function increaseTotalValueLocked(
|
94
|
+
NftId targetNftId,
|
95
|
+
address token,
|
96
|
+
Amount amount
|
97
|
+
)
|
98
|
+
external
|
99
|
+
virtual
|
100
|
+
returns (Amount totalValueLocked)
|
101
|
+
{
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
|
106
|
+
function decreaseTotalValueLocked(
|
107
|
+
NftId targetNftId,
|
108
|
+
address token,
|
109
|
+
Amount amount
|
110
|
+
)
|
111
|
+
external
|
112
|
+
virtual
|
113
|
+
returns (Amount totalValueLocked)
|
114
|
+
{
|
115
|
+
|
116
|
+
}
|
117
|
+
|
118
|
+
|
119
|
+
function setTotalValueLocked(
|
120
|
+
NftId targetNftId,
|
121
|
+
address token,
|
122
|
+
Amount amount
|
123
|
+
)
|
124
|
+
external
|
125
|
+
virtual
|
126
|
+
{
|
127
|
+
|
128
|
+
}
|
129
|
+
|
130
|
+
function getStaking()
|
131
|
+
external
|
132
|
+
virtual
|
133
|
+
returns (IStaking staking)
|
134
|
+
{
|
135
|
+
return _getStakingServiceStorage()._staking;
|
136
|
+
}
|
137
|
+
|
138
|
+
|
139
|
+
function _initialize(
|
140
|
+
address owner,
|
141
|
+
bytes memory data
|
142
|
+
)
|
143
|
+
internal
|
144
|
+
virtual override
|
145
|
+
initializer()
|
146
|
+
{
|
147
|
+
(
|
148
|
+
address registryAddress,
|
149
|
+
address stakingAddress
|
150
|
+
) = abi.decode(data, (address, address));
|
151
|
+
|
152
|
+
initializeService(registryAddress, address(0), owner);
|
153
|
+
|
154
|
+
StakingServiceStorage storage $ = _getStakingServiceStorage();
|
155
|
+
$._staking = _registerStaking(stakingAddress);
|
156
|
+
|
157
|
+
registerInterface(type(IStakingService).interfaceId);
|
158
|
+
}
|
159
|
+
|
160
|
+
|
161
|
+
function _registerStaking(
|
162
|
+
address stakingAddress
|
163
|
+
)
|
164
|
+
internal
|
165
|
+
returns (IStaking staking)
|
166
|
+
{
|
167
|
+
// check if provided staking contract is already registred
|
168
|
+
// staking contract may have been already registered by a previous major relase
|
169
|
+
IRegistry.ObjectInfo memory stakingInfo = getRegistry().getObjectInfo(stakingAddress);
|
170
|
+
if (stakingInfo.nftId.gtz()) {
|
171
|
+
// registered object but wrong type
|
172
|
+
if (stakingInfo.objectType != STAKING()) {
|
173
|
+
revert ErrorStakingServiceNotStaking(stakingAddress);
|
174
|
+
}
|
175
|
+
|
176
|
+
// return correctly registered staking contract
|
177
|
+
return IStaking(stakingAddress);
|
178
|
+
}
|
179
|
+
|
180
|
+
// check that contract implements IStaking
|
181
|
+
if(!IStaking(stakingAddress).supportsInterface(type(IStaking).interfaceId)) {
|
182
|
+
revert ErrorStakingServiceNotSupportingIStaking(stakingAddress);
|
183
|
+
}
|
184
|
+
|
185
|
+
address owner = msg.sender;
|
186
|
+
IRegistryService(
|
187
|
+
_getServiceAddress(REGISTRY())).registerStaking(
|
188
|
+
IRegisterable(stakingAddress),
|
189
|
+
owner);
|
190
|
+
|
191
|
+
return IStaking(stakingAddress);
|
192
|
+
}
|
193
|
+
|
194
|
+
|
195
|
+
function _getStakingServiceStorage() private pure returns (StakingServiceStorage storage $) {
|
196
|
+
assembly {
|
197
|
+
$.slot := STAKING_SERVICE_LOCATION_V1
|
198
|
+
}
|
199
|
+
}
|
200
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
5
|
+
import {IVersionable} from "../shared/IVersionable.sol";
|
6
|
+
import {ProxyManager} from "../shared/ProxyManager.sol";
|
7
|
+
import {StakingService} from "./StakingService.sol";
|
8
|
+
|
9
|
+
contract StakingServiceManager is
|
10
|
+
ProxyManager
|
11
|
+
{
|
12
|
+
|
13
|
+
StakingService private _stakingService;
|
14
|
+
|
15
|
+
/// @dev initializes proxy manager with service implementation
|
16
|
+
constructor(
|
17
|
+
address registryAddress
|
18
|
+
)
|
19
|
+
ProxyManager(registryAddress)
|
20
|
+
{
|
21
|
+
StakingService svc = new StakingService();
|
22
|
+
bytes memory data = abi.encode(
|
23
|
+
registryAddress,
|
24
|
+
IRegistry(registryAddress).getStakingAddress());
|
25
|
+
|
26
|
+
IVersionable versionable = deploy(
|
27
|
+
address(svc),
|
28
|
+
data);
|
29
|
+
|
30
|
+
_stakingService = StakingService(address(versionable));
|
31
|
+
}
|
32
|
+
|
33
|
+
//--- view functions ----------------------------------------------------//
|
34
|
+
function getStakingService()
|
35
|
+
external
|
36
|
+
view
|
37
|
+
returns (StakingService)
|
38
|
+
{
|
39
|
+
return _stakingService;
|
40
|
+
}
|
41
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
// based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/structs/EnumerableSet.sol
|
5
|
+
library LibAddressSet {
|
6
|
+
|
7
|
+
struct Set {
|
8
|
+
address[] elements;
|
9
|
+
mapping(address element => uint256 index) at;
|
10
|
+
}
|
11
|
+
|
12
|
+
function add(Set storage set, address element) external returns(bool added) {
|
13
|
+
if (set.at[element] == 0) {
|
14
|
+
set.elements.push(element);
|
15
|
+
set.at[element] = set.elements.length;
|
16
|
+
return true;
|
17
|
+
} else {
|
18
|
+
return false;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
function remove(Set storage set, address element) external returns(bool removed) {
|
23
|
+
uint256 elementIndex = set.at[element];
|
24
|
+
|
25
|
+
if (elementIndex > 0) {
|
26
|
+
uint256 toDeleteIndex = elementIndex - 1;
|
27
|
+
uint256 lastIndex = set.elements.length - 1;
|
28
|
+
|
29
|
+
if (lastIndex != toDeleteIndex) {
|
30
|
+
address lastElement = set.elements[lastIndex];
|
31
|
+
set.elements[toDeleteIndex] = lastElement;
|
32
|
+
set.at[lastElement] = elementIndex; // Replace lastValue's index to valueIndex
|
33
|
+
}
|
34
|
+
|
35
|
+
set.elements.pop();
|
36
|
+
delete set.at[element];
|
37
|
+
return true;
|
38
|
+
}
|
39
|
+
|
40
|
+
return false;
|
41
|
+
}
|
42
|
+
|
43
|
+
function isEmpty(Set storage set) external view returns(bool empty) {
|
44
|
+
return set.elements.length == 0;
|
45
|
+
}
|
46
|
+
|
47
|
+
function contains(Set storage set, address element) external view returns(bool inSet) {
|
48
|
+
return set.at[element] > 0;
|
49
|
+
}
|
50
|
+
|
51
|
+
function getLength(Set storage set) external view returns(uint256 length) {
|
52
|
+
return set.elements.length;
|
53
|
+
}
|
54
|
+
|
55
|
+
function getElementAt(Set storage set, uint256 index) external view returns(address element) {
|
56
|
+
return set.elements[index];
|
57
|
+
}
|
58
|
+
}
|
@@ -0,0 +1,114 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {UFixed, UFixedLib} from "./UFixed.sol";
|
5
|
+
|
6
|
+
type Amount is uint96;
|
7
|
+
|
8
|
+
using {
|
9
|
+
addAmount as +,
|
10
|
+
subAmount as -,
|
11
|
+
eqAmount as ==,
|
12
|
+
nqAmount as !=,
|
13
|
+
ltAmount as <,
|
14
|
+
gtAmount as >,
|
15
|
+
AmountLib.eq,
|
16
|
+
AmountLib.eqz,
|
17
|
+
AmountLib.gtz,
|
18
|
+
AmountLib.toInt,
|
19
|
+
AmountLib.add,
|
20
|
+
AmountLib.toUFixed
|
21
|
+
} for Amount global;
|
22
|
+
|
23
|
+
function addAmount(Amount a, Amount b) pure returns (Amount) {
|
24
|
+
return AmountLib.add(a, b);
|
25
|
+
}
|
26
|
+
|
27
|
+
function subAmount(Amount a, Amount b) pure returns (Amount) {
|
28
|
+
return AmountLib.sub(a, b);
|
29
|
+
}
|
30
|
+
|
31
|
+
function eqAmount(Amount a, Amount b) pure returns (bool) {
|
32
|
+
return AmountLib.eq(a, b);
|
33
|
+
}
|
34
|
+
|
35
|
+
function nqAmount(Amount a, Amount b) pure returns (bool) {
|
36
|
+
return !AmountLib.eq(a, b);
|
37
|
+
}
|
38
|
+
|
39
|
+
function ltAmount(Amount a, Amount b) pure returns (bool) {
|
40
|
+
return AmountLib.lt(a, b);
|
41
|
+
}
|
42
|
+
|
43
|
+
function gtAmount(Amount a, Amount b) pure returns (bool) {
|
44
|
+
return AmountLib.gt(a, b);
|
45
|
+
}
|
46
|
+
|
47
|
+
library AmountLib {
|
48
|
+
|
49
|
+
error ErrorAmountLibValueTooBig(uint256 amount);
|
50
|
+
|
51
|
+
function zero() public pure returns (Amount) {
|
52
|
+
return Amount.wrap(0);
|
53
|
+
}
|
54
|
+
|
55
|
+
function max() public pure returns (Amount) {
|
56
|
+
return Amount.wrap(_max());
|
57
|
+
}
|
58
|
+
|
59
|
+
/// @dev converts the uint amount into Amount
|
60
|
+
/// function reverts if value is exceeding max Amount value
|
61
|
+
function toAmount(uint256 amount) public pure returns (Amount) {
|
62
|
+
if(amount > _max()) {
|
63
|
+
revert ErrorAmountLibValueTooBig(amount);
|
64
|
+
}
|
65
|
+
|
66
|
+
return Amount.wrap(uint96(amount));
|
67
|
+
}
|
68
|
+
|
69
|
+
/// @dev return true if amount equals 0
|
70
|
+
function eqz(Amount amount) public pure returns (bool) {
|
71
|
+
return Amount.unwrap(amount) == 0;
|
72
|
+
}
|
73
|
+
|
74
|
+
/// @dev return true if amount1 equals amount2
|
75
|
+
function eq(Amount amount1, Amount amount2) public pure returns (bool) {
|
76
|
+
return Amount.unwrap(amount1) == Amount.unwrap(amount2);
|
77
|
+
}
|
78
|
+
|
79
|
+
/// @dev return true if amount a1 is smaller than a2
|
80
|
+
function lt(Amount a1, Amount a2) public pure returns (bool) {
|
81
|
+
return Amount.unwrap(a1) < Amount.unwrap(a2);
|
82
|
+
}
|
83
|
+
|
84
|
+
/// @dev return true if amount a1 is larger than a2
|
85
|
+
function gt(Amount a1, Amount a2) public pure returns (bool) {
|
86
|
+
return Amount.unwrap(a1) > Amount.unwrap(a2);
|
87
|
+
}
|
88
|
+
|
89
|
+
/// @dev return true if amount is larger than 0
|
90
|
+
function gtz(Amount amount) public pure returns (bool) {
|
91
|
+
return Amount.unwrap(amount) > 0;
|
92
|
+
}
|
93
|
+
|
94
|
+
function add(Amount a1, Amount a2) public pure returns (Amount) {
|
95
|
+
return Amount.wrap(Amount.unwrap(a1) + Amount.unwrap(a2));
|
96
|
+
}
|
97
|
+
|
98
|
+
function sub(Amount a1, Amount a2) public pure returns (Amount) {
|
99
|
+
return Amount.wrap(Amount.unwrap(a1) - Amount.unwrap(a2));
|
100
|
+
}
|
101
|
+
|
102
|
+
function toInt(Amount amount) public pure returns (uint256) {
|
103
|
+
return uint256(uint96(Amount.unwrap(amount)));
|
104
|
+
}
|
105
|
+
|
106
|
+
function toUFixed(Amount amount) public pure returns (UFixed) {
|
107
|
+
return UFixedLib.toUFixed(Amount.unwrap(amount));
|
108
|
+
}
|
109
|
+
|
110
|
+
function _max() internal pure returns (uint96) {
|
111
|
+
// IMPORTANT: type nees to match with actual definition for Amount
|
112
|
+
return type(uint96).max;
|
113
|
+
}
|
114
|
+
}
|
@@ -49,9 +49,10 @@ function toBlocknumber(uint256 blocknum) pure returns (Blocknumber) {
|
|
49
49
|
}
|
50
50
|
|
51
51
|
function blockBlocknumber() view returns (Blocknumber) {
|
52
|
-
return
|
52
|
+
return BlocknumberLib.currentBlocknumber();
|
53
53
|
}
|
54
54
|
|
55
|
+
// TODO move to BlocknumberLib and rename to zero()
|
55
56
|
/// @dev Return the Blocknumber zero (0)
|
56
57
|
function zeroBlocknumber() pure returns (Blocknumber) {
|
57
58
|
return toBlocknumber(0);
|
@@ -63,6 +64,11 @@ function blockNumber() view returns (Blocknumber) {
|
|
63
64
|
}
|
64
65
|
|
65
66
|
library BlocknumberLib {
|
67
|
+
/// @dev returns the current Blocknumber
|
68
|
+
function currentBlocknumber() public view returns (Blocknumber) {
|
69
|
+
return Blocknumber.wrap(uint32(block.number));
|
70
|
+
}
|
71
|
+
|
66
72
|
/// @dev return true if Blocknumber a is greater than Blocknumber b
|
67
73
|
function gt(
|
68
74
|
Blocknumber a,
|