@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
@@ -342,6 +342,13 @@
342
342
  "outputs": [],
343
343
  "stateMutability": "nonpayable"
344
344
  },
345
+ {
346
+ "type": "function",
347
+ "name": "test_deploy_with_usdc_order",
348
+ "inputs": [],
349
+ "outputs": [],
350
+ "stateMutability": "nonpayable"
351
+ },
345
352
  {
346
353
  "type": "function",
347
354
  "name": "test_deploy_with_usdc_platform_referrer_zero",
@@ -425,29 +432,6 @@
425
432
  "outputs": [],
426
433
  "stateMutability": "nonpayable"
427
434
  },
428
- {
429
- "type": "function",
430
- "name": "uniswapV3SwapCallback",
431
- "inputs": [
432
- {
433
- "name": "amount0Delta",
434
- "type": "int256",
435
- "internalType": "int256"
436
- },
437
- {
438
- "name": "amount1Delta",
439
- "type": "int256",
440
- "internalType": "int256"
441
- },
442
- {
443
- "name": "data",
444
- "type": "bytes",
445
- "internalType": "bytes"
446
- }
447
- ],
448
- "outputs": [],
449
- "stateMutability": "nonpayable"
450
- },
451
435
  {
452
436
  "type": "event",
453
437
  "name": "SlotFound",
@@ -0,0 +1,15 @@
1
+ [
2
+ {
3
+ "type": "function",
4
+ "name": "owner",
5
+ "inputs": [],
6
+ "outputs": [
7
+ {
8
+ "name": "",
9
+ "type": "address",
10
+ "internalType": "address"
11
+ }
12
+ ],
13
+ "stateMutability": "view"
14
+ }
15
+ ]
package/abis/ICoin.json CHANGED
@@ -69,40 +69,6 @@
69
69
  ],
70
70
  "stateMutability": "view"
71
71
  },
72
- {
73
- "type": "function",
74
- "name": "onERC721Received",
75
- "inputs": [
76
- {
77
- "name": "operator",
78
- "type": "address",
79
- "internalType": "address"
80
- },
81
- {
82
- "name": "from",
83
- "type": "address",
84
- "internalType": "address"
85
- },
86
- {
87
- "name": "tokenId",
88
- "type": "uint256",
89
- "internalType": "uint256"
90
- },
91
- {
92
- "name": "data",
93
- "type": "bytes",
94
- "internalType": "bytes"
95
- }
96
- ],
97
- "outputs": [
98
- {
99
- "name": "",
100
- "type": "bytes4",
101
- "internalType": "bytes4"
102
- }
103
- ],
104
- "stateMutability": "nonpayable"
105
- },
106
72
  {
107
73
  "type": "function",
108
74
  "name": "platformReferrer",
@@ -528,6 +494,16 @@
528
494
  "name": "AddressZero",
529
495
  "inputs": []
530
496
  },
497
+ {
498
+ "type": "error",
499
+ "name": "CannotMintZeroLiquidity",
500
+ "inputs": []
501
+ },
502
+ {
503
+ "type": "error",
504
+ "name": "DopplerPoolMustHaveMoreThan2DiscoveryPositions",
505
+ "inputs": []
506
+ },
531
507
  {
532
508
  "type": "error",
533
509
  "name": "ERC20TransferAmountMismatch",
@@ -578,11 +554,32 @@
578
554
  "name": "InvalidMarketType",
579
555
  "inputs": []
580
556
  },
557
+ {
558
+ "type": "error",
559
+ "name": "InvalidTickRangeMisordered",
560
+ "inputs": [
561
+ {
562
+ "name": "tickLower",
563
+ "type": "int24",
564
+ "internalType": "int24"
565
+ },
566
+ {
567
+ "name": "tickUpper",
568
+ "type": "int24",
569
+ "internalType": "int24"
570
+ }
571
+ ]
572
+ },
581
573
  {
582
574
  "type": "error",
583
575
  "name": "InvalidWethLowerTick",
584
576
  "inputs": []
585
577
  },
578
+ {
579
+ "type": "error",
580
+ "name": "LegacyPoolMustHaveOneDiscoveryPosition",
581
+ "inputs": []
582
+ },
586
583
  {
587
584
  "type": "error",
588
585
  "name": "MarketAlreadyGraduated",
@@ -593,6 +590,27 @@
593
590
  "name": "MarketNotGraduated",
594
591
  "inputs": []
595
592
  },
