@zoralabs/coins 1.1.1 → 2.0.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 (61) hide show
  1. package/.turbo/turbo-build.log +97 -93
  2. package/CHANGELOG.md +28 -0
  3. package/LICENSE +90 -21
  4. package/README.md +126 -0
  5. package/abis/BaseCoinV4.json +1840 -0
  6. package/abis/BaseZoraV4CoinHook.json +6 -2
  7. package/abis/CoinUniV4Test.json +20 -0
  8. package/abis/ContentCoinHook.json +6 -2
  9. package/abis/CreatorCoinHook.json +6 -2
  10. package/abis/FactoryTest.json +7 -0
  11. package/abis/FeeEstimatorHook.json +6 -2
  12. package/abis/IZoraV4CoinHook.json +2 -2
  13. package/abis/Ownable2StepUpgradeable.json +138 -0
  14. package/abis/ZoraFactoryImpl.json +39 -0
  15. package/addresses/8453.json +5 -5
  16. package/dist/index.cjs +36 -3
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.js +35 -2
  19. package/dist/index.js.map +1 -1
  20. package/dist/wagmiGenerated.d.ts +32 -1
  21. package/dist/wagmiGenerated.d.ts.map +1 -1
  22. package/package/wagmiGenerated.ts +35 -2
  23. package/package.json +1 -1
  24. package/script/TestBackingCoinSwap.s.sol +1 -1
  25. package/script/TestV4Swap.s.sol +1 -1
  26. package/src/BaseCoin.sol +7 -2
  27. package/src/{CoinV4.sol → BaseCoinV4.sol} +15 -17
  28. package/src/Coin.sol +7 -1
  29. package/src/ContentCoin.sol +45 -0
  30. package/src/CreatorCoin.sol +14 -6
  31. package/src/ZoraFactoryImpl.sol +10 -4
  32. package/src/deployment/CoinsDeployerBase.sol +3 -3
  33. package/src/hooks/BaseZoraV4CoinHook.sol +10 -2
  34. package/src/hooks/ContentCoinHook.sol +7 -1
  35. package/src/hooks/CreatorCoinHook.sol +7 -1
  36. package/src/hooks/HookUpgradeGate.sol +7 -1
  37. package/src/interfaces/IZoraV4CoinHook.sol +1 -1
  38. package/src/libs/CoinCommon.sol +7 -1
  39. package/src/libs/CoinConfigurationVersions.sol +7 -1
  40. package/src/libs/CoinConstants.sol +7 -1
  41. package/src/libs/CoinDopplerMultiCurve.sol +7 -1
  42. package/src/libs/CoinRewards.sol +7 -1
  43. package/src/libs/CoinRewardsV4.sol +7 -1
  44. package/src/libs/CoinSetup.sol +7 -1
  45. package/src/libs/CreatorCoinConstants.sol +7 -1
  46. package/src/libs/CreatorCoinRewards.sol +7 -1
  47. package/src/libs/DopplerMath.sol +7 -1
  48. package/src/libs/HooksDeployment.sol +7 -1
  49. package/src/libs/PoolStateReader.sol +7 -1
  50. package/src/libs/UniV4SwapHelper.sol +7 -1
  51. package/src/libs/UniV4SwapToCurrency.sol +7 -1
  52. package/src/libs/V4Liquidity.sol +7 -1
  53. package/src/types/PoolConfiguration.sol +7 -1
  54. package/src/utils/AutoSwapper.sol +7 -1
  55. package/src/version/ContractVersionBase.sol +1 -1
  56. package/test/CoinUniV4.t.sol +61 -5
  57. package/test/Factory.t.sol +41 -0
  58. package/test/Upgrades.t.sol +8 -8
  59. package/test/utils/BaseTest.sol +23 -15
  60. package/wagmi.config.ts +1 -1
  61. /package/abis/{CoinV4.json → ContentCoin.json} +0 -0
@@ -1,18 +1,21 @@
1
1
 
