@zoralabs/coins 0.9.0 → 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 (124) hide show
  1. package/.turbo/turbo-build.log +131 -114
  2. package/CHANGELOG.md +40 -0
  3. package/abis/BaseCoin.json +26 -118
  4. package/abis/BaseTest.json +47 -0
  5. package/abis/Coin.json +171 -63
  6. package/abis/CoinDopplerMultiCurve.json +38 -0
  7. package/abis/CoinRewardsV4.json +54 -0
  8. package/abis/CoinTest.json +53 -20
  9. package/abis/CoinUniV4Test.json +1053 -0
  10. package/abis/CoinV4.json +234 -211
  11. package/abis/DeployScript.json +47 -0
  12. package/abis/DeployedCoinVersionLookup.json +21 -0
  13. package/abis/DeployedCoinVersionLookupTest.json +716 -0
  14. package/abis/DifferentNamespaceVersionLookup.json +39 -0
  15. package/abis/DopplerUniswapV3Test.json +49 -93
  16. package/abis/ERC20.json +310 -0
  17. package/abis/FactoryTest.json +85 -7
  18. package/abis/FeeEstimatorHook.json +1528 -0
  19. package/abis/HooksDeployment.json +23 -0
  20. package/abis/HooksTest.json +47 -0
  21. package/abis/ICoin.json +40 -71
  22. package/abis/ICoinV3.json +879 -0
  23. package/abis/ICoinV4.json +915 -0
  24. package/abis/IDeployedCoinVersionLookup.json +21 -0
  25. package/abis/IERC721.json +36 -36
  26. package/abis/IHasPoolKey.json +42 -0
  27. package/abis/IHasRewardsRecipients.json +54 -0
  28. package/abis/IHasSwapPath.json +60 -0
  29. package/abis/IMsgSender.json +15 -0
  30. package/abis/IPoolConfigEncoding.json +46 -0
  31. package/abis/ISwapPathRouter.json +92 -0
  32. package/abis/IUniversalRouter.json +61 -0
  33. package/abis/IUnlockCallback.json +21 -0
  34. package/abis/IV4Quoter.json +310 -0
  35. package/abis/IZoraFactory.json +191 -11
  36. package/abis/IZoraV4CoinHook.json +348 -4
  37. package/abis/MockERC20.json +21 -0
  38. package/abis/MultiOwnableTest.json +47 -0
  39. package/abis/{CoinConfigurationVersions.json → Position.json} +1 -1
  40. package/abis/PrintUpgradeCommand.json +9 -0
  41. package/abis/ProxyShim.json +24 -0
  42. package/abis/StateLibrary.json +80 -0
  43. package/abis/TestDeployedCoinVersionLookupImplementation.json +39 -0
  44. package/abis/TestV4Swap.json +9 -0
  45. package/abis/UpgradeCoinImpl.json +47 -0
  46. package/abis/UpgradesTest.json +67 -0
  47. package/abis/Vm.json +1482 -111
  48. package/abis/VmSafe.json +856 -32
  49. package/abis/ZoraFactoryImpl.json +339 -1
  50. package/abis/ZoraV4CoinHook.json +455 -5
  51. package/addresses/8453.json +8 -4
  52. package/addresses/84532.json +8 -4
  53. package/dist/index.cjs +1920 -169
  54. package/dist/index.cjs.map +1 -1
  55. package/dist/index.js +1916 -169
  56. package/dist/index.js.map +1 -1
  57. package/dist/wagmiGenerated.d.ts +2599 -183
  58. package/dist/wagmiGenerated.d.ts.map +1 -1
  59. package/package/wagmiGenerated.ts +1928 -165
  60. package/package.json +8 -3
  61. package/remappings.txt +6 -1
  62. package/script/CoinsDeployerBase.sol +74 -11
  63. package/script/DeployDevFactory.s.sol +21 -0
  64. package/script/PrintUpgradeCommand.s.sol +13 -0
  65. package/script/Simulate.s.sol +1 -10
  66. package/script/TestBackingCoinSwap.s.sol +146 -0
  67. package/script/TestV4Swap.s.sol +136 -0
  68. package/script/UpgradeFactoryImpl.s.sol +1 -1
  69. package/src/BaseCoin.sol +176 -0
  70. package/src/Coin.sol +87 -202
  71. package/src/CoinV4.sol +121 -0
  72. package/src/ZoraFactoryImpl.sol +208 -36
  73. package/src/hooks/ZoraV4CoinHook.sol +195 -0
  74. package/src/hooks/{BaseCoinDeployHook.sol → deployment/BaseCoinDeployHook.sol} +3 -3
  75. package/src/hooks/{BuySupplyWithSwapRouterHook.sol → deployment/BuySupplyWithSwapRouterHook.sol} +7 -5
  76. package/src/interfaces/ICoin.sol +31 -39
  77. package/src/interfaces/ICoinV3.sol +71 -0
  78. package/src/interfaces/ICoinV4.sol +69 -0
  79. package/src/interfaces/IDeployedCoinVersionLookup.sol +11 -0
  80. package/src/interfaces/IMsgSender.sol +9 -0
  81. package/src/interfaces/IPoolConfigEncoding.sol +14 -0
  82. package/src/interfaces/ISwapPathRouter.sol +14 -0
  83. package/src/interfaces/IZoraFactory.sol +65 -27
  84. package/src/interfaces/IZoraV4CoinHook.sol +116 -0
  85. package/src/libs/CoinCommon.sol +15 -0
  86. package/src/libs/CoinConfigurationVersions.sol +116 -1
  87. package/src/libs/CoinConstants.sol +5 -0
  88. package/src/libs/CoinDopplerMultiCurve.sol +134 -0
  89. package/src/libs/CoinDopplerUniV3.sol +19 -171
  90. package/src/libs/CoinRewards.sol +195 -0
  91. package/src/libs/CoinRewardsV4.sol +180 -0
  92. package/src/libs/CoinSetup.sol +57 -0
  93. package/src/libs/CoinSetupV3.sol +6 -67
  94. package/src/libs/DopplerMath.sol +156 -0
  95. package/src/libs/HooksDeployment.sol +84 -0
  96. package/src/libs/MarketConstants.sol +4 -0
  97. package/src/libs/PoolStateReader.sol +22 -0
  98. package/src/libs/UniV3BuySell.sol +74 -292
  99. package/src/libs/UniV4SwapHelper.sol +65 -0
  100. package/src/libs/UniV4SwapToCurrency.sol +109 -0
  101. package/src/libs/V4Liquidity.sol +129 -0
  102. package/src/types/PoolConfiguration.sol +15 -0
  103. package/src/utils/DeployedCoinVersionLookup.sol +52 -0
  104. package/src/version/ContractVersionBase.sol +1 -1
  105. package/test/Coin.t.sol +78 -88
  106. package/test/CoinDopplerUniV3.t.sol +32 -171
  107. package/test/CoinUniV4.t.sol +752 -0
  108. package/test/{Hooks.t.sol → DeploymentHooks.t.sol} +2 -6
  109. package/test/Factory.t.sol +80 -47
  110. package/test/MultiOwnable.t.sol +6 -3
  111. package/test/Upgrades.t.sol +6 -5
  112. package/test/mocks/MockERC20.sol +12 -0
  113. package/test/utils/BaseTest.sol +106 -56
  114. package/test/utils/DeployedCoinVersionLookup.t.sol +127 -0
  115. package/test/utils/FeeEstimatorHook.sol +84 -0
  116. package/test/utils/ProxyShim.sol +17 -0
  117. package/wagmi.config.ts +4 -0
  118. package/.env +0 -1
  119. package/.turbo/turbo-update-contract-version.log +0 -22
  120. package/abis/CoinSetupV3.json +0 -7
  121. package/abis/HookDeployer.json +0 -68
  122. package/abis/IHookDeployer.json +0 -42
  123. package/src/libs/CoinLegacy.sol +0 -48
  124. package/src/libs/CoinLegacyMarket.sol +0 -182
