@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
@@ -0,0 +1,120 @@
1
+ [
2
+ {
3
+ "type": "function",
4
+ "name": "IS_SCRIPT",
5
+ "inputs": [],
6
+ "outputs": [
7
+ {
8
+ "name": "",
9
+ "type": "bool",
10
+ "internalType": "bool"
11
+ }
12
+ ],
13
+ "stateMutability": "view"
14
+ },
15
+ {
16
+ "type": "function",
17
+ "name": "MAX_TOTAL_SUPPLY",
18
+ "inputs": [],
19
+ "outputs": [
20
+ {
21
+ "name": "",
22
+ "type": "uint256",
23
+ "internalType": "uint256"
24
+ }
25
+ ],
26
+ "stateMutability": "view"
27
+ },
28
+ {
29
+ "type": "function",
30
+ "name": "MIN_ORDER_SIZE",
31
+ "inputs": [],
32
+ "outputs": [
33
+ {
34
+ "name": "",
35
+ "type": "uint256",
36
+ "internalType": "uint256"
37
+ }
38
+ ],
39
+ "stateMutability": "view"
40
+ },
41
+ {
42
+ "type": "function",
43
+ "name": "PLATFORM_REFERRER_FEE_BPS",
44
+ "inputs": [],
45
+ "outputs": [
46
+ {
47
+ "name": "",
48
+ "type": "uint256",
49
+ "internalType": "uint256"
50
+ }
51
+ ],
52
+ "stateMutability": "view"
53
+ },
54
+ {
55
+ "type": "function",
56
+ "name": "PROTOCOL_FEE_BPS",
57
+ "inputs": [],
58
+ "outputs": [
59
+ {
60
+ "name": "",
61
+ "type": "uint256",
62
+ "internalType": "uint256"
63
+ }
64
+ ],
65
+ "stateMutability": "view"
66
+ },
67
+ {
68
+ "type": "function",
69
+ "name": "TOKEN_CREATOR_FEE_BPS",
70
+ "inputs": [],
71
+ "outputs": [
72
+ {
73
+ "name": "",
74
+ "type": "uint256",
75
+ "internalType": "uint256"
76
+ }
77
+ ],
78
+ "stateMutability": "view"
79
+ },
80
+ {
81
+ "type": "function",
82
+ "name": "TOTAL_FEE_BPS",
83
+ "inputs": [],
84
+ "outputs": [
85
+ {
86
+ "name": "",
87
+ "type": "uint256",
88
+ "internalType": "uint256"
89
+ }
90
+ ],
91
+ "stateMutability": "view"
92
+ },
93
+ {
94
+ "type": "function",
95
+ "name": "TRADE_REFERRER_FEE_BPS",
96
+ "inputs": [],
97
+ "outputs": [
98
+ {
99
+ "name": "",
100
+ "type": "uint256",
101
+ "internalType": "uint256"
102
+ }
103
+ ],
104
+ "stateMutability": "view"
105
+ },
106
+ {
107
+ "type": "function",
108
+ "name": "run",
109
+ "inputs": [],
110
+ "outputs": [],
111
+ "stateMutability": "nonpayable"
112
+ },
113
+ {
114
+ "type": "function",
115
+ "name": "setUp",
116
+ "inputs": [],
117
+ "outputs": [],
118
+ "stateMutability": "nonpayable"
119
+ }
120
+ ]
@@ -0,0 +1,22 @@
1
+ [
2
+ {
3
+ "type": "error",
4
+ "name": "InvalidPrice",
5
+ "inputs": []
6
+ },
7
+ {
8
+ "type": "error",
9
+ "name": "InvalidPriceOrLiquidity",
10
+ "inputs": []
11
+ },
12
+ {
13
+ "type": "error",
14
+ "name": "NotEnoughLiquidity",
15
+ "inputs": []
16
+ },
17
+ {
18
+ "type": "error",
19
+ "name": "PriceOverflow",
20
+ "inputs": []
21
+ }
22
+ ]
@@ -0,0 +1,24 @@
1
+ [
2
+ {
3
+ "type": "error",
4
+ "name": "InvalidSqrtPrice",
5
+ "inputs": [
6
+ {
7
+ "name": "sqrtPriceX96",
8
+ "type": "uint160",
9
+ "internalType": "uint160"
10
+ }
11
+ ]
12
+ },
13
+ {
14
+ "type": "error",
15
+ "name": "InvalidTick",
16
+ "inputs": [
17
+ {
18
+ "name": "tick",
19
+ "type": "int24",
20
+ "internalType": "int24"
21
+ }
22
+ ]
23
+ }
24
+ ]
@@ -100,6 +100,65 @@
100
100
  ],