2
- > @zoralabs/coins@1.1.1 build /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
2
+ > @zoralabs/coins@2.0.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@1.1.1 wagmi:generate /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
6
+ > @zoralabs/coins@2.0.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 244 files with Solc 0.8.28
10
- Solc 0.8.28 finished in 219.49s
9
+ Compiling 246 files with Solc 0.8.28
10
+ Solc 0.8.28 finished in 226.34s
11
11
  Compiler run successful with warnings:
12
+ Warning (3420): Source file does not specify required compiler version! Consider adding "pragma solidity ^0.8.28;"
13
+ --> src/BaseCoin.sol
14
+
12
15
  Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning.
13
16
  --> src/deployment/CoinsDeployerBase.sol:117:31:
14
17
  |
15
- 117 | function deployCoinV4Impl(address zoraV4CoinHook) internal returns (CoinV4) {
18
+ 117 | function deployCoinV4Impl(address zoraV4CoinHook) internal returns (ContentCoin) {
16
19
  | ^^^^^^^^^^^^^^^^^^^^^^
17
20
 
18
21
  Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning.
@@ -70,122 +73,123 @@ Warning (2072): Unused local variable.
70
73
  ✅ Updated ./package/wagmiGenerated.ts (10 replacements)
71
74
  ✨ All files processed successfully!
72
75
 
73
- > @zoralabs/coins@1.1.1 copy-abis /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
76
+ > @zoralabs/coins@2.0.0 copy-abis /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
74
77
  > pnpm exec bundle-abis
75
78
 
76
79
 
77
- > @zoralabs/coins@1.1.1 prettier:write /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
80
+ > @zoralabs/coins@2.0.0 prettier:write /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
78
81
  > prettier --write 'src/**/*.sol' 'test/**/*.sol' 'script/**/*.sol'
79
82
 
80
- src/BaseCoin.sol 323ms (unchanged)
81
- src/Coin.sol 140ms (unchanged)
82
- src/CoinV4.sol 117ms (unchanged)
83
- src/CreatorCoin.sol 50ms (unchanged)
84
- src/deployment/CoinsDeployerBase.sol 196ms (unchanged)
85
- src/hooks/BaseZoraV4CoinHook.sol 179ms (unchanged)
86
- src/hooks/ContentCoinHook.sol 7ms
87
- src/hooks/CreatorCoinHook.sol 5ms (unchanged)
88
- src/hooks/deployment/BaseCoinDeployHook.sol 13ms (unchanged)
89
- src/hooks/deployment/BuySupplyWithSwapRouterHook.sol 127ms (unchanged)
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)
90
94
  src/hooks/HookUpgradeGate.sol 23ms (unchanged)
91
- src/interfaces/IAirlock.sol 1ms (unchanged)
95
+ src/interfaces/IAirlock.sol 2ms (unchanged)
92
96
  src/interfaces/ICoin.sol 13ms (unchanged)
93
- src/interfaces/ICoinComments.sol 1ms (unchanged)
97
+ src/interfaces/ICoinComments.sol 2ms (unchanged)
94
98
  src/interfaces/ICoinDeployHook.sol 1ms (unchanged)
95
- src/interfaces/ICoinV3.sol 2ms (unchanged)
99
+ src/interfaces/ICoinV3.sol 3ms (unchanged)
96
100
  src/interfaces/ICoinV4.sol 2ms (unchanged)
97
101
  src/interfaces/ICreatorCoin.sol 1ms (unchanged)
98
- src/interfaces/ICreatorCoinHook.sol 2ms (unchanged)
99
- src/interfaces/IDeployedCoinVersionLookup.sol 3ms (unchanged)
100
- src/interfaces/IDopplerErrors.sol 1ms (unchanged)
102
+ src/interfaces/ICreatorCoinHook.sol 1ms (unchanged)
103
+ src/interfaces/IDeployedCoinVersionLookup.sol 1ms (unchanged)
104
+ src/interfaces/IDopplerErrors.sol 0ms (unchanged)
101
105
  src/interfaces/IERC7572.sol 1ms (unchanged)
102
106
  src/interfaces/IHasRewardsRecipients.sol 1ms (unchanged)
103
107
  src/interfaces/IHooksUpgradeGate.sol 2ms (unchanged)
104
108
  src/interfaces/IMsgSender.sol 1ms (unchanged)
105
- src/interfaces/INonfungiblePositionManager.sol 5ms (unchanged)
109
+ src/interfaces/INonfungiblePositionManager.sol 8ms (unchanged)
106
110
  src/interfaces/IPoolConfigEncoding.sol 2ms (unchanged)
107
- src/interfaces/IProtocolRewards.sol 7ms (unchanged)
108
- src/interfaces/ISwapPathRouter.sol 2ms (unchanged)
109
- src/interfaces/ISwapRouter.sol 1ms (unchanged)
110
- src/interfaces/IUniswapV3Factory.sol 3ms (unchanged)
111
- src/interfaces/IUniswapV3Pool.sol 4ms (unchanged)
112
- src/interfaces/IUniswapV3SwapCallback.sol 1ms (unchanged)
113
- src/interfaces/IUpgradeableV4Hook.sol 4ms (unchanged)
111
+ src/interfaces/IProtocolRewards.sol 3ms (unchanged)
112
+ src/interfaces/ISwapPathRouter.sol 1ms (unchanged)
113
+ src/interfaces/ISwapRouter.sol 0ms (unchanged)
114
+ src/interfaces/IUniswapV3Factory.sol 2ms (unchanged)
115
+ src/interfaces/IUniswapV3Pool.sol 3ms (unchanged)
116
+ src/interfaces/IUniswapV3SwapCallback.sol 2ms (unchanged)
117
+ src/interfaces/IUpgradeableV4Hook.sol 2ms (unchanged)
114
118
  src/interfaces/IWETH.sol 2ms (unchanged)
115
- src/interfaces/IZoraFactory.sol 7ms (unchanged)
116
- src/interfaces/IZoraV4CoinHook.sol 6ms (unchanged)
117
- src/libs/CoinCommon.sol 4ms (unchanged)
118
- src/libs/CoinConfigurationVersions.sol 61ms (unchanged)
119
- src/libs/CoinConstants.sol 4ms (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)
120
124
  src/libs/CoinDopplerMultiCurve.sol 106ms (unchanged)
121
- src/libs/CoinDopplerUniV3.sol 29ms (unchanged)
122
- src/libs/CoinRewards.sol 112ms (unchanged)
123
- src/libs/CoinRewardsV4.sol 98ms (unchanged)
124
- src/libs/CoinSetup.sol 19ms (unchanged)
125
- src/libs/CoinSetupV3.sol 17ms (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)
126
130
  src/libs/CreatorCoinConstants.sol 2ms (unchanged)
127
- src/libs/CreatorCoinRewards.sol 11ms (unchanged)
128
- src/libs/DopplerMath.sol 77ms (unchanged)
129
- src/libs/HooksDeployment.sol 94ms (unchanged)
130
- src/libs/MarketConstants.sol 1ms (unchanged)
131
- src/libs/PoolStateReader.sol 5ms (unchanged)
132
- src/libs/UniV3BuySell.sol 77ms (unchanged)
131
+ src/libs/CreatorCoinRewards.sol 10ms (unchanged)
132
+ src/libs/DopplerMath.sol 88ms (unchanged)
133
+ src/libs/HooksDeployment.sol 85ms (unchanged)
134
+ src/libs/MarketConstants.sol 2ms (unchanged)
135
+ src/libs/PoolStateReader.sol 7ms (unchanged)
136
+ src/libs/UniV3BuySell.sol 78ms (unchanged)
133
137
  src/libs/UniV3Errors.sol 1ms (unchanged)
134
138
  src/libs/UniV4SwapHelper.sol 24ms (unchanged)
135
- src/libs/UniV4SwapToCurrency.sol 50ms (unchanged)
136
- src/libs/V4Liquidity.sol 133ms (unchanged)
137
- src/proxy/ZoraFactory.sol 6ms (unchanged)
138
- src/types/LpPosition.sol 0ms (unchanged)
139
+ src/libs/UniV4SwapToCurrency.sol 52ms (unchanged)
140
+ src/libs/V4Liquidity.sol 136ms (unchanged)
141
+ src/proxy/ZoraFactory.sol 7ms (unchanged)
142
+ src/types/LpPosition.sol 1ms (unchanged)
139
143
  src/types/PoolConfiguration.sol 1ms (unchanged)
140
144
  src/types/PoolState.sol 1ms (unchanged)
141
- src/utils/AutoSwapper.sol 16ms (unchanged)
142
- src/utils/DeployedCoinVersionLookup.sol 7ms (unchanged)
143
- src/utils/MultiOwnable.sol 37ms (unchanged)
144
- src/utils/uniswap/BitMath.sol 10ms (unchanged)
145
- src/utils/uniswap/BytesLib.sol 11ms (unchanged)
146
- src/utils/uniswap/CustomRevert.sol 37ms (unchanged)
147
- src/utils/uniswap/FixedPoint96.sol 1ms (unchanged)
145
+ src/utils/AutoSwapper.sol 19ms (unchanged)
146
+ 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)
148
152
  src/utils/uniswap/FullMath.sol 21ms (unchanged)