@@ -0,0 +1,310 @@
1
+ [
2
+ {
3
+ "type": "function",
4
+ "name": "msgSender",
5
+ "inputs": [],
6
+ "outputs": [
7
+ {
8
+ "name": "",
9
+ "type": "address",
10
+ "internalType": "address"
11
+ }
12
+ ],
13
+ "stateMutability": "view"
14
+ },
15
+ {
16
+ "type": "function",
17
+ "name": "poolManager",
18
+ "inputs": [],
19
+ "outputs": [
20
+ {
21
+ "name": "",
22
+ "type": "address",
23
+ "internalType": "contract IPoolManager"
24
+ }
25
+ ],
26
+ "stateMutability": "view"
27
+ },
28
+ {
29
+ "type": "function",
30
+ "name": "quoteExactInput",
31
+ "inputs": [
32
+ {
33
+ "name": "params",
34
+ "type": "tuple",
35
+ "internalType": "struct IV4Quoter.QuoteExactParams",
36
+ "components": [
37
+ {
38
+ "name": "exactCurrency",
39
+ "type": "address",
40
+ "internalType": "Currency"
41
+ },
42
+ {
43
+ "name": "path",
44
+ "type": "tuple[]",
45
+ "internalType": "struct PathKey[]",
46
+ "components": [
47
+ {
48
+ "name": "intermediateCurrency",
49
+ "type": "address",
50
+ "internalType": "Currency"
51
+ },
52
+ {
53
+ "name": "fee",
54
+ "type": "uint24",
55
+ "internalType": "uint24"
56
+ },
57
+ {
58
+ "name": "tickSpacing",
59
+ "type": "int24",
60
+ "internalType": "int24"
61
+ },
62
+ {
63
+ "name": "hooks",
64
+ "type": "address",
65
+ "internalType": "contract IHooks"
66
+ },
67
+ {
68
+ "name": "hookData",
69
+ "type": "bytes",
70
+ "internalType": "bytes"
71
+ }
72
+ ]
73
+ },
74
+ {
75
+ "name": "exactAmount",
76
+ "type": "uint128",
77
+ "internalType": "uint128"
78
+ }
79
+ ]
80
+ }
81
+ ],
82
+ "outputs": [
83
+ {
84
+ "name": "amountOut",
85
+ "type": "uint256",
86
+ "internalType": "uint256"
87
+ },
88
+ {
89
+ "name": "gasEstimate",
90
+ "type": "uint256",
91
+ "internalType": "uint256"
92
+ }
93
+ ],
94
+ "stateMutability": "nonpayable"
95
+ },
96
+ {
97
+ "type": "function",
98
+ "name": "quoteExactInputSingle",
99
+ "inputs": [
100
+ {
101
+ "name": "params",
102
+ "type": "tuple",
103
+ "internalType": "struct IV4Quoter.QuoteExactSingleParams",
104
+ "components": [
105
+ {
106
+ "name": "poolKey",
107
+ "type": "tuple",
108
+ "internalType": "struct PoolKey",
109
+ "components": [
110
+ {
111
+ "name": "currency0",
112
+ "type": "address",
113
+ "internalType": "Currency"
114
+ },
115
+ {
116
+ "name": "currency1",
117
+ "type": "address",
118
+ "internalType": "Currency"
119
+ },
120
+ {
121
+ "name": "fee",
122
+ "type": "uint24",
123
+ "internalType": "uint24"
124
+ },
125
+ {
126
+ "name": "tickSpacing",
127
+ "type": "int24",
128
+ "internalType": "int24"
129
+ },
130
+ {
131
+ "name": "hooks",
132
+ "type": "address",
133
+ "internalType": "contract IHooks"
134
+ }
135
+ ]
136
+ },
137
+ {
138
+ "name": "zeroForOne",
139
+ "type": "bool",
140
+ "internalType": "bool"
141
+ },
142
+ {
143
+ "name": "exactAmount",
144
+ "type": "uint128",
145
+ "internalType": "uint128"
146
+ },
147
+ {
148
+ "name": "hookData",
149
+ "type": "bytes",
150
+ "internalType": "bytes"
151
+ }
152
+ ]
153
+ }
154
+ ],
155
+ "outputs": [
156
+ {
157
+ "name": "amountOut",
158
+ "type": "uint256",
159
+ "internalType": "uint256"
160
+ },
161
+ {
162
+ "name": "gasEstimate",
163
+ "type": "uint256",
164
+ "internalType": "uint256"
165
+ }
166
+ ],
167
+ "stateMutability": "nonpayable"
168
+ },
169
+ {
170
+ "type": "function",
171
+ "name": "quoteExactOutput",
172
+ "inputs": [
173
+ {
174
+ "name": "params",
175
+ "type": "tuple",
176
+ "internalType": "struct IV4Quoter.QuoteExactParams",
177
+ "components": [
178
+ {
179
+ "name": "exactCurrency",
180
+ "type": "address",
181
+ "internalType": "Currency"
182
+ },
183
+ {
184
+ "name": "path",
185
+ "type": "tuple[]",
186
+ "internalType": "struct PathKey[]",
187
+ "components": [
188
+ {
189
+ "name": "intermediateCurrency",
190
+ "type": "address",
191
+ "internalType": "Currency"
192
+ },
193
+ {
194
+ "name": "fee",
195
+ "type": "uint24",
196
+ "internalType": "uint24"
197
+ },
198
+ {
199
+ "name": "tickSpacing",
200
+ "type": "int24",
201
+ "internalType": "int24"
202
+ },
203
+ {
204
+ "name": "hooks",
205
+ "type": "address",
206
+ "internalType": "contract IHooks"
207
+ },
208
+ {
209
+ "name": "hookData",
210
+ "type": "bytes",
211
+ "internalType": "bytes"
212
+ }
213
+ ]
214
+ },
215
+ {
216
+ "name": "exactAmount",
217
+ "type": "uint128",
218
+ "internalType": "uint128"
219
+ }
220
+ ]
221
+ }
222
+ ],
223
+ "outputs": [
224
+ {
225
+ "name": "amountIn",
226
+ "type": "uint256",
227
+ "internalType": "uint256"
228
+ },
229
+ {
230
+ "name": "gasEstimate",
231
+ "type": "uint256",
232
+ "internalType": "uint256"
233
+ }
234
+ ],
235
+ "stateMutability": "nonpayable"
236
+ },
237
+ {
238
+ "type": "function",
239
+ "name": "quoteExactOutputSingle",
240
+ "inputs": [
241
+ {
242
+ "name": "params",
243
+ "type": "tuple",
244
+ "internalType": "struct IV4Quoter.QuoteExactSingleParams",
245
+ "components": [
246
+ {
247
+ "name": "poolKey",
248
+ "type": "tuple",
249
+ "internalType": "struct PoolKey",
250
+ "components": [
251
+ {
252
+ "name": "currency0",
253
+ "type": "address",
254
+ "internalType": "Currency"
255
+ },
256
+ {
257
+ "name": "currency1",
258
+ "type": "address",
259
+ "internalType": "Currency"
260
+ },
261
+ {
262
+ "name": "fee",
263
+ "type": "uint24",
264
+ "internalType": "uint24"
265
+ },
266
+ {
267
+ "name": "tickSpacing",
268
+ "type": "int24",
269
+ "internalType": "int24"
270
+ },
271
+ {
272
+ "name": "hooks",
273
+ "type": "address",
274
+ "internalType": "contract IHooks"
275
+ }
276
+ ]
277
+ },
278
+ {
279
+ "name": "zeroForOne",
280
+ "type": "bool",
281
+ "internalType": "bool"
282
+ },
283
+ {
284
+ "name": "exactAmount",
285
+ "type": "uint128",
286
+ "internalType": "uint128"
287
+ },
288
+ {
289
+ "name": "hookData",
290
+ "type": "bytes",
291
+ "internalType": "bytes"
292
+ }
293
+ ]
294
+ }
295
+ ],
296
+ "outputs": [
297
+ {
298
+ "name": "amountIn",
299
+ "type": "uint256",
300
+ "internalType": "uint256"
301
+ },
302
+ {
303
+ "name": "gasEstimate",
304
+ "type": "uint256",
305
+ "internalType": "uint256"
306
+ }
307
+ ],
308
+ "stateMutability": "nonpayable"
309
+ }
310
+ ]
@@ -1,4 +1,61 @@
1
1
  [
2
+ {
3
+ "type": "function",
4
+ "name": "coinAddress",
5
+ "inputs": [
6
+ {
7
+ "name": "msgSender",
8
+ "type": "address",
9
+ "internalType": "address"
10
+ },
11
+ {
12
+ "name": "name",
13
+ "type": "string",
14
+ "internalType": "string"
15
+ },
16
+ {
17
+ "name": "symbol",
18
+ "type": "string",
19
+ "internalType": "string"
20
+ },
21
+ {
22
+ "name": "poolConfig",
23
+ "type": "bytes",
24
+ "internalType": "bytes"
25
+ },
26
+ {
27
+ "name": "platformReferrer",
28
+ "type": "address",
29
+ "internalType": "address"
30
+ },
31
+ {
32
+ "name": "coinSalt",
33
+ "type": "bytes32",
34
+ "internalType": "bytes32"
35
+ }
36
+ ],
37
+ "outputs": [
38
+ {
39
+ "name": "",
40
+ "type": "address",
41
+ "internalType": "address"
42
+ }
43
+ ],
44
+ "stateMutability": "view"
45
+ },
46
+ {
47
+ "type": "function",
48
+ "name": "coinImpl",
49
+ "inputs": [],
50
+ "outputs": [
51
+ {
52
+ "name": "",
53
+ "type": "address",
54
+ "internalType": "address"
55
+ }
56
+ ],
57
+ "stateMutability": "view"
58
+ },
2
59
  {
3
60
  "type": "function",
4
61
  "name": "deploy",
@@ -28,37 +85,42 @@
28
85
  "type": "string",
29
86
  "internalType": "string"
30
87
  },
88
+ {
89
+ "name": "poolConfig",
90
+ "type": "bytes",
91
+ "internalType": "bytes"
92
+ },
31
93
  {
32
94
  "name": "platformReferrer",
33
95
  "type": "address",
34
96
  "internalType": "address"
35
97
  },
36
98
  {
37
- "name": "currency",
99
+ "name": "postDeployHook",
38
100
  "type": "address",
39
101
  "internalType": "address"
40
102
  },
41
103
  {
42
- "name": "tickLower",
43
- "type": "int24",
44
- "internalType": "int24"
104
+ "name": "postDeployHookData",
105
+ "type": "bytes",
106
+ "internalType": "bytes"
45
107
  },
46
108
  {
47
- "name": "orderSize",
48
- "type": "uint256",
49
- "internalType": "uint256"
109
+ "name": "coinSalt",
110
+ "type": "bytes32",
111
+ "internalType": "bytes32"
50
112
  }
51
113
  ],
