@zoralabs/coins 1.1.2 → 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.
- package/.turbo/turbo-build.log +96 -95
- package/CHANGELOG.md +22 -0
- package/README.md +126 -0
- package/abis/BaseCoinV4.json +1840 -0
- package/abis/BaseZoraV4CoinHook.json +6 -2
- package/abis/CoinUniV4Test.json +20 -0
- package/abis/ContentCoinHook.json +6 -2
- package/abis/CreatorCoinHook.json +6 -2
- package/abis/FactoryTest.json +7 -0
- package/abis/FeeEstimatorHook.json +6 -2
- package/abis/IZoraV4CoinHook.json +2 -2
- package/abis/Ownable2StepUpgradeable.json +138 -0
- package/abis/ZoraFactoryImpl.json +39 -0
- package/addresses/8453.json +5 -5
- package/dist/index.cjs +36 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +35 -2
- package/dist/index.js.map +1 -1
- package/dist/wagmiGenerated.d.ts +32 -1
- package/dist/wagmiGenerated.d.ts.map +1 -1
- package/package/wagmiGenerated.ts +35 -2
- package/package.json +1 -1
- package/script/TestBackingCoinSwap.s.sol +1 -1
- package/script/TestV4Swap.s.sol +1 -1
- package/src/{CoinV4.sol → BaseCoinV4.sol} +8 -16
- package/src/ContentCoin.sol +45 -0
- package/src/CreatorCoin.sol +7 -5
- package/src/ZoraFactoryImpl.sol +3 -3
- package/src/deployment/CoinsDeployerBase.sol +3 -3
- package/src/hooks/BaseZoraV4CoinHook.sol +3 -1
- package/src/interfaces/IZoraV4CoinHook.sol +1 -1
- package/src/version/ContractVersionBase.sol +1 -1
- package/test/CoinUniV4.t.sol +61 -5
- package/test/Factory.t.sol +41 -0
- package/test/Upgrades.t.sol +8 -8
- package/test/utils/BaseTest.sol +23 -15
- package/wagmi.config.ts +1 -1
- /package/abis/{CoinV4.json → ContentCoin.json} +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
> @zoralabs/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@
|
|
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
|
|
10
|
-
Solc 0.8.28 finished in
|
|
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
12
|
Warning (3420): Source file does not specify required compiler version! Consider adding "pragma solidity ^0.8.28;"
|
|
13
13
|
--> src/BaseCoin.sol
|
|
@@ -15,7 +15,7 @@ Warning (3420): Source file does not specify required compiler version! Consider
|
|
|
15
15
|
Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning.
|
|
16
16
|
--> src/deployment/CoinsDeployerBase.sol:117:31:
|
|
17
17
|
|
|
|
18
|
-
117 | function deployCoinV4Impl(address zoraV4CoinHook) internal returns (
|
|
18
|
+
117 | function deployCoinV4Impl(address zoraV4CoinHook) internal returns (ContentCoin) {
|
|
19
19
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
20
20
|
|
|
21
21
|
Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning.
|
|
@@ -73,121 +73,122 @@ Warning (2072): Unused local variable.
|
|
|
73
73
|
✅ Updated ./package/wagmiGenerated.ts (10 replacements)
|
|
74
74
|
✨ All files processed successfully!
|
|
75
75
|
|
|
76
|
-
> @zoralabs/coins@
|
|
76
|
+
> @zoralabs/coins@2.0.0 copy-abis /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
|
|
77
77
|
> pnpm exec bundle-abis
|
|
78
78
|
|
|
79
79
|
|
|
80
|
-
> @zoralabs/coins@
|
|
80
|
+
> @zoralabs/coins@2.0.0 prettier:write /home/runner/work/zora-protocol-private/zora-protocol-private/packages/coins
|
|
81
81
|
> prettier --write 'src/**/*.sol' 'test/**/*.sol' 'script/**/*.sol'
|
|
82
82
|
|
|
83
|
-
src/BaseCoin.sol
|
|
84
|
-
src/
|
|
85
|
-
src/
|
|
86
|
-
src/
|
|
87
|
-
src/
|
|
88
|
-
src/
|
|
89
|
-
src/hooks/
|
|
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)
|
|
90
91
|
src/hooks/CreatorCoinHook.sol 6ms (unchanged)
|
|
91
|
-
src/hooks/deployment/BaseCoinDeployHook.sol
|
|
92
|
-
src/hooks/deployment/BuySupplyWithSwapRouterHook.sol
|
|
92
|
+
src/hooks/deployment/BaseCoinDeployHook.sol 11ms (unchanged)
|
|
93
|
+
src/hooks/deployment/BuySupplyWithSwapRouterHook.sol 130ms (unchanged)
|
|
93
94
|
src/hooks/HookUpgradeGate.sol 23ms (unchanged)
|
|
94
|
-
src/interfaces/IAirlock.sol
|
|
95
|
-
src/interfaces/ICoin.sol
|
|
96
|
-
src/interfaces/ICoinComments.sol
|
|
97
|
-
src/interfaces/ICoinDeployHook.sol
|
|
98
|
-
src/interfaces/ICoinV3.sol
|
|
99
|
-
src/interfaces/ICoinV4.sol
|
|
100
|
-
src/interfaces/ICreatorCoin.sol
|
|
95
|
+
src/interfaces/IAirlock.sol 2ms (unchanged)
|
|
96
|
+
src/interfaces/ICoin.sol 13ms (unchanged)
|
|
97
|
+
src/interfaces/ICoinComments.sol 2ms (unchanged)
|
|
98
|
+
src/interfaces/ICoinDeployHook.sol 1ms (unchanged)
|
|
99
|
+
src/interfaces/ICoinV3.sol 3ms (unchanged)
|
|
100
|
+
src/interfaces/ICoinV4.sol 2ms (unchanged)
|
|
101
|
+
src/interfaces/ICreatorCoin.sol 1ms (unchanged)
|
|
101
102
|
src/interfaces/ICreatorCoinHook.sol 1ms (unchanged)
|
|
102
103
|
src/interfaces/IDeployedCoinVersionLookup.sol 1ms (unchanged)
|
|
103
|
-
src/interfaces/IDopplerErrors.sol
|
|
104
|
+
src/interfaces/IDopplerErrors.sol 0ms (unchanged)
|
|
104
105
|
src/interfaces/IERC7572.sol 1ms (unchanged)
|
|
105
106
|
src/interfaces/IHasRewardsRecipients.sol 1ms (unchanged)
|
|
106
107
|
src/interfaces/IHooksUpgradeGate.sol 2ms (unchanged)
|
|
107
|
-
src/interfaces/IMsgSender.sol
|
|
108
|
-
src/interfaces/INonfungiblePositionManager.sol
|
|
108
|
+
src/interfaces/IMsgSender.sol 1ms (unchanged)
|
|
109
|
+
src/interfaces/INonfungiblePositionManager.sol 8ms (unchanged)
|
|
109
110
|
src/interfaces/IPoolConfigEncoding.sol 2ms (unchanged)
|
|
110
|
-
src/interfaces/IProtocolRewards.sol
|
|
111
|
-
src/interfaces/ISwapPathRouter.sol
|
|
111
|
+
src/interfaces/IProtocolRewards.sol 3ms (unchanged)
|
|
112
|
+
src/interfaces/ISwapPathRouter.sol 1ms (unchanged)
|
|
112
113
|
src/interfaces/ISwapRouter.sol 0ms (unchanged)
|
|
113
|
-
src/interfaces/IUniswapV3Factory.sol
|
|
114
|
-
src/interfaces/IUniswapV3Pool.sol
|
|
114
|
+
src/interfaces/IUniswapV3Factory.sol 2ms (unchanged)
|
|
115
|
+
src/interfaces/IUniswapV3Pool.sol 3ms (unchanged)
|
|
115
116
|
src/interfaces/IUniswapV3SwapCallback.sol 2ms (unchanged)
|
|
116
117
|
src/interfaces/IUpgradeableV4Hook.sol 2ms (unchanged)
|
|
117
118
|
src/interfaces/IWETH.sol 2ms (unchanged)
|
|
118
|
-
src/interfaces/IZoraFactory.sol
|
|
119
|
-
src/interfaces/IZoraV4CoinHook.sol
|
|
120
|
-
src/libs/CoinCommon.sol
|
|
121
|
-
src/libs/CoinConfigurationVersions.sol
|
|
122
|
-
src/libs/CoinConstants.sol
|
|
123
|
-
src/libs/CoinDopplerMultiCurve.sol
|
|
124
|
-
src/libs/CoinDopplerUniV3.sol
|
|
125
|
-
src/libs/CoinRewards.sol
|
|
126
|
-
src/libs/CoinRewardsV4.sol
|
|
127
|
-
src/libs/CoinSetup.sol
|
|
128
|
-
src/libs/CoinSetupV3.sol
|
|
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)
|
|
129
130
|
src/libs/CreatorCoinConstants.sol 2ms (unchanged)
|
|
130
|
-
src/libs/CreatorCoinRewards.sol
|
|
131
|
-
src/libs/DopplerMath.sol
|
|
132
|
-
src/libs/HooksDeployment.sol
|
|
133
|
-
src/libs/MarketConstants.sol
|
|
134
|
-
src/libs/PoolStateReader.sol
|
|
135
|
-
src/libs/UniV3BuySell.sol
|
|
136
|
-
src/libs/UniV3Errors.sol
|
|
137
|
-
src/libs/UniV4SwapHelper.sol
|
|
138
|
-
src/libs/UniV4SwapToCurrency.sol
|
|
139
|
-
src/libs/V4Liquidity.sol
|
|
140
|
-
src/proxy/ZoraFactory.sol
|
|
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)
|
|
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)
|
|
141
142
|
src/types/LpPosition.sol 1ms (unchanged)
|
|
142
143
|
src/types/PoolConfiguration.sol 1ms (unchanged)
|
|
143
|
-
src/types/PoolState.sol
|
|
144
|
-
src/utils/AutoSwapper.sol
|
|
145
|
-
src/utils/DeployedCoinVersionLookup.sol
|
|
146
|
-
src/utils/MultiOwnable.sol
|
|
147
|
-
src/utils/uniswap/BitMath.sol
|
|
148
|
-
src/utils/uniswap/BytesLib.sol
|
|
149
|
-
src/utils/uniswap/CustomRevert.sol
|
|
144
|
+
src/types/PoolState.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)
|
|
150
151
|
src/utils/uniswap/FixedPoint96.sol 2ms (unchanged)
|
|
151
152
|
src/utils/uniswap/FullMath.sol 21ms (unchanged)
|
|
152
|
-
src/utils/uniswap/LiquidityAmounts.sol
|
|
153
|
+
src/utils/uniswap/LiquidityAmounts.sol 41ms (unchanged)
|
|
153
154
|
src/utils/uniswap/Path.sol 5ms (unchanged)
|
|
154
155
|
src/utils/uniswap/SafeCast.sol 11ms (unchanged)
|
|
155
|
-
src/utils/uniswap/SqrtPriceMath.sol
|
|
156
|
-
src/utils/uniswap/TickMath.sol
|
|
156
|
+
src/utils/uniswap/SqrtPriceMath.sol 63ms (unchanged)
|
|
157
|
+
src/utils/uniswap/TickMath.sol 59ms (unchanged)
|
|
157
158
|
src/utils/uniswap/UnsafeMath.sol 2ms (unchanged)
|
|
158
159
|
src/version/ContractVersionBase.sol 1ms (unchanged)
|
|
159
|
-
src/ZoraFactoryImpl.sol
|
|
160
|
+
src/ZoraFactoryImpl.sol 152ms (unchanged)
|
|
160
161
|
test/AutoSwapper.t.sol 36ms (unchanged)
|
|
161
|
-
test/Coin.t.sol
|
|
162
|
-
test/CoinDopplerUniV3.t.sol
|
|
163
|
-
test/CoinUniV4.t.sol
|
|
164
|
-
test/CreatorCoin.t.sol
|
|
165
|
-
test/DeploymentHooks.t.sol
|
|
166
|
-
test/Factory.t.sol
|
|
167
|
-
test/HooksDeployment.t.sol
|
|
168
|
-
test/LiquidityMigration.t.sol
|
|
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)
|
|
169
170
|
test/mocks/MockERC20.sol 4ms (unchanged)
|
|
170
|
-
test/MultiOwnable.t.sol
|
|
171
|
-
test/Upgrades.t.sol
|
|
172
|
-
test/utils/BaseTest.sol
|
|
173
|
-
test/utils/ContractAddresses.sol
|
|
174
|
-
test/utils/DeployedCoinVersionLookup.t.sol
|
|
175
|
-
test/utils/FeeEstimatorHook.sol
|
|
176
|
-
test/utils/ProtocolRewards.sol
|
|
177
|
-
test/utils/ProxyShim.sol
|
|
178
|
-
script/Deploy.s.sol
|
|
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)
|
|
179
|
+
script/Deploy.s.sol 3ms (unchanged)
|
|
179
180
|
script/DeployAutoSwapper.s.sol 8ms (unchanged)
|
|
180
|
-
script/DeployDevFactory.s.sol
|
|
181
|
-
script/DeployPostDeploymentHooks.s.sol
|
|
182
|
-
script/DeployUpgradeGate.s.sol
|
|
183
|
-
script/GenerateDeterministicParams.s.sol
|
|
184
|
-
script/PrintRegisterUpgradePath.s.sol
|
|
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)
|
|
185
186
|
script/PrintUpgradeCommand.s.sol 2ms (unchanged)
|
|
186
|
-
script/Simulate.s.sol
|
|
187
|
-
script/TestBackingCoinSwap.s.sol
|
|
188
|
-
script/TestV4Swap.s.sol
|
|
189
|
-
script/UpgradeCoinImpl.sol
|
|
190
|
-
script/UpgradeFactoryImpl.s.sol
|
|
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)
|
|
191
192
|
script/UpgradeHooks.s.sol 4ms (unchanged)
|
|
192
193
|
[34mCLI[39m Building entry: package/index.ts
|
|
193
194
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
@@ -197,9 +198,9 @@ script/UpgradeHooks.s.sol 4ms (unchanged)
|
|
|
197
198
|
[34mCLI[39m Cleaning output folder
|
|
198
199
|
[34mCJS[39m Build start
|
|
199
200
|
[34mESM[39m Build start
|
|
200
|
-
[32mCJS[39m [1mdist/index.cjs [22m[
|
|
201
|
-
[32mCJS[39m [1mdist/index.cjs.map [22m[
|
|
202
|
-
[32mCJS[39m ⚡️ Build success in
|
|
203
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
204
|
-
[32mESM[39m [1mdist/index.js.map [22m[
|
|
201
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m131.00 KB[39m
|
|
202
|
+
[32mCJS[39m [1mdist/index.cjs.map [22m[32m232.35 KB[39m
|
|
203
|
+
[32mCJS[39m ⚡️ Build success in 42ms
|
|
204
|
+
[32mESM[39m [1mdist/index.js [22m[32m129.58 KB[39m
|
|
205
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m232.20 KB[39m
|
|
205
206
|
[32mESM[39m ⚡️ Build success in 42ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,32 @@
|
|
|
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
|
+
|
|
3
24
|
## 1.1.2
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
6
27
|
|
|
7
28
|
- 522a7c33: Update LICENSE for coins
|
|
29
|
+
- 5c561b01: Fixed bug where hooks could not receive taken eth for paying out rewards
|
|
8
30
|
|
|
9
31
|
## 1.1.1
|
|
10
32
|
|
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).
|