@zoralabs/coins 0.7.1 → 1.0.0

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.
Files changed (167) hide show
  1. package/.turbo/turbo-build.log +106 -84
  2. package/CHANGELOG.md +68 -0
  3. package/abis/BadImpl.json +15 -0
  4. package/abis/BalanceDeltaLibrary.json +15 -0
  5. package/abis/BaseCoin.json +1350 -0
  6. package/abis/BaseCoinDeployHook.json +78 -0
  7. package/abis/BaseHook.json +897 -0
  8. package/abis/BaseTest.json +60 -91
  9. package/abis/BeforeSwapDeltaLibrary.json +15 -0
  10. package/abis/BuySupplyWithSwapRouterHook.json +126 -0
  11. package/abis/Coin.json +214 -150
  12. package/abis/CoinConstants.json +65 -0
  13. package/abis/CoinDopplerMultiCurve.json +38 -0
  14. package/abis/CoinRewardsV4.json +54 -0
  15. package/abis/CoinTest.json +66 -111
  16. package/abis/CoinUniV4Test.json +1053 -0
  17. package/abis/CoinV4.json +1687 -0
  18. package/abis/CurrencyLibrary.json +25 -0
  19. package/abis/DeployHooks.json +9 -0
  20. package/abis/DeployScript.json +47 -0
  21. package/abis/DeployedCoinVersionLookup.json +21 -0
  22. package/abis/DeployedCoinVersionLookupTest.json +716 -0
  23. package/abis/DifferentNamespaceVersionLookup.json +39 -0
  24. package/abis/DopplerUniswapV3Test.json +62 -184
  25. package/abis/ERC20.json +310 -0
  26. package/abis/FactoryTest.json +98 -98
  27. package/abis/FakeHookNoInterface.json +21 -0
  28. package/abis/FeeEstimatorHook.json +1528 -0
  29. package/abis/Hooks.json +28 -0
  30. package/abis/HooksDeployment.json +23 -0
  31. package/abis/HooksTest.json +698 -0
  32. package/abis/IAllowanceTransfer.json +486 -0
  33. package/abis/ICoin.json +62 -69
  34. package/abis/ICoinDeployHook.json +31 -0
  35. package/abis/ICoinV3.json +879 -0
  36. package/abis/ICoinV4.json +915 -0
  37. package/abis/IContractMetadata.json +28 -0
  38. package/abis/IDeployedCoinVersionLookup.json +21 -0
  39. package/abis/IEIP712.json +15 -0
  40. package/abis/IEIP712_v4.json +15 -0
  41. package/abis/IERC20Minimal.json +172 -0
  42. package/abis/IERC6909Claims.json +288 -0
  43. package/abis/IERC721.json +36 -36
  44. package/abis/IERC721Permit_v4.json +88 -0
  45. package/abis/IExtsload.json +64 -0
  46. package/abis/IExttload.json +40 -0
  47. package/abis/IHasAfterCoinDeploy.json +31 -0
  48. package/abis/IHasContractName.json +15 -0
  49. package/abis/IHasPoolKey.json +42 -0
  50. package/abis/IHasRewardsRecipients.json +54 -0
  51. package/abis/IHasSwapPath.json +60 -0
  52. package/abis/IHooks.json +789 -0
  53. package/abis/IImmutableState.json +15 -0
  54. package/abis/IMsgSender.json +15 -0
  55. package/abis/IMulticall_v4.json +21 -0
  56. package/abis/INotifier.json +187 -0
  57. package/abis/IPermit2.json +865 -0
  58. package/abis/IPermit2Forwarder.json +138 -0
  59. package/abis/IPoolConfigEncoding.json +46 -0
  60. package/abis/IPoolInitializer_v4.json +53 -0
  61. package/abis/IPoolManager.json +1286 -0
  62. package/abis/IPositionManager.json +712 -0
  63. package/abis/IProtocolFees.json +174 -0
  64. package/abis/ISignatureTransfer.json +394 -0
  65. package/abis/ISubscriber.json +89 -0
  66. package/abis/ISwapPathRouter.json +92 -0
  67. package/abis/ISwapRouter.json +82 -0
  68. package/abis/IUniversalRouter.json +61 -0
  69. package/abis/IUnlockCallback.json +21 -0
  70. package/abis/IUnorderedNonce.json +44 -0
  71. package/abis/IV4Quoter.json +310 -0
  72. package/abis/IV4Router.json +47 -0
  73. package/abis/IZoraFactory.json +328 -4
  74. package/abis/IZoraV4CoinHook.json +427 -0
  75. package/abis/ImmutableState.json +36 -0
  76. package/abis/LPFeeLibrary.json +65 -0
  77. package/abis/MockERC20.json +21 -0
  78. package/abis/MultiOwnableTest.json +60 -91
  79. package/abis/{CoinConfigurationVersions.json → Position.json} +1 -1
  80. package/abis/PrintUpgradeCommand.json +9 -0
  81. package/abis/ProxyShim.json +24 -0
  82. package/abis/Simulate.json +0 -91
  83. package/abis/StateLibrary.json +80 -0
  84. package/abis/TestDeployedCoinVersionLookupImplementation.json +39 -0
  85. package/abis/TestV4Swap.json +9 -0
  86. package/abis/{CoinSetup.json → UniV3BuySell.json} +5 -0
  87. package/abis/UniV3Errors.json +32 -0
  88. package/abis/UpgradeCoinImpl.json +47 -0
  89. package/abis/UpgradeFactoryImpl.json +9 -0
  90. package/abis/UpgradesTest.json +671 -0
  91. package/abis/Vm.json +1482 -111
  92. package/abis/VmSafe.json +856 -32
  93. package/abis/ZoraFactoryImpl.json +450 -1
  94. package/abis/ZoraV4CoinHook.json +1439 -0
  95. package/addresses/8453.json +8 -3
  96. package/addresses/84532.json +8 -3
  97. package/dist/index.cjs +1998 -184
  98. package/dist/index.cjs.map +1 -1
  99. package/dist/index.js +1989 -178
  100. package/dist/index.js.map +1 -1
  101. package/dist/wagmiGenerated.d.ts +2852 -688
  102. package/dist/wagmiGenerated.d.ts.map +1 -1
  103. package/package/wagmiGenerated.ts +1992 -173
  104. package/package.json +7 -2
  105. package/remappings.txt +6 -1
  106. package/script/CoinsDeployerBase.sol +105 -10
  107. package/script/DeployDevFactory.s.sol +21 -0
  108. package/script/DeployHooks.s.sol +22 -0
  109. package/script/PrintUpgradeCommand.s.sol +13 -0
  110. package/script/Simulate.s.sol +4 -12
  111. package/script/TestBackingCoinSwap.s.sol +146 -0
  112. package/script/TestV4Swap.s.sol +136 -0
  113. package/script/UpgradeCoinImpl.sol +2 -2
  114. package/script/UpgradeFactoryImpl.s.sol +23 -0
  115. package/src/BaseCoin.sol +176 -0
  116. package/src/Coin.sol +93 -515
  117. package/src/CoinV4.sol +121 -0
  118. package/src/ZoraFactoryImpl.sol +257 -57
  119. package/src/hooks/ZoraV4CoinHook.sol +195 -0
  120. package/src/hooks/deployment/BaseCoinDeployHook.sol +62 -0
  121. package/src/hooks/deployment/BuySupplyWithSwapRouterHook.sol +80 -0
  122. package/src/interfaces/ICoin.sol +35 -39
  123. package/src/interfaces/ICoinDeployHook.sol +8 -0
  124. package/src/interfaces/ICoinV3.sol +71 -0
  125. package/src/interfaces/ICoinV4.sol +69 -0
  126. package/src/interfaces/IDeployedCoinVersionLookup.sol +11 -0
  127. package/src/interfaces/IMsgSender.sol +9 -0
  128. package/src/interfaces/IPoolConfigEncoding.sol +14 -0
  129. package/src/interfaces/ISwapPathRouter.sol +14 -0
  130. package/src/interfaces/ISwapRouter.sol +1 -35
  131. package/src/interfaces/IZoraFactory.sol +97 -7
  132. package/src/interfaces/IZoraV4CoinHook.sol +116 -0
  133. package/src/libs/CoinCommon.sol +15 -0
  134. package/src/libs/CoinConfigurationVersions.sol +116 -1
  135. package/src/{utils → libs}/CoinConstants.sol +11 -6
  136. package/src/libs/CoinDopplerMultiCurve.sol +134 -0
  137. package/src/libs/CoinDopplerUniV3.sol +19 -171
  138. package/src/libs/CoinRewards.sol +195 -0
  139. package/src/libs/CoinRewardsV4.sol +180 -0
  140. package/src/libs/CoinSetup.sol +40 -20
  141. package/src/libs/CoinSetupV3.sol +50 -0
  142. package/src/libs/DopplerMath.sol +156 -0
  143. package/src/libs/HooksDeployment.sol +84 -0
  144. package/src/libs/MarketConstants.sol +4 -0
  145. package/src/libs/PoolStateReader.sol +22 -0
  146. package/src/libs/UniV3BuySell.sol +231 -0
  147. package/src/libs/UniV3Errors.sol +11 -0
  148. package/src/libs/UniV4SwapHelper.sol +65 -0
  149. package/src/libs/UniV4SwapToCurrency.sol +109 -0
  150. package/src/libs/V4Liquidity.sol +129 -0
  151. package/src/types/PoolConfiguration.sol +15 -0
  152. package/src/utils/DeployedCoinVersionLookup.sol +52 -0
  153. package/src/version/ContractVersionBase.sol +1 -1
  154. package/test/Coin.t.sol +94 -101
  155. package/test/CoinDopplerUniV3.t.sol +35 -184
  156. package/test/CoinUniV4.t.sol +752 -0
  157. package/test/DeploymentHooks.t.sol +270 -0
  158. package/test/Factory.t.sol +84 -50
  159. package/test/MultiOwnable.t.sol +6 -3
  160. package/test/Upgrades.t.sol +68 -0
  161. package/test/mocks/MockERC20.sol +12 -0
  162. package/test/utils/BaseTest.sol +124 -59
  163. package/test/utils/DeployedCoinVersionLookup.t.sol +127 -0
  164. package/test/utils/FeeEstimatorHook.sol +84 -0
  165. package/test/utils/ProxyShim.sol +17 -0
  166. package/wagmi.config.ts +10 -9
  167. package/src/libs/CoinLegacy.sol +0 -48
