@zoralabs/coins 2.0.0 → 2.1.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 (69) hide show
  1. package/.turbo/turbo-build.log +106 -110
  2. package/CHANGELOG.md +28 -0
  3. package/README.md +30 -109
  4. package/abis/BaseCoin.json +442 -0
  5. package/abis/CoinTest.json +3 -246
  6. package/abis/FactoryTest.json +5 -137
  7. package/abis/HooksTest.json +0 -26
  8. package/abis/ICoin.json +378 -0
  9. package/abis/ICoinV3.json +378 -0
  10. package/abis/IZoraFactory.json +0 -18
  11. package/abis/LiquidityMigrationTest.json +101 -0
  12. package/abis/MockBadFactory.json +15 -0
  13. package/abis/ZoraFactoryImpl.json +1 -67
  14. package/dist/index.cjs +236 -265
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.js +235 -264
  17. package/dist/index.js.map +1 -1
  18. package/dist/wagmiGenerated.d.ts +389 -493
  19. package/dist/wagmiGenerated.d.ts.map +1 -1
  20. package/package/wagmiGenerated.ts +240 -269
  21. package/package.json +3 -3
  22. package/script/DeployPostDeploymentHooks.s.sol +2 -2
  23. package/script/TestBackingCoinSwap.s.sol +8 -8
  24. package/script/TestV4Swap.s.sol +8 -8
  25. package/script/UpgradeFactoryImpl.s.sol +0 -1
  26. package/src/BaseCoin.sol +109 -6
  27. package/src/ContentCoin.sol +4 -4
  28. package/src/CreatorCoin.sol +5 -5
  29. package/src/ZoraFactoryImpl.sol +10 -93
  30. package/src/deployment/CoinsDeployerBase.sol +10 -27
  31. package/src/hooks/BaseZoraV4CoinHook.sol +5 -5
  32. package/src/hooks/deployment/BuySupplyWithSwapRouterHook.sol +4 -5
  33. package/src/interfaces/ICoin.sol +67 -1
  34. package/src/interfaces/ICreatorCoin.sol +2 -2
  35. package/src/interfaces/IZoraFactory.sol +0 -5
  36. package/src/libs/CoinConfigurationVersions.sol +1 -39
  37. package/src/libs/CoinRewardsV4.sol +2 -2
  38. package/src/libs/CoinSetup.sol +1 -4
  39. package/src/libs/UniV4SwapHelper.sol +1 -1
  40. package/src/libs/UniV4SwapToCurrency.sol +2 -2
  41. package/src/libs/V4Liquidity.sol +1 -1
  42. package/src/version/ContractVersionBase.sol +1 -1
  43. package/test/Coin.t.sol +112 -535
  44. package/test/CoinUniV4.t.sol +5 -5
  45. package/test/DeploymentHooks.t.sol +5 -102
  46. package/test/Factory.t.sol +23 -306
  47. package/test/LiquidityMigration.t.sol +160 -2
  48. package/test/MultiOwnable.t.sol +36 -36
  49. package/test/Upgrades.t.sol +16 -35
  50. package/test/utils/BaseTest.sol +16 -69
  51. package/test/utils/FeeEstimatorHook.sol +3 -3
  52. package/wagmi.config.ts +1 -1
  53. package/abis/BaseCoinV4.json +0 -1840
  54. package/abis/Coin.json +0 -1912
  55. package/abis/DopplerUniswapV3Test.json +0 -800
  56. package/abis/ICoinV4.json +0 -1048
  57. package/abis/Simulate.json +0 -29
  58. package/abis/UniV3BuySell.json +0 -12
  59. package/abis/UniV3Errors.json +0 -32
  60. package/script/Simulate.s.sol +0 -59
  61. package/src/BaseCoinV4.sol +0 -143
  62. package/src/Coin.sol +0 -236
  63. package/src/interfaces/ICoinV4.sol +0 -74
  64. package/src/libs/CoinDopplerUniV3.sol +0 -50
  65. package/src/libs/CoinRewards.sol +0 -201
  66. package/src/libs/CoinSetupV3.sol +0 -50
  67. package/src/libs/UniV3BuySell.sol +0 -231
  68. package/src/libs/UniV3Errors.sol +0 -11
  69. package/test/CoinDopplerUniV3.t.sol +0 -310
@@ -1,33 +1,39 @@
1
1
 
