@etherisc/gif-next 0.0.2-239d061-784 → 0.0.2-23ade4a-264
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -10
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +97 -123
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +368 -163
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +81 -83
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +295 -121
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +261 -188
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +85 -155
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +288 -259
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +102 -196
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +64 -50
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +5 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +808 -456
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +171 -195
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +893 -800
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +448 -121
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +120 -227
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +249 -380
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +231 -114
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -13
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +39 -215
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +40 -10
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +36 -11
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +54 -71
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.json +10 -0
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +203 -326
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +665 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +162 -361
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +206 -105
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +754 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +637 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +1076 -241
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +354 -97
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +130 -199
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +95 -250
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +409 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +705 -138
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +51 -282
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +75 -146
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +18 -170
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +106 -437
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +212 -139
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +137 -244
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +211 -102
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +63 -267
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +203 -102
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +15 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +19 -0
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +77 -173
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +18 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +31 -12
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +109 -257
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +202 -107
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +11 -11
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +46 -53
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +17 -30
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +2 -2
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +17 -30
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/{experiment/inheritance/IB.sol/IB.json → shared/IRegistryLinked.sol/IRegistryLinked.json} +18 -20
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +18 -170
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +0 -150
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +22 -48
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +80 -4
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +195 -86
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +34 -71
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +84 -0
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +32 -208
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +0 -150
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +2 -2
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +34 -71
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +6 -6
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +50 -262
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +6 -188
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +2 -2
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +100 -0
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +2 -2
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +17 -4
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +100 -0
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +23 -4
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +4 -0
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.json +124 -0
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +25 -7
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.json +2 -2
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +2 -2
- package/contracts/components/Component.sol +98 -77
- package/contracts/components/Distribution.sol +159 -35
- package/contracts/components/IComponent.sol +40 -16
- package/contracts/components/IDistributionComponent.sol +39 -15
- package/contracts/components/IPoolComponent.sol +73 -47
- package/contracts/components/IProductComponent.sol +3 -2
- package/contracts/components/Pool.sol +171 -126
- package/contracts/components/Product.sol +38 -23
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
- package/contracts/instance/BundleManager.sol +7 -5
- package/contracts/instance/Cloneable.sol +7 -2
- package/contracts/instance/IInstance.sol +36 -10
- package/contracts/instance/IInstanceService.sol +35 -4
- package/contracts/instance/Instance.sol +95 -36
- package/contracts/instance/InstanceAccessManager.sol +382 -157
- package/contracts/instance/InstanceReader.sol +7 -10
- package/contracts/instance/InstanceService.sol +234 -173
- package/contracts/instance/InstanceServiceManager.sol +1 -1
- package/contracts/instance/ObjectManager.sol +6 -8
- package/contracts/instance/base/ComponentService.sol +5 -5
- package/contracts/instance/base/KeyValueStore.sol +5 -2
- package/contracts/instance/base/Lifecycle.sol +11 -2
- package/contracts/instance/module/IAccess.sol +20 -13
- package/contracts/instance/module/IBundle.sol +2 -1
- package/contracts/instance/module/IComponents.sol +35 -0
- package/contracts/instance/module/IDistribution.sol +2 -0
- package/contracts/instance/module/IPolicy.sol +30 -3
- package/contracts/instance/module/ISetup.sol +7 -21
- package/contracts/instance/service/ApplicationService.sol +139 -57
- package/contracts/instance/service/ApplicationServiceManager.sol +35 -0
- package/contracts/instance/service/BundleService.sol +76 -38
- package/contracts/instance/service/BundleServiceManager.sol +1 -1
- package/contracts/instance/service/ClaimService.sol +151 -0
- package/contracts/instance/service/ClaimServiceManager.sol +35 -0
- package/contracts/instance/service/DistributionService.sol +375 -13
- package/contracts/instance/service/DistributionServiceManager.sol +1 -1
- package/contracts/instance/service/IApplicationService.sol +9 -9
- package/contracts/instance/service/IBundleService.sol +19 -11
- package/contracts/instance/service/IClaimService.sol +61 -0
- package/contracts/instance/service/IDistributionService.sol +86 -0
- package/contracts/instance/service/IPolicyService.sol +18 -34
- package/contracts/instance/service/IPoolService.sol +17 -2
- package/contracts/instance/service/PolicyService.sol +74 -195
- package/contracts/instance/service/PolicyServiceManager.sol +2 -2
- package/contracts/instance/service/PoolService.sol +128 -17
- package/contracts/instance/service/PoolServiceManager.sol +1 -1
- package/contracts/instance/service/ProductService.sol +10 -2
- package/contracts/instance/service/ProductServiceManager.sol +2 -2
- package/contracts/registry/ChainNft.sol +8 -0
- package/contracts/registry/IRegistry.sol +2 -0
- package/contracts/registry/IRegistryService.sol +10 -8
- package/contracts/registry/ITransferInterceptor.sol +1 -0
- package/contracts/registry/Registry.sol +26 -21
- package/contracts/registry/RegistryService.sol +62 -40
- package/contracts/registry/RegistryServiceManager.sol +13 -13
- package/contracts/registry/ReleaseManager.sol +18 -28
- package/contracts/registry/TokenRegistry.sol +13 -10
- package/contracts/shared/ERC165.sol +2 -1
- package/contracts/shared/INftOwnable.sol +7 -11
- package/contracts/shared/IPolicyHolder.sol +2 -2
- package/contracts/shared/IRegistryLinked.sol +12 -0
- package/contracts/shared/IService.sol +2 -0
- package/contracts/shared/IVersionable.sol +4 -47
- package/contracts/shared/NftOwnable.sol +18 -85
- package/contracts/shared/PolicyHolder.sol +31 -2
- package/contracts/shared/ProxyManager.sol +98 -24
- package/contracts/shared/Registerable.sol +3 -10
- package/contracts/shared/RegistryLinked.sol +48 -0
- package/contracts/shared/Service.sol +10 -12
- package/contracts/shared/TokenHandler.sol +11 -5
- package/contracts/shared/Versionable.sol +1 -90
- package/contracts/types/Blocknumber.sol +1 -0
- package/contracts/types/ClaimId.sol +52 -0
- package/contracts/types/DistributorType.sol +2 -2
- package/contracts/types/Fee.sol +1 -0
- package/contracts/types/NftId.sol +8 -0
- package/contracts/types/ObjectType.sol +6 -5
- package/contracts/types/PayoutId.sol +54 -0
- package/contracts/types/Referral.sol +4 -0
- package/contracts/types/RoleId.sol +16 -9
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/StateId.sol +1 -0
- package/contracts/types/Timestamp.sol +13 -13
- package/contracts/types/UFixed.sol +1 -0
- package/contracts/types/Version.sol +1 -0
- package/package.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.json +0 -66
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.json +0 -24
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.json +0 -42
- 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/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/contracts/experiment/cloning/Cloner.sol +0 -47
- 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/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
|
@@ -1,34 +1,56 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.20;
|
|
3
3
|
|
|
4
|
-
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
|
|
5
|
-
import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
|
|
6
4
|
import {ITransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
|
|
7
5
|
|
|
6
|
+
import {Blocknumber, blockNumber} from "../types/Blocknumber.sol";
|
|
8
7
|
import {IVersionable} from "./IVersionable.sol";
|
|
9
8
|
import {NftOwnable} from "./NftOwnable.sol";
|
|
9
|
+
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
|
|
10
|
+
import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
|
|
11
|
+
import {Timestamp, TimestampLib} from "../types/Timestamp.sol";
|
|
10
12
|
import {UpgradableProxyWithAdmin} from "./UpgradableProxyWithAdmin.sol";
|
|
13
|
+
import {Version, VersionLib} from "../types/Version.sol";
|
|
11
14
|
|
|
12
15
|
/// @dev manages proxy deployments for upgradable contracs of type IVersionable
|
|
13
16
|
contract ProxyManager is
|
|
14
17
|
NftOwnable
|
|
15
18
|
{
|
|
16
19
|
|
|
17
|
-
|
|
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);
|
|
20
30
|
|
|
21
|
-
error
|
|
22
|
-
error
|
|
23
|
-
|
|
31
|
+
error ErrorProxyManagerAlreadyDeployed();
|
|
32
|
+
error ErrorProxyManagerNotYetDeployed();
|
|
33
|
+
|
|
34
|
+
error ErrorProxyManagerZeroVersion();
|
|
35
|
+
error ErrorProxyManagerNextVersionNotIncreasing(Version nextVersion);
|
|
24
36
|
|
|
25
37
|
UpgradableProxyWithAdmin internal _proxy;
|
|
26
|
-
|
|
38
|
+
|
|
39
|
+
// state to keep version history
|
|
40
|
+
mapping(Version version => VersionInfo info) _versionHistory;
|
|
41
|
+
Version [] _versions;
|
|
27
42
|
|
|
28
43
|
/// @dev only used to capture proxy owner
|
|
29
|
-
constructor()
|
|
44
|
+
constructor(address registry)
|
|
30
45
|
{
|
|
31
|
-
|
|
46
|
+
initializeProxyManager(registry);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function initializeProxyManager(address registry)
|
|
50
|
+
public
|
|
51
|
+
initializer()
|
|
52
|
+
{
|
|
53
|
+
initializeNftOwnable(msg.sender, registry);
|
|
32
54
|
}
|
|
33
55
|
|
|
34
56
|
/// @dev deploy initial contract
|
|
@@ -38,22 +60,23 @@ contract ProxyManager is
|
|
|
38
60
|
onlyOwner()
|
|
39
61
|
returns (IVersionable versionable)
|
|
40
62
|
{
|
|
41
|
-
if (
|
|
42
|
-
|
|
63
|
+
if (_versions.length > 0) {
|
|
64
|
+
revert ErrorProxyManagerAlreadyDeployed();
|
|
65
|
+
}
|
|
43
66
|
|
|
44
67
|
address currentProxyOwner = getOwner(); // used by implementation
|
|
45
68
|
address initialProxyAdminOwner = address(this); // used by proxy
|
|
46
|
-
bytes memory data = getDeployData(initialImplementation, currentProxyOwner, initializationData);
|
|
47
69
|
|
|
48
70
|
_proxy = new UpgradableProxyWithAdmin(
|
|
49
71
|
initialImplementation,
|
|
50
72
|
initialProxyAdminOwner,
|
|
51
|
-
|
|
73
|
+
getDeployData(currentProxyOwner, initializationData)
|
|
52
74
|
);
|
|
53
75
|
|
|
54
76
|
versionable = IVersionable(address(_proxy));
|
|
77
|
+
_updateVersionHistory(versionable.getVersion(), initialImplementation, currentProxyOwner);
|
|
55
78
|
|
|
56
|
-
emit
|
|
79
|
+
emit LogProxyManagerVersionableDeployed(address(_proxy), initialImplementation);
|
|
57
80
|
}
|
|
58
81
|
|
|
59
82
|
/// @dev upgrade existing contract
|
|
@@ -63,33 +86,84 @@ contract ProxyManager is
|
|
|
63
86
|
onlyOwner()
|
|
64
87
|
returns (IVersionable versionable)
|
|
65
88
|
{
|
|
66
|
-
if (
|
|
89
|
+
if (_versions.length == 0) {
|
|
90
|
+
revert ErrorProxyManagerNotYetDeployed();
|
|
91
|
+
}
|
|
67
92
|
|
|
68
93
|
address currentProxyOwner = getOwner();
|
|
69
94
|
ProxyAdmin proxyAdmin = getProxy().getProxyAdmin();
|
|
70
95
|
ITransparentUpgradeableProxy proxy = ITransparentUpgradeableProxy(address(_proxy));
|
|
71
|
-
bytes memory data = getUpgradeData(newImplementation, currentProxyOwner, upgradeData);
|
|
72
96
|
|
|
73
97
|
proxyAdmin.upgradeAndCall(
|
|
74
98
|
proxy,
|
|
75
99
|
newImplementation,
|
|
76
|
-
|
|
100
|
+
getUpgradeData(upgradeData));
|
|
77
101
|
|
|
78
102
|
versionable = IVersionable(address(_proxy));
|
|
103
|
+
_updateVersionHistory(versionable.getVersion(), newImplementation, currentProxyOwner);
|
|
79
104
|
|
|
80
|
-
emit
|
|
105
|
+
emit LogProxyManagerVersionableUpgraded(address(_proxy), newImplementation);
|
|
81
106
|
|
|
82
107
|
}
|
|
83
108
|
|
|
84
|
-
function getDeployData(address
|
|
85
|
-
return abi.encodeWithSelector(
|
|
109
|
+
function getDeployData(address proxyOwner, bytes memory deployData) public pure returns (bytes memory data) {
|
|
110
|
+
return abi.encodeWithSelector(
|
|
111
|
+
IVersionable.initializeVersionable.selector,
|
|
112
|
+
proxyOwner,
|
|
113
|
+
deployData);
|
|
86
114
|
}
|
|
87
115
|
|
|
88
|
-
function getUpgradeData(
|
|
89
|
-
return abi.encodeWithSelector(
|
|
116
|
+
function getUpgradeData(bytes memory upgradeData) public pure returns (bytes memory data) {
|
|
117
|
+
return abi.encodeWithSelector(
|
|
118
|
+
IVersionable.upgradeVersionable.selector,
|
|
119
|
+
upgradeData);
|
|
90
120
|
}
|
|
91
121
|
|
|
92
122
|
function getProxy() public returns (UpgradableProxyWithAdmin) {
|
|
93
123
|
return _proxy;
|
|
94
124
|
}
|
|
125
|
+
|
|
126
|
+
function getVersion() external view virtual returns(Version) {
|
|
127
|
+
return IVersionable(address(_proxy)).getVersion();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function getVersionCount() external view returns(uint256) {
|
|
131
|
+
return _versions.length;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function getVersion(uint256 idx) external view returns(Version) {
|
|
135
|
+
return _versions[idx];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function getVersionInfo(Version _version) external view returns(VersionInfo memory) {
|
|
139
|
+
return _versionHistory[_version];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function _updateVersionHistory(
|
|
143
|
+
Version newVersion,
|
|
144
|
+
address implementation,
|
|
145
|
+
address activatedBy
|
|
146
|
+
)
|
|
147
|
+
private
|
|
148
|
+
{
|
|
149
|
+
if(newVersion == VersionLib.zeroVersion()) {
|
|
150
|
+
revert ErrorProxyManagerZeroVersion();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if(_versions.length > 0) {
|
|
154
|
+
if(newVersion.toInt() <= _versions[_versions.length-1].toInt()) {
|
|
155
|
+
revert ErrorProxyManagerNextVersionNotIncreasing(newVersion);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// update version history
|
|
160
|
+
_versions.push(newVersion);
|
|
161
|
+
_versionHistory[newVersion] = VersionInfo(
|
|
162
|
+
newVersion,
|
|
163
|
+
implementation,
|
|
164
|
+
activatedBy,
|
|
165
|
+
TimestampLib.blockTimestamp(),
|
|
166
|
+
blockNumber()
|
|
167
|
+
);
|
|
168
|
+
}
|
|
95
169
|
}
|
|
@@ -18,8 +18,6 @@ contract Registerable is
|
|
|
18
18
|
// keccak256(abi.encode(uint256(keccak256("gif-next.contracts.shared.Registerable.sol")) - 1)) & ~bytes32(uint256(0xff));
|
|
19
19
|
bytes32 public constant REGISTERABLE_LOCATION_V1 = 0x6548007c3f4340f82f348c576c0ff69f4f529cadd5ad41f96aae61abceeaa300;
|
|
20
20
|
|
|
21
|
-
error ErrorRegisterableNotRegistry(address registryAddress);
|
|
22
|
-
|
|
23
21
|
struct RegisterableStorage {
|
|
24
22
|
NftId _parentNftId;
|
|
25
23
|
ObjectType _objectType;
|
|
@@ -39,7 +37,7 @@ contract Registerable is
|
|
|
39
37
|
ObjectType objectType,
|
|
40
38
|
bool isInterceptor,
|
|
41
39
|
address initialOwner,
|
|
42
|
-
bytes memory data
|
|
40
|
+
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
|
43
41
|
)
|
|
44
42
|
public
|
|
45
43
|
virtual
|
|
@@ -49,16 +47,11 @@ contract Registerable is
|
|
|
49
47
|
initialOwner,
|
|
50
48
|
registryAddress);
|
|
51
49
|
|
|
52
|
-
// TODO check parentNftId -> registry.isRegistered(parentNftId)
|
|
53
|
-
// TODO check object-parent type pair -> registry.isValidTypeCombo() or something...verify with registry that setup will be able to register...
|
|
54
|
-
|
|
55
50
|
RegisterableStorage storage $ = _getRegisterableStorage();
|
|
56
51
|
$._parentNftId = parentNftId;
|
|
57
52
|
$._objectType = objectType;
|
|
58
53
|
$._isInterceptor = isInterceptor;
|
|
59
|
-
$._data =
|
|
60
|
-
|
|
61
|
-
registerInterface(type(IRegisterable).interfaceId);
|
|
54
|
+
$._data = registryData;
|
|
62
55
|
}
|
|
63
56
|
|
|
64
57
|
|
|
@@ -75,7 +68,7 @@ contract Registerable is
|
|
|
75
68
|
$._objectType,
|
|
76
69
|
$._isInterceptor,
|
|
77
70
|
address(this),
|
|
78
|
-
|
|
71
|
+
getOwner(),
|
|
79
72
|
$._data);
|
|
80
73
|
}
|
|
81
74
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
pragma solidity ^0.8.20;
|
|
3
|
+
|
|
4
|
+
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
5
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
|
6
|
+
import {IRegistryLinked} from "./IRegistryLinked.sol";
|
|
7
|
+
|
|
8
|
+
contract RegistryLinked is
|
|
9
|
+
Initializable,
|
|
10
|
+
IRegistryLinked
|
|
11
|
+
{
|
|
12
|
+
|
|
13
|
+
IRegistry private _registry;
|
|
14
|
+
|
|
15
|
+
/// @dev initialization for upgradable contracts
|
|
16
|
+
// used in _initializeRegisterable
|
|
17
|
+
function initializeRegistryLinked(
|
|
18
|
+
address registryAddress
|
|
19
|
+
)
|
|
20
|
+
public
|
|
21
|
+
virtual
|
|
22
|
+
onlyInitializing()
|
|
23
|
+
{
|
|
24
|
+
if (registryAddress.code.length == 0) {
|
|
25
|
+
revert ErrorNotRegistry(registryAddress);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
_registry = IRegistry(registryAddress);
|
|
29
|
+
|
|
30
|
+
try _registry.supportsInterface(type(IRegistry).interfaceId) returns (bool isRegistry) {
|
|
31
|
+
if (!isRegistry) {
|
|
32
|
+
revert ErrorNotRegistry(registryAddress);
|
|
33
|
+
}
|
|
34
|
+
} catch {
|
|
35
|
+
revert ErrorNotRegistry(registryAddress);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
function getRegistry() public view returns (IRegistry) {
|
|
41
|
+
return _registry;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
function getRegistryAddress() public view returns (address) {
|
|
46
|
+
return address(_registry);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -3,7 +3,7 @@ pragma solidity ^0.8.19;
|
|
|
3
3
|
|
|
4
4
|
import {ObjectType, SERVICE} from "../types/ObjectType.sol";
|
|
5
5
|
import {NftId, zeroNftId} from "../types/NftId.sol";
|
|
6
|
-
import {Version, VersionPart, VersionLib} from "../types/Version.sol";
|
|
6
|
+
import {Version, VersionPart, VersionLib, VersionPartLib} from "../types/Version.sol";
|
|
7
7
|
|
|
8
8
|
import {Versionable} from "./Versionable.sol";
|
|
9
9
|
import {IService} from "./IService.sol";
|
|
@@ -22,8 +22,9 @@ abstract contract Service is
|
|
|
22
22
|
{
|
|
23
23
|
function getDomain() public pure virtual override returns(ObjectType);
|
|
24
24
|
|
|
25
|
+
// version major version MUST be consistent with major version of getVersion()
|
|
25
26
|
function getMajorVersion() public view virtual override returns(VersionPart majorVersion) {
|
|
26
|
-
return
|
|
27
|
+
return VersionPartLib.toVersionPart(3);
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
// from Versionable
|
|
@@ -44,17 +45,14 @@ abstract contract Service is
|
|
|
44
45
|
virtual
|
|
45
46
|
onlyInitializing()
|
|
46
47
|
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
initializeRegisterable(
|
|
49
|
+
registry,
|
|
50
|
+
IRegistry(registry).getNftId(),
|
|
51
|
+
SERVICE(),
|
|
52
|
+
false, // is interceptor
|
|
53
|
+
initialOwner,
|
|
54
|
+
""); // data
|
|
51
55
|
|
|
52
|
-
initializeRegisterable(registry, registryNftId, SERVICE(), isInterceptor, initialOwner, data);
|
|
53
56
|
registerInterface(type(IService).interfaceId);
|
|
54
57
|
}
|
|
55
|
-
|
|
56
|
-
// this is just a conveniene function, actual validation will be done upon registration
|
|
57
|
-
function _getRegistryNftId(address registryAddress) internal view returns (NftId) {
|
|
58
|
-
return IRegistry(registryAddress).getNftId(registryAddress);
|
|
59
|
-
}
|
|
60
58
|
}
|
|
@@ -4,6 +4,8 @@ pragma solidity ^0.8.20;
|
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
|
5
5
|
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
6
6
|
|
|
7
|
+
/// @dev token specific transfer helper
|
|
8
|
+
/// relies internally on oz SafeERC20.safeTransferFrom
|
|
7
9
|
contract TokenHandler {
|
|
8
10
|
IERC20Metadata private _token;
|
|
9
11
|
|
|
@@ -11,17 +13,21 @@ contract TokenHandler {
|
|
|
11
13
|
_token = IERC20Metadata(token);
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
// TODO add logging
|
|
15
16
|
function transfer(
|
|
16
17
|
address from,
|
|
17
18
|
address to,
|
|
18
|
-
uint256 amount
|
|
19
|
-
)
|
|
19
|
+
uint256 amount
|
|
20
|
+
)
|
|
21
|
+
external
|
|
22
|
+
{
|
|
20
23
|
SafeERC20.safeTransferFrom(_token, from, to, amount);
|
|
21
|
-
// _token.transferFrom(from, to, amount);
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
function getToken()
|
|
26
|
+
function getToken()
|
|
27
|
+
external
|
|
28
|
+
view
|
|
29
|
+
returns (IERC20Metadata)
|
|
30
|
+
{
|
|
25
31
|
return _token;
|
|
26
32
|
}
|
|
27
33
|
}
|
|
@@ -3,84 +3,39 @@ pragma solidity ^0.8.20;
|
|
|
3
3
|
|
|
4
4
|
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
5
5
|
|
|
6
|
-
import {Blocknumber, blockNumber} from "../types/Blocknumber.sol";
|
|
7
|
-
import {Timestamp, TimestampLib} from "../types/Timestamp.sol";
|
|
8
|
-
import {Version, VersionPart, VersionLib} from "../types/Version.sol";
|
|
9
|
-
|
|
10
6
|
import {IVersionable} from "./IVersionable.sol";
|
|
11
|
-
|
|
7
|
+
import {Version, VersionLib} from "../types/Version.sol";
|
|
12
8
|
|
|
13
9
|
|
|
14
10
|
abstract contract Versionable is
|
|
15
11
|
Initializable,
|
|
16
12
|
IVersionable
|
|
17
13
|
{
|
|
18
|
-
// keccak256(abi.encode(uint256(keccak256("gif-next.contracts.shared.Versionable.sol")) - 1)) & ~bytes32(uint256(0xff))
|
|
19
|
-
bytes32 private constant VERSIONABLE_LOCATION_V1 = 0x4f61291a8ac3d020d0a7d919a76b8592aa88385744dee3f8b4f3873b969ed900;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/// @custom:storage-location erc7201:gif-next.contracts.shared.Versionable.sol
|
|
23
|
-
struct VersionableStorage {
|
|
24
|
-
mapping(Version version => VersionInfo info) _versionHistory;
|
|
25
|
-
Version [] _versions;
|
|
26
|
-
Version _v1;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
14
|
constructor() {
|
|
31
15
|
_disableInitializers();
|
|
32
16
|
}
|
|
33
|
-
// TODO write test where new version of private _updateVersionHistory is added and used...
|
|
34
17
|
|
|
35
18
|
function initializeVersionable(
|
|
36
|
-
address implementation,
|
|
37
19
|
address activatedBy,
|
|
38
20
|
bytes memory data
|
|
39
21
|
)
|
|
40
22
|
public
|
|
41
23
|
initializer
|
|
42
24
|
{
|
|
43
|
-
_updateVersionHistory(implementation, activatedBy);
|
|
44
25
|
_initialize(activatedBy, data);
|
|
45
26
|
}
|
|
46
27
|
|
|
47
|
-
// TODO activatedBy MUST ALWAYS be an owner?
|
|
48
28
|
function upgradeVersionable(
|
|
49
|
-
address implementation,
|
|
50
|
-
address activatedBy,
|
|
51
29
|
bytes memory data
|
|
52
30
|
)
|
|
53
31
|
external
|
|
54
32
|
reinitializer(VersionLib.toUint64(getVersion()))
|
|
55
33
|
{
|
|
56
|
-
_updateVersionHistory(implementation, activatedBy);
|
|
57
34
|
_upgrade(data);
|
|
58
35
|
}
|
|
59
36
|
|
|
60
|
-
function isInitialized(Version _version) public override view returns(bool) {
|
|
61
|
-
return _getVersionableStorage()._versionHistory[_version].activatedIn.toInt() > 0;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
37
|
function getVersion() public pure virtual returns(Version);
|
|
65
38
|
|
|
66
|
-
function getVersionCount() public view override returns(uint256) {
|
|
67
|
-
return _getVersionableStorage()._versions.length;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function getVersion(uint256 idx) public view override returns(Version) {
|
|
71
|
-
return _getVersionableStorage()._versions[idx];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function getVersionInfo(Version _version) public override view returns(VersionInfo memory) {
|
|
75
|
-
return _getVersionableStorage()._versionHistory[_version];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function getInitializedVersion() public view returns(uint64) {
|
|
79
|
-
return _getInitializedVersion();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
39
|
// IMPORTANT each version must implement this function
|
|
85
40
|
// each implementation MUST use onlyInitialising modifier
|
|
86
41
|
// each implementation MUST call intializers of all base contracts...
|
|
@@ -92,7 +47,6 @@ abstract contract Versionable is
|
|
|
92
47
|
revert();
|
|
93
48
|
}
|
|
94
49
|
|
|
95
|
-
|
|
96
50
|
// IMPORTANT each version except version "1" must implement this function
|
|
97
51
|
// each implementation MUST use onlyInitialising modifier
|
|
98
52
|
function _upgrade(bytes memory data)
|
|
@@ -102,47 +56,4 @@ abstract contract Versionable is
|
|
|
102
56
|
{
|
|
103
57
|
revert();
|
|
104
58
|
}
|
|
105
|
-
|
|
106
|
-
function _getVersionableStorage() private pure returns (VersionableStorage storage $) {
|
|
107
|
-
assembly {
|
|
108
|
-
$.slot := VERSIONABLE_LOCATION_V1
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// can only be called once per contract
|
|
113
|
-
// needs to be called inside the proxy upgrade tx
|
|
114
|
-
// TODO run reinitializer(version().toUint64()) modifier after "version()" is checked,
|
|
115
|
-
function _updateVersionHistory(
|
|
116
|
-
address implementation,
|
|
117
|
-
address activatedBy
|
|
118
|
-
)
|
|
119
|
-
private
|
|
120
|
-
onlyInitializing
|
|
121
|
-
{
|
|
122
|
-
VersionableStorage storage $ = _getVersionableStorage();
|
|
123
|
-
|
|
124
|
-
uint64 version = _getInitializedVersion();
|
|
125
|
-
|
|
126
|
-
Version thisVersion = getVersion();
|
|
127
|
-
|
|
128
|
-
if(version == 1) {
|
|
129
|
-
// thisVersion is alias to version "1"
|
|
130
|
-
$._v1 = thisVersion;
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
require(thisVersion > $._v1, "INVALID VERSION");
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// update version history
|
|
137
|
-
$._versions.push(thisVersion);
|
|
138
|
-
$._versionHistory[thisVersion] = VersionInfo(
|
|
139
|
-
thisVersion,
|
|
140
|
-
implementation,
|
|
141
|
-
activatedBy,
|
|
142
|
-
TimestampLib.blockTimestamp(),
|
|
143
|
-
blockNumber()
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
emit LogVersionableInitialized(thisVersion, implementation, activatedBy);
|
|
147
|
-
}
|
|
148
59
|
}
|
|
@@ -52,6 +52,7 @@ function blockBlocknumber() view returns (Blocknumber) {
|
|
|
52
52
|
return toBlocknumber(block.number);
|
|
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);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
pragma solidity ^0.8.20;
|
|
3
|
+
|
|
4
|
+
// uint16 allows for 65'535 claims per policy
|
|
5
|
+
type ClaimId is uint16;
|
|
6
|
+
|
|
7
|
+
// type bindings
|
|
8
|
+
using {
|
|
9
|
+
eqClaimId as ==,
|
|
10
|
+
neClaimId as !=,
|
|
11
|
+
ClaimIdLib.eqz,
|
|
12
|
+
ClaimIdLib.gtz,
|
|
13
|
+
ClaimIdLib.toInt
|
|
14
|
+
} for ClaimId global;
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
// pure free functions for operators
|
|
18
|
+
function eqClaimId(ClaimId a, ClaimId b) pure returns (bool isSame) {
|
|
19
|
+
return ClaimId.unwrap(a) == ClaimId.unwrap(b);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function neClaimId(ClaimId a, ClaimId b) pure returns (bool isDifferent) {
|
|
23
|
+
return ClaimId.unwrap(a) != ClaimId.unwrap(b);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// library functions that operate on user defined type
|
|
27
|
+
library ClaimIdLib {
|
|
28
|
+
/// @dev Converts the ClaimId to a uint.
|
|
29
|
+
function zero() public pure returns (ClaimId) {
|
|
30
|
+
return ClaimId.wrap(0);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/// @dev Converts an uint into a ClaimId.
|
|
34
|
+
function toClaimId(uint256 a) public pure returns (ClaimId) {
|
|
35
|
+
return ClaimId.wrap(uint16(a));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/// @dev Converts the ClaimId to a uint.
|
|
39
|
+
function toInt(ClaimId a) public pure returns (uint16) {
|
|
40
|
+
return uint16(ClaimId.unwrap(a));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/// @dev Returns true if the value is non-zero (> 0).
|
|
44
|
+
function gtz(ClaimId a) public pure returns (bool) {
|
|
45
|
+
return ClaimId.unwrap(a) > 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/// @dev Returns true if the value is zero (== 0).
|
|
49
|
+
function eqz(ClaimId a) public pure returns (bool) {
|
|
50
|
+
return ClaimId.unwrap(a) == 0;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -3,7 +3,7 @@ pragma solidity ^0.8.20;
|
|
|
3
3
|
|
|
4
4
|
import {Key32, KeyId, Key32Lib} from "./Key32.sol";
|
|
5
5
|
import {NftId} from "./NftId.sol";
|
|
6
|
-
import {
|
|
6
|
+
import {DISTRIBUTOR_TYPE} from "./ObjectType.sol";
|
|
7
7
|
|
|
8
8
|
type DistributorType is bytes8;
|
|
9
9
|
|
|
@@ -45,7 +45,7 @@ library DistributorTypeLib {
|
|
|
45
45
|
|
|
46
46
|
/// @dev Returns the key32 value for the specified nft id and object type.
|
|
47
47
|
function toKey32(DistributorType id) public pure returns (Key32 key) {
|
|
48
|
-
return Key32Lib.toKey32(
|
|
48
|
+
return Key32Lib.toKey32(DISTRIBUTOR_TYPE(), toKeyId(id));
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/// @dev Returns the key id value for the specified nft id
|
package/contracts/types/Fee.sol
CHANGED
|
@@ -24,6 +24,7 @@ function toNftId(uint256 id) pure returns (NftId) {
|
|
|
24
24
|
return NftId.wrap(uint96(id));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
// TODO move to NftIdLib and rename to zero()
|
|
27
28
|
/// @dev Return the NftId zero (0)
|
|
28
29
|
function zeroNftId() pure returns (NftId) {
|
|
29
30
|
return NftId.wrap(0);
|
|
@@ -40,6 +41,13 @@ function neNftId(NftId a, NftId b) pure returns (bool isDifferent) {
|
|
|
40
41
|
|
|
41
42
|
// library functions that operate on user defined type
|
|
42
43
|
library NftIdLib {
|
|
44
|
+
|
|
45
|
+
/// @dev the zero nft id
|
|
46
|
+
/// is never a valid nft id and implies a non-initialized value
|
|
47
|
+
function zero() public pure returns (NftId) {
|
|
48
|
+
return NftId.wrap(0);
|
|
49
|
+
}
|
|
50
|
+
|
|
43
51
|
/// @dev Converts the NftId to a uint256.
|
|
44
52
|
function toInt(NftId nftId) public pure returns (uint96) {
|
|
45
53
|
return uint96(NftId.unwrap(nftId));
|
|
@@ -66,7 +66,7 @@ function DISTRIBUTION() pure returns (ObjectType) {
|
|
|
66
66
|
return toObjectType(120);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
function
|
|
69
|
+
function DISTRIBUTOR_TYPE() pure returns (ObjectType) {
|
|
70
70
|
return toObjectType(121);
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -98,12 +98,12 @@ function POLICY() pure returns (ObjectType) {
|
|
|
98
98
|
return toObjectType(211);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
function
|
|
102
|
-
return toObjectType(
|
|
101
|
+
function CLAIM() pure returns (ObjectType) {
|
|
102
|
+
return toObjectType(212);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
function
|
|
106
|
-
return toObjectType(
|
|
105
|
+
function BUNDLE() pure returns (ObjectType) {
|
|
106
|
+
return toObjectType(220);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
function PAYOUT() pure returns (ObjectType) {
|
|
@@ -115,6 +115,7 @@ function toObjectType(uint256 objectType) pure returns (ObjectType) {
|
|
|
115
115
|
return ObjectType.wrap(uint8(objectType));
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
// TODO move to ObjecTypeLib and rename to zero()
|
|
118
119
|
/// @dev Return the ObjectType zero (0)
|
|
119
120
|
function zeroObjectType() pure returns (ObjectType) {
|
|
120
121
|
return ObjectType.wrap(0);
|