149
- src/utils/uniswap/LiquidityAmounts.sol 46ms (unchanged)
150
- src/utils/uniswap/Path.sol 8ms (unchanged)
153
+ src/utils/uniswap/LiquidityAmounts.sol 41ms (unchanged)
154
+ src/utils/uniswap/Path.sol 5ms (unchanged)
151
155
  src/utils/uniswap/SafeCast.sol 11ms (unchanged)
152
- src/utils/uniswap/SqrtPriceMath.sol 58ms (unchanged)
153
- src/utils/uniswap/TickMath.sol 58ms (unchanged)
156
+ src/utils/uniswap/SqrtPriceMath.sol 63ms (unchanged)
157
+ src/utils/uniswap/TickMath.sol 59ms (unchanged)
154
158
  src/utils/uniswap/UnsafeMath.sol 2ms (unchanged)
155
159
  src/version/ContractVersionBase.sol 1ms (unchanged)
156
- src/ZoraFactoryImpl.sol 150ms (unchanged)
157
- test/AutoSwapper.t.sol 35ms (unchanged)
158
- test/Coin.t.sol 313ms (unchanged)
159
- test/CoinDopplerUniV3.t.sol 115ms (unchanged)
160
- test/CoinUniV4.t.sol 315ms (unchanged)
161
- test/CreatorCoin.t.sol 140ms (unchanged)
162
- test/DeploymentHooks.t.sol 126ms (unchanged)
163
- test/Factory.t.sol 162ms (unchanged)
164
- test/HooksDeployment.t.sol 26ms (unchanged)
165
- test/LiquidityMigration.t.sol 86ms (unchanged)
166
- test/mocks/MockERC20.sol 3ms (unchanged)
167
- test/MultiOwnable.t.sol 79ms (unchanged)
168
- test/Upgrades.t.sol 120ms (unchanged)
169
- test/utils/BaseTest.sol 167ms (unchanged)
170
- test/utils/ContractAddresses.sol 2ms (unchanged)
171
- test/utils/DeployedCoinVersionLookup.t.sol 40ms (unchanged)
172
- test/utils/FeeEstimatorHook.sol 24ms (unchanged)
173
- test/utils/ProtocolRewards.sol 287ms (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)
174
178
  test/utils/ProxyShim.sol 3ms (unchanged)