593
+ {
594
+ "type": "error",
595
+ "name": "MaxShareToBeSoldExceeded",
596
+ "inputs": [
597
+ {
598
+ "name": "value",
599
+ "type": "uint256",
600
+ "internalType": "uint256"
601
+ },
602
+ {
603
+ "name": "limit",
604
+ "type": "uint256",
605
+ "internalType": "uint256"
606
+ }
607
+ ]
608
+ },
609
+ {
610
+ "type": "error",
611
+ "name": "NumDiscoveryPositionsOutOfRange",
612
+ "inputs": []
613
+ },
596
614
  {
597
615
  "type": "error",
598
616
  "name": "OnlyPool",
@@ -0,0 +1,44 @@
1
+ [
2
+ {
3
+ "type": "error",
4
+ "name": "CannotMintZeroLiquidity",
5
+ "inputs": []
6
+ },
7
+ {
8
+ "type": "error",
9
+ "name": "InvalidTickRangeMisordered",
10
+ "inputs": [
11
+ {
12
+ "name": "tickLower",
13
+ "type": "int24",
14
+ "internalType": "int24"
15
+ },
16
+ {
17
+ "name": "tickUpper",
18
+ "type": "int24",
19
+ "internalType": "int24"
20
+ }
21
+ ]
22
+ },
23
+ {
24
+ "type": "error",
25
+ "name": "MaxShareToBeSoldExceeded",
26
+ "inputs": [
27
+ {
28
+ "name": "value",
29
+ "type": "uint256",
30
+ "internalType": "uint256"
31
+ },
32
+ {
33
+ "name": "limit",
34
+ "type": "uint256",
35
+ "internalType": "uint256"
36
+ }
37
+ ]
38
+ },
39
+ {
40
+ "type": "error",
41
+ "name": "NumDiscoveryPositionsOutOfRange",
42
+ "inputs": []
43
+ }
44
+ ]
@@ -97,6 +97,19 @@
97
97
  ],
98
98
  "stateMutability": "payable"
99
99
  },