101
101
  "stateMutability": "payable"
102
102
  },
103
+ {
104
+ "type": "function",
105
+ "name": "deploy",
106
+ "inputs": [
107
+ {
108
+ "name": "payoutRecipient",
109
+ "type": "address",
110
+ "internalType": "address"
111
+ },
112
+ {
113
+ "name": "owners",
114
+ "type": "address[]",
115
+ "internalType": "address[]"
116
+ },
117
+ {
118
+ "name": "uri",
119
+ "type": "string",
120
+ "internalType": "string"
121
+ },
122
+ {
123
+ "name": "name",
124
+ "type": "string",
125
+ "internalType": "string"
126
+ },
127
+ {
128
+ "name": "symbol",
129
+ "type": "string",
130
+ "internalType": "string"
131
+ },
132
+ {
133
+ "name": "poolConfig",
134
+ "type": "bytes",
135
+ "internalType": "bytes"
136
+ },
137
+ {
138
+ "name": "platformReferrer",
139
+ "type": "address",
140
+ "internalType": "address"
141
+ },
142
+ {
143
+ "name": "orderSize",
144
+ "type": "uint256",
145
+ "internalType": "uint256"
146
+ }
147
+ ],
148
+ "outputs": [
149
+ {
150
+ "name": "",
151
+ "type": "address",
152
+ "internalType": "address"
153
+ },
154
+ {
155
+ "name": "",
156
+ "type": "uint256",
157
+ "internalType": "uint256"
158
+ }
159
+ ],
160
+ "stateMutability": "payable"
161
+ },
103
162
  {
104
163
  "type": "function",
105
164
  "name": "implementation",
@@ -1,6 +1,6 @@
1
1
  {
2
- "COIN_IMPL": "0xFDfD1A05a22bd5Ee57a97Af4A2ADb7B3D74385E8",
3
- "COIN_VERSION": "0.6.0",
2
+ "COIN_IMPL": "0xbECAe78D441FBa11017bB7A8798D018b0977F76d",
3
+ "COIN_VERSION": "0.7.0",
4
4
  "ZORA_FACTORY": "0x777777751622c0d3258f214F9DF38E35BF45baF3",
5
- "ZORA_FACTORY_IMPL": "0x914f448760938Ba34aBf9bC992B7Fb7553B309eA"
5
+ "ZORA_FACTORY_IMPL": "0x5Fd1a258917eBcbb3163c7BB006C58A557dAf837"
6
6
  }
package/dist/index.cjs CHANGED
@@ -40,12 +40,9 @@ var coinABI = [
40
40
  },
41
41
  { name: "_protocolRewards", internalType: "address", type: "address" },
42
42
  { name: "_weth", internalType: "address", type: "address" },
43
- {
44
- name: "_nonfungiblePositionManager",
45
- internalType: "address",
46
- type: "address"
47
- },
48
- { name: "_swapRouter", internalType: "address", type: "address" }
43
+ { name: "_v3Factory", internalType: "address", type: "address" },
44
+ { name: "_swapRouter", internalType: "address", type: "address" },
45
+ { name: "_airlock", internalType: "address", type: "address" }
49
46
  ],
50
47
  stateMutability: "nonpayable"
51
48
  },
@@ -129,6 +126,13 @@ var coinABI = [
129
126
  outputs: [],
130
127
  stateMutability: "nonpayable"
131
128
  },
