@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.
- package/.turbo/turbo-build.log +97 -93
- package/CHANGELOG.md +28 -0
- package/LICENSE +90 -21
- 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/BaseCoin.sol +7 -2
- package/src/{CoinV4.sol → BaseCoinV4.sol} +15 -17
- package/src/Coin.sol +7 -1
- package/src/ContentCoin.sol +45 -0
- package/src/CreatorCoin.sol +14 -6
- package/src/ZoraFactoryImpl.sol +10 -4
- package/src/deployment/CoinsDeployerBase.sol +3 -3
- package/src/hooks/BaseZoraV4CoinHook.sol +10 -2
- package/src/hooks/ContentCoinHook.sol +7 -1
- package/src/hooks/CreatorCoinHook.sol +7 -1
- package/src/hooks/HookUpgradeGate.sol +7 -1
- package/src/interfaces/IZoraV4CoinHook.sol +1 -1
- package/src/libs/CoinCommon.sol +7 -1
- package/src/libs/CoinConfigurationVersions.sol +7 -1
- package/src/libs/CoinConstants.sol +7 -1
- package/src/libs/CoinDopplerMultiCurve.sol +7 -1
- package/src/libs/CoinRewards.sol +7 -1
- package/src/libs/CoinRewardsV4.sol +7 -1
- package/src/libs/CoinSetup.sol +7 -1
- package/src/libs/CreatorCoinConstants.sol +7 -1
- package/src/libs/CreatorCoinRewards.sol +7 -1
- package/src/libs/DopplerMath.sol +7 -1
- package/src/libs/HooksDeployment.sol +7 -1
- package/src/libs/PoolStateReader.sol +7 -1
- package/src/libs/UniV4SwapHelper.sol +7 -1
- package/src/libs/UniV4SwapToCurrency.sol +7 -1
- package/src/libs/V4Liquidity.sol +7 -1
- package/src/types/PoolConfiguration.sol +7 -1
- package/src/utils/AutoSwapper.sol +7 -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/src/libs/DopplerMath.sol
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: ZORA-DELAYED-OSL-v1
|
|
2
|
+
// This software is licensed under the Zora Delayed Open Source License.
|
|
3
|
+
// Under this license, you may use, copy, modify, and distribute this software for
|
|
4
|
+
// non-commercial purposes only. Commercial use and competitive products are prohibited
|
|
5
|
+
// until the "Open Date" (3 years from first public distribution or earlier at Zora's discretion),
|
|
6
|
+
// at which point this software automatically becomes available under the MIT License.
|
|
7
|
+
// Full license terms available at: https://docs.zora.co/coins/license
|
|
2
8
|
pragma solidity ^0.8.24;
|
|
3
9
|
|
|
4
10
|
import {IDopplerErrors} from "../interfaces/IDopplerErrors.sol";
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: ZORA-DELAYED-OSL-v1
|
|
2
|
+
// This software is licensed under the Zora Delayed Open Source License.
|
|
3
|
+
// Under this license, you may use, copy, modify, and distribute this software for
|
|
4
|
+
// non-commercial purposes only. Commercial use and competitive products are prohibited
|
|
5
|
+
// until the "Open Date" (3 years from first public distribution or earlier at Zora's discretion),
|
|
6
|
+
// at which point this software automatically becomes available under the MIT License.
|
|
7
|
+
// Full license terms available at: https://docs.zora.co/coins/license
|
|
2
8
|
pragma solidity ^0.8.23;
|
|
3
9
|
|
|
4
10
|
import {Hooks} from "@uniswap/v4-core/src/libraries/Hooks.sol";
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: ZORA-DELAYED-OSL-v1
|
|
2
|
+
// This software is licensed under the Zora Delayed Open Source License.
|
|
3
|
+
// Under this license, you may use, copy, modify, and distribute this software for
|
|
4
|
+
// non-commercial purposes only. Commercial use and competitive products are prohibited
|
|
5
|
+
// until the "Open Date" (3 years from first public distribution or earlier at Zora's discretion),
|
|
6
|
+
// at which point this software automatically becomes available under the MIT License.
|
|
7
|
+
// Full license terms available at: https://docs.zora.co/coins/license
|
|
2
8
|
pragma solidity ^0.8.23;
|
|
3
9
|
|
|
4
10
|
import {StateLibrary} from "@uniswap/v4-core/src/libraries/StateLibrary.sol";
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: ZORA-DELAYED-OSL-v1
|
|
2
|
+
// This software is licensed under the Zora Delayed Open Source License.
|
|
3
|
+
// Under this license, you may use, copy, modify, and distribute this software for
|
|
4
|
+
// non-commercial purposes only. Commercial use and competitive products are prohibited
|
|
5
|
+
// until the "Open Date" (3 years from first public distribution or earlier at Zora's discretion),
|
|
6
|
+
// at which point this software automatically becomes available under the MIT License.
|
|
7
|
+
// Full license terms available at: https://docs.zora.co/coins/license
|
|
2
8
|
pragma solidity ^0.8.23;
|
|
3
9
|
|
|
4
10
|
import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: ZORA-DELAYED-OSL-v1
|
|
2
|
+
// This software is licensed under the Zora Delayed Open Source License.
|
|
3
|
+
// Under this license, you may use, copy, modify, and distribute this software for
|
|
4
|
+
// non-commercial purposes only. Commercial use and competitive products are prohibited
|
|
5
|
+
// until the "Open Date" (3 years from first public distribution or earlier at Zora's discretion),
|
|
6
|
+
// at which point this software automatically becomes available under the MIT License.
|
|
7
|
+
// Full license terms available at: https://docs.zora.co/coins/license
|
|
2
8
|
pragma solidity ^0.8.23;
|
|
3
9
|
|
|
4
10
|
import {Currency} from "@uniswap/v4-core/src/types/Currency.sol";
|
package/src/libs/V4Liquidity.sol
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: ZORA-DELAYED-OSL-v1
|
|
2
|
+
// This software is licensed under the Zora Delayed Open Source License.
|
|
3
|
+
// Under this license, you may use, copy, modify, and distribute this software for
|
|
4
|
+
// non-commercial purposes only. Commercial use and competitive products are prohibited
|
|
5
|
+
// until the "Open Date" (3 years from first public distribution or earlier at Zora's discretion),
|
|
6
|
+
// at which point this software automatically becomes available under the MIT License.
|
|
7
|
+
// Full license terms available at: https://docs.zora.co/coins/license
|
|
2
8
|
pragma solidity ^0.8.23;
|
|
3
9
|
|
|
4
10
|
import {TickMath} from "@uniswap/v4-core/src/libraries/TickMath.sol";
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: ZORA-DELAYED-OSL-v1
|
|
2
|
+
// This software is licensed under the Zora Delayed Open Source License.
|
|
3
|
+
// Under this license, you may use, copy, modify, and distribute this software for
|
|
4
|
+
// non-commercial purposes only. Commercial use and competitive products are prohibited
|
|
5
|
+
// until the "Open Date" (3 years from first public distribution or earlier at Zora's discretion),
|
|
6
|
+
// at which point this software automatically becomes available under the MIT License.
|
|
7
|
+
// Full license terms available at: https://docs.zora.co/coins/license
|
|
2
8
|
pragma solidity ^0.8.23;
|
|
3
9
|
|
|
4
10
|
/// @notice The configuration of the pool
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: ZORA-DELAYED-OSL-v1
|
|
2
|
+
// This software is licensed under the Zora Delayed Open Source License.
|
|
3
|
+
// Under this license, you may use, copy, modify, and distribute this software for
|
|
4
|
+
// non-commercial purposes only. Commercial use and competitive products are prohibited
|
|
5
|
+
// until the "Open Date" (3 years from first public distribution or earlier at Zora's discretion),
|
|
6
|
+
// at which point this software automatically becomes available under the MIT License.
|
|
7
|
+
// Full license terms available at: https://docs.zora.co/coins/license
|
|
2
8
|
pragma solidity ^0.8.28;
|
|
3
9
|
|
|
4
10
|
import {ISwapRouter} from "@zoralabs/shared-contracts/interfaces/uniswap/ISwapRouter.sol";
|
|
@@ -9,6 +9,6 @@ import {IVersionedContract} from "@zoralabs/shared-contracts/interfaces/IVersion
|
|
|
9
9
|
contract ContractVersionBase is IVersionedContract {
|
|
10
10
|
/// @notice The version of the contract
|
|
11
11
|
function contractVersion() external pure override returns (string memory) {
|
|
12
|
-
return "
|
|
12
|
+
return "2.0.0";
|
|
13
13
|
}
|
|
14
14
|
}
|
package/test/CoinUniV4.t.sol
CHANGED
|
@@ -63,7 +63,7 @@ contract CoinUniV4Test is BaseTest {
|
|
|
63
63
|
uint256 deadline = block.timestamp + 20;
|
|
64
64
|
router.execute(commands, inputs, deadline);
|
|
65
65
|
|
|
66
|
-
feeState = FeeEstimatorHook(address(contentCoinHook)).getFeeState();
|
|
66
|
+
feeState = FeeEstimatorHook(payable(address(contentCoinHook))).getFeeState();
|
|
67
67
|
|
|
68
68
|
vm.revertToState(snapshot);
|
|
69
69
|
}
|
|
@@ -80,8 +80,8 @@ contract CoinUniV4Test is BaseTest {
|
|
|
80
80
|
uint256 deadline = block.timestamp + 20;
|
|
81
81
|
router.execute(commands, inputs, deadline);
|
|
82
82
|
|
|
83
|
-
delta = FeeEstimatorHook(address(contentCoinHook)).getFeeState().lastDelta;
|
|
84
|
-
swapParams = FeeEstimatorHook(address(contentCoinHook)).getFeeState().lastSwapParams;
|
|
83
|
+
delta = FeeEstimatorHook(payable(address(contentCoinHook))).getFeeState().lastDelta;
|
|
84
|
+
swapParams = FeeEstimatorHook(payable(address(contentCoinHook))).getFeeState().lastSwapParams;
|
|
85
85
|
|
|
86
86
|
sqrtPriceX96 = PoolStateReader.getSqrtPriceX96(coinV4.getPoolKey(), poolManager);
|
|
87
87
|
|
|
@@ -90,7 +90,7 @@ contract CoinUniV4Test is BaseTest {
|
|
|
90
90
|
|
|
91
91
|
function test_setupZeroAddressForPoolManager() public {
|
|
92
92
|
vm.expectRevert(ICoin.AddressZero.selector);
|
|
93
|
-
new
|
|
93
|
+
new ContentCoin({
|
|
94
94
|
protocolRewardRecipient_: address(0x1234),
|
|
95
95
|
protocolRewards_: address(0x1234),
|
|
96
96
|
poolManager_: IPoolManager(address(0)),
|
|
@@ -100,7 +100,7 @@ contract CoinUniV4Test is BaseTest {
|
|
|
100
100
|
|
|
101
101
|
// function test_setupZeroAddressForHooks() public {
|
|
102
102
|
// vm.expectRevert(ICoin.AddressZero.selector);
|
|
103
|
-
// new
|
|
103
|
+
// new ContentCoin({
|
|
104
104
|
// protocolRewardRecipient_: address(0x1234),
|
|
105
105
|
// protocolRewards_: address(0x1234),
|
|
106
106
|
// poolManager_: IPoolManager(address(0x1234)),
|
|
@@ -293,6 +293,62 @@ contract CoinUniV4Test is BaseTest {
|
|
|
293
293
|
assertApproxEqAbs(mockERC20A.balanceOf(coinV4.protocolRewardRecipient()), totalRewards.protocol, 10, "protocol reward currency");
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
+
function test_distributesMarketRewardsInEth() public {
|
|
297
|
+
uint64 amountIn = 0.1 ether;
|
|
298
|
+
|
|
299
|
+
// Use address(0) as currency to price the coin in ETH
|
|
300
|
+
address currency = address(0);
|
|
301
|
+
bytes32 salt = keccak256(abi.encodePacked("eth-rewards-test"));
|
|
302
|
+
_deployV4Coin(currency, address(0), salt);
|
|
303
|
+
|
|
304
|
+
address trader = makeAddr("trader");
|
|
305
|
+
|
|
306
|
+
// Give trader ETH
|
|
307
|
+
vm.deal(trader, amountIn);
|
|
308
|
+
|
|
309
|
+
// Record initial ETH balance of payout recipient
|
|
310
|
+
uint256 initialPayoutBalance = coinV4.payoutRecipient().balance;
|
|
311
|
+
|
|
312
|
+
// Swap ETH for coin
|
|
313
|
+
_swapSomeCurrencyForCoin(coinV4, currency, amountIn, trader);
|
|
314
|
+
|
|
315
|
+
// Verify that rewards were paid out in ETH
|
|
316
|
+
assertGt(coinV4.payoutRecipient().balance, initialPayoutBalance, "backing reward should be paid in ETH");
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function test_canSwapEthForCoin(uint128 amountIn) public {
|
|
320
|
+
vm.assume(amountIn > 0.00001 ether);
|
|
321
|
+
vm.assume(amountIn < 1 ether);
|
|
322
|
+
|
|
323
|
+
// Use address(0) as currency to price the coin in ETH
|
|
324
|
+
address currency = address(0);
|
|
325
|
+
bytes32 salt = keccak256(abi.encodePacked("eth-coin-test"));
|
|
326
|
+
_deployV4Coin(currency, address(0), salt);
|
|
327
|
+
|
|
328
|
+
address trader = makeAddr("trader");
|
|
329
|
+
|
|
330
|
+
// Give trader ETH
|
|
331
|
+
vm.deal(trader, amountIn);
|
|
332
|
+
|
|
333
|
+
uint256 initialEthBalance = trader.balance;
|
|
334
|
+
|
|
335
|
+
// Swap ETH for coin
|
|
336
|
+
_swapSomeCurrencyForCoin(coinV4, currency, amountIn, trader);
|
|
337
|
+
|
|
338
|
+
// Verify the swap worked
|
|
339
|
+
assertEq(trader.balance, initialEthBalance - amountIn, "trader should have spent ETH");
|
|
340
|
+
assertGt(coinV4.balanceOf(trader), 0, "trader should have received coin");
|
|
341
|
+
|
|
342
|
+
// Now swap some coin back for ETH
|
|
343
|
+
uint128 coinBalance = uint128(coinV4.balanceOf(trader));
|
|
344
|
+
|
|
345
|
+
_swapSomeCoinForCurrency(coinV4, currency, coinBalance, trader);
|
|
346
|
+
|
|
347
|
+
// Verify the reverse swap worked
|
|
348
|
+
assertEq(coinV4.balanceOf(trader), 0, "trader should have no coins left");
|
|
349
|
+
assertGt(trader.balance, 0, "trader should have received ETH back");
|
|
350
|
+
}
|
|
351
|
+
|
|
296
352
|
function test_swap_emitsCoinMarketRewardsV4(uint64 amountIn) public {
|
|
297
353
|
vm.assume(amountIn > 0.00001 ether);
|
|
298
354
|
address currency = address(mockERC20A);
|
package/test/Factory.t.sol
CHANGED
|
@@ -29,6 +29,47 @@ contract FactoryTest is BaseTest {
|
|
|
29
29
|
assertEq(ZoraFactoryImpl(address(factory)).owner(), initialOwner);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
function test_ownable2Step() public {
|
|
33
|
+
// old current impl
|
|
34
|
+
assertEq(ZoraFactoryImpl(address(factory)).owner(), users.factoryOwner);
|
|
35
|
+
|
|
36
|
+
// 1st ensure owner slot is set at expected address
|
|
37
|
+
|
|
38
|
+
bytes32 ownableSlot = hex"9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300";
|
|
39
|
+
bytes32 ownable2StepSlot = hex"237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00";
|
|
40
|
+
|
|
41
|
+
address ownerAddress = address(uint160(uint256(vm.load(address(factory), ownableSlot))));
|
|
42
|
+
assertEq(ownerAddress, users.factoryOwner);
|
|
43
|
+
|
|
44
|
+
assertEq(ZoraFactoryImpl(address(factory)).pendingOwner(), address(0));
|
|
45
|
+
|
|
46
|
+
address newFactoryImpl = address(
|
|
47
|
+
new ZoraFactoryImpl(address(coinV3Impl), address(coinV4Impl), address(creatorCoinImpl), address(contentCoinHook), address(creatorCoinHook))
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
// Upgrade to current / new impl
|
|
51
|
+
vm.prank(users.factoryOwner);
|
|
52
|
+
ZoraFactoryImpl(address(factory)).upgradeToAndCall(newFactoryImpl, "");
|
|
53
|
+
|
|
54
|
+
// 2nd ensure owner is read from correct slot
|
|
55
|
+
assertEq(ZoraFactoryImpl(address(factory)).owner(), users.factoryOwner);
|
|
56
|
+
|
|
57
|
+
address newOwner = makeAddr("newOwner");
|
|
58
|
+
|
|
59
|
+
// 3rd ensure pending owner is set correctly
|
|
60
|
+
vm.prank(users.factoryOwner);
|
|
61
|
+
ZoraFactoryImpl(address(factory)).transferOwnership(newOwner);
|
|
62
|
+
assertEq(ZoraFactoryImpl(address(factory)).pendingOwner(), newOwner);
|
|
63
|
+
|
|
64
|
+
address ownerAddress2Step = address(uint160(uint256(vm.load(address(factory), ownable2StepSlot))));
|
|
65
|
+
assertEq(ownerAddress2Step, newOwner);
|
|
66
|
+
|
|
67
|
+
// 4th ensure owner is set correctly
|
|
68
|
+
vm.prank(newOwner);
|
|
69
|
+
ZoraFactoryImpl(address(factory)).acceptOwnership();
|
|
70
|
+
assertEq(ZoraFactoryImpl(address(factory)).owner(), newOwner);
|
|
71
|
+
}
|
|
72
|
+
|
|
32
73
|
function test_deploy_no_eth() public {
|
|
33
74
|
address[] memory owners = new address[](1);
|
|
34
75
|
owners[0] = users.creator;
|
package/test/Upgrades.t.sol
CHANGED
|
@@ -21,7 +21,7 @@ import {HooksDeployment} from "../src/libs/HooksDeployment.sol";
|
|
|
21
21
|
import {IHooks} from "@uniswap/v4-core/src/interfaces/IHooks.sol";
|
|
22
22
|
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
|
|
23
23
|
import {MultiOwnable} from "../src/utils/MultiOwnable.sol";
|
|
24
|
-
import {
|
|
24
|
+
import {ContentCoin} from "../src/ContentCoin.sol";
|
|
25
25
|
import {UniV4SwapHelper} from "../src/libs/UniV4SwapHelper.sol";
|
|
26
26
|
import {StateLibrary} from "@uniswap/v4-core/src/libraries/StateLibrary.sol";
|
|
27
27
|
import {IZoraV4CoinHook} from "../src/interfaces/IZoraV4CoinHook.sol";
|
|
@@ -225,22 +225,22 @@ contract UpgradesTest is BaseTest, CoinsDeployerBase {
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
function test_canUpgradeBrokenContentCoinAndSwap() public {
|
|
228
|
-
vm.createSelectFork("base",
|
|
228
|
+
vm.createSelectFork("base", 32613149);
|
|
229
229
|
|
|
230
230
|
address trader = 0xf69fEc6d858c77e969509843852178bd24CAd2B6;
|
|
231
231
|
|
|
232
|
-
address contentCoin =
|
|
232
|
+
address contentCoin = 0xB9799C839818bF50240CE683363D00c43a2E23b8;
|
|
233
233
|
|
|
234
234
|
address creatorCoin = ICoinV4(contentCoin).currency();
|
|
235
235
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
uint256 amountIn = IERC20(creatorCoin).balanceOf(trader);
|
|
236
|
+
uint256 amountIn = 0.000111 ether;
|
|
239
237
|
|
|
240
238
|
bytes memory creationCode = HooksDeployment.contentCoinCreationCode(address(poolManager), coinVersionLookup, new address[](0), upgradeGate);
|
|
241
239
|
|
|
242
240
|
(IHooks newHook, ) = HooksDeployment.deployHookWithExistingOrNewSalt(address(this), creationCode, bytes32(0));
|
|
243
241
|
|
|
242
|
+
address existingHook = address(ICoinV4(contentCoin).hooks());
|
|
243
|
+
|
|
244
244
|
address[] memory baseImpls = new address[](1);
|
|
245
245
|
baseImpls[0] = existingHook;
|
|
246
246
|
|
|
@@ -248,7 +248,7 @@ contract UpgradesTest is BaseTest, CoinsDeployerBase {
|
|
|
248
248
|
IHooksUpgradeGate(upgradeGate).registerUpgradePath(baseImpls, address(newHook));
|
|
249
249
|
|
|
250
250
|
vm.prank(MultiOwnable(contentCoin).owners()[0]);
|
|
251
|
-
|
|
251
|
+
ContentCoin(contentCoin).migrateLiquidity(address(newHook), "");
|
|
252
252
|
|
|
253
253
|
// do some swaps to test out
|
|
254
254
|
_swapSomeCurrencyForCoin(ICoinV4(contentCoin), creatorCoin, uint128(amountIn), trader);
|
|
@@ -305,7 +305,7 @@ contract UpgradesTest is BaseTest, CoinsDeployerBase {
|
|
|
305
305
|
uint160 beforePrice = PoolStateReader.getSqrtPriceX96(creatorCoin.getPoolKey(), poolManager);
|
|
306
306
|
|
|
307
307
|
vm.prank(MultiOwnable(address(creatorCoin)).owners()[0]);
|
|
308
|
-
|
|
308
|
+
ContentCoin(address(creatorCoin)).migrateLiquidity(address(newHook), "");
|
|
309
309
|
|
|
310
310
|
// get liquidity of original positions after migration
|
|
311
311
|
uint128[] memory liquidityOfPositionsAfterMigration = getLiquidityForPositions(beforeKey, beforePositions);
|
package/test/utils/BaseTest.sol
CHANGED
|
@@ -13,7 +13,7 @@ import {IZoraFactory} from "../../src/interfaces/IZoraFactory.sol";
|
|
|
13
13
|
import {ZoraFactoryImpl} from "../../src/ZoraFactoryImpl.sol";
|
|
14
14
|
import {ZoraFactory} from "../../src/proxy/ZoraFactory.sol";
|
|
15
15
|
import {Coin} from "../../src/Coin.sol";
|
|
16
|
-
import {
|
|
16
|
+
import {ContentCoin} from "../../src/ContentCoin.sol";
|
|
17
17
|
import {MultiOwnable} from "../../src/utils/MultiOwnable.sol";
|
|
18
18
|
import {ICoin} from "../../src/interfaces/ICoin.sol";
|
|
19
19
|
import {IERC7572} from "../../src/interfaces/IERC7572.sol";
|
|
@@ -75,14 +75,14 @@ contract BaseTest is Test, ContractAddresses {
|
|
|
75
75
|
IUniversalRouter internal router;
|
|
76
76
|
IPoolManager internal poolManager;
|
|
77
77
|
IV4Quoter internal quoter;
|
|
78
|
-
|
|
78
|
+
ContentCoin internal coinV4;
|
|
79
79
|
|
|
80
80
|
ISwapRouter internal swapRouter;
|
|
81
81
|
IAirlock internal airlock;
|
|
82
82
|
Users internal users;
|
|
83
83
|
|
|
84
84
|
Coin internal coinV3Impl;
|
|
85
|
-
|
|
85
|
+
ContentCoin internal coinV4Impl;
|
|
86
86
|
CreatorCoin internal creatorCoinImpl;
|
|
87
87
|
ZoraFactoryImpl internal factoryImpl;
|
|
88
88
|
IZoraFactory internal factory;
|
|
@@ -157,7 +157,7 @@ contract BaseTest is Test, ContractAddresses {
|
|
|
157
157
|
salt
|
|
158
158
|
);
|
|
159
159
|
|
|
160
|
-
coinV4 =
|
|
160
|
+
coinV4 = ContentCoin(payable(coinAddress));
|
|
161
161
|
return coinV4;
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -206,11 +206,15 @@ contract BaseTest is Test, ContractAddresses {
|
|
|
206
206
|
);
|
|
207
207
|
|
|
208
208
|
vm.startPrank(trader);
|
|
209
|
-
|
|
209
|
+
if (currency != address(0)) {
|
|
210
|
+
UniV4SwapHelper.approveTokenWithPermit2(permit2, address(router), currency, amountIn, uint48(block.timestamp + 1 days));
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
uint256 value = currency == address(0) ? amountIn : 0;
|
|
210
214
|
|
|
211
215
|
// Execute the swap
|
|
212
216
|
uint256 deadline = block.timestamp + 20;
|
|
213
|
-
router.execute(commands, inputs, deadline);
|
|
217
|
+
router.execute{value: value}(commands, inputs, deadline);
|
|
214
218
|
|
|
215
219
|
vm.stopPrank();
|
|
216
220
|
}
|
|
@@ -269,18 +273,22 @@ contract BaseTest is Test, ContractAddresses {
|
|
|
269
273
|
(bytes32 contentCoinSalt, bytes32 creatorCoinSalt) = getSalts(trustedMessageSenders);
|
|
270
274
|
|
|
271
275
|
contentCoinHook = ContentCoinHook(
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
HooksDeployment.
|
|
275
|
-
|
|
276
|
+
payable(
|
|
277
|
+
address(
|
|
278
|
+
HooksDeployment.deployHookWithSalt(
|
|
279
|
+
HooksDeployment.contentCoinCreationCode(V4_POOL_MANAGER, address(factory), trustedMessageSenders, address(hookUpgradeGate)),
|
|
280
|
+
contentCoinSalt
|
|
281
|
+
)
|
|
276
282
|
)
|
|
277
283
|
)
|
|
278
284
|
);
|
|
279
285
|
creatorCoinHook = CreatorCoinHook(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
HooksDeployment.
|
|
283
|
-
|
|
286
|
+
payable(
|
|
287
|
+
address(
|
|
288
|
+
HooksDeployment.deployHookWithSalt(
|
|
289
|
+
HooksDeployment.creatorCoinHookCreationCode(V4_POOL_MANAGER, address(factory), trustedMessageSenders, address(hookUpgradeGate)),
|
|
290
|
+
creatorCoinSalt
|
|
291
|
+
)
|
|
284
292
|
)
|
|
285
293
|
)
|
|
286
294
|
);
|
|
@@ -324,7 +332,7 @@ contract BaseTest is Test, ContractAddresses {
|
|
|
324
332
|
|
|
325
333
|
_deployHooks();
|
|
326
334
|
|
|
327
|
-
coinV4Impl = new
|
|
335
|
+
coinV4Impl = new ContentCoin(users.feeRecipient, address(protocolRewards), IPoolManager(V4_POOL_MANAGER), DOPPLER_AIRLOCK);
|
|
328
336
|
|
|
329
337
|
creatorCoinImpl = new CreatorCoin(users.feeRecipient, address(protocolRewards), IPoolManager(V4_POOL_MANAGER), DOPPLER_AIRLOCK);
|
|
330
338
|
|
package/wagmi.config.ts
CHANGED
|
File without changes
|