100
+ {
101
+ "type": "function",
102
+ "name": "factory",
103
+ "inputs": [],
104
+ "outputs": [
105
+ {
106
+ "name": "",
107
+ "type": "address",
108
+ "internalType": "address"
109
+ }
110
+ ],
111
+ "stateMutability": "view"
112
+ },
100
113
  {
101
114
  "type": "function",
102
115
  "name": "mint",
@@ -0,0 +1,198 @@
1
+ [
2
+ {
3
+ "type": "function",
4
+ "name": "createPool",
5
+ "inputs": [
6
+ {
7
+ "name": "tokenA",
8
+ "type": "address",
9
+ "internalType": "address"
10
+ },
11
+ {
12
+ "name": "tokenB",
13
+ "type": "address",
14
+ "internalType": "address"
15
+ },
16
+ {
17
+ "name": "fee",
18
+ "type": "uint24",
19
+ "internalType": "uint24"
20
+ }
21
+ ],
22
+ "outputs": [
23
+ {
24
+ "name": "pool",
25
+ "type": "address",
26
+ "internalType": "address"
27
+ }
28
+ ],
29
+ "stateMutability": "nonpayable"
30
+ },
31
+ {
32
+ "type": "function",
33
+ "name": "enableFeeAmount",
34
+ "inputs": [
35
+ {
36
+ "name": "fee",
37
+ "type": "uint24",
38
+ "internalType": "uint24"
39
+ },
40
+ {
41
+ "name": "tickSpacing",
42
+ "type": "int24",
43
+ "internalType": "int24"
44
+ }
45
+ ],
46
+ "outputs": [],
47
+ "stateMutability": "nonpayable"
48
+ },
49
+ {
50
+ "type": "function",
51
+ "name": "feeAmountTickSpacing",
52
+ "inputs": [
53
+ {
54
+ "name": "fee",
55
+ "type": "uint24",
56
+ "internalType": "uint24"
57
+ }
58
+ ],
59
+ "outputs": [
60
+ {
61
+ "name": "",
62
+ "type": "int24",
63
+ "internalType": "int24"
64
+ }
65
+ ],
66
+ "stateMutability": "view"
67
+ },
68
+ {
69
+ "type": "function",
70
+ "name": "getPool",
71
+ "inputs": [
72
+ {
73
+ "name": "tokenA",
74
+ "type": "address",
75
+ "internalType": "address"
76
+ },
77
+ {
78
+ "name": "tokenB",
79
+ "type": "address",
80
+ "internalType": "address"
81
+ },
82
+ {
83
+ "name": "fee",
84
+ "type": "uint24",
85
+ "internalType": "uint24"
86
+ }
87
+ ],
88
+ "outputs": [
89
+ {
90
+ "name": "pool",
91
+ "type": "address",
92
+ "internalType": "address"
93
+ }
94
+ ],
95
+ "stateMutability": "view"
96
+ },
97
+ {
98
+ "type": "function",
99
+ "name": "owner",
100
+ "inputs": [],
101
+ "outputs": [
102
+ {
103
+ "name": "",
104
+ "type": "address",
105
+ "internalType": "address"
106
+ }
107
+ ],
108
+ "stateMutability": "view"
109
+ },
110
+ {
111
+ "type": "function",
112
+ "name": "setOwner",
113
+ "inputs": [
114
+ {
115
+ "name": "_owner",
116
+ "type": "address",
117
+ "internalType": "address"
118
+ }
119
+ ],
120
+ "outputs": [],
121
+ "stateMutability": "nonpayable"
122
+ },
123
+ {
124
+ "type": "event",
125
+ "name": "FeeAmountEnabled",
126
+ "inputs": [
127
+ {
128
+ "name": "fee",
129
+ "type": "uint24",
130
+ "indexed": true,
131
+ "internalType": "uint24"
132
+ },
133
+ {
134
+ "name": "tickSpacing",
135
+ "type": "int24",
136
+ "indexed": true,
137
+ "internalType": "int24"
138
+ }
139
+ ],
140
+ "anonymous": false
141
+ },
142
+ {
143
+ "type": "event",
144
+ "name": "OwnerChanged",
145
+ "inputs": [
146
+ {
147
+ "name": "oldOwner",
148
+ "type": "address",
149
+ "indexed": true,
150
+ "internalType": "address"
151
+ },
152
+ {
153
+ "name": "newOwner",
154
+ "type": "address",
155
+ "indexed": true,
156
+ "internalType": "address"
157
+ }
158
+ ],
159
+ "anonymous": false
160
+ },
161
+ {
162
+ "type": "event",
163
+ "name": "PoolCreated",
164
+ "inputs": [
165
+ {
166
+ "name": "token0",
167
+ "type": "address",
168
+ "indexed": true,
169
+ "internalType": "address"
170
+ },
171
+ {
172
+ "name": "token1",
173
+ "type": "address",
174
+ "indexed": true,
175
+ "internalType": "address"
176
+ },
177
+ {
178
+ "name": "fee",
179
+ "type": "uint24",
180
+ "indexed": true,
181
+ "internalType": "uint24"
182
+ },
183
+ {
184
+ "name": "tickSpacing",
185
+ "type": "int24",
186
+ "indexed": false,
187
+ "internalType": "int24"
188
+ },
189
+ {
190
+ "name": "pool",
191
+ "type": "address",
192
+ "indexed": false,
193
+ "internalType": "address"
194
+ }
195
+ ],
196
+ "anonymous": false
197
+ }
198
+ ]
@@ -1,4 +1,82 @@
1
1
  [
2
+ {
3
+ "type": "function",
4
+ "name": "burn",
5
+ "inputs": [
6
+ {
7
+ "name": "tickLower",
8
+ "type": "int24",
9
+ "internalType": "int24"
10
+ },
11
+ {
12
+ "name": "tickUpper",
13
+ "type": "int24",
14
+ "internalType": "int24"
15
+ },
16
+ {
17
+ "name": "amount",
18
+ "type": "uint128",
19
+ "internalType": "uint128"
20
+ }
21
+ ],
22
+ "outputs": [
23
+ {
24
+ "name": "amount0",
25
+ "type": "uint256",
26
+ "internalType": "uint256"
27
+ },
28
+ {
29
+ "name": "amount1",
30
+ "type": "uint256",
31
+ "internalType": "uint256"
32
+ }
33
+ ],
34
+ "stateMutability": "nonpayable"
35
+ },
36
+ {
37
+ "type": "function",
38
+ "name": "collect",
39
+ "inputs": [
40
+ {
41
+ "name": "recipient",
42
+ "type": "address",
43
+ "internalType": "address"
44
+ },
45
+ {
46
+ "name": "tickLower",
47
+ "type": "int24",
48
+ "internalType": "int24"
49
+ },
50
+ {
51
+ "name": "tickUpper",
52
+ "type": "int24",
53
+ "internalType": "int24"
54
+ },
55
+ {
56
+ "name": "amount0Requested",
57
+ "type": "uint128",
58
+ "internalType": "uint128"
59
+ },
60
+ {
61
+ "name": "amount1Requested",
62
+ "type": "uint128",
63
+ "internalType": "uint128"
64
+ }
65
+ ],
66
+ "outputs": [
67
+ {
68
+ "name": "amount0",
69
+ "type": "uint128",
70
+ "internalType": "uint128"
71
+ },
72
+ {
73
+ "name": "amount1",
74
+ "type": "uint128",
75
+ "internalType": "uint128"
76
+ }
77
+ ],
78
+ "stateMutability": "nonpayable"
79
+ },
2
80
  {
3
81
  "type": "function",
4
82
  "name": "feeGrowthGlobal0X128",
@@ -25,6 +103,63 @@
25
103
  ],
26
104
  "stateMutability": "view"
27
105
  },
106
+ {
107
+ "type": "function",
108
+ "name": "initialize",
109
+ "inputs": [
110
+ {
111
+ "name": "sqrtPriceX96",
112
+ "type": "uint160",
113
+ "internalType": "uint160"
114
+ }
115
+ ],
116
+ "outputs": [],
117
+ "stateMutability": "nonpayable"
118
+ },
119
+ {
120
+ "type": "function",
121
+ "name": "mint",
122
+ "inputs": [
123
+ {
124
+ "name": "recipient",
125
+ "type": "address",
126
+ "internalType": "address"
127
+ },
128
+ {
129
+ "name": "tickLower",
130
+ "type": "int24",
131
+ "internalType": "int24"
132
+ },
133
+ {
134
+ "name": "tickUpper",
135
+ "type": "int24",
136
+ "internalType": "int24"
137
+ },
138
+ {
139
+ "name": "amount",
140
+ "type": "uint128",
141
+ "internalType": "uint128"
142
+ },
143
+ {
144
+ "name": "data",
145
+ "type": "bytes",
146
+ "internalType": "bytes"
147
+ }
148
+ ],
149
+ "outputs": [
150
+ {
151
+ "name": "amount0",
152
+ "type": "uint256",
153
+ "internalType": "uint256"
154
+ },
155
+ {
156
+ "name": "amount1",
157
+ "type": "uint256",
158
+ "internalType": "uint256"
159
+ }
160
+ ],
161
+ "stateMutability": "nonpayable"
162
+ },
28
163
  {
29
164
  "type": "function",
30
165
  "name": "slot0",
@@ -406,29 +406,6 @@
406
406
  "outputs": [],
407
407
  "stateMutability": "nonpayable"
408
408
  },
409
- {
410
- "type": "function",
411
- "name": "uniswapV3SwapCallback",
412
- "inputs": [
413
- {
414
- "name": "amount0Delta",
415
- "type": "int256",
416
- "internalType": "int256"
417
- },
418
- {
419
- "name": "amount1Delta",
420
- "type": "int256",
421
- "internalType": "int256"
422
- },
423
- {
424
- "name": "data",
425
- "type": "bytes",
426
- "internalType": "bytes"
427
- }
428
- ],
429
- "outputs": [],
430
- "stateMutability": "nonpayable"
431
- },
432
409
  {
433
410
  "type": "event",
434
411
  "name": "log",
@@ -0,0 +1,7 @@
1
+ [
2
+ {
3
+ "type": "error",
4
+ "name": "SafeCastOverflow",
5
+ "inputs": []
6
+ }
7
+ ]