@zoralabs/coins 2.2.1 → 2.3.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$colon$js.log +99 -99
- package/CHANGELOG.md +44 -5
- package/README.md +4 -0
- package/abis/BaseCoin.json +0 -5
- package/abis/ContentCoin.json +0 -5
- package/abis/CreatorCoin.json +0 -5
- package/abis/FeeEstimatorHook.json +94 -1
- package/abis/IUpgradeableDestinationV4HookWithUpdateableFee.json +95 -0
- package/abis/IZoraFactory.json +69 -0
- package/abis/ZoraFactoryImpl.json +69 -0
- package/abis/ZoraV4CoinHook.json +94 -1
- package/addresses/8453.json +6 -6
- package/audits/report-cantinacode-zora-0827.pdf +3498 -4
- package/dist/index.cjs +21 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -3
- package/dist/index.js.map +1 -1
- package/dist/wagmiGenerated.d.ts +54 -12
- package/dist/wagmiGenerated.d.ts.map +1 -1
- package/foundry.toml +3 -3
- package/package/wagmiGenerated.ts +21 -3
- package/package.json +1 -1
- package/script/TestBackingCoinSwap.s.sol +0 -2
- package/script/TestV4Swap.s.sol +0 -2
- package/src/BaseCoin.sol +4 -12
- package/src/ContentCoin.sol +3 -4
- package/src/CreatorCoin.sol +8 -10
- package/src/ZoraFactoryImpl.sol +115 -83
- package/src/hook-registry/ZoraHookRegistry.sol +4 -0
- package/src/hooks/ZoraV4CoinHook.sol +66 -9
- package/src/interfaces/IUpgradeableV4Hook.sol +18 -0
- package/src/interfaces/IZoraFactory.sol +21 -2
- package/src/libs/CoinConstants.sol +51 -8
- package/src/libs/CoinDopplerMultiCurve.sol +11 -11
- package/src/libs/CoinRewardsV4.sol +26 -33
- package/src/libs/CoinSetup.sol +2 -9
- package/src/libs/DopplerMath.sol +2 -2
- package/src/libs/V4Liquidity.sol +79 -15
- package/src/version/ContractVersionBase.sol +1 -1
- package/test/Coin.t.sol +5 -5
- package/test/CoinRewardsV4.t.sol +33 -0
- package/test/CoinUniV4.t.sol +2 -3
- package/test/ContentCoinRewards.t.sol +43 -0
- package/test/CreatorCoin.t.sol +53 -29
- package/test/DeploymentHooks.t.sol +54 -2
- package/test/LiquidityMigration.t.sol +145 -7
- package/test/V4Liquidity.t.sol +178 -0
- package/test/utils/BaseTest.sol +0 -1
- package/test/utils/RewardTestHelpers.sol +4 -4
- package/abis/CoinConstants.json +0 -54
- package/abis/CoinRewardsV4.json +0 -67
- package/src/libs/CreatorCoinConstants.sol +0 -15
- package/src/libs/MarketConstants.sol +0 -23
- /package/abis/{VmContractHelper227.json → VmContractHelper226.json} +0 -0
package/dist/wagmiGenerated.d.ts
CHANGED
|
@@ -1564,10 +1564,6 @@ export declare const baseCoinABI: readonly [{
|
|
|
1564
1564
|
readonly type: "error";
|
|
1565
1565
|
readonly inputs: readonly [];
|
|
1566
1566
|
readonly name: "OwnerCannotBeAddressZero";
|
|
1567
|
-
}, {
|
|
1568
|
-
readonly type: "error";
|
|
1569
|
-
readonly inputs: readonly [];
|
|
1570
|
-
readonly name: "ReentrancyGuardReentrantCall";
|
|
1571
1567
|
}, {
|
|
1572
1568
|
readonly type: "error";
|
|
1573
1569
|
readonly inputs: readonly [];
|
|
@@ -3191,10 +3187,6 @@ export declare const contentCoinABI: readonly [{
|
|
|
3191
3187
|
readonly type: "error";
|
|
3192
3188
|
readonly inputs: readonly [];
|
|
3193
3189
|
readonly name: "OwnerCannotBeAddressZero";
|
|
3194
|
-
}, {
|
|
3195
|
-
readonly type: "error";
|
|
3196
|
-
readonly inputs: readonly [];
|
|
3197
|
-
readonly name: "ReentrancyGuardReentrantCall";
|
|
3198
3190
|
}, {
|
|
3199
3191
|
readonly type: "error";
|
|
3200
3192
|
readonly inputs: readonly [];
|
|
@@ -4749,10 +4741,6 @@ export declare const creatorCoinABI: readonly [{
|
|
|
4749
4741
|
readonly type: "error";
|
|
4750
4742
|
readonly inputs: readonly [];
|
|
4751
4743
|
readonly name: "OwnerCannotBeAddressZero";
|
|
4752
|
-
}, {
|
|
4753
|
-
readonly type: "error";
|
|
4754
|
-
readonly inputs: readonly [];
|
|
4755
|
-
readonly name: "ReentrancyGuardReentrantCall";
|
|
4756
4744
|
}, {
|
|
4757
4745
|
readonly type: "error";
|
|
4758
4746
|
readonly inputs: readonly [];
|
|
@@ -6056,6 +6044,60 @@ export declare const zoraFactoryImplABI: readonly [{
|
|
|
6056
6044
|
readonly type: "address";
|
|
6057
6045
|
}];
|
|
6058
6046
|
readonly stateMutability: "nonpayable";
|
|
6047
|
+
}, {
|
|
6048
|
+
readonly type: "function";
|
|
6049
|
+
readonly inputs: readonly [{
|
|
6050
|
+
readonly name: "payoutRecipient";
|
|
6051
|
+
readonly internalType: "address";
|
|
6052
|
+
readonly type: "address";
|
|
6053
|
+
}, {
|
|
6054
|
+
readonly name: "owners";
|
|
6055
|
+
readonly internalType: "address[]";
|
|
6056
|
+
readonly type: "address[]";
|
|
6057
|
+
}, {
|
|
6058
|
+
readonly name: "uri";
|
|
6059
|
+
readonly internalType: "string";
|
|
6060
|
+
readonly type: "string";
|
|
6061
|
+
}, {
|
|
6062
|
+
readonly name: "name";
|
|
6063
|
+
readonly internalType: "string";
|
|
6064
|
+
readonly type: "string";
|
|
6065
|
+
}, {
|
|
6066
|
+
readonly name: "symbol";
|
|
6067
|
+
readonly internalType: "string";
|
|
6068
|
+
readonly type: "string";
|
|
6069
|
+
}, {
|
|
6070
|
+
readonly name: "poolConfig";
|
|
6071
|
+
readonly internalType: "bytes";
|
|
6072
|
+
readonly type: "bytes";
|
|
6073
|
+
}, {
|
|
6074
|
+
readonly name: "platformReferrer";
|
|
6075
|
+
readonly internalType: "address";
|
|
6076
|
+
readonly type: "address";
|
|
6077
|
+
}, {
|
|
6078
|
+
readonly name: "postDeployHook";
|
|
6079
|
+
readonly internalType: "address";
|
|
6080
|
+
readonly type: "address";
|
|
6081
|
+
}, {
|
|
6082
|
+
readonly name: "postDeployHookData";
|
|
6083
|
+
readonly internalType: "bytes";
|
|
6084
|
+
readonly type: "bytes";
|
|
6085
|
+
}, {
|
|
6086
|
+
readonly name: "coinSalt";
|
|
6087
|
+
readonly internalType: "bytes32";
|
|
6088
|
+
readonly type: "bytes32";
|
|
6089
|
+
}];
|
|
6090
|
+
readonly name: "deployCreatorCoin";
|
|
6091
|
+
readonly outputs: readonly [{
|
|
6092
|
+
readonly name: "coin";
|
|
6093
|
+
readonly internalType: "address";
|
|
6094
|
+
readonly type: "address";
|
|
6095
|
+
}, {
|
|
6096
|
+
readonly name: "postDeployHookDataOut";
|
|
6097
|
+
readonly internalType: "bytes";
|
|
6098
|
+
readonly type: "bytes";
|
|
6099
|
+
}];
|
|
6100
|
+
readonly stateMutability: "payable";
|
|
6059
6101
|
}, {
|
|
6060
6102
|
readonly type: "function";
|
|
6061
6103
|
readonly inputs: readonly [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wagmiGenerated.d.ts","sourceRoot":"","sources":["../package/wagmiGenerated.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2FjB,CAAA;AAMV,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"wagmiGenerated.d.ts","sourceRoot":"","sources":["../package/wagmiGenerated.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2FjB,CAAA;AAMV,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAimBrB,CAAA"}
|
package/foundry.toml
CHANGED
|
@@ -20,6 +20,6 @@ fs_permissions = [
|
|
|
20
20
|
runs = 100
|
|
21
21
|
|
|
22
22
|
[rpc_endpoints]
|
|
23
|
-
base = "https://base
|
|
24
|
-
mainnet = "https://
|
|
25
|
-
zora = "https://rpc.zora.energy"
|
|
23
|
+
base = "https://base.gateway.tenderly.co/${TENDERLY_KEY}"
|
|
24
|
+
mainnet = "https://mainnet.gateway.tenderly.co/${TENDERLY_KEY}"
|
|
25
|
+
zora = "https://rpc.zora.energy/${CONDUIT_KEY}"
|
|
@@ -1174,7 +1174,6 @@ export const baseCoinABI = [
|
|
|
1174
1174
|
},
|
|
1175
1175
|
{ type: 'error', inputs: [], name: 'OnlyWeth' },
|
|
1176
1176
|
{ type: 'error', inputs: [], name: 'OwnerCannotBeAddressZero' },
|
|
1177
|
-
{ type: 'error', inputs: [], name: 'ReentrancyGuardReentrantCall' },
|
|
1178
1177
|
{ type: 'error', inputs: [], name: 'SlippageBoundsExceeded' },
|
|
1179
1178
|
{ type: 'error', inputs: [], name: 'UseRevokeOwnershipToRemoveSelf' },
|
|
1180
1179
|
] as const
|
|
@@ -2367,7 +2366,6 @@ export const contentCoinABI = [
|
|
|
2367
2366
|
},
|
|
2368
2367
|
{ type: 'error', inputs: [], name: 'OnlyWeth' },
|
|
2369
2368
|
{ type: 'error', inputs: [], name: 'OwnerCannotBeAddressZero' },
|
|
2370
|
-
{ type: 'error', inputs: [], name: 'ReentrancyGuardReentrantCall' },
|
|
2371
2369
|
{ type: 'error', inputs: [], name: 'SlippageBoundsExceeded' },
|
|
2372
2370
|
{ type: 'error', inputs: [], name: 'UseRevokeOwnershipToRemoveSelf' },
|
|
2373
2371
|
] as const
|
|
@@ -3542,7 +3540,6 @@ export const creatorCoinABI = [
|
|
|
3542
3540
|
},
|
|
3543
3541
|
{ type: 'error', inputs: [], name: 'OnlyWeth' },
|
|
3544
3542
|
{ type: 'error', inputs: [], name: 'OwnerCannotBeAddressZero' },
|
|
3545
|
-
{ type: 'error', inputs: [], name: 'ReentrancyGuardReentrantCall' },
|
|
3546
3543
|
{ type: 'error', inputs: [], name: 'SlippageBoundsExceeded' },
|
|
3547
3544
|
{ type: 'error', inputs: [], name: 'UseRevokeOwnershipToRemoveSelf' },
|
|
3548
3545
|
] as const
|
|
@@ -4414,6 +4411,27 @@ export const zoraFactoryImplABI = [
|
|
|
4414
4411
|
outputs: [{ name: '', internalType: 'address', type: 'address' }],
|
|
4415
4412
|
stateMutability: 'nonpayable',
|
|
4416
4413
|
},
|
|
4414
|
+
{
|
|
4415
|
+
type: 'function',
|
|
4416
|
+
inputs: [
|
|
4417
|
+
{ name: 'payoutRecipient', internalType: 'address', type: 'address' },
|
|
4418
|
+
{ name: 'owners', internalType: 'address[]', type: 'address[]' },
|
|
4419
|
+
{ name: 'uri', internalType: 'string', type: 'string' },
|
|
4420
|
+
{ name: 'name', internalType: 'string', type: 'string' },
|
|
4421
|
+
{ name: 'symbol', internalType: 'string', type: 'string' },
|
|
4422
|
+
{ name: 'poolConfig', internalType: 'bytes', type: 'bytes' },
|
|
4423
|
+
{ name: 'platformReferrer', internalType: 'address', type: 'address' },
|
|
4424
|
+
{ name: 'postDeployHook', internalType: 'address', type: 'address' },
|
|
4425
|
+
{ name: 'postDeployHookData', internalType: 'bytes', type: 'bytes' },
|
|
4426
|
+
{ name: 'coinSalt', internalType: 'bytes32', type: 'bytes32' },
|
|
4427
|
+
],
|
|
4428
|
+
name: 'deployCreatorCoin',
|
|
4429
|
+
outputs: [
|
|
4430
|
+
{ name: 'coin', internalType: 'address', type: 'address' },
|
|
4431
|
+
{ name: 'postDeployHookDataOut', internalType: 'bytes', type: 'bytes' },
|
|
4432
|
+
],
|
|
4433
|
+
stateMutability: 'payable',
|
|
4434
|
+
},
|
|
4417
4435
|
{
|
|
4418
4436
|
type: 'function',
|
|
4419
4437
|
inputs: [
|
package/package.json
CHANGED
|
@@ -6,14 +6,12 @@ import {CoinsDeployerBase} from "../src/deployment/CoinsDeployerBase.sol";
|
|
|
6
6
|
|
|
7
7
|
import {IZoraFactory} from "../src/interfaces/IZoraFactory.sol";
|
|
8
8
|
import {CoinConfigurationVersions} from "../src/libs/CoinConfigurationVersions.sol";
|
|
9
|
-
import {MarketConstants} from "../src/libs/MarketConstants.sol";
|
|
10
9
|
import {UniV4SwapHelper} from "../src/libs/UniV4SwapHelper.sol";
|
|
11
10
|
import {ContentCoin} from "../src/ContentCoin.sol";
|
|
12
11
|
import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";
|
|
13
12
|
import {IUniversalRouter} from "@uniswap/universal-router/contracts/interfaces/IUniversalRouter.sol";
|
|
14
13
|
import {IPermit2} from "permit2/src/interfaces/IPermit2.sol";
|
|
15
14
|
import {MockERC20} from "../test/mocks/MockERC20.sol";
|
|
16
|
-
import {MarketConstants} from "../src/libs/MarketConstants.sol";
|
|
17
15
|
import {Currency} from "@uniswap/v4-core/src/types/Currency.sol";
|
|
18
16
|
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
19
17
|
import {ICoin} from "../src/interfaces/ICoin.sol";
|
package/script/TestV4Swap.s.sol
CHANGED
|
@@ -6,14 +6,12 @@ import {CoinsDeployerBase} from "../src/deployment/CoinsDeployerBase.sol";
|
|
|
6
6
|
|
|
7
7
|
import {IZoraFactory} from "../src/interfaces/IZoraFactory.sol";
|
|
8
8
|
import {CoinConfigurationVersions} from "../src/libs/CoinConfigurationVersions.sol";
|
|
9
|
-
import {MarketConstants} from "../src/libs/MarketConstants.sol";
|
|
10
9
|
import {UniV4SwapHelper} from "../src/libs/UniV4SwapHelper.sol";
|
|
11
10
|
import {ContentCoin} from "../src/ContentCoin.sol";
|
|
12
11
|
import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";
|
|
13
12
|
import {IUniversalRouter} from "@uniswap/universal-router/contracts/interfaces/IUniversalRouter.sol";
|
|
14
13
|
import {IPermit2} from "permit2/src/interfaces/IPermit2.sol";
|
|
15
14
|
import {MockERC20} from "../test/mocks/MockERC20.sol";
|
|
16
|
-
import {MarketConstants} from "../src/libs/MarketConstants.sol";
|
|
17
15
|
import {Currency} from "@uniswap/v4-core/src/types/Currency.sol";
|
|
18
16
|
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
19
17
|
import {ICoin} from "../src/interfaces/ICoin.sol";
|
package/src/BaseCoin.sol
CHANGED
|
@@ -32,7 +32,6 @@ import {CoinCommon} from "./libs/CoinCommon.sol";
|
|
|
32
32
|
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
|
|
33
33
|
import {ERC20PermitUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol";
|
|
34
34
|
import {ERC165Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";
|
|
35
|
-
import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
|
|
36
35
|
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
37
36
|
import {ContractVersionBase} from "./version/ContractVersionBase.sol";
|
|
38
37
|
import {MultiOwnable} from "./utils/MultiOwnable.sol";
|
|
@@ -40,7 +39,6 @@ import {FullMath} from "./utils/uniswap/FullMath.sol";
|
|
|
40
39
|
import {TickMath} from "./utils/uniswap/TickMath.sol";
|
|
41
40
|
import {LiquidityAmounts} from "./utils/uniswap/LiquidityAmounts.sol";
|
|
42
41
|
import {CoinConstants} from "./libs/CoinConstants.sol";
|
|
43
|
-
import {MarketConstants} from "./libs/MarketConstants.sol";
|
|
44
42
|
import {LpPosition} from "./types/LpPosition.sol";
|
|
45
43
|
import {PoolState} from "./types/PoolState.sol";
|
|
46
44
|
|
|
@@ -54,7 +52,7 @@ import {PoolState} from "./types/PoolState.sol";
|
|
|
54
52
|
\$$$$$$ | $$$$$$ |$$$$$$\ $$ | \$$ |
|
|
55
53
|
\______/ \______/ \______|\__| \__|
|
|
56
54
|
*/
|
|
57
|
-
abstract contract BaseCoin is ICoin, ContractVersionBase, ERC20PermitUpgradeable, MultiOwnable,
|
|
55
|
+
abstract contract BaseCoin is ICoin, ContractVersionBase, ERC20PermitUpgradeable, MultiOwnable, ERC165Upgradeable {
|
|
58
56
|
using SafeERC20 for IERC20;
|
|
59
57
|
|
|
60
58
|
/// @notice The address of the protocol rewards contract
|
|
@@ -168,7 +166,6 @@ abstract contract BaseCoin is ICoin, ContractVersionBase, ERC20PermitUpgradeable
|
|
|
168
166
|
__ERC20Permit_init("");
|
|
169
167
|
|
|
170
168
|
__MultiOwnable_init(owners_);
|
|
171
|
-
__ReentrancyGuard_init();
|
|
172
169
|
|
|
173
170
|
// Set mutable state
|
|
174
171
|
_setPayoutRecipient(payoutRecipient_);
|
|
@@ -181,14 +178,9 @@ abstract contract BaseCoin is ICoin, ContractVersionBase, ERC20PermitUpgradeable
|
|
|
181
178
|
_handleInitialDistribution();
|
|
182
179
|
}
|
|
183
180
|
|
|
184
|
-
/// @
|
|
185
|
-
function
|
|
186
|
-
|
|
187
|
-
_mint(address(this), CoinConstants.MAX_TOTAL_SUPPLY);
|
|
188
|
-
|
|
189
|
-
// Distribute the creator launch reward to the payout recipient
|
|
190
|
-
_transfer(address(this), payoutRecipient, CoinConstants.CREATOR_LAUNCH_REWARD);
|
|
191
|
-
}
|
|
181
|
+
/// @notice The initial mint and distribution of the coin supply.
|
|
182
|
+
/// @dev This function must be overridden by the child contract.
|
|
183
|
+
function _handleInitialDistribution() internal virtual;
|
|
192
184
|
|
|
193
185
|
/// @notice Returns the name of the token for EIP712 domain.
|
|
194
186
|
/// @notice This can change when the user changes the "name" of the token.
|
package/src/ContentCoin.sol
CHANGED
|
@@ -10,12 +10,11 @@ pragma solidity ^0.8.23;
|
|
|
10
10
|
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
|
|
11
11
|
import {BaseCoin} from "./BaseCoin.sol";
|
|
12
12
|
import {CoinConstants} from "./libs/CoinConstants.sol";
|
|
13
|
-
import {MarketConstants} from "./libs/MarketConstants.sol";
|
|
14
13
|
import {IHasCoinType} from "./interfaces/ICoin.sol";
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* @title ContentCoin
|
|
18
|
-
* @notice Content coin implementation that uses creator coins as backing currency
|
|
17
|
+
* @notice Content coin implementation that typically uses creator coins as backing currency, but can be set to any currency as the backing currency
|
|
19
18
|
* @dev Inherits from BaseCoin and implements content-specific distribution logic
|
|
20
19
|
*/
|
|
21
20
|
contract ContentCoin is BaseCoin {
|
|
@@ -39,14 +38,14 @@ contract ContentCoin is BaseCoin {
|
|
|
39
38
|
_mint(address(this), CoinConstants.MAX_TOTAL_SUPPLY);
|
|
40
39
|
|
|
41
40
|
// Distribute the creator launch reward to the payout recipient
|
|
42
|
-
_transfer(address(this), payoutRecipient, CoinConstants.
|
|
41
|
+
_transfer(address(this), payoutRecipient, CoinConstants.CONTENT_COIN_INITIAL_CREATOR_SUPPLY);
|
|
43
42
|
|
|
44
43
|
// Transfer the market supply to the hook for liquidity
|
|
45
44
|
_transfer(address(this), address(poolKey.hooks), balanceOf(address(this)));
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
function totalSupplyForPositions() external pure override returns (uint256) {
|
|
49
|
-
return
|
|
48
|
+
return CoinConstants.CONTENT_COIN_MARKET_SUPPLY;
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
function coinType() external pure override returns (IHasCoinType.CoinType) {
|
package/src/CreatorCoin.sol
CHANGED
|
@@ -8,12 +8,11 @@
|
|
|
8
8
|
pragma solidity ^0.8.28;
|
|
9
9
|
|
|
10
10
|
import {ICreatorCoin} from "./interfaces/ICreatorCoin.sol";
|
|
11
|
-
import {
|
|
11
|
+
import {CoinConstants} from "./libs/CoinConstants.sol";
|
|
12
12
|
import {IHooks, PoolConfiguration, PoolKey, ICoin} from "./interfaces/ICoin.sol";
|
|
13
13
|
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
|
|
14
14
|
import {BaseCoin} from "./BaseCoin.sol";
|
|
15
15
|
import {IHasCoinType} from "./interfaces/ICoin.sol";
|
|
16
|
-
import {MarketConstants} from "./libs/MarketConstants.sol";
|
|
17
16
|
|
|
18
17
|
contract CreatorCoin is ICreatorCoin, BaseCoin {
|
|
19
18
|
uint256 public vestingStartTime;
|
|
@@ -28,7 +27,7 @@ contract CreatorCoin is ICreatorCoin, BaseCoin {
|
|
|
28
27
|
) BaseCoin(protocolRewardRecipient_, protocolRewards_, poolManager_, airlock_) initializer {}
|
|
29
28
|
|
|
30
29
|
function totalSupplyForPositions() external pure override returns (uint256) {
|
|
31
|
-
return
|
|
30
|
+
return CoinConstants.CREATOR_COIN_MARKET_SUPPLY;
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
function coinType() external pure override returns (IHasCoinType.CoinType) {
|
|
@@ -47,7 +46,7 @@ contract CreatorCoin is ICreatorCoin, BaseCoin {
|
|
|
47
46
|
uint160 sqrtPriceX96,
|
|
48
47
|
PoolConfiguration memory poolConfiguration_
|
|
49
48
|
) public override(BaseCoin, ICoin) {
|
|
50
|
-
require(currency_ ==
|
|
49
|
+
require(currency_ == CoinConstants.CREATOR_COIN_CURRENCY, InvalidCurrency());
|
|
51
50
|
|
|
52
51
|
super.initialize({
|
|
53
52
|
payoutRecipient_: payoutRecipient_,
|
|
@@ -63,19 +62,18 @@ contract CreatorCoin is ICreatorCoin, BaseCoin {
|
|
|
63
62
|
});
|
|
64
63
|
|
|
65
64
|
vestingStartTime = block.timestamp;
|
|
66
|
-
vestingEndTime = block.timestamp +
|
|
65
|
+
vestingEndTime = block.timestamp + CoinConstants.CREATOR_VESTING_DURATION;
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
/// @dev The initial mint and distribution of the coin supply.
|
|
70
69
|
/// Implements creator coin specific distribution: 500M to liquidity pool, 500M vested to creator.
|
|
71
70
|
function _handleInitialDistribution() internal override {
|
|
72
|
-
_mint(address(this),
|
|
71
|
+
_mint(address(this), CoinConstants.TOTAL_SUPPLY);
|
|
73
72
|
|
|
74
|
-
_transfer(address(this), address(poolKey.hooks),
|
|
73
|
+
_transfer(address(this), address(poolKey.hooks), CoinConstants.CREATOR_COIN_MARKET_SUPPLY);
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
/// @notice Allows the creator payout recipient to claim vested tokens
|
|
78
|
-
/// @dev Optimized for frequent calls from Uniswap V4 hooks
|
|
79
77
|
/// @return claimAmount The amount of tokens claimed
|
|
80
78
|
function claimVesting() external returns (uint256) {
|
|
81
79
|
uint256 claimAmount = getClaimableAmount();
|
|
@@ -114,13 +112,13 @@ contract CreatorCoin is ICreatorCoin, BaseCoin {
|
|
|
114
112
|
|
|
115
113
|
// After vesting ends - fully vested
|
|
116
114
|
if (timestamp >= vestingEndTime) {
|
|
117
|
-
return
|
|
115
|
+
return CoinConstants.CREATOR_COIN_CREATOR_VESTING_SUPPLY;
|
|
118
116
|
}
|
|
119
117
|
|
|
120
118
|
// Linear vesting: (elapsed_time / total_duration) * total_amount
|
|
121
119
|
uint256 elapsedTime = timestamp - vestingStartTime;
|
|
122
120
|
|
|
123
121
|
// Multiply first to avoid precision loss
|
|
124
|
-
return (
|
|
122
|
+
return (CoinConstants.CREATOR_COIN_CREATOR_VESTING_SUPPLY * elapsedTime) / CoinConstants.CREATOR_VESTING_DURATION;
|
|
125
123
|
}
|
|
126
124
|
}
|
package/src/ZoraFactoryImpl.sol
CHANGED
|
@@ -34,7 +34,6 @@ import {IVersionedContract} from "@zoralabs/shared-contracts/interfaces/IVersion
|
|
|
34
34
|
import {CoinSetup} from "./libs/CoinSetup.sol";
|
|
35
35
|
import {CoinDopplerMultiCurve} from "./libs/CoinDopplerMultiCurve.sol";
|
|
36
36
|
import {ICreatorCoin} from "./interfaces/ICreatorCoin.sol";
|
|
37
|
-
import {MarketConstants} from "./libs/MarketConstants.sol";
|
|
38
37
|
import {DeployedCoinVersionLookup} from "./utils/DeployedCoinVersionLookup.sol";
|
|
39
38
|
import {IZoraHookRegistry} from "./interfaces/IZoraHookRegistry.sol";
|
|
40
39
|
|
|
@@ -67,15 +66,7 @@ contract ZoraFactoryImpl is
|
|
|
67
66
|
zoraHookRegistry = zoraHookRegistry_;
|
|
68
67
|
}
|
|
69
68
|
|
|
70
|
-
/// @
|
|
71
|
-
/// @param payoutRecipient The recipient of creator reward payouts; this can be updated by an owner
|
|
72
|
-
/// @param owners The list of addresses that will be able to manage the coin's payout address and metadata uri
|
|
73
|
-
/// @param uri The coin metadata uri
|
|
74
|
-
/// @param name The name of the coin
|
|
75
|
-
/// @param symbol The symbol of the coin
|
|
76
|
-
/// @param poolConfig The config parameters for the coin's pool
|
|
77
|
-
/// @param platformReferrer The address of the platform referrer
|
|
78
|
-
/// @param coinSalt The salt used to deploy the coin
|
|
69
|
+
/// @inheritdoc IZoraFactory
|
|
79
70
|
function deployCreatorCoin(
|
|
80
71
|
address payoutRecipient,
|
|
81
72
|
address[] memory owners,
|
|
@@ -87,39 +78,24 @@ contract ZoraFactoryImpl is
|
|
|
87
78
|
bytes32 coinSalt
|
|
88
79
|
) public nonReentrant returns (address) {
|
|
89
80
|
bytes32 salt = _buildSalt(msg.sender, name, symbol, poolConfig, platformReferrer, coinSalt);
|
|
81
|
+
return address(_createAndInitializeCreatorCoin(payoutRecipient, owners, uri, name, symbol, poolConfig, platformReferrer, salt));
|
|
82
|
+
}
|
|
90
83
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
ICreatorCoin(creatorCoin).initialize(payoutRecipient, owners, uri, name, symbol, platformReferrer, currency, poolKey, sqrtPriceX96, poolConfiguration);
|
|
107
|
-
|
|
108
|
-
emit CreatorCoinCreated(
|
|
109
|
-
msg.sender,
|
|
110
|
-
payoutRecipient,
|
|
111
|
-
platformReferrer,
|
|
112
|
-
currency,
|
|
113
|
-
uri,
|
|
114
|
-
name,
|
|
115
|
-
symbol,
|
|
116
|
-
address(creatorCoin),
|
|
117
|
-
poolKey,
|
|
118
|
-
CoinCommon.hashPoolKey(poolKey),
|
|
119
|
-
IVersionedContract(address(creatorCoin)).contractVersion()
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
return creatorCoin;
|
|
84
|
+
/// @inheritdoc IZoraFactory
|
|
85
|
+
function deployCreatorCoin(
|
|
86
|
+
address payoutRecipient,
|
|
87
|
+
address[] memory owners,
|
|
88
|
+
string memory uri,
|
|
89
|
+
string memory name,
|
|
90
|
+
string memory symbol,
|
|
91
|
+
bytes memory poolConfig,
|
|
92
|
+
address platformReferrer,
|
|
93
|
+
address postDeployHook,
|
|
94
|
+
bytes calldata postDeployHookData,
|
|
95
|
+
bytes32 coinSalt
|
|
96
|
+
) external payable nonReentrant returns (address coin, bytes memory postDeployHookDataOut) {
|
|
97
|
+
bytes32 salt = _buildSalt(msg.sender, name, symbol, poolConfig, platformReferrer, coinSalt);
|
|
98
|
+
return _deployCreatorCoinWithHook(payoutRecipient, owners, uri, name, symbol, poolConfig, platformReferrer, postDeployHook, postDeployHookData, salt);
|
|
123
99
|
}
|
|
124
100
|
|
|
125
101
|
/// @inheritdoc IZoraFactory
|
|
@@ -152,6 +128,18 @@ contract ZoraFactoryImpl is
|
|
|
152
128
|
return Clones.predictDeterministicAddress(getCoinImpl(CoinConfigurationVersions.getVersion(poolConfig)), salt, address(this));
|
|
153
129
|
}
|
|
154
130
|
|
|
131
|
+
function _executePostDeployHook(address coin, address deployHook, bytes calldata hookData) internal returns (bytes memory hookDataOut) {
|
|
132
|
+
if (deployHook != address(0)) {
|
|
133
|
+
if (!IERC165(deployHook).supportsInterface(type(IHasAfterCoinDeploy).interfaceId)) {
|
|
134
|
+
revert InvalidHook();
|
|
135
|
+
}
|
|
136
|
+
hookDataOut = IHasAfterCoinDeploy(deployHook).afterCoinDeploy{value: msg.value}(msg.sender, ICoin(coin), hookData);
|
|
137
|
+
} else if (msg.value > 0) {
|
|
138
|
+
// cannot send eth without a hook
|
|
139
|
+
revert EthTransferInvalid();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
155
143
|
/// @dev Internal function to deploy a coin with a hook
|
|
156
144
|
function _deployWithHook(
|
|
157
145
|
address payoutRecipient,
|
|
@@ -166,16 +154,24 @@ contract ZoraFactoryImpl is
|
|
|
166
154
|
bytes32 salt
|
|
167
155
|
) internal returns (address coin, bytes memory hookDataOut) {
|
|
168
156
|
coin = address(_createAndInitializeCoin(payoutRecipient, owners, uri, name, symbol, poolConfig, platformReferrer, salt));
|
|
157
|
+
hookDataOut = _executePostDeployHook(coin, deployHook, hookData);
|
|
158
|
+
}
|
|
169
159
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
160
|
+
/// @dev Internal function to deploy a creator coin with a hook
|
|
161
|
+
function _deployCreatorCoinWithHook(
|
|
162
|
+
address payoutRecipient,
|
|
163
|
+
address[] memory owners,
|
|
164
|
+
string memory uri,
|
|
165
|
+
string memory name,
|
|
166
|
+
string memory symbol,
|
|
167
|
+
bytes memory poolConfig,
|
|
168
|
+
address platformReferrer,
|
|
169
|
+
address deployHook,
|
|
170
|
+
bytes calldata hookData,
|
|
171
|
+
bytes32 salt
|
|
172
|
+
) internal returns (address coin, bytes memory hookDataOut) {
|
|
173
|
+
coin = address(_createAndInitializeCreatorCoin(payoutRecipient, owners, uri, name, symbol, poolConfig, platformReferrer, salt));
|
|
174
|
+
hookDataOut = _executePostDeployHook(coin, deployHook, hookData);
|
|
179
175
|
}
|
|
180
176
|
|
|
181
177
|
/**
|
|
@@ -252,29 +248,55 @@ contract ZoraFactoryImpl is
|
|
|
252
248
|
revert ICoin.InvalidPoolVersion();
|
|
253
249
|
}
|
|
254
250
|
|
|
255
|
-
function
|
|
256
|
-
|
|
251
|
+
function _createCoinWithPoolConfig(
|
|
252
|
+
address _implementation,
|
|
253
|
+
bytes memory poolConfig,
|
|
254
|
+
bytes32 coinSalt,
|
|
255
|
+
address payoutRecipient,
|
|
256
|
+
address[] memory owners,
|
|
257
|
+
string memory uri,
|
|
258
|
+
string memory name,
|
|
259
|
+
string memory symbol,
|
|
260
|
+
address platformReferrer
|
|
261
|
+
) internal returns (address coin, uint8 version, PoolKey memory poolKey, address currency) {
|
|
262
|
+
version = CoinConfigurationVersions.getVersion(poolConfig);
|
|
263
|
+
coin = Clones.cloneDeterministic(_implementation, coinSalt);
|
|
264
|
+
_setVersionForDeployedCoin(coin, version);
|
|
265
|
+
|
|
266
|
+
uint160 sqrtPriceX96;
|
|
267
|
+
bool isCoinToken0;
|
|
268
|
+
PoolConfiguration memory poolConfiguration;
|
|
269
|
+
(, currency, sqrtPriceX96, isCoinToken0, poolConfiguration) = CoinSetup.generatePoolConfig(coin, poolConfig);
|
|
270
|
+
|
|
271
|
+
poolKey = CoinSetup.buildPoolKey(coin, currency, isCoinToken0, IHooks(hook));
|
|
272
|
+
ICoin(coin).initialize(payoutRecipient, owners, uri, name, symbol, platformReferrer, currency, poolKey, sqrtPriceX96, poolConfiguration);
|
|
257
273
|
}
|
|
258
274
|
|
|
259
|
-
function
|
|
260
|
-
ICoin coin,
|
|
261
|
-
address currency,
|
|
262
|
-
bool isCoinToken0,
|
|
263
|
-
uint160 sqrtPriceX96,
|
|
264
|
-
PoolConfiguration memory poolConfiguration,
|
|
275
|
+
function _createAndInitializeCreatorCoin(
|
|
265
276
|
address payoutRecipient,
|
|
266
277
|
address[] memory owners,
|
|
267
278
|
string memory uri,
|
|
268
279
|
string memory name,
|
|
269
280
|
string memory symbol,
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
281
|
+
bytes memory poolConfig,
|
|
282
|
+
address platformReferrer,
|
|
283
|
+
bytes32 coinSalt
|
|
284
|
+
) internal returns (ICreatorCoin) {
|
|
285
|
+
(address creatorCoin, uint8 version, PoolKey memory poolKey, address currency) = _createCoinWithPoolConfig(
|
|
286
|
+
creatorCoinImpl,
|
|
287
|
+
poolConfig,
|
|
288
|
+
coinSalt,
|
|
289
|
+
payoutRecipient,
|
|
290
|
+
owners,
|
|
291
|
+
uri,
|
|
292
|
+
name,
|
|
293
|
+
symbol,
|
|
294
|
+
platformReferrer
|
|
295
|
+
);
|
|
273
296
|
|
|
274
|
-
|
|
275
|
-
coin.initialize(payoutRecipient, owners, uri, name, symbol, platformReferrer, currency, poolKey, sqrtPriceX96, poolConfiguration);
|
|
297
|
+
require(version == CoinConfigurationVersions.DOPPLER_MULTICURVE_UNI_V4_POOL_VERSION, InvalidConfig());
|
|
276
298
|
|
|
277
|
-
emit
|
|
299
|
+
emit CreatorCoinCreated(
|
|
278
300
|
msg.sender,
|
|
279
301
|
payoutRecipient,
|
|
280
302
|
platformReferrer,
|
|
@@ -282,11 +304,13 @@ contract ZoraFactoryImpl is
|
|
|
282
304
|
uri,
|
|
283
305
|
name,
|
|
284
306
|
symbol,
|
|
285
|
-
|
|
307
|
+
creatorCoin,
|
|
286
308
|
poolKey,
|
|
287
309
|
CoinCommon.hashPoolKey(poolKey),
|
|
288
|
-
IVersionedContract(
|
|
310
|
+
IVersionedContract(creatorCoin).contractVersion()
|
|
289
311
|
);
|
|
312
|
+
|
|
313
|
+
return ICreatorCoin(creatorCoin);
|
|
290
314
|
}
|
|
291
315
|
|
|
292
316
|
function _createAndInitializeCoin(
|
|
@@ -299,26 +323,34 @@ contract ZoraFactoryImpl is
|
|
|
299
323
|
address platformReferrer,
|
|
300
324
|
bytes32 coinSalt
|
|
301
325
|
) internal returns (ICoin) {
|
|
302
|
-
uint8 version =
|
|
303
|
-
|
|
304
|
-
|
|
326
|
+
(address coin, uint8 version, PoolKey memory poolKey, address currency) = _createCoinWithPoolConfig(
|
|
327
|
+
coinV4Impl,
|
|
328
|
+
poolConfig,
|
|
329
|
+
coinSalt,
|
|
330
|
+
payoutRecipient,
|
|
331
|
+
owners,
|
|
332
|
+
uri,
|
|
333
|
+
name,
|
|
334
|
+
symbol,
|
|
335
|
+
platformReferrer
|
|
336
|
+
);
|
|
305
337
|
|
|
306
|
-
|
|
338
|
+
require(version == CoinConfigurationVersions.DOPPLER_MULTICURVE_UNI_V4_POOL_VERSION, ICoin.InvalidPoolVersion());
|
|
307
339
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
340
|
+
emit CoinCreatedV4(
|
|
341
|
+
msg.sender,
|
|
342
|
+
payoutRecipient,
|
|
343
|
+
platformReferrer,
|
|
344
|
+
currency,
|
|
345
|
+
uri,
|
|
346
|
+
name,
|
|
347
|
+
symbol,
|
|
348
|
+
coin,
|
|
349
|
+
poolKey,
|
|
350
|
+
CoinCommon.hashPoolKey(poolKey),
|
|
351
|
+
IVersionedContract(coin).contractVersion()
|
|
311
352
|
);
|
|
312
353
|
|
|
313
|
-
if (CoinConfigurationVersions.isV3(version)) {
|
|
314
|
-
// V3 is no longer supported
|
|
315
|
-
revert ICoin.InvalidPoolVersion();
|
|
316
|
-
} else if (CoinConfigurationVersions.isV4(version)) {
|
|
317
|
-
_setupV4Coin(ICoin(coin), currency, isCoinToken0, sqrtPriceX96, poolConfiguration, payoutRecipient, owners, uri, name, symbol, platformReferrer);
|
|
318
|
-
} else {
|
|
319
|
-
revert ICoin.InvalidPoolVersion();
|
|
320
|
-
}
|
|
321
|
-
|
|
322
354
|
return ICoin(coin);
|
|
323
355
|
}
|
|
324
356
|
|