@@ -0,0 +1,109 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.23;
3
+
4
+ import {Currency} from "@uniswap/v4-core/src/types/Currency.sol";
5
+ import {ISwapPathRouter} from "../interfaces/ISwapPathRouter.sol";
6
+ import {IHasPoolKey} from "../interfaces/ICoinV4.sol";
7
+ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
8
+ import {IPoolManager, PoolKey} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
9
+ import {SwapParams} from "@uniswap/v4-core/src/types/PoolOperation.sol";
10
+ import {BalanceDelta, BalanceDeltaLibrary} from "@uniswap/v4-core/src/types/BalanceDelta.sol";
11
+ import {IHasSwapPath} from "../interfaces/ICoinV4.sol";
12
+ import {TickMath} from "@uniswap/v4-core/src/libraries/TickMath.sol";
13
+ import {PathKey} from "@uniswap/v4-periphery/src/libraries/PathKey.sol";
14
+ import {IDeployedCoinVersionLookup} from "../interfaces/IDeployedCoinVersionLookup.sol";
15
+ import {IZoraV4CoinHook} from "../interfaces/IZoraV4CoinHook.sol";
16
+ import {CoinConfigurationVersions} from "./CoinConfigurationVersions.sol";
17
+
18
+ library UniV4SwapToCurrency {
19
+ using BalanceDeltaLibrary for BalanceDelta;
20
+
21
+ function swapToPath(
22
+ IPoolManager poolManager,
23
+ uint128 amount0,
24
+ uint128 amount1,
25
+ Currency currencyIn,
26
+ PathKey[] memory path
27
+ ) internal returns (Currency lastCurrency, uint128 lastCurrencyBalance) {
28
+ require(path.length > 0, IZoraV4CoinHook.PathMustHaveAtLeastOneStep());
29
+
30
+ // do first swap - the first swap updates output the balance with the initial balance that existed before the swap
31
+ (lastCurrency, lastCurrencyBalance) = _doFirstSwapFromCoinToCurrency(poolManager, path[0], currencyIn, amount0, amount1);
32
+
33
+ // for each path, swap the currency to the next currency
34
+ for (uint256 i = 1; i < path.length; i++) {
35
+ (PoolKey memory poolKey, bool zeroForOne) = _getPoolAndSwapDirection(path[i], lastCurrency);
36
+ lastCurrencyBalance = uint128(_swap(poolManager, poolKey, zeroForOne, -int128(lastCurrencyBalance), ""));
37
+ lastCurrency = zeroForOne ? poolKey.currency1 : poolKey.currency0;
38
+ }
39
+ }
40
+
41
+ function _doFirstSwapFromCoinToCurrency(
42
+ IPoolManager poolManager,
43
+ PathKey memory pathKey,
44
+ Currency coin,
45
+ uint128 amount0,
46
+ uint128 amount1
47
+ ) private returns (Currency outputCurrency, uint128 outputAmount) {
48
+ (PoolKey memory poolKey, bool zeroForOne) = _getPoolAndSwapDirection(pathKey, coin);
49
+
50
+ uint128 coinAmount = zeroForOne ? amount0 : amount1;
51
+
52
+ outputCurrency = zeroForOne ? poolKey.currency1 : poolKey.currency0;
53
+
54
+ uint128 initialAmountCurrency = zeroForOne ? amount1 : amount0;
55
+
56
+ // if not swapping any coin for currency, output amount is amount of currency
57
+ if (coinAmount == 0) {
58
+ outputAmount = initialAmountCurrency;
59
+ } else {
60
+ outputAmount = uint128(_swap(poolManager, poolKey, zeroForOne, -int128(coinAmount), bytes("")));
61
+ }
62
+ }
63
+
64
+ function _swap(
65
+ IPoolManager poolManager,
66
+ PoolKey memory poolKey,
67
+ bool zeroForOne,
68
+ int256 amountSpecified,
69
+ bytes memory hookData
70
+ ) private returns (int128 reciprocalAmount) {
71
+ // for protection of exactOut swaps, sqrtPriceLimit is not exposed as a feature in this contract
72
+ unchecked {
73
+ BalanceDelta delta = poolManager.swap(
74
+ poolKey,
75
+ SwapParams(zeroForOne, amountSpecified, zeroForOne ? TickMath.MIN_SQRT_PRICE + 1 : TickMath.MAX_SQRT_PRICE - 1),
76
+ hookData
77
+ );
78
+
79
+ reciprocalAmount = (zeroForOne == amountSpecified < 0) ? delta.amount1() : delta.amount0();
80
+ }
81
+ }
82
+
83
+ /// @notice Get the pool and swap direction for a given PathKey
84
+ /// @param params the given PathKey
85
+ /// @param currencyIn the input currency
86
+ /// @return poolKey the pool key of the swap
87
+ /// @return zeroForOne the direction of the swap, true if currency0 is being swapped for currency1
88
+ function _getPoolAndSwapDirection(PathKey memory params, Currency currencyIn) internal pure returns (PoolKey memory poolKey, bool zeroForOne) {
89
+ Currency currencyOut = params.intermediateCurrency;
90
+ (Currency currency0, Currency currency1) = currencyIn < currencyOut ? (currencyIn, currencyOut) : (currencyOut, currencyIn);
91
+
92
+ zeroForOne = currencyIn == currency0;
93
+ poolKey = PoolKey(currency0, currency1, params.fee, params.tickSpacing, params.hooks);
94
+ }
95
+
96
+ function getSubSwapPath(address currency, IDeployedCoinVersionLookup coinVersionLookup) internal view returns (PathKey[] memory) {
97
+ if (!_hasSwapPath(currency, coinVersionLookup)) {
98
+ return new PathKey[](0);
99
+ }
100
+ return IHasSwapPath(currency).getPayoutSwapPath(coinVersionLookup).path;
101
+ }
102
+
103
+ function _hasSwapPath(address currency, IDeployedCoinVersionLookup coinVersionLookup) private view returns (bool) {
104
+ if (CoinConfigurationVersions.isV4(coinVersionLookup.getVersionForDeployedCoin(currency))) {
105
+ return IERC165(currency).supportsInterface(type(IHasSwapPath).interfaceId);
106
+ }
107
+ return false;
108
+ }
109
+ }
@@ -0,0 +1,129 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.23;
3
+
4
+ import {TickMath} from "@uniswap/v4-core/src/libraries/TickMath.sol";
5
+ import {SqrtPriceMath} from "@uniswap/v4-core/src/libraries/SqrtPriceMath.sol";
6
+ import {FullMath} from "@uniswap/v4-core/src/libraries/FullMath.sol";
7
+ import {IUnlockCallback} from "@uniswap/v4-core/src/interfaces/callback/IUnlockCallback.sol";
8
+ import {IPoolManager, PoolKey, IHooks, ModifyLiquidityParams, BalanceDelta} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
9
+ import {StateLibrary} from "@uniswap/v4-core/src/libraries/StateLibrary.sol";
10
+ import {BalanceDeltaLibrary} from "@uniswap/v4-core/src/types/BalanceDelta.sol";
11
+ import {TransientStateLibrary} from "@uniswap/v4-core/src/libraries/TransientStateLibrary.sol";
12
+ import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol";
13
+ import {LpPosition} from "../types/LpPosition.sol";
14
+ import {SafeCast} from "@uniswap/v4-core/src/libraries/SafeCast.sol";
15
+ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
16
+ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
17
+ import {SwapParams} from "@uniswap/v4-core/src/types/PoolOperation.sol";
18
+ import {IHasRewardsRecipients} from "../interfaces/ICoin.sol";
19
+ import {IHasSwapPath} from "../interfaces/ICoinV4.sol";
20
+ import {UniV4SwapToCurrency} from "./UniV4SwapToCurrency.sol";
21
+ import {PathKey} from "@uniswap/v4-periphery/src/libraries/PathKey.sol";
22
+
23
+ // command = 1; mint
24
+ struct CallbackData {
25
+ PoolKey poolKey;
26
+ LpPosition[] positions;
27
+ }
28
+
29
+ struct UnlockData {
30
+ uint256 amount0;
31
+ uint256 amount1;
32
+ int128 fees0;
33
+ int128 fees1;
34
+ }
35
+
36
+ library V4Liquidity {
37
+ using BalanceDeltaLibrary for BalanceDelta;
38
+ using CurrencyLibrary for Currency;
39
+
40
+ function lockAndMint(IPoolManager poolManager, PoolKey memory poolKey, LpPosition[] memory positions) internal {
41
+ bytes memory data = abi.encode(CallbackData({poolKey: poolKey, positions: positions}));
42
+
43
+ IPoolManager(poolManager).unlock(data);
44
+ }
45
+
46
+ function handleMintPositionsCallback(IPoolManager poolManager, bytes memory data) internal returns (UnlockData memory) {
47
+ CallbackData memory callbackData = abi.decode(data, (CallbackData));
48
+
49
+ uint256 amount0;
50
+ uint256 amount1;
51
+ int128 fees0;
52
+ int128 fees1;
53
+
54
+ (fees0, fees1) = _mintPositions(poolManager, callbackData.poolKey, callbackData.positions);
55
+
56
+ _settleUp(poolManager, callbackData.poolKey);
57
+
58
+ return UnlockData({amount0: amount0, amount1: amount1, fees0: fees0, fees1: fees1});
59
+ }
60
+
61
+ function collectFees(IPoolManager poolManager, PoolKey memory poolKey, LpPosition[] storage positions) internal returns (int128 balance0, int128 balance1) {
62
+ ModifyLiquidityParams memory params;
63
+ uint256 numPositions = positions.length;
64
+
65
+ for (uint256 i; i < numPositions; i++) {
66
+ params = ModifyLiquidityParams({
67
+ tickLower: positions[i].tickLower,
68
+ tickUpper: positions[i].tickUpper,
69
+ liquidityDelta: 0, // only collect
70
+ salt: 0
71
+ });
72
+
73
+ (, BalanceDelta feesDelta) = poolManager.modifyLiquidity(poolKey, params, "");
74
+
75
+ // check if there is enough erc20 balance for each token to take the fees
76
+ balance0 += feesDelta.amount0();
77
+ balance1 += feesDelta.amount1();
78
+ }
79
+ }
80
+
81
+ function _mintPositions(IPoolManager poolManager, PoolKey memory poolKey, LpPosition[] memory positions) private returns (int128 amount0, int128 amount1) {
82
+ ModifyLiquidityParams memory params;
83
+ uint256 numPositions = positions.length;
84
+
85
+ for (uint256 i; i < numPositions; i++) {
86
+ params = ModifyLiquidityParams({
87
+ tickLower: positions[i].tickLower,
88
+ tickUpper: positions[i].tickUpper,
89
+ liquidityDelta: SafeCast.toInt256(positions[i].liquidity),
90
+ salt: 0
91
+ });
92
+
93
+ (BalanceDelta delta, ) = poolManager.modifyLiquidity(poolKey, params, "");
94
+
95
+ amount0 += delta.amount0();
96
+ amount1 += delta.amount1();
97
+ }
98
+ }
99
+
100
+ function _settleUp(IPoolManager poolManager, PoolKey memory poolKey) private returns (int256 currency0Delta, int256 currency1Delta) {
101
+ // calculate the current deltas
102
+ currency0Delta = TransientStateLibrary.currencyDelta(poolManager, address(this), poolKey.currency0);
103
+ currency1Delta = TransientStateLibrary.currencyDelta(poolManager, address(this), poolKey.currency1);
104
+
105
+ _settleDeltas(poolManager, poolKey, currency0Delta, currency1Delta);
106
+ }
107
+
108
+ function _settleDeltas(IPoolManager poolManager, PoolKey memory poolKey, int256 currency0Delta, int256 currency1Delta) private {
109
+ if (currency0Delta > 0) {
110
+ poolManager.take(poolKey.currency0, address(this), uint256(currency0Delta));
111
+ }
112
+
113
+ if (currency1Delta > 0) {
114
+ poolManager.take(poolKey.currency1, address(this), uint256(currency1Delta));
115
+ }
116
+
117
+ if (currency0Delta < 0) {
118
+ poolManager.sync(poolKey.currency0);
119
+ poolKey.currency0.transfer(address(poolManager), uint256(-currency0Delta));
120
+ poolManager.settle();
121
+ }
122
+
123
+ if (currency1Delta < 0) {
124
+ poolManager.sync(poolKey.currency1);
125
+ poolKey.currency1.transfer(address(poolManager), uint256(-currency1Delta));
126
+ poolManager.settle();
127
+ }
128
+ }
129
+ }
@@ -0,0 +1,15 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.23;
3
+
4
+ /// @notice The configuration of the pool
5
+ /// @dev This is used to configure the pool's liquidity positions
6
+ struct PoolConfiguration {
7
+ uint8 version;
8
+ uint16 numPositions;
9
+ uint24 fee;
10
+ int24 tickSpacing;
11
+ uint16[] numDiscoveryPositions;
12
+ int24[] tickLower;
13
+ int24[] tickUpper;
14
+ uint256[] maxDiscoverySupplyShare;
15
+ }
@@ -0,0 +1,52 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.23;
3
+
4
+ import {IDeployedCoinVersionLookup} from "../interfaces/IDeployedCoinVersionLookup.sol";
5
+
6
+ /**
7
+ * @title DeployedCoinVersionLookup
8
+ * @notice Contract for storing and retrieving version information for deployed coins
9
+ * @dev Uses the ERC-7201 static storage slot pattern for upgradeable storage
10
+ */
11
+ contract DeployedCoinVersionLookup is IDeployedCoinVersionLookup {
12
+ struct DeployedCoinVersion {
13
+ uint8 version;
14
+ }
15
+
16
+ /// @custom:storage-location erc7201:zora.coins.deployedcoinversionlookup.storage
17
+ struct DeployedCoinVersionStorage {
18
+ mapping(address => DeployedCoinVersion) deployedCoinWithVersion;
19
+ }
20
+
21
+ // keccak256(abi.encode(uint256(keccak256("zora.coins.deployedcoinversionlookup.storage")) - 1)) & ~bytes32(uint256(0xff))
22
+ bytes32 private constant DEPLOYED_COIN_VERSION_STORAGE_LOCATION = 0x9a79df0b86f39d0543c14aee714123562f798115071e932933bcc3e29cc86f00;
23
+
24
+ /**
25
+ * @dev Returns the storage slot struct for deployed coin versions
26
+ * @return $ Storage struct containing the deployedCoinWithVersion mapping
27
+ */
28
+ function _getDeployedCoinVersionStorage() private pure returns (DeployedCoinVersionStorage storage $) {
29
+ assembly {
30
+ $.slot := DEPLOYED_COIN_VERSION_STORAGE_LOCATION
31
+ }
32
+ }
33
+
34
+ /**
35
+ * @notice Gets the version for a deployed coin
36
+ * @param coin The address of the coin
37
+ * @return version The version of the coin (0 if not found)
38
+ */
39
+ function getVersionForDeployedCoin(address coin) public view returns (uint8) {
40
+ return _getDeployedCoinVersionStorage().deployedCoinWithVersion[coin].version;
41
+ }
42
+
43
+ /**
44
+ * @notice Sets the version for a deployed coin
45
+ * @dev Only callable internally
46
+ * @param coin The address of the coin
47
+ * @param version The version to set
48
+ */
49
+ function _setVersionForDeployedCoin(address coin, uint8 version) internal {
50
+ _getDeployedCoinVersionStorage().deployedCoinWithVersion[coin] = DeployedCoinVersion({version: version});
51
+ }
52
+ }
@@ -9,6 +9,6 @@ import {IVersionedContract} from "@zoralabs/shared-contracts/interfaces/IVersion
9
9
  contract ContractVersionBase is IVersionedContract {
10
10
  /// @notice The version of the contract
11
11
  function contractVersion() external pure override returns (string memory) {
12
- return "0.7.1";
12
+ return "1.0.0";
13
13
  }
14
14
  }