2
- > @zoralabs/coins@2.0.0 build /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
2
+ > @zoralabs/coins@2.1.0 build /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
3
3
  > pnpm run wagmi:generate && pnpm run copy-abis && pnpm run prettier:write && tsup
4
4
 
5
5
 
6
- > @zoralabs/coins@2.0.0 wagmi:generate /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
6
+ > @zoralabs/coins@2.1.0 wagmi:generate /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
7
7
  > FOUNDRY_PROFILE=dev forge build && wagmi generate && pnpm exec rename-generated-abi-casing ./package/wagmiGenerated.ts
8
8
 
9
- Compiling 246 files with Solc 0.8.28
10
- Solc 0.8.28 finished in 226.34s
9
+ Compiling 236 files with Solc 0.8.28
10
+ Solc 0.8.28 finished in 186.86s
11
11
  Compiler run successful with warnings:
12
12
  Warning (3420): Source file does not specify required compiler version! Consider adding "pragma solidity ^0.8.28;"
13
13
  --> src/BaseCoin.sol
14
14
 
15
15
  Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning.
16
- --> src/deployment/CoinsDeployerBase.sol:117:31:
16
+ --> src/ZoraFactoryImpl.sol:214:9:
17
17
  |
18
- 117 | function deployCoinV4Impl(address zoraV4CoinHook) internal returns (ContentCoin) {
18
+ 214 | uint256 orderSize
19
+ | ^^^^^^^^^^^^^^^^^
20
+
21
+ Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning.
22
+ --> src/deployment/CoinsDeployerBase.sol:104:31:
23
+ |
24
+ 104 | function deployCoinV4Impl(address zoraV4CoinHook) internal returns (ContentCoin) {
19
25
  | ^^^^^^^^^^^^^^^^^^^^^^
20
26
 
21
27
  Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning.
22
- --> src/deployment/CoinsDeployerBase.sol:127:36:
28
+ --> src/deployment/CoinsDeployerBase.sol:114:36:
23
29
  |
24
- 127 | function deployCreatorCoinImpl(address creatorCoinHook) internal returns (CreatorCoin) {
30
+ 114 | function deployCreatorCoinImpl(address creatorCoinHook) internal returns (CreatorCoin) {
25
31
  | ^^^^^^^^^^^^^^^^^^^^^^^
26
32
 
27
33
  Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning.
28
- --> src/deployment/CoinsDeployerBase.sol:290:84:
34
+ --> src/deployment/CoinsDeployerBase.sol:273:84:
29
35
  |
30
- 290 | function deployDevFactory(CoinsDeployment memory deployment) internal returns (ZoraFactory devFactory) {
36
+ 273 | function deployDevFactory(CoinsDeployment memory deployment) internal returns (ZoraFactory devFactory) {
31
37
  | ^^^^^^^^^^^^^^^^^^^^^^
32
38
 
33
39
  Warning (2072): Unused local variable.
@@ -49,15 +55,15 @@ Warning (2072): Unused local variable.
49
55
  | ^^^^^^^^^^^^^^^^^^^^^^
50
56
 
51
57
  Warning (2072): Unused local variable.
52
- --> test/LiquidityMigration.t.sol:186:9:
58
+ --> test/LiquidityMigration.t.sol:188:9:
53
59
  |
54
- 186 | address originalHook = address(contentCoinHook);
60
+ 188 | address originalHook = address(contentCoinHook);
55
61
  | ^^^^^^^^^^^^^^^^^^^^
56
62
 
57
63
  Warning (2072): Unused local variable.
58
- --> test/LiquidityMigration.t.sol:208:9:
64
+ --> test/LiquidityMigration.t.sol:210:9:
59
65
  |
60
- 208 | PoolKey memory poolKey = coinV4.getPoolKey();
66
+ 210 | PoolKey memory poolKey = coinV4.getPoolKey();
61
67
  | ^^^^^^^^^^^^^^^^^^^^^^
62
68
 
63
69
  - Validating plugins
@@ -73,123 +79,113 @@ Warning (2072): Unused local variable.
73
79
  ✅ Updated ./package/wagmiGenerated.ts (10 replacements)
74
80
  ✨ All files processed successfully!
75
81
 
76
- > @zoralabs/coins@2.0.0 copy-abis /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
82
+ > @zoralabs/coins@2.1.0 copy-abis /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
77
83
  > pnpm exec bundle-abis
78
84
 
79
85
 
80
- > @zoralabs/coins@2.0.0 prettier:write /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
86
+ > @zoralabs/coins@2.1.0 prettier:write /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
81
87
  > prettier --write 'src/**/*.sol' 'test/**/*.sol' 'script/**/*.sol'
82
88
 
83
- src/BaseCoin.sol 331ms (unchanged)
84
- src/BaseCoinV4.sol 110ms (unchanged)
85
- src/Coin.sol 124ms (unchanged)
86
- src/ContentCoin.sol 25ms (unchanged)
87
- src/CreatorCoin.sol 47ms (unchanged)
88
- src/deployment/CoinsDeployerBase.sol 189ms (unchanged)
89
- src/hooks/BaseZoraV4CoinHook.sol 183ms (unchanged)
90
- src/hooks/ContentCoinHook.sol 9ms (unchanged)
91
- src/hooks/CreatorCoinHook.sol 6ms (unchanged)
92
- src/hooks/deployment/BaseCoinDeployHook.sol 11ms (unchanged)
93
- src/hooks/deployment/BuySupplyWithSwapRouterHook.sol 130ms (unchanged)
94
- src/hooks/HookUpgradeGate.sol 23ms (unchanged)
95
- src/interfaces/IAirlock.sol 2ms (unchanged)
89
+ src/BaseCoin.sol 423ms (unchanged)
90
+ src/ContentCoin.sol 34ms (unchanged)
91
+ src/CreatorCoin.sol 63ms (unchanged)
92
+ src/deployment/CoinsDeployerBase.sol 216ms (unchanged)
93
+ src/hooks/BaseZoraV4CoinHook.sol 180ms (unchanged)
94
+ src/hooks/ContentCoinHook.sol 7ms (unchanged)
95
+ src/hooks/CreatorCoinHook.sol 7ms (unchanged)
96
+ src/hooks/deployment/BaseCoinDeployHook.sol 20ms (unchanged)
97
+ src/hooks/deployment/BuySupplyWithSwapRouterHook.sol 118ms (unchanged)
98
+ src/hooks/HookUpgradeGate.sol 22ms (unchanged)
99
+ src/interfaces/IAirlock.sol 1ms (unchanged)
96
100
  src/interfaces/ICoin.sol 13ms (unchanged)
97
- src/interfaces/ICoinComments.sol 2ms (unchanged)
101
+ src/interfaces/ICoinComments.sol 1ms (unchanged)
98
102
  src/interfaces/ICoinDeployHook.sol 1ms (unchanged)
99
103
  src/interfaces/ICoinV3.sol 3ms (unchanged)
100
- src/interfaces/ICoinV4.sol 2ms (unchanged)
101
- src/interfaces/ICreatorCoin.sol 1ms (unchanged)
102
- src/interfaces/ICreatorCoinHook.sol 1ms (unchanged)
104
+ src/interfaces/ICreatorCoin.sol 2ms (unchanged)
105
+ src/interfaces/ICreatorCoinHook.sol 2ms (unchanged)
103
106
  src/interfaces/IDeployedCoinVersionLookup.sol 1ms (unchanged)
104
- src/interfaces/IDopplerErrors.sol 0ms (unchanged)
105
- src/interfaces/IERC7572.sol 1ms (unchanged)
107
+ src/interfaces/IDopplerErrors.sol 1ms (unchanged)
108
+ src/interfaces/IERC7572.sol 0ms (unchanged)
106
109
  src/interfaces/IHasRewardsRecipients.sol 1ms (unchanged)
107
- src/interfaces/IHooksUpgradeGate.sol 2ms (unchanged)
110
+ src/interfaces/IHooksUpgradeGate.sol 1ms (unchanged)
108
111
  src/interfaces/IMsgSender.sol 1ms (unchanged)
109
- src/interfaces/INonfungiblePositionManager.sol 8ms (unchanged)
112
+ src/interfaces/INonfungiblePositionManager.sol 4ms (unchanged)
110
113
  src/interfaces/IPoolConfigEncoding.sol 2ms (unchanged)
111
- src/interfaces/IProtocolRewards.sol 3ms (unchanged)
114
+ src/interfaces/IProtocolRewards.sol 2ms (unchanged)
112
115
  src/interfaces/ISwapPathRouter.sol 1ms (unchanged)
113
- src/interfaces/ISwapRouter.sol 0ms (unchanged)
114
- src/interfaces/IUniswapV3Factory.sol 2ms (unchanged)
116
+ src/interfaces/ISwapRouter.sol 1ms (unchanged)
117
+ src/interfaces/IUniswapV3Factory.sol 5ms (unchanged)
115
118
  src/interfaces/IUniswapV3Pool.sol 3ms (unchanged)
116
- src/interfaces/IUniswapV3SwapCallback.sol 2ms (unchanged)
119
+ src/interfaces/IUniswapV3SwapCallback.sol 1ms (unchanged)
117
120
  src/interfaces/IUpgradeableV4Hook.sol 2ms (unchanged)
118
- src/interfaces/IWETH.sol 2ms (unchanged)
119
- src/interfaces/IZoraFactory.sol 10ms (unchanged)
120
- src/interfaces/IZoraV4CoinHook.sol 7ms (unchanged)
121
- src/libs/CoinCommon.sol 10ms (unchanged)
122
- src/libs/CoinConfigurationVersions.sol 52ms (unchanged)
123
- src/libs/CoinConstants.sol 3ms (unchanged)
124
- src/libs/CoinDopplerMultiCurve.sol 106ms (unchanged)
125
- src/libs/CoinDopplerUniV3.sol 28ms (unchanged)
126
- src/libs/CoinRewards.sol 113ms (unchanged)
127
- src/libs/CoinRewardsV4.sol 102ms (unchanged)
128
- src/libs/CoinSetup.sol 23ms (unchanged)
129
- src/libs/CoinSetupV3.sol 14ms (unchanged)
121
+ src/interfaces/IWETH.sol 1ms (unchanged)
122
+ src/interfaces/IZoraFactory.sol 12ms (unchanged)
123
+ src/interfaces/IZoraV4CoinHook.sol 6ms (unchanged)
124
+ src/libs/CoinCommon.sol 4ms (unchanged)
125
+ src/libs/CoinConfigurationVersions.sol 46ms (unchanged)
126
+ src/libs/CoinConstants.sol 4ms (unchanged)
127
+ src/libs/CoinDopplerMultiCurve.sol 103ms (unchanged)
128
+ src/libs/CoinRewardsV4.sol 99ms (unchanged)
129
+ src/libs/CoinSetup.sol 26ms (unchanged)
130
130
  src/libs/CreatorCoinConstants.sol 2ms (unchanged)
131
- src/libs/CreatorCoinRewards.sol 10ms (unchanged)
131
+ src/libs/CreatorCoinRewards.sol 18ms (unchanged)
132
132
  src/libs/DopplerMath.sol 88ms (unchanged)
133
- src/libs/HooksDeployment.sol 85ms (unchanged)
133
+ src/libs/HooksDeployment.sol 79ms (unchanged)
134
134
  src/libs/MarketConstants.sol 2ms (unchanged)
135
- src/libs/PoolStateReader.sol 7ms (unchanged)
136
- src/libs/UniV3BuySell.sol 78ms (unchanged)
137
- src/libs/UniV3Errors.sol 1ms (unchanged)
138
- src/libs/UniV4SwapHelper.sol 24ms (unchanged)
139
- src/libs/UniV4SwapToCurrency.sol 52ms (unchanged)
140
- src/libs/V4Liquidity.sol 136ms (unchanged)
141
- src/proxy/ZoraFactory.sol 7ms (unchanged)
135
+ src/libs/PoolStateReader.sol 6ms (unchanged)
136
+ src/libs/UniV4SwapHelper.sol 29ms (unchanged)
137
+ src/libs/UniV4SwapToCurrency.sol 48ms (unchanged)
138
+ src/libs/V4Liquidity.sol 131ms (unchanged)
139
+ src/proxy/ZoraFactory.sol 5ms (unchanged)
142
140
  src/types/LpPosition.sol 1ms (unchanged)
143
- src/types/PoolConfiguration.sol 1ms (unchanged)
141
+ src/types/PoolConfiguration.sol 3ms (unchanged)
144
142
  src/types/PoolState.sol 1ms (unchanged)
145
- src/utils/AutoSwapper.sol 19ms (unchanged)
143
+ src/utils/AutoSwapper.sol 20ms (unchanged)
146
144
  src/utils/DeployedCoinVersionLookup.sol 4ms (unchanged)
147
- src/utils/MultiOwnable.sol 39ms (unchanged)
148
- src/utils/uniswap/BitMath.sol 11ms (unchanged)
149
- src/utils/uniswap/BytesLib.sol 15ms (unchanged)
150
- src/utils/uniswap/CustomRevert.sol 34ms (unchanged)
151
- src/utils/uniswap/FixedPoint96.sol 2ms (unchanged)
152
- src/utils/uniswap/FullMath.sol 21ms (unchanged)
153
- src/utils/uniswap/LiquidityAmounts.sol 41ms (unchanged)
145
+ src/utils/MultiOwnable.sol 45ms (unchanged)
146
+ src/utils/uniswap/BitMath.sol 10ms (unchanged)
147
+ src/utils/uniswap/BytesLib.sol 17ms (unchanged)
148
+ src/utils/uniswap/CustomRevert.sol 41ms (unchanged)
149
+ src/utils/uniswap/FixedPoint96.sol 1ms (unchanged)
150
+ src/utils/uniswap/FullMath.sol 20ms (unchanged)
151
+ src/utils/uniswap/LiquidityAmounts.sol 46ms (unchanged)
154
152
  src/utils/uniswap/Path.sol 5ms (unchanged)
155
153
  src/utils/uniswap/SafeCast.sol 11ms (unchanged)
156
- src/utils/uniswap/SqrtPriceMath.sol 63ms (unchanged)
157
- src/utils/uniswap/TickMath.sol 59ms (unchanged)
154
+ src/utils/uniswap/SqrtPriceMath.sol 64ms (unchanged)
155
+ src/utils/uniswap/TickMath.sol 68ms (unchanged)
158
156
  src/utils/uniswap/UnsafeMath.sol 2ms (unchanged)
159
157
  src/version/ContractVersionBase.sol 1ms (unchanged)
160
- src/ZoraFactoryImpl.sol 152ms (unchanged)
161
- test/AutoSwapper.t.sol 36ms (unchanged)
162
- test/Coin.t.sol 315ms (unchanged)
163
- test/CoinDopplerUniV3.t.sol 159ms (unchanged)
164
- test/CoinUniV4.t.sol 337ms (unchanged)
165
- test/CreatorCoin.t.sol 141ms (unchanged)
166
- test/DeploymentHooks.t.sol 99ms (unchanged)
167
- test/Factory.t.sol 202ms (unchanged)
168
- test/HooksDeployment.t.sol 29ms (unchanged)
169
- test/LiquidityMigration.t.sol 87ms (unchanged)
170
- test/mocks/MockERC20.sol 4ms (unchanged)
171
- test/MultiOwnable.t.sol 97ms (unchanged)
172
- test/Upgrades.t.sol 111ms (unchanged)
173
- test/utils/BaseTest.sol 175ms (unchanged)
174
- test/utils/ContractAddresses.sol 3ms (unchanged)
175
- test/utils/DeployedCoinVersionLookup.t.sol 36ms (unchanged)
176
- test/utils/FeeEstimatorHook.sol 30ms (unchanged)
177
- test/utils/ProtocolRewards.sol 283ms (unchanged)
178
- test/utils/ProxyShim.sol 3ms (unchanged)
158
+ src/ZoraFactoryImpl.sol 106ms (unchanged)
159
+ test/AutoSwapper.t.sol 34ms (unchanged)
160
+ test/Coin.t.sol 110ms (unchanged)
161
+ test/CoinUniV4.t.sol 336ms (unchanged)
162
+ test/CreatorCoin.t.sol 130ms (unchanged)
163
+ test/DeploymentHooks.t.sol 66ms (unchanged)
164
+ test/Factory.t.sol 76ms (unchanged)
165
+ test/HooksDeployment.t.sol 25ms (unchanged)
166
+ test/LiquidityMigration.t.sol 155ms (unchanged)
167
+ test/mocks/MockERC20.sol 2ms (unchanged)
168
+ test/MultiOwnable.t.sol 80ms (unchanged)
169
+ test/Upgrades.t.sol 107ms (unchanged)
170
+ test/utils/BaseTest.sol 154ms (unchanged)
171
+ test/utils/ContractAddresses.sol 2ms (unchanged)
172
+ test/utils/DeployedCoinVersionLookup.t.sol 38ms (unchanged)
173
+ test/utils/FeeEstimatorHook.sol 26ms (unchanged)
174
+ test/utils/ProtocolRewards.sol 281ms (unchanged)
175
+ test/utils/ProxyShim.sol 6ms (unchanged)
179
176
  script/Deploy.s.sol 3ms (unchanged)
180
- script/DeployAutoSwapper.s.sol 8ms (unchanged)
181
- script/DeployDevFactory.s.sol 4ms (unchanged)
182
- script/DeployPostDeploymentHooks.s.sol 9ms (unchanged)
183
- script/DeployUpgradeGate.s.sol 5ms (unchanged)
184
- script/GenerateDeterministicParams.s.sol 11ms (unchanged)
185
- script/PrintRegisterUpgradePath.s.sol 18ms (unchanged)
177
+ script/DeployAutoSwapper.s.sol 13ms (unchanged)
178
+ script/DeployDevFactory.s.sol 3ms (unchanged)
179
+ script/DeployPostDeploymentHooks.s.sol 2ms (unchanged)
180
+ script/DeployUpgradeGate.s.sol 3ms (unchanged)
181
+ script/GenerateDeterministicParams.s.sol 12ms (unchanged)
182
+ script/PrintRegisterUpgradePath.s.sol 9ms (unchanged)
186
183
  script/PrintUpgradeCommand.s.sol 2ms (unchanged)
187
- script/Simulate.s.sol 16ms (unchanged)
188
- script/TestBackingCoinSwap.s.sol 34ms (unchanged)
189
- script/TestV4Swap.s.sol 33ms (unchanged)
190
- script/UpgradeCoinImpl.sol 6ms (unchanged)
191
- script/UpgradeFactoryImpl.s.sol 6ms (unchanged)
192
- script/UpgradeHooks.s.sol 4ms (unchanged)
184
+ script/TestBackingCoinSwap.s.sol 31ms (unchanged)
185
+ script/TestV4Swap.s.sol 30ms (unchanged)
186
+ script/UpgradeCoinImpl.sol 5ms (unchanged)
187
+ script/UpgradeFactoryImpl.s.sol 5ms (unchanged)
188
+ script/UpgradeHooks.s.sol 6ms (unchanged)
193
189
  CLI Building entry: package/index.ts
194
190
  CLI Using tsconfig: tsconfig.json
195
191
  CLI tsup v8.4.0
@@ -198,9 +194,9 @@ script/UpgradeHooks.s.sol 4ms (unchanged)
198
194
  CLI Cleaning output folder
199
195
  CJS Build start
200
196
  ESM Build start
201
- CJS dist/index.cjs 131.00 KB
202
- CJS dist/index.cjs.map 232.35 KB
203
- CJS ⚡️ Build success in 42ms
204
- ESM dist/index.js 129.58 KB
205
- ESM dist/index.js.map 232.20 KB
206
- ESM ⚡️ Build success in 42ms
197
+ ESM dist/index.js 128.58 KB
198
+ ESM dist/index.js.map 229.86 KB
199
+ ESM ⚡️ Build success in 44ms
200
+ CJS dist/index.cjs 130.00 KB
201
+ CJS dist/index.cjs.map 230.01 KB
202
+ CJS ⚡️ Build success in 44ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @zoralabs/coins
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - dac72691: Remove Uniswap V3 support and refactor coin architecture
8
+
9
+ **Removal of V3 Support:**
10
+
11
+ - Removed support for creating coins based on Uniswap V3 - only V4 coins are supported
12
+ - Default coin deployment now creates Uniswap V4 coins when no config is provided (previously created V3)
13
+ - Removed V3-specific test files and utilities
14
+ - Updated remaining tests to use V4 deployment methods
15
+ - Removed V3 configuration functions and encoders
16
+ - Added revert logic for V3 deployment attempts in factory deploy functions
17
+
18
+ **Architecture Refactoring:**
19
+
20
+ - Merged BaseCoinV4 functionality into BaseCoin.sol to consolidate Uniswap V4 integration
21
+ - Combined ICoinV4 interface with ICoin interface to simplify the interface hierarchy
22
+ - Updated ContentCoin and CreatorCoin to inherit directly from BaseCoin
23
+ - Removed duplicate files: BaseCoinV4.sol and ICoinV4.sol
24
+ - Updated all imports and references throughout the codebase
25
+ - This is an internal refactoring that doesn't change external functionality
26
+
27
+ ### Patch Changes
28
+
29
+ - deb9175b: Enforce 32 bytes for decoding trade referral address from hook data
30
+
3
31
  ## 2.0.0
4
32
 
5
33
  ### Major Changes
package/README.md CHANGED
@@ -2,131 +2,52 @@
2
2
 
3
3
  A protocol for creating and trading creator and content coins with automatic rewards distribution on top of Uniswap V4 hooks.
4
4
 
5
- ## Architecture Overview
5
+ ## 📖 Documentation
6
6
 
7
- The Coins protocol consists of several key contracts that work together to enable coin creation, trading, and customization:
7
+ For comprehensive documentation including architecture details, contract specifications, and usage guides, visit:
8
8
 
9
- ### Core Contracts
9
+ **[Coins Documentation](https://docs.zora.co/docs/coins)**
10
10
 
11
- #### BaseCoin
11
+ ## Quick Start
12
12
 
13
- The abstract base contract that provides core ERC20 functionality with additional features:
13
+ This package contains the core smart contracts for the Zora Coins protocol. For end-user guides and detailed explanations, see the documentation link above.
14
14
 
15
- - **ERC20 with Permit**: Standard token functionality with gasless approvals
16
- - **Multi-ownership**: Support for multiple owners
17
- - **Reward Distribution**: Distributes rewards on swaps
18
- - **Comment System**: Support for on-chain comments via `ICoinComments`
15
+ ### Development Setup
19
16
 
20
- #### BaseCoinV4
17
+ 1. **Install dependencies**:
21
18
 
22
- Abstract base contract that provides shared Uniswap V4 functionality:
19
+ ```bash
20
+ pnpm install
21
+ ```
23
22
 
24
- - **V4 Pool Manager**: Direct integration with Uniswap V4's singleton pool manager
25
- - **Pool Configuration**: Flexible pool setup with custom parameters
26
- - **Hook System**: Customizable hooks for advanced trading logic
27
- - **Swap Path Management**: Support for multi-hop swaps through `IHasSwapPath`
28
- - **Liquidity Migration**: Ability to migrate liquidity between hook implementations
23
+ 2. **Environment setup**:
29
24
 
30
- #### ContentCoin
25
+ ```bash
26
+ cp .env.example .env
27
+ # Edit .env with your configuration
28
+ ```
31
29
 
32
- Content coin implementation that inherits from `BaseCoinV4`:
30
+ 3. **Build contracts**:
33
31
 
34
- - **Creator Coin Backing**: Always uses the creator's CreatorCoin as the backing currency
35
- - **Supply**: 1 billion total supply (990M for liquidity pool, 10M creator reward)
36
- - **Multiple per Creator**: Each creator can have multiple content coins
32
+ ```bash
33
+ forge build
34
+ ```
37
35
 
38
- #### CreatorCoin
36
+ 4. **Run tests**:
37
+ ```bash
38
+ forge test -vvv
39
+ ```
39
40
 
40
- Specialized coin implementation for creators (one per creator) that inherits from `BaseCoinV4`:
41
+ ### Testing
41
42
 
42
- - **Vesting Schedule**: Built-in token vesting for creator rewards (5-year vesting)
43
- - **Fixed Currency**: Always uses ZORA token as backing currency
44
- - **Address**: `0x1111111111166b7FE7bd91427724B487980aFc69`
45
- - **Network**: Base mainnet only (protocol is deployed exclusively on Base)
46
- - **Supply**: 1 billion total supply (500M for market, 500M for creator vesting)
47
- - **Single per Creator**: Each creator has exactly one CreatorCoin that backs their content coins
43
+ For individual packages:
48
44
 
49
- #### Coin (V3 Implementation - Legacy)
45
+ - `forge test -vvv` - Run Solidity tests with verbose output
46
+ - `forge test --watch -vvv` - Run tests in watch mode
47
+ - `forge test -vvv --match-test {test_name}` - Run specific test
48
+ - `pnpm test` - Run JavaScript/TypeScript tests
50
49
 
51
- The V3 implementation of coins using Uniswap V3 integration, predating the V4 architecture:
52
-
53
- - **Uniswap V3 Integration**: Uses Uniswap V3 factory and swap router for trading
54
- - **Concentrated Liquidity**: Manages multiple liquidity positions with custom ranges
55
- - **Currency Flexibility**: Supports any ERC20 token as backing currency (not restricted to ZORA)
56
- - **Position Management**: Maintains array of `LpPosition` structs for liquidity tracking
57
- - **Market Rewards**: Distributes rewards from liquidity position fees
58
- - **V3 vs V4 Differences**:
59
- - V3 uses traditional swap router patterns vs V4's singleton pool manager
60
- - V3 requires separate pool deployment vs V4's integrated pool creation
61
- - V3 has manual liquidity position management vs V4's hook-based automation
62
- - **Migration Path**: Existing V3 coins continue to operate but new deployments use V4
63
-
64
- #### ZoraFactory (Proxy Contract)
65
-
66
- The proxy contract that delegates to ZoraFactoryImpl using the ERC1967 proxy pattern:
67
-
68
- - **ERC1967 Proxy**: Standard upgradeable proxy implementation from OpenZeppelin
69
- - **Immutable Name**: Distinguished by immutable name field (`keccak256("ZoraFactory")`) for verification
70
- - **Delegation Pattern**: All function calls are delegated to the implementation contract
71
- - **Upgrade Safety**: Supports safe upgrades through the UUPS pattern in the implementation
72
- - **Cross-Chain Consistency**: Deterministic deployment ensures same address across chains
73
- - **Critical Initialization**: Must be initialized in the same transaction as deployment
74
- - Proxy deployment and initialization are separate steps for address mining
75
- - Failure to initialize leaves the factory in an unusable state
76
- - **Verification**: Unique bytecode allows proper contract verification on block explorers
77
-
78
- #### ZoraFactoryImpl
79
-
80
- The main factory contract for deploying coins:
81
-
82
- - **Deterministic Deployment**: Uses CREATE2 for predictable addresses when deploying coins
83
- - **Version Management**: Supports multiple coin implementations
84
- - **Hook Integration**: Automated hook deployment and configuration
85
- - **Upgrade Support**: UUPS upgradeable pattern for factory improvements and bug fixes
86
-
87
- #### HookUpgradeGate
88
-
89
- Manages safe upgrade paths for V4 coin hooks with strict security controls:
90
-
91
- - **Upgrade Path Registry**: Maintains `mapping(address => mapping(address => bool))` of allowed upgrades
92
- - **Multi-Path Registration**: Single upgrade can be registered for multiple base implementations
93
- - **Owner Control**: Uses Ownable2Step for secure ownership transfers with two-step process
94
- - **Security Features**:
95
- - Only owner can register or remove upgrade paths
96
- - Prevents unauthorized hook upgrades that could compromise coins
97
- - Whitelist approach ensures only vetted upgrades are allowed
98
- - **Upgrade Process**:
99
- 1. Owner registers upgrade path via `registerUpgradePath()`
100
- 2. Coin creators can then upgrade their hooks using registered paths
101
- 3. Upgrades can be revoked by owner via `removeUpgradePath()`
102
- - **Event Logging**: Emits `UpgradeRegistered` and `UpgradeRemoved` events for transparency
103
- - **Use Cases**: Enables safe migration of coins to new hook implementations without breaking existing functionality
104
-
105
- ### Hook System
106
-
107
- The protocol supports various hooks for customizing coin behavior:
108
-
109
- #### BaseZoraV4CoinHook
110
-
111
- Immutable base hook contract providing behavior that happens after swaps:
112
-
113
- - **Deployment Hooks**: Integrates with coin deployment process for initialization
114
- - **Trading Hooks**: Hooks into swap events for custom logic execution
115
- - **Reward Distribution**: Manages reward distribution during trading activities
116
- - **State Management**: Maintains hook-specific state across transactions
117
- - **Content Validation**: Ensures proper coin -> liquidity association
118
- - **Liquidity Migration**: Supports controlled liquidity migration by the creator to a new hook.
119
-
120
- ## Supply Distribution Summary
121
-
122
- | Coin Type | Total Supply | Liquidity Pool | Creator Allocation | Vesting Period |
123
- | --------------- | ------------- | -------------- | ------------------ | -------------- |
124
- | **ContentCoin** | 1,000,000,000 | 990,000,000 | 10,000,000 | None |
125
- | **CreatorCoin** | 1,000,000,000 | 500,000,000 | 500,000,000 | 5 years |
126
-
127
- _All amounts are in tokens with 18 decimals_
128
-
129
- ## Deployment
50
+ ### Deployment
130
51
 
131
52
  The `ZoraFactory` contract is deployed deterministically using a turnkey account. The deployment process uses a helper contract, [DeterministicDeployerAndCaller](../../packages/shared-contracts/src/deployment/DeterministicDeployerAndCaller.sol).
132
53