129
+ {
130
+ type: "function",
131
+ inputs: [],
132
+ name: "airlock",
133
+ outputs: [{ name: "", internalType: "address", type: "address" }],
134
+ stateMutability: "view"
135
+ },
132
136
  {
133
137
  type: "function",
134
138
  inputs: [
@@ -237,9 +241,8 @@ var coinABI = [
237
241
  { name: "tokenURI_", internalType: "string", type: "string" },
238
242
  { name: "name_", internalType: "string", type: "string" },
239
243
  { name: "symbol_", internalType: "string", type: "string" },
240
- { name: "platformReferrer_", internalType: "address", type: "address" },
241
- { name: "currency_", internalType: "address", type: "address" },
242
- { name: "tickLower_", internalType: "int24", type: "int24" }
244
+ { name: "poolConfig_", internalType: "bytes", type: "bytes" },
245
+ { name: "platformReferrer_", internalType: "address", type: "address" }
243
246
  ],
244
247
  name: "initialize",
245
248
  outputs: [],
@@ -252,13 +255,6 @@ var coinABI = [
252
255
  outputs: [{ name: "", internalType: "bool", type: "bool" }],
253
256
  stateMutability: "view"
254
257
  },
255
- {
256
- type: "function",
257
- inputs: [],
258
- name: "lpTokenId",
259
- outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
260
- stateMutability: "view"
261
- },
262
258
  {
263
259
  type: "function",
264
260
  inputs: [],
@@ -273,25 +269,6 @@ var coinABI = [
273
269
  outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
274
270
  stateMutability: "view"
275
271
  },
276
- {
277
- type: "function",
278
- inputs: [],
279
- name: "nonfungiblePositionManager",
280
- outputs: [{ name: "", internalType: "address", type: "address" }],
281
- stateMutability: "view"
282
- },
283
- {
284
- type: "function",
285
- inputs: [
286
- { name: "", internalType: "address", type: "address" },
287
- { name: "", internalType: "address", type: "address" },
288
- { name: "", internalType: "uint256", type: "uint256" },
289
- { name: "", internalType: "bytes", type: "bytes" }
290
- ],
291
- name: "onERC721Received",
292
- outputs: [{ name: "", internalType: "bytes4", type: "bytes4" }],
293
- stateMutability: "view"
294
- },
295
272
  {
296
273
  type: "function",
297
274
  inputs: [],
@@ -335,6 +312,44 @@ var coinABI = [
335
312
  outputs: [{ name: "", internalType: "address", type: "address" }],
336
313
  stateMutability: "view"
337
314
  },
315
+ {
316
+ type: "function",
317
+ inputs: [],
318
+ name: "poolConfiguration",
319
+ outputs: [
320
+ { name: "version", internalType: "uint8", type: "uint8" },
321
+ { name: "tickLower", internalType: "int24", type: "int24" },
322
+ { name: "tickUpper", internalType: "int24", type: "int24" },
323
+ { name: "numPositions", internalType: "uint16", type: "uint16" },
324
+ {
325
+ name: "maxDiscoverySupplyShare",
326
+ internalType: "uint256",
327
+ type: "uint256"
328
+ }
329
+ ],
330
+ stateMutability: "view"
331
+ },
332
+ {
333
+ type: "function",
334
+ inputs: [],
335
+ name: "poolState",
336
+ outputs: [
337
+ { name: "asset", internalType: "address", type: "address" },
338
+ { name: "numeraire", internalType: "address", type: "address" },
339
+ { name: "tickLower", internalType: "int24", type: "int24" },
340
+ { name: "tickUpper", internalType: "int24", type: "int24" },
341
+ { name: "numPositions", internalType: "uint16", type: "uint16" },
342
+ { name: "isInitialized", internalType: "bool", type: "bool" },
343
+ { name: "isExited", internalType: "bool", type: "bool" },
344
+ { name: "maxShareToBeSold", internalType: "uint256", type: "uint256" },
345
+ {
346
+ name: "totalTokensOnBondingCurve",
347
+ internalType: "uint256",
348
+ type: "uint256"
349
+ }
350
+ ],
351
+ stateMutability: "view"
352
+ },
338
353
  {
339
354
  type: "function",
340
355
  inputs: [],
@@ -463,14 +478,21 @@ var coinABI = [
463
478
  {
464
479
  type: "function",
465
480
  inputs: [
466
- { name: "amount0Delta", internalType: "int256", type: "int256" },
467
- { name: "amount1Delta", internalType: "int256", type: "int256" },
481
+ { name: "amount0Owed", internalType: "uint256", type: "uint256" },
482
+ { name: "amount1Owed", internalType: "uint256", type: "uint256" },
468
483
  { name: "", internalType: "bytes", type: "bytes" }
469
484
  ],
470
- name: "uniswapV3SwapCallback",
485
+ name: "uniswapV3MintCallback",
471
486
  outputs: [],
472
487
  stateMutability: "nonpayable"
473
488
  },
489
+ {
490
+ type: "function",
491
+ inputs: [],
492
+ name: "v3Factory",
493
+ outputs: [{ name: "", internalType: "address", type: "address" }],
494
+ stateMutability: "view"
495
+ },
474
496
  {
475
497
  type: "event",
476
498
  anonymous: false,
@@ -879,6 +901,12 @@ var coinABI = [
879
901
  },
880
902
  { type: "error", inputs: [], name: "AddressZero" },
881
903
  { type: "error", inputs: [], name: "AlreadyOwner" },
904
+ { type: "error", inputs: [], name: "CannotMintZeroLiquidity" },
905
+ {
906
+ type: "error",
907
+ inputs: [],
908
+ name: "DopplerPoolMustHaveMoreThan2DiscoveryPositions"
909
+ },
882
910
  { type: "error", inputs: [], name: "ECDSAInvalidSignature" },
883
911
  {
884
912
  type: "error",
@@ -961,11 +989,30 @@ var coinABI = [
961
989
  { type: "error", inputs: [], name: "InvalidCurrencyLowerTick" },
962
990
  { type: "error", inputs: [], name: "InvalidInitialization" },
963
991
  { type: "error", inputs: [], name: "InvalidMarketType" },
992
+ { type: "error", inputs: [], name: "InvalidPoolVersion" },
993
+ {
994
+ type: "error",
995
+ inputs: [
996
+ { name: "tickLower", internalType: "int24", type: "int24" },
997
+ { name: "tickUpper", internalType: "int24", type: "int24" }
998
+ ],
999
+ name: "InvalidTickRangeMisordered"
1000
+ },
964
1001
  { type: "error", inputs: [], name: "InvalidWethLowerTick" },
1002
+ { type: "error", inputs: [], name: "LegacyPoolMustHaveOneDiscoveryPosition" },
965
1003
  { type: "error", inputs: [], name: "MarketAlreadyGraduated" },
966
1004
  { type: "error", inputs: [], name: "MarketNotGraduated" },
1005
+ {
1006
+ type: "error",
1007
+ inputs: [
1008
+ { name: "value", internalType: "uint256", type: "uint256" },
1009
+ { name: "limit", internalType: "uint256", type: "uint256" }
1010
+ ],
1011
+ name: "MaxShareToBeSoldExceeded"
1012
+ },
967
1013
  { type: "error", inputs: [], name: "NotInitializing" },
968
1014
  { type: "error", inputs: [], name: "NotOwner" },
1015
+ { type: "error", inputs: [], name: "NumDiscoveryPositionsOutOfRange" },
969
1016
  { type: "error", inputs: [], name: "OneOwnerRequired" },
970
1017
  { type: "error", inputs: [], name: "OnlyOwner" },
971
1018
  { type: "error", inputs: [], name: "OnlyPool" },
@@ -981,6 +1028,36 @@ var coinABI = [
981
1028
  { type: "error", inputs: [], name: "UseRevokeOwnershipToRemoveSelf" }
982
1029
  ];
983
1030
  var iUniswapV3PoolABI = [
1031
+ {
1032
+ type: "function",
1033
+ inputs: [
1034
+ { name: "tickLower", internalType: "int24", type: "int24" },
1035
+ { name: "tickUpper", internalType: "int24", type: "int24" },
1036
+ { name: "amount", internalType: "uint128", type: "uint128" }
1037
+ ],
1038
+ name: "burn",
1039
+ outputs: [
1040
+ { name: "amount0", internalType: "uint256", type: "uint256" },
1041
+ { name: "amount1", internalType: "uint256", type: "uint256" }
1042
+ ],
1043
+ stateMutability: "nonpayable"
1044
+ },
1045
+ {
1046
+ type: "function",
1047
+ inputs: [
1048
+ { name: "recipient", internalType: "address", type: "address" },
1049
+ { name: "tickLower", internalType: "int24", type: "int24" },
1050
+ { name: "tickUpper", internalType: "int24", type: "int24" },
1051
+ { name: "amount0Requested", internalType: "uint128", type: "uint128" },
1052
+ { name: "amount1Requested", internalType: "uint128", type: "uint128" }
1053
+ ],
1054
+ name: "collect",
1055
+ outputs: [
1056
+ { name: "amount0", internalType: "uint128", type: "uint128" },
1057
+ { name: "amount1", internalType: "uint128", type: "uint128" }
1058
+ ],
1059
+ stateMutability: "nonpayable"
1060
+ },
984
1061
  {
985
1062
  type: "function",
986
1063
  inputs: [],
@@ -995,6 +1072,31 @@ var iUniswapV3PoolABI = [
995
1072
  outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
996
1073
  stateMutability: "view"
997
1074
  },
1075
+ {
1076
+ type: "function",
1077
+ inputs: [
1078
+ { name: "sqrtPriceX96", internalType: "uint160", type: "uint160" }
1079
+ ],
1080
+ name: "initialize",
1081
+ outputs: [],
1082
+ stateMutability: "nonpayable"
1083
+ },
1084
+ {
1085
+ type: "function",
1086
+ inputs: [
1087
+ { name: "recipient", internalType: "address", type: "address" },
1088
+ { name: "tickLower", internalType: "int24", type: "int24" },
1089
+ { name: "tickUpper", internalType: "int24", type: "int24" },
1090
+ { name: "amount", internalType: "uint128", type: "uint128" },
1091
+ { name: "data", internalType: "bytes", type: "bytes" }
1092
+ ],
1093
+ name: "mint",
1094
+ outputs: [
1095
+ { name: "amount0", internalType: "uint256", type: "uint256" },
1096
+ { name: "amount1", internalType: "uint256", type: "uint256" }
1097
+ ],
1098
+ stateMutability: "nonpayable"
1099
+ },
998
1100
  {
999
1101
  type: "function",
1000
1102
  inputs: [],
@@ -1096,6 +1198,25 @@ var zoraFactoryImplABI = [
1096
1198
  ],
1097
1199
  stateMutability: "payable"
1098
1200
  },
1201
+ {
1202
+ type: "function",
1203
+ inputs: [
1204
+ { name: "payoutRecipient", internalType: "address", type: "address" },
1205
+ { name: "owners", internalType: "address[]", type: "address[]" },
1206
+ { name: "uri", internalType: "string", type: "string" },
1207
+ { name: "name", internalType: "string", type: "string" },
1208
+ { name: "symbol", internalType: "string", type: "string" },
1209
+ { name: "poolConfig", internalType: "bytes", type: "bytes" },
1210
+ { name: "platformReferrer", internalType: "address", type: "address" },
1211
+ { name: "orderSize", internalType: "uint256", type: "uint256" }
1212
+ ],
1213
+ name: "deploy",
1214
+ outputs: [
1215
+ { name: "", internalType: "address", type: "address" },
1216
+ { name: "", internalType: "uint256", type: "uint256" }
1217
+ ],
1218
+ stateMutability: "payable"
1219
+ },
1099
1220
  {
1100
1221
  type: "function",
1101
1222
  inputs: [],
@@ -1300,7 +1421,7 @@ var zoraFactoryImplABI = [
1300
1421
  }
1301
1422
  ];
1302
1423
  var zoraFactoryImplAddress = {
1303
- 8453: "0x777777751622c0d3258f214F9DF38E35BF45baF3",
1424
+ 8453: "0x02B2705500096Ff83F9eF78873ca5DFB06C00Ddc",
1304
1425
  84532: "0x777777751622c0d3258f214F9DF38E35BF45baF3"
1305
1426
  };
1306
1427
  var zoraFactoryImplConfig = {