52
114
  "outputs": [
53
115
  {
54
- "name": "",
116
+ "name": "coin",
55
117
  "type": "address",
56
118
  "internalType": "address"
57
119
  },
58
120
  {
59
- "name": "",
60
- "type": "uint256",
61
- "internalType": "uint256"
121
+ "name": "postDeployHookDataOut",
122
+ "type": "bytes",
123
+ "internalType": "bytes"
62
124
  }
63
125
  ],
64
126
  "stateMutability": "payable"
@@ -186,6 +248,19 @@
186
248
  ],
187
249
  "stateMutability": "payable"
188
250
  },
251
+ {
252
+ "type": "function",
253
+ "name": "implementation",
254
+ "inputs": [],
255
+ "outputs": [
256
+ {
257
+ "name": "",
258
+ "type": "address",
259
+ "internalType": "address"
260
+ }
261
+ ],
262
+ "stateMutability": "view"
263
+ },
189
264
  {
190
265
  "type": "event",
191
266
  "name": "CoinCreated",
@@ -253,6 +328,111 @@
253
328
  ],
254
329
  "anonymous": false
255
330
  },
331
+ {
332
+ "type": "event",
333
+ "name": "CoinCreatedV4",
334
+ "inputs": [
335
+ {
336
+ "name": "caller",
337
+ "type": "address",
338
+ "indexed": true,
339
+ "internalType": "address"
340
+ },
341
+ {
342
+ "name": "payoutRecipient",
343
+ "type": "address",
344
+ "indexed": true,
345
+ "internalType": "address"
346
+ },
347
+ {
348
+ "name": "platformReferrer",
349
+ "type": "address",
350
+ "indexed": true,
351
+ "internalType": "address"
352
+ },
353
+ {
354
+ "name": "currency",
355
+ "type": "address",
356
+ "indexed": false,
357
+ "internalType": "address"
358
+ },
359
+ {
360
+ "name": "uri",
361
+ "type": "string",
362
+ "indexed": false,
363
+ "internalType": "string"
364
+ },
365
+ {
366
+ "name": "name",
367
+ "type": "string",
368
+ "indexed": false,
369
+ "internalType": "string"
370
+ },
371
+ {
372
+ "name": "symbol",
373
+ "type": "string",
374
+ "indexed": false,
375
+ "internalType": "string"
376
+ },
377
+ {
378
+ "name": "coin",
379
+ "type": "address",
380
+ "indexed": false,
381
+ "internalType": "address"
382
+ },
383
+ {
384
+ "name": "poolKey",
385
+ "type": "tuple",
386
+ "indexed": false,
387
+ "internalType": "struct PoolKey",
388
+ "components": [
389
+ {
390
+ "name": "currency0",
391
+ "type": "address",
392
+ "internalType": "Currency"
393
+ },
394
+ {
395
+ "name": "currency1",
396
+ "type": "address",
397
+ "internalType": "Currency"
398
+ },
399
+ {
400
+ "name": "fee",
401
+ "type": "uint24",
402
+ "internalType": "uint24"
403
+ },
404
+ {
405
+ "name": "tickSpacing",
406
+ "type": "int24",
407
+ "internalType": "int24"
408
+ },
409
+ {
410
+ "name": "hooks",
411
+ "type": "address",
412
+ "internalType": "contract IHooks"
413
+ }
414
+ ]
415
+ },
416
+ {
417
+ "name": "poolKeyHash",
418
+ "type": "bytes32",
419
+ "indexed": false,
420
+ "internalType": "bytes32"
421
+ },
422
+ {
423
+ "name": "version",
424
+ "type": "string",
425
+ "indexed": false,
426
+ "internalType": "string"
427
+ }
428
+ ],
429
+ "anonymous": false
430
+ },
431
+ {
432
+ "type": "error",
433
+ "name": "Deprecated",
434
+ "inputs": []
435
+ },
256
436
  {
257
437
  "type": "error",
258
438
  "name": "ERC20TransferAmountMismatch",