@zoralabs/coins 0.6.1 → 0.7.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 (66) hide show
  1. package/.turbo/turbo-build.log +69 -55
  2. package/CHANGELOG.md +12 -0
  3. package/abis/BaseTest.json +0 -23
  4. package/abis/Coin.json +186 -77
  5. package/abis/CoinConfigurationVersions.json +7 -0
  6. package/abis/CoinSetup.json +7 -0
  7. package/abis/CoinTest.json +5 -49
  8. package/abis/CustomRevert.json +28 -0
  9. package/abis/DopplerUniswapV3Test.json +891 -0
  10. package/abis/FactoryTest.json +7 -23
  11. package/abis/IAirlock.json +15 -0
  12. package/abis/ICoin.json +52 -34
  13. package/abis/IDopplerErrors.json +44 -0
  14. package/abis/INonfungiblePositionManager.json +13 -0
  15. package/abis/IUniswapV3Factory.json +198 -0
  16. package/abis/IUniswapV3Pool.json +135 -0
  17. package/abis/MultiOwnableTest.json +0 -23
  18. package/abis/SafeCast.json +7 -0
  19. package/abis/Simulate.json +120 -0
  20. package/abis/SqrtPriceMath.json +22 -0
  21. package/abis/TickMath.json +24 -0
  22. package/abis/ZoraFactoryImpl.json +59 -0
  23. package/addresses/8453.json +3 -3
  24. package/dist/index.cjs +160 -39
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.js +160 -39
  27. package/dist/index.js.map +1 -1
  28. package/dist/wagmiGenerated.d.ts +349 -67
  29. package/dist/wagmiGenerated.d.ts.map +1 -1
  30. package/package/wagmiGenerated.ts +161 -40
  31. package/package.json +3 -3
  32. package/script/CoinsDeployerBase.sol +1 -1
  33. package/script/Simulate.s.sol +67 -0
  34. package/src/Coin.sol +159 -90
  35. package/src/ZoraFactoryImpl.sol +47 -1
  36. package/src/interfaces/IAirlock.sol +6 -0
  37. package/src/interfaces/ICoin.sol +18 -2
  38. package/src/interfaces/IDopplerErrors.sol +14 -0
  39. package/src/interfaces/INonfungiblePositionManager.sol +2 -0
  40. package/src/interfaces/IUniswapV3Factory.sol +64 -0
  41. package/src/interfaces/IUniswapV3Pool.sol +48 -0
  42. package/src/libs/CoinConfigurationVersions.sol +9 -0
  43. package/src/libs/CoinDopplerUniV3.sol +202 -0
  44. package/src/libs/CoinLegacy.sol +48 -0
  45. package/src/libs/CoinSetup.sol +37 -0
  46. package/src/libs/MarketConstants.sol +25 -0
  47. package/src/types/LpPosition.sol +8 -0
  48. package/src/types/PoolState.sol +24 -0
  49. package/src/utils/CoinConstants.sol +5 -12
  50. package/src/utils/uniswap/BitMath.sol +55 -0
  51. package/src/utils/uniswap/CustomRevert.sol +111 -0
  52. package/src/utils/uniswap/FixedPoint96.sol +11 -0
  53. package/src/utils/uniswap/FullMath.sol +118 -0
  54. package/src/utils/uniswap/LiquidityAmounts.sol +117 -0
  55. package/src/utils/uniswap/SafeCast.sol +61 -0
  56. package/src/utils/uniswap/SqrtPriceMath.sol +249 -0
  57. package/src/utils/uniswap/TickMath.sol +244 -0
  58. package/src/utils/uniswap/UnsafeMath.sol +30 -0
  59. package/src/version/ContractVersionBase.sol +1 -1
  60. package/test/Coin.t.sol +65 -65
  61. package/test/CoinDopplerUniV3.t.sol +452 -0
  62. package/test/Factory.t.sol +49 -7
  63. package/test/utils/BaseTest.sol +26 -7
  64. package/wagmi.config.ts +1 -1
  65. package/abis/IERC721Receiver.json +0 -36
  66. package/src/utils/TickMath.sol +0 -210
package/dist/index.js CHANGED
@@ -10,12 +10,9 @@ var coinABI = [
10
10
  },
11
11
  { name: "_protocolRewards", internalType: "address", type: "address" },
12
12
  { name: "_weth", internalType: "address", type: "address" },