175
179
  script/Deploy.s.sol 3ms (unchanged)
176
- script/DeployAutoSwapper.s.sol 9ms (unchanged)
180
+ script/DeployAutoSwapper.s.sol 8ms (unchanged)
177
181
  script/DeployDevFactory.s.sol 4ms (unchanged)
178
- script/DeployPostDeploymentHooks.s.sol 3ms (unchanged)
182
+ script/DeployPostDeploymentHooks.s.sol 9ms (unchanged)
179
183
  script/DeployUpgradeGate.s.sol 5ms (unchanged)
180
- script/GenerateDeterministicParams.s.sol 14ms (unchanged)
181
- script/PrintRegisterUpgradePath.s.sol 10ms (unchanged)
184
+ script/GenerateDeterministicParams.s.sol 11ms (unchanged)
185
+ script/PrintRegisterUpgradePath.s.sol 18ms (unchanged)
182
186
  script/PrintUpgradeCommand.s.sol 2ms (unchanged)
183
- script/Simulate.s.sol 10ms (unchanged)
187
+ script/Simulate.s.sol 16ms (unchanged)
184
188
  script/TestBackingCoinSwap.s.sol 34ms (unchanged)
185
- script/TestV4Swap.s.sol 28ms (unchanged)
186
- script/UpgradeCoinImpl.sol 7ms (unchanged)
189
+ script/TestV4Swap.s.sol 33ms (unchanged)
190
+ script/UpgradeCoinImpl.sol 6ms (unchanged)
187
191
  script/UpgradeFactoryImpl.s.sol 6ms (unchanged)
188
- script/UpgradeHooks.s.sol 3ms (unchanged)
192
+ script/UpgradeHooks.s.sol 4ms (unchanged)
189
193
  CLI Building entry: package/index.ts
190
194
  CLI Using tsconfig: tsconfig.json
191
195
  CLI tsup v8.4.0
@@ -194,9 +198,9 @@ script/UpgradeHooks.s.sol 3ms (unchanged)
194
198
  CLI Cleaning output folder
195
199
  CJS Build start
196
200
  ESM Build start
197
- ESM dist/index.js 128.93 KB
198
- ESM dist/index.js.map 231.01 KB
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
199
206
  ESM ⚡️ Build success in 42ms
200
- CJS dist/index.cjs 130.34 KB
201
- CJS dist/index.cjs.map 231.16 KB
202
- CJS ⚡️ Build success in 43ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @zoralabs/coins
2
2
 
3
+ ## 2.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - acb9ff94: Move ZoraFactoryImpl to 2-step ownable with same storage slots
8
+
9
+ This change updates the factory contract to use Ownable2StepUpgradeable instead of OwnableUpgradeable. The change maintains storage slot compatibility while adding the two-step ownership transfer pattern for enhanced security.
10
+
11
+ Key changes:
12
+
13
+ - ZoraFactoryImpl now inherits from Ownable2StepUpgradeable
14
+ - Adds pendingOwner() function
15
+ - Requires acceptOwnership() call to complete ownership transfers
16
+ - Maintains storage slot compatibility for upgrades
17
+
18
+ ### Patch Changes
19
+
20
+ - 65d36dbb: Refactor coinv4 into basecoinv4 and content coin
21
+
22
+ This refactoring splits the coinv4 implementation into a base coin contract and content coin contract for better modularity and separation of concerns.
23
+
24
+ ## 1.1.2
25
+
26
+ ### Patch Changes
27
+
28
+ - 522a7c33: Update LICENSE for coins
29
+ - 5c561b01: Fixed bug where hooks could not receive taken eth for paying out rewards
30
+
3
31
  ## 1.1.1
4
32
 
5
33
  ### Patch Changes
package/LICENSE CHANGED
@@ -1,21 +1,90 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Zora Labs
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ License
2
+
3
+ All source code specified as: SPDX-Identifier: ZORA-DELAYED-OSL-v1
4
+ follows this license.
5
+
6
+ Other licenses are specified on a file by file basis
7
+
8
+ Definitions:
9
+ "Licensed Work" means the software, code, or content distributed under this License,
10
+ including any copies or derivative works thereof.
11
+
12
+ "Licensor" means Zora Labs, Inc., a Delaware corporation.
13
+
14
+ "Commercial Purpose" means any use that generates, or is intended to generate, revenue,
15
+ monetary value, or other commercial benefit, whether through fees, subscriptions, token
16
+ issuance, staking incentives, or other monetization mechanisms.
17
+
18
+ "Competitive Product" means a Product provided for Commercial Purposes, and provides
19
+ functionality substantially similar to or substitutable for, in whole or in part, the
20
+ Licensed Work, and that is made available to third parties directly or indirectly,
21
+ whether operated independently or as part of a broader offering.
22
+
23
+ "Product" means any software application, protocol, service, or system that (i) makes
24
+ the Licensed Work (or any derivative work thereof) available for third-party
25
+ interaction, directly or indirectly, including but not limited to through interfaces,
26
+ middleware, aggregators, composable integrations, or smart contract deployment; (ii)
27
+ uses the Licensed Work (or any derivative work thereof) in a production environment or
28
+ mainnet context; (iii) integrates or incorporates the Licensed Work as part of a
29
+ broader software or financial service offering; or (iv) is operated for a Commercial
30
+ Purpose, whether or not publicly accessible.
31
+
32
+ "Open Date" means the earlier of: (i) the third anniversary of the first public
33
+ distribution of the Licensed Work, and (ii) the date specified by the Licensor as the
34
+ official date the Licensed Work shall become available under the MIT License.
35
+
36
+ Terms:
37
+
38
+ The Licensor hereby grants you a non-exclusive, non-transferable, worldwide,
39
+ royalty-free license to (i) use, copy, modify, and create derivative works of the
40
+ Licensed Work; (ii) distribute the Licensed Work (or any derivative works thereof), in
41
+ each of (i) and (ii), solely for purposes other than (a) Commercial Purposes, or (b) as
42
+ a Competitive Product. You are not granted rights to, and you may not exploit, the
43
+ Licensed Work for Commercial Purposes or as a Competitive Product. For the avoidance of
44
+ doubt, deploying modified versions of the Licensed Work that preserve the core
45
+ functionality or interface of the Licensed Work shall be considered a derivative work
46
+ and subject to this License. This License governs your use even if you receive the
47
+ Licensed Work from a third party, whether in its original form or in a derivative or
48
+ modified form.
49
+
50
+ You must retain, in all copies and substantial portions of the Licensed Work and in all
51
+ derivative works, (i) all copyright notices, author credits, and licensing notices
52
+ included by the Licensor, and (ii) a notice stating, "This software includes original
53
+ work licensed under the Delayed Open Source License by Zora Labs, Inc."
54
+
55
+ Your rights under this License terminate immediately for all versions of the Licensed
56
+ Work if you violate its terms.
57
+
58
+ THE LICENSED WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
59
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR
60
+ A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
61
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
62
+ CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE LICENSED
63
+ WORK OR THE USE OR OTHER DEALINGS IN THE LICENSED WORK.
64
+
65
+ Effective on the Open Date, the Licensed Work becomes available under the MIT License
66
+ (attached hereto as Appendix A).
67
+
68
+ Contact:
69
+
70
+ To request written consent for unlicensed uses, please contact: support@zora.co
71
+
72
+ Appendix A – MIT License
73
+
74
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this
75
+ software and associated documentation files (the "Software"), to deal in the Software
76
+ without restriction, including without limitation the rights to use, copy, modify,
77
+ merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
78
+ permit persons to whom the Software is furnished to do so, subject to the following
79
+ conditions:
80
+
81
+ The above copyright notice and this permission notice shall be included in all copies
82
+ or substantial portions of the Software.
83
+
84
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
85
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
86
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
87
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
88
+ CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
89
+ OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
90
+
package/README.md CHANGED
@@ -1,5 +1,131 @@
1
1
  # Coins
2
2
 
3
+ A protocol for creating and trading creator and content coins with automatic rewards distribution on top of Uniswap V4 hooks.
4
+
5
+ ## Architecture Overview
6
+
7
+ The Coins protocol consists of several key contracts that work together to enable coin creation, trading, and customization:
8
+
9
+ ### Core Contracts
10
+
11
+ #### BaseCoin
12
+
13
+ The abstract base contract that provides core ERC20 functionality with additional features:
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`
19
+
20
+ #### BaseCoinV4
21
+
22
+ Abstract base contract that provides shared Uniswap V4 functionality:
23
+
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
29
+
30
+ #### ContentCoin
31
+
32
+ Content coin implementation that inherits from `BaseCoinV4`:
33
+
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
37
+
38
+ #### CreatorCoin
39
+
40
+ Specialized coin implementation for creators (one per creator) that inherits from `BaseCoinV4`:
41
+
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
48
+
49
+ #### Coin (V3 Implementation - Legacy)
50
+
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
+
3
129
  ## Deployment
4
130
 
5
131
  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).