@zoralabs/coins 0.9.0 → 1.0.1

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 (131) hide show
  1. package/.turbo/turbo-build.log +179 -114
  2. package/CHANGELOG.md +46 -0
  3. package/abis/BaseCoin.json +26 -118
  4. package/abis/BaseTest.json +47 -0
  5. package/abis/BuySupplyWithSwapRouterHook.json +40 -0
  6. package/abis/Coin.json +171 -63
  7. package/abis/CoinDopplerMultiCurve.json +38 -0
  8. package/abis/CoinRewardsV4.json +54 -0
  9. package/abis/CoinTest.json +53 -20
  10. package/abis/CoinUniV4Test.json +1091 -0
  11. package/abis/CoinV4.json +234 -211
  12. package/abis/DeployScript.json +47 -0
  13. package/abis/DeployedCoinVersionLookup.json +21 -0
  14. package/abis/DeployedCoinVersionLookupTest.json +716 -0
  15. package/abis/DifferentNamespaceVersionLookup.json +39 -0
  16. package/abis/DopplerUniswapV3Test.json +49 -93
  17. package/abis/ERC20.json +310 -0
  18. package/abis/FactoryTest.json +85 -7
  19. package/abis/FeeEstimatorHook.json +1515 -0
  20. package/abis/HooksDeployment.json +23 -0
  21. package/abis/HooksTest.json +60 -0
  22. package/abis/ICoin.json +40 -71
  23. package/abis/ICoinV3.json +879 -0
  24. package/abis/ICoinV4.json +915 -0
  25. package/abis/IDeployedCoinVersionLookup.json +21 -0
  26. package/abis/IERC721.json +36 -36
  27. package/abis/IHasPoolKey.json +42 -0
  28. package/abis/IHasRewardsRecipients.json +54 -0
  29. package/abis/IHasSwapPath.json +60 -0
  30. package/abis/IMsgSender.json +15 -0
  31. package/abis/IPoolConfigEncoding.json +46 -0
  32. package/abis/ISwapPathRouter.json +92 -0
  33. package/abis/IUniversalRouter.json +61 -0
  34. package/abis/IUnlockCallback.json +21 -0
  35. package/abis/IV4Quoter.json +310 -0
  36. package/abis/IZoraFactory.json +210 -11
  37. package/abis/IZoraV4CoinHook.json +348 -4
  38. package/abis/MockERC20.json +21 -0
  39. package/abis/MultiOwnableTest.json +47 -0
  40. package/abis/{CoinConfigurationVersions.json → Position.json} +1 -1
  41. package/abis/PrintUpgradeCommand.json +9 -0
  42. package/abis/ProxyShim.json +24 -0
  43. package/abis/StateLibrary.json +80 -0
  44. package/abis/TestDeployedCoinVersionLookupImplementation.json +39 -0
  45. package/abis/TestV4Swap.json +9 -0
  46. package/abis/UpgradeCoinImpl.json +47 -0
  47. package/abis/UpgradesTest.json +81 -0
  48. package/abis/Vm.json +1482 -111
  49. package/abis/VmSafe.json +856 -32
  50. package/abis/ZoraFactoryImpl.json +339 -1
  51. package/abis/ZoraV4CoinHook.json +442 -5
  52. package/addresses/8453.json +7 -4
  53. package/addresses/84532.json +8 -5
  54. package/addresses/dev/8453.json +10 -0
  55. package/dist/index.cjs +1932 -167
  56. package/dist/index.cjs.map +1 -1
  57. package/dist/index.js +1928 -167
  58. package/dist/index.js.map +1 -1
  59. package/dist/wagmiGenerated.d.ts +2606 -160
  60. package/dist/wagmiGenerated.d.ts.map +1 -1
  61. package/foundry.toml +1 -0
  62. package/package/wagmiGenerated.ts +1941 -164
  63. package/package.json +8 -3
  64. package/remappings.txt +6 -1
  65. package/script/Deploy.s.sol +1 -1
  66. package/script/DeployDevFactory.s.sol +21 -0
  67. package/script/DeployHooks.s.sol +1 -1
  68. package/script/PrintUpgradeCommand.s.sol +13 -0
  69. package/script/Simulate.s.sol +1 -10
  70. package/script/TestBackingCoinSwap.s.sol +147 -0
  71. package/script/TestV4Swap.s.sol +136 -0
  72. package/script/UpgradeCoinImpl.sol +2 -2
  73. package/script/UpgradeFactoryImpl.s.sol +2 -2
  74. package/src/BaseCoin.sol +190 -0
  75. package/src/Coin.sol +87 -202
  76. package/src/CoinV4.sol +121 -0
  77. package/src/ZoraFactoryImpl.sol +208 -36
  78. package/{script → src/deployment}/CoinsDeployerBase.sol +111 -17
  79. package/src/hooks/ZoraV4CoinHook.sol +212 -0
  80. package/src/hooks/{BaseCoinDeployHook.sol → deployment/BaseCoinDeployHook.sol} +3 -3
  81. package/src/hooks/deployment/BuySupplyWithSwapRouterHook.sol +140 -0
  82. package/src/interfaces/ICoin.sol +31 -39
  83. package/src/interfaces/ICoinV3.sol +71 -0
  84. package/src/interfaces/ICoinV4.sol +69 -0
  85. package/src/interfaces/IDeployedCoinVersionLookup.sol +11 -0
  86. package/src/interfaces/IMsgSender.sol +9 -0
  87. package/src/interfaces/IPoolConfigEncoding.sol +14 -0
  88. package/src/interfaces/ISwapPathRouter.sol +14 -0
  89. package/src/interfaces/IZoraFactory.sol +67 -28
  90. package/src/interfaces/IZoraV4CoinHook.sol +116 -0
  91. package/src/libs/CoinCommon.sol +15 -0
  92. package/src/libs/CoinConfigurationVersions.sol +116 -1
  93. package/src/libs/CoinConstants.sol +5 -0
  94. package/src/libs/CoinDopplerMultiCurve.sol +134 -0
  95. package/src/libs/CoinDopplerUniV3.sol +19 -171
  96. package/src/libs/CoinRewards.sol +195 -0
  97. package/src/libs/CoinRewardsV4.sol +179 -0
  98. package/src/libs/CoinSetup.sol +57 -0
  99. package/src/libs/CoinSetupV3.sol +6 -67
  100. package/src/libs/DopplerMath.sol +156 -0
  101. package/src/libs/HooksDeployment.sol +128 -0
  102. package/src/libs/MarketConstants.sol +4 -0
  103. package/src/libs/PoolStateReader.sol +22 -0
  104. package/src/libs/UniV3BuySell.sol +74 -292
  105. package/src/libs/UniV4SwapHelper.sol +65 -0
  106. package/src/libs/UniV4SwapToCurrency.sol +109 -0
  107. package/src/libs/V4Liquidity.sol +122 -0
  108. package/src/types/PoolConfiguration.sol +15 -0
  109. package/src/utils/DeployedCoinVersionLookup.sol +52 -0
  110. package/src/version/ContractVersionBase.sol +1 -1
  111. package/test/Coin.t.sol +78 -88
  112. package/test/CoinDopplerUniV3.t.sol +32 -171
  113. package/test/CoinUniV4.t.sol +777 -0
  114. package/test/{Hooks.t.sol → DeploymentHooks.t.sol} +53 -16
  115. package/test/Factory.t.sol +80 -47
  116. package/test/MultiOwnable.t.sol +6 -3
  117. package/test/Upgrades.t.sol +97 -5
  118. package/test/mocks/MockERC20.sol +12 -0
  119. package/test/utils/BaseTest.sol +162 -57
  120. package/test/utils/DeployedCoinVersionLookup.t.sol +127 -0
  121. package/test/utils/FeeEstimatorHook.sol +84 -0
  122. package/test/utils/ProxyShim.sol +17 -0
  123. package/wagmi.config.ts +4 -0
  124. package/.env +0 -1
  125. package/.turbo/turbo-update-contract-version.log +0 -22
  126. package/abis/CoinSetupV3.json +0 -7
  127. package/abis/HookDeployer.json +0 -68
  128. package/abis/IHookDeployer.json +0 -42
  129. package/src/hooks/BuySupplyWithSwapRouterHook.sol +0 -78
  130. package/src/libs/CoinLegacy.sol +0 -48
  131. 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,38 @@
186
248
  ],
187
249
  "stateMutability": "payable"
188
250
  },
251
+ {
252
+ "type": "function",
253
+ "name": "getVersionForDeployedCoin",
254
+ "inputs": [
255
+ {
256
+ "name": "coin",
257
+ "type": "address",
258
+ "internalType": "address"
259
+ }
260
+ ],
261
+ "outputs": [
262
+ {
263
+ "name": "",
264
+ "type": "uint8",
265
+ "internalType": "uint8"
266
+ }
267
+ ],
268
+ "stateMutability": "view"
269
+ },
270
+ {
271
+ "type": "function",
272
+ "name": "implementation",
273
+ "inputs": [],
274
+ "outputs": [
275
+ {
276
+ "name": "",
277
+ "type": "address",
278
+ "internalType": "address"
279
+ }
280
+ ],
281
+ "stateMutability": "view"
282
+ },
189
283
  {
190
284
  "type": "event",
191
285
  "name": "CoinCreated",
@@ -253,6 +347,111 @@
253
347
  ],
254
348
  "anonymous": false
255
349
  },
350
+ {
351
+ "type": "event",
352
+ "name": "CoinCreatedV4",
353
+ "inputs": [
354
+ {
355
+ "name": "caller",
356
+ "type": "address",
357
+ "indexed": true,
358
+ "internalType": "address"
359
+ },
360
+ {
361
+ "name": "payoutRecipient",
362
+ "type": "address",
363
+ "indexed": true,
364
+ "internalType": "address"
365
+ },
366
+ {
367
+ "name": "platformReferrer",
368
+ "type": "address",
369
+ "indexed": true,
370
+ "internalType": "address"
371
+ },
372
+ {
373
+ "name": "currency",
374
+ "type": "address",
375
+ "indexed": false,
376
+ "internalType": "address"
377
+ },
378
+ {
379
+ "name": "uri",
380
+ "type": "string",
381
+ "indexed": false,
382
+ "internalType": "string"
383
+ },
384
+ {
385
+ "name": "name",
386
+ "type": "string",
387
+ "indexed": false,
388
+ "internalType": "string"
389
+ },
390
+ {
391
+ "name": "symbol",
392
+ "type": "string",
393
+ "indexed": false,
394
+ "internalType": "string"
395
+ },
396
+ {
397
+ "name": "coin",
398
+ "type": "address",
399
+ "indexed": false,
400
+ "internalType": "address"
401
+ },
402
+ {
403
+ "name": "poolKey",
404
+ "type": "tuple",
405
+ "indexed": false,
406
+ "internalType": "struct PoolKey",
407
+ "components": [
408
+ {
409
+ "name": "currency0",
410
+ "type": "address",
411
+ "internalType": "Currency"
412
+ },
413
+ {
414
+ "name": "currency1",
415
+ "type": "address",
416
+ "internalType": "Currency"
417
+ },
418
+ {
419
+ "name": "fee",
420
+ "type": "uint24",
421
+ "internalType": "uint24"
422
+ },
423
+ {
424
+ "name": "tickSpacing",
425
+ "type": "int24",
426
+ "internalType": "int24"
427
+ },
428
+ {
429
+ "name": "hooks",
430
+ "type": "address",
431
+ "internalType": "contract IHooks"
432
+ }
433
+ ]
434
+ },
435
+ {
436
+ "name": "poolKeyHash",
437
+ "type": "bytes32",
438
+ "indexed": false,
439
+ "internalType": "bytes32"
440
+ },
441
+ {
442
+ "name": "version",
443
+ "type": "string",
444
+ "indexed": false,
445
+ "internalType": "string"
446
+ }
447
+ ],
448
+ "anonymous": false
449
+ },
450
+ {
451
+ "type": "error",
452
+ "name": "Deprecated",
453
+ "inputs": []
454
+ },
256
455
  {
257
456
  "type": "error",
258
457
  "name": "ERC20TransferAmountMismatch",