13
- {
14
- name: "_nonfungiblePositionManager",
15
- internalType: "address",
16
- type: "address"
17
- },
18
- { name: "_swapRouter", internalType: "address", type: "address" }
13
+ { name: "_v3Factory", internalType: "address", type: "address" },
14
+ { name: "_swapRouter", internalType: "address", type: "address" },
15
+ { name: "_airlock", internalType: "address", type: "address" }
19
16
  ],
20
17
  stateMutability: "nonpayable"
21
18
  },
@@ -99,6 +96,13 @@ var coinABI = [
99
96
  outputs: [],
100
97
  stateMutability: "nonpayable"
101
98
  },
99
+ {
100
+ type: "function",
101
+ inputs: [],
102
+ name: "airlock",
103
+ outputs: [{ name: "", internalType: "address", type: "address" }],
104
+ stateMutability: "view"
105
+ },
102
106
  {
103
107
  type: "function",
104
108
  inputs: [
@@ -207,9 +211,8 @@ var coinABI = [
207
211
  { name: "tokenURI_", internalType: "string", type: "string" },
208
212
  { name: "name_", internalType: "string", type: "string" },
209
213
  { name: "symbol_", internalType: "string", type: "string" },
210
- { name: "platformReferrer_", internalType: "address", type: "address" },
211
- { name: "currency_", internalType: "address", type: "address" },
212
- { name: "tickLower_", internalType: "int24", type: "int24" }
214
+ { name: "poolConfig_", internalType: "bytes", type: "bytes" },
215
+ { name: "platformReferrer_", internalType: "address", type: "address" }
213
216
  ],
214
217
  name: "initialize",
215
218
  outputs: [],
@@ -222,13 +225,6 @@ var coinABI = [
222
225
  outputs: [{ name: "", internalType: "bool", type: "bool" }],
223
226
  stateMutability: "view"
224
227
  },
225
- {
226
- type: "function",
227
- inputs: [],
228
- name: "lpTokenId",
229
- outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
230
- stateMutability: "view"
231
- },
232
228
  {
233
229
  type: "function",
234
230
  inputs: [],
@@ -243,25 +239,6 @@ var coinABI = [
243
239
  outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
244
240
  stateMutability: "view"
245
241
  },
246
- {
247
- type: "function",
248
- inputs: [],
249
- name: "nonfungiblePositionManager",
250
- outputs: [{ name: "", internalType: "address", type: "address" }],
251
- stateMutability: "view"
252
- },
253
- {
254
- type: "function",
255
- inputs: [
256
- { name: "", internalType: "address", type: "address" },
257
- { name: "", internalType: "address", type: "address" },
258
- { name: "", internalType: "uint256", type: "uint256" },
259
- { name: "", internalType: "bytes", type: "bytes" }
260
- ],
261
- name: "onERC721Received",
262
- outputs: [{ name: "", internalType: "bytes4", type: "bytes4" }],
263
- stateMutability: "view"
264
- },
265
242
  {
266
243
  type: "function",
267
244
  inputs: [],
@@ -305,6 +282,44 @@ var coinABI = [
305
282
  outputs: [{ name: "", internalType: "address", type: "address" }],
306
283
  stateMutability: "view"
307
284
  },
285
+ {
286
+ type: "function",
287
+ inputs: [],
288
+ name: "poolConfiguration",
289
+ outputs: [
290
+ { name: "version", internalType: "uint8", type: "uint8" },
291
+ { name: "tickLower", internalType: "int24", type: "int24" },
292
+ { name: "tickUpper", internalType: "int24", type: "int24" },
293
+ { name: "numPositions", internalType: "uint16", type: "uint16" },
294
+ {
295
+ name: "maxDiscoverySupplyShare",
296
+ internalType: "uint256",
297
+ type: "uint256"
298
+ }
299
+ ],
300
+ stateMutability: "view"
301
+ },
302
+ {
303
+ type: "function",
304
+ inputs: [],
305
+ name: "poolState",
306
+ outputs: [
307
+ { name: "asset", internalType: "address", type: "address" },
308
+ { name: "numeraire", internalType: "address", type: "address" },
309
+ { name: "tickLower", internalType: "int24", type: "int24" },
310
+ { name: "tickUpper", internalType: "int24", type: "int24" },
311
+ { name: "numPositions", internalType: "uint16", type: "uint16" },
312
+ { name: "isInitialized", internalType: "bool", type: "bool" },
313
+ { name: "isExited", internalType: "bool", type: "bool" },
314
+ { name: "maxShareToBeSold", internalType: "uint256", type: "uint256" },
315
+ {
316
+ name: "totalTokensOnBondingCurve",
317
+ internalType: "uint256",
318
+ type: "uint256"
319
+ }
320
+ ],
321
+ stateMutability: "view"
322
+ },
308
323
  {
309
324
  type: "function",
310
325
  inputs: [],
@@ -433,14 +448,21 @@ var coinABI = [
433
448
  {
434
449
  type: "function",
435
450
  inputs: [
436
- { name: "amount0Delta", internalType: "int256", type: "int256" },
437
- { name: "amount1Delta", internalType: "int256", type: "int256" },
451
+ { name: "amount0Owed", internalType: "uint256", type: "uint256" },
452
+ { name: "amount1Owed", internalType: "uint256", type: "uint256" },
438
453
  { name: "", internalType: "bytes", type: "bytes" }
439
454
  ],
440
- name: "uniswapV3SwapCallback",
455
+ name: "uniswapV3MintCallback",
441
456
  outputs: [],
442
457
  stateMutability: "nonpayable"
443
458
  },
459
+ {
460
+ type: "function",
461
+ inputs: [],
462
+ name: "v3Factory",
463
+ outputs: [{ name: "", internalType: "address", type: "address" }],
464
+ stateMutability: "view"
465
+ },
444
466
  {
445
467
  type: "event",
446
468
  anonymous: false,
@@ -849,6 +871,12 @@ var coinABI = [
849
871
  },
850
872
  { type: "error", inputs: [], name: "AddressZero" },
851
873
  { type: "error", inputs: [], name: "AlreadyOwner" },
874
+ { type: "error", inputs: [], name: "CannotMintZeroLiquidity" },
875
+ {
876
+ type: "error",
877
+ inputs: [],
878
+ name: "DopplerPoolMustHaveMoreThan2DiscoveryPositions"
879
+ },
852
880
  { type: "error", inputs: [], name: "ECDSAInvalidSignature" },
853
881
  {
854
882
  type: "error",
@@ -931,11 +959,30 @@ var coinABI = [
931
959
  { type: "error", inputs: [], name: "InvalidCurrencyLowerTick" },
932
960
  { type: "error", inputs: [], name: "InvalidInitialization" },
933
961
  { type: "error", inputs: [], name: "InvalidMarketType" },
962
+ { type: "error", inputs: [], name: "InvalidPoolVersion" },
963
+ {
964
+ type: "error",
965
+ inputs: [
966
+ { name: "tickLower", internalType: "int24", type: "int24" },
967
+ { name: "tickUpper", internalType: "int24", type: "int24" }
968
+ ],
969
+ name: "InvalidTickRangeMisordered"
970
+ },
934
971
  { type: "error", inputs: [], name: "InvalidWethLowerTick" },
972
+ { type: "error", inputs: [], name: "LegacyPoolMustHaveOneDiscoveryPosition" },
935
973
  { type: "error", inputs: [], name: "MarketAlreadyGraduated" },
936
974
  { type: "error", inputs: [], name: "MarketNotGraduated" },
975
+ {
976
+ type: "error",
977
+ inputs: [
978
+ { name: "value", internalType: "uint256", type: "uint256" },
979
+ { name: "limit", internalType: "uint256", type: "uint256" }
980
+ ],
981
+ name: "MaxShareToBeSoldExceeded"
982
+ },
937
983
  { type: "error", inputs: [], name: "NotInitializing" },
938
984
  { type: "error", inputs: [], name: "NotOwner" },
985
+ { type: "error", inputs: [], name: "NumDiscoveryPositionsOutOfRange" },
939
986
  { type: "error", inputs: [], name: "OneOwnerRequired" },
940
987
  { type: "error", inputs: [], name: "OnlyOwner" },
941
988
  { type: "error", inputs: [], name: "OnlyPool" },
@@ -951,6 +998,36 @@ var coinABI = [
951
998
  { type: "error", inputs: [], name: "UseRevokeOwnershipToRemoveSelf" }
952
999
  ];
953
1000
  var iUniswapV3PoolABI = [
1001
+ {
1002
+ type: "function",
1003
+ inputs: [
1004
+ { name: "tickLower", internalType: "int24", type: "int24" },
1005
+ { name: "tickUpper", internalType: "int24", type: "int24" },
1006
+ { name: "amount", internalType: "uint128", type: "uint128" }
1007
+ ],
1008
+ name: "burn",
1009
+ outputs: [
1010
+ { name: "amount0", internalType: "uint256", type: "uint256" },
1011
+ { name: "amount1", internalType: "uint256", type: "uint256" }
1012
+ ],
1013
+ stateMutability: "nonpayable"
1014
+ },
1015
+ {
1016
+ type: "function",
1017
+ inputs: [
1018
+ { name: "recipient", internalType: "address", type: "address" },
1019
+ { name: "tickLower", internalType: "int24", type: "int24" },
1020
+ { name: "tickUpper", internalType: "int24", type: "int24" },
1021
+ { name: "amount0Requested", internalType: "uint128", type: "uint128" },
1022
+ { name: "amount1Requested", internalType: "uint128", type: "uint128" }
1023
+ ],
1024
+ name: "collect",
1025
+ outputs: [
1026
+ { name: "amount0", internalType: "uint128", type: "uint128" },
1027
+ { name: "amount1", internalType: "uint128", type: "uint128" }
1028
+ ],
1029
+ stateMutability: "nonpayable"
1030
+ },
954
1031
  {
955
1032
  type: "function",
956
1033
  inputs: [],
@@ -965,6 +1042,31 @@ var iUniswapV3PoolABI = [
965
1042
  outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
966
1043
  stateMutability: "view"
967
1044
  },
1045
+ {
1046
+ type: "function",
1047
+ inputs: [
1048
+ { name: "sqrtPriceX96", internalType: "uint160", type: "uint160" }
1049
+ ],
1050
+ name: "initialize",
1051
+ outputs: [],
1052
+ stateMutability: "nonpayable"
1053
+ },
1054
+ {
1055
+ type: "function",
1056
+ inputs: [
1057
+ { name: "recipient", internalType: "address", type: "address" },
1058
+ { name: "tickLower", internalType: "int24", type: "int24" },
1059
+ { name: "tickUpper", internalType: "int24", type: "int24" },
1060
+ { name: "amount", internalType: "uint128", type: "uint128" },
1061
+ { name: "data", internalType: "bytes", type: "bytes" }
1062
+ ],
1063
+ name: "mint",
1064
+ outputs: [
1065
+ { name: "amount0", internalType: "uint256", type: "uint256" },
1066
+ { name: "amount1", internalType: "uint256", type: "uint256" }
1067
+ ],
1068
+ stateMutability: "nonpayable"
1069
+ },
968
1070
  {
969
1071
  type: "function",
970
1072
  inputs: [],
@@ -1066,6 +1168,25 @@ var zoraFactoryImplABI = [
1066
1168
  ],
1067
1169
  stateMutability: "payable"
1068
1170
  },
1171
+ {
1172
+ type: "function",
1173
+ inputs: [
1174
+ { name: "payoutRecipient", internalType: "address", type: "address" },
1175
+ { name: "owners", internalType: "address[]", type: "address[]" },
1176
+ { name: "uri", internalType: "string", type: "string" },
1177
+ { name: "name", internalType: "string", type: "string" },
1178
+ { name: "symbol", internalType: "string", type: "string" },
1179
+ { name: "poolConfig", internalType: "bytes", type: "bytes" },
1180
+ { name: "platformReferrer", internalType: "address", type: "address" },
1181
+ { name: "orderSize", internalType: "uint256", type: "uint256" }
1182
+ ],
1183
+ name: "deploy",
1184
+ outputs: [
1185
+ { name: "", internalType: "address", type: "address" },
1186
+ { name: "", internalType: "uint256", type: "uint256" }
1187
+ ],
1188
+ stateMutability: "payable"
1189
+ },
1069
1190
  {
1070
1191
  type: "function",
1071
1192
  inputs: [],
@@ -1270,7 +1391,7 @@ var zoraFactoryImplABI = [
1270
1391
  }
1271
1392
  ];
1272
1393
  var zoraFactoryImplAddress = {
1273
- 8453: "0x777777751622c0d3258f214F9DF38E35BF45baF3",
1394
+ 8453: "0x02B2705500096Ff83F9eF78873ca5DFB06C00Ddc",
1274
1395
  84532: "0x777777751622c0d3258f214F9DF38E35BF45baF3"
1275
1396
  };
1276
1397
  var zoraFactoryImplConfig = {