Skip to content

Commit 264cb13

Browse files
committed
deploy modules: account for upgrades
1 parent 2b61d7a commit 264cb13

25 files changed

+1211
-588
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ The vTokens can then be used to earn yield by:<br>
2020
Contract | mainnet | sepolia | goerli
2121
--- | --- | --- | ---
2222
[CreateVaultZap](./src/zaps/CreateVaultZap.sol) | [0x56dab32697B4A313f353DA0CE42B5113eD8E6f74](https://etherscan.io/address/0x56dab32697B4A313f353DA0CE42B5113eD8E6f74#code) | [0xD80b916470F8e79FD8d09874cb159CbB8D13d8da](https://sepolia.etherscan.io/address/0xD80b916470F8e79FD8d09874cb159CbB8D13d8da#code) | [0xc6464CC63bC20b64e1633A0293C2C9b202F4f1b6](https://goerli.etherscan.io/address/0xc6464CC63bC20b64e1633A0293C2C9b202F4f1b6#code)
23+
DefaultProxyAdmin | [0xf8Cab5e4912e08c475033776d9472b81c1325e58](https://etherscan.io/address/0xf8Cab5e4912e08c475033776d9472b81c1325e58#code) | [0x36cBBb16F2FA71d4B773E9F4A11cF7FC53B13EfD](https://sepolia.etherscan.io/address/0x36cBBb16F2FA71d4B773E9F4A11cF7FC53B13EfD#code) | [0xa0d26F02D5e94C8E9ED524875D9fce36ab4838a2](https://goerli.etherscan.io/address/0xa0d26F02D5e94C8E9ED524875D9fce36ab4838a2#code)
2324
[MarketplaceUniversalRouterZap](./src/zaps/MarketplaceUniversalRouterZap.sol) | [0x293A0c49c85F1D8851C665Ac3cE1f1DC2a79bE3d](https://etherscan.io/address/0x293A0c49c85F1D8851C665Ac3cE1f1DC2a79bE3d#code) | [0xd88a3B9D0Fb2d39ec8394CfFD983aFBB2D4a6410](https://sepolia.etherscan.io/address/0xd88a3B9D0Fb2d39ec8394CfFD983aFBB2D4a6410#code) | [0x0be2D766Eef4b6a72F1fAe2e49619F013d647B8A](https://goerli.etherscan.io/address/0x0be2D766Eef4b6a72F1fAe2e49619F013d647B8A#code)
2425
[MigratorZap](./src/zaps/MigratorZap.sol) | [0x089610Fb04c34C014B4B391f4eCEFAef94E98CEc](https://etherscan.io/address/0x089610Fb04c34C014B4B391f4eCEFAef94E98CEc#code) | [0x19762e505aF085284E287c8DAb931fb28545461f](https://sepolia.etherscan.io/address/0x19762e505aF085284E287c8DAb931fb28545461f#code) | [0xD4B67Fe6a1258fd5e1C4dF84f3De01F62e7ac127](https://goerli.etherscan.io/address/0xD4B67Fe6a1258fd5e1C4dF84f3De01F62e7ac127#code)
2526
[NFTXEligibilityManager](./src/v2/NFTXEligibilityManager.sol) | [0x4086e98Cce041d286112d021612fD894cFed94D5](https://etherscan.io/address/0x4086e98Cce041d286112d021612fD894cFed94D5#code) | [0xa1ad09f8Fd789E3A940Ba9Dc5aE4D17021eF290D](https://sepolia.etherscan.io/address/0xa1ad09f8Fd789E3A940Ba9Dc5aE4D17021eF290D#code) | [0xA4e9e286CE7A34d19f774c36844225468290C3A8](https://goerli.etherscan.io/address/0xA4e9e286CE7A34d19f774c36844225468290C3A8#code)
26-
[NFTXFeeDistributorV3](./src/NFTXFeeDistributorV3.sol) | [0xF4d96C5094FCD9eC24E612585e723b58F89e21fe](https://etherscan.io/address/0xF4d96C5094FCD9eC24E612585e723b58F89e21fe#code) | [0x6432Fdc3F020B9d34B6Bff26013c6c882Cd85C87](https://sepolia.etherscan.io/address/0x6432Fdc3F020B9d34B6Bff26013c6c882Cd85C87#code) | [0xA8076Ec5Dbb95165e14624Ff43dE2290e78A6905](https://goerli.etherscan.io/address/0xA8076Ec5Dbb95165e14624Ff43dE2290e78A6905#code)
27+
[NFTXFeeDistributorV3](./src/NFTXFeeDistributorV3.sol) | [0xF4d96C5094FCD9eC24E612585e723b58F89e21fe](https://etherscan.io/address/0xF4d96C5094FCD9eC24E612585e723b58F89e21fe#code) | [0x53AE38742C78EE64fC077EF840B2Aa47A7E9c603](https://sepolia.etherscan.io/address/0x53AE38742C78EE64fC077EF840B2Aa47A7E9c603#code) | [0xA8076Ec5Dbb95165e14624Ff43dE2290e78A6905](https://goerli.etherscan.io/address/0xA8076Ec5Dbb95165e14624Ff43dE2290e78A6905#code)
2728
[NFTXInventoryStakingV3Upgradeable](./src/NFTXInventoryStakingV3Upgradeable.sol) | [0x889f313e2a3FDC1c9a45bC6020A8a18749CD6152](https://etherscan.io/address/0x889f313e2a3FDC1c9a45bC6020A8a18749CD6152#code) | [0xfBFf0635f7c5327FD138E1EBa72BD9877A6a7C1C](https://sepolia.etherscan.io/address/0xfBFf0635f7c5327FD138E1EBa72BD9877A6a7C1C#code) | [0xEf771a17e6970d8B4b208a76e94F175277554230](https://goerli.etherscan.io/address/0xEf771a17e6970d8B4b208a76e94F175277554230#code)
2829
[NFTXRouter](./src/NFTXRouter.sol) | [0x70A741A12262d4b5Ff45C0179c783a380EebE42a](https://etherscan.io/address/0x70A741A12262d4b5Ff45C0179c783a380EebE42a#code) | [0x441b7DE4340AAa5aA86dB4DA43d9Badf7B2DAA66](https://sepolia.etherscan.io/address/0x441b7DE4340AAa5aA86dB4DA43d9Badf7B2DAA66#code) | [0x8E16cdd0D9A15d2d0EFeA531660e8DbD0F6eE12D](https://goerli.etherscan.io/address/0x8E16cdd0D9A15d2d0EFeA531660e8DbD0F6eE12D#code)
2930
[nftxUniversalRouter](https://github.com/NFTX-project/nftx-universal-router/blob/nftx-universal-router/contracts/UniversalRouter.sol) | [0x250d62a67254A46c0De472d2c9215E1d890cC90f](https://etherscan.io/address/0x250d62a67254A46c0De472d2c9215E1d890cC90f#code) | [0x12156cCA1958B6591CC49EaE03a5553458a4b424](https://sepolia.etherscan.io/address/0x12156cCA1958B6591CC49EaE03a5553458a4b424#code) | [0xF7c4FC5C2e30258e1E4d1197fc63aeDE371508f3](https://goerli.etherscan.io/address/0xF7c4FC5C2e30258e1E4d1197fc63aeDE371508f3#code)

addresses.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"mainnet": {
33
"CreateVaultZap": "0x56dab32697B4A313f353DA0CE42B5113eD8E6f74",
4+
"DefaultProxyAdmin": "0xf8Cab5e4912e08c475033776d9472b81c1325e58",
45
"MarketplaceUniversalRouterZap": "0x293A0c49c85F1D8851C665Ac3cE1f1DC2a79bE3d",
56
"MigratorZap": "0x089610Fb04c34C014B4B391f4eCEFAef94E98CEc",
67
"NFTXEligibilityManager": "0x4086e98Cce041d286112d021612fD894cFed94D5",
@@ -19,10 +20,11 @@
1920
},
2021
"sepolia": {
2122
"CreateVaultZap": "0xD80b916470F8e79FD8d09874cb159CbB8D13d8da",
23+
"DefaultProxyAdmin": "0x36cBBb16F2FA71d4B773E9F4A11cF7FC53B13EfD",
2224
"MarketplaceUniversalRouterZap": "0xd88a3B9D0Fb2d39ec8394CfFD983aFBB2D4a6410",
2325
"MigratorZap": "0x19762e505aF085284E287c8DAb931fb28545461f",
2426
"NFTXEligibilityManager": "0xa1ad09f8Fd789E3A940Ba9Dc5aE4D17021eF290D",
25-
"NFTXFeeDistributorV3": "0x6432Fdc3F020B9d34B6Bff26013c6c882Cd85C87",
27+
"NFTXFeeDistributorV3": "0x53AE38742C78EE64fC077EF840B2Aa47A7E9c603",
2628
"NFTXInventoryStakingV3Upgradeable": "0xfBFf0635f7c5327FD138E1EBa72BD9877A6a7C1C",
2729
"NFTXRouter": "0x441b7DE4340AAa5aA86dB4DA43d9Badf7B2DAA66",
2830
"nftxUniversalRouter": "0x12156cCA1958B6591CC49EaE03a5553458a4b424",
@@ -37,6 +39,7 @@
3739
},
3840
"goerli": {
3941
"CreateVaultZap": "0xc6464CC63bC20b64e1633A0293C2C9b202F4f1b6",
42+
"DefaultProxyAdmin": "0xa0d26F02D5e94C8E9ED524875D9fce36ab4838a2",
4043
"MarketplaceUniversalRouterZap": "0x0be2D766Eef4b6a72F1fAe2e49619F013d647B8A",
4144
"MigratorZap": "0xD4B67Fe6a1258fd5e1C4dF84f3De01F62e7ac127",
4245
"NFTXEligibilityManager": "0xA4e9e286CE7A34d19f774c36844225468290C3A8",

deploy/NFTXV3.ts

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,46 @@
11
import { HardhatRuntimeEnvironment, Network } from "hardhat/types";
22
import { DeployFunction } from "hardhat-deploy/types";
3-
import { utils } from "ethers";
4-
import deployConfig from "../deployConfig";
5-
import { deployNFTXV3Core } from "./modules/FeeDistributor";
3+
import { deployVaultFactory } from "./modules/VaultFactory";
4+
import { deployUniswapV3Factory } from "./modules/UniswapV3Factory";
5+
import { deployInventoryStaking } from "./modules/InventoryStaking";
6+
import { deployUniswapV3Periphery } from "./modules/UniswapV3Periphery";
7+
import { deployNFTXRouter } from "./modules/NFTXRouter";
8+
import { deployFeeDistributor } from "./modules/FeeDistributor";
69

710
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
8-
await deployNFTXV3Core(hre);
11+
const { vaultFactory } = await deployVaultFactory({ hre });
12+
13+
const { inventoryStaking } = await deployInventoryStaking({
14+
hre,
15+
vaultFactory,
16+
});
17+
18+
const { uniswapFactory } = await deployUniswapV3Factory({
19+
hre,
20+
});
21+
22+
const { positionManager, swapRouter, quoter } =
23+
await deployUniswapV3Periphery({
24+
hre,
25+
uniswapFactory,
26+
});
27+
28+
const { nftxRouter } = await deployNFTXRouter({
29+
hre,
30+
vaultFactory,
31+
inventoryStaking,
32+
positionManager,
33+
swapRouter,
34+
quoter,
35+
});
36+
37+
const { feeDistributor } = await deployFeeDistributor({
38+
hre,
39+
nftxRouter,
40+
uniswapFactory,
41+
inventoryStaking,
42+
vaultFactory,
43+
});
944
};
1045
export default func;
1146
func.tags = ["NFTXV3"];

deploy/Zaps.ts

Lines changed: 38 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
11
import { HardhatRuntimeEnvironment, Network } from "hardhat/types";
22
import { DeployFunction } from "hardhat-deploy/types";
3-
import { getConfig, getContract } from "./utils";
3+
import * as readline from "readline";
4+
import { getConfig } from "./utils";
5+
import { deployMarketplaceZap } from "./modules/MarketplaceZap";
6+
import { deployCreateVaultZap } from "./modules/CreateVaultZap";
7+
import { deployMigratorZap } from "./modules/MigratorZap";
8+
9+
const waitForEnter = async () => {
10+
const rl = readline.createInterface({
11+
input: process.stdin,
12+
output: process.stdout,
13+
});
14+
return new Promise<void>((resolve) => {
15+
rl.question(
16+
"🚨🚨 Make sure the UniversalRouter is updated & set in deployConfig. Redeploy if UniswapV3Factory address or salt was modified 🚨🚨\n Press Enter to continue...",
17+
() => {
18+
rl.close();
19+
resolve();
20+
}
21+
);
22+
});
23+
};
424

525
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
6-
const { config, deployments, deploy, execute, deployer } = await getConfig(
7-
hre
8-
);
26+
await waitForEnter();
27+
28+
const { deployments } = await getConfig(hre);
929

1030
const vaultFactory = await deployments.get("NFTXVaultFactoryUpgradeableV3");
1131
const uniswapFactory = await deployments.get("UniswapV3FactoryUpgradeable");
@@ -15,95 +35,26 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1535
);
1636
const nftxRouter = await deployments.get("NFTXRouter");
1737

18-
const marketplaceZap = await deploy("MarketplaceUniversalRouterZap", {
19-
from: deployer,
20-
args: [
21-
vaultFactory.address,
22-
config.nftxUniversalRouter,
23-
config.permit2,
24-
inventoryStaking.address,
25-
config.WETH,
26-
],
27-
log: true,
38+
const { marketplaceZap } = await deployMarketplaceZap({
39+
hre,
40+
vaultFactory: vaultFactory.address,
41+
inventoryStaking: inventoryStaking.address,
2842
});
2943

30-
const vaultFactoryContract = await getContract(
44+
const { createVaultZap } = await deployCreateVaultZap({
3145
hre,
32-
"NFTXVaultFactoryUpgradeableV3",
33-
vaultFactory.address
34-
);
35-
const isMarketplaceZapExcludedFromFees =
36-
await vaultFactoryContract.excludedFromFees(marketplaceZap.address);
37-
if (!isMarketplaceZapExcludedFromFees) {
38-
// MarketplaceZap has in-built fee handling
39-
console.log("Setting fee exclusion for MarketplaceZap...");
40-
await execute(
41-
"NFTXVaultFactoryUpgradeableV3",
42-
{ from: deployer },
43-
"setFeeExclusion",
44-
marketplaceZap.address,
45-
true
46-
);
47-
console.log("Fee exclusion set for MarketplaceZap");
48-
}
49-
50-
const createVaultZap = await deploy("CreateVaultZap", {
51-
from: deployer,
52-
args: [
53-
nftxRouter.address,
54-
uniswapFactory.address,
55-
inventoryStaking.address,
56-
],
57-
log: true,
46+
vaultFactory: vaultFactory.address,
47+
nftxRouter: nftxRouter.address,
48+
uniswapFactory: uniswapFactory.address,
49+
inventoryStaking: inventoryStaking.address,
5850
});
5951

60-
const isCreateVaultZapExcludedFromFees =
61-
await vaultFactoryContract.excludedFromFees(createVaultZap.address);
62-
if (!isCreateVaultZapExcludedFromFees) {
63-
// CreateVaultZap doesn't deduct fees
64-
console.log("Setting fee exclusion for CreateVaultZap...");
65-
await execute(
66-
"NFTXVaultFactoryUpgradeableV3",
67-
{ from: deployer },
68-
"setFeeExclusion",
69-
createVaultZap.address,
70-
true
71-
);
72-
console.log("Fee exclusion set for CreateVaultZap");
73-
}
74-
75-
const migratorZap = await deploy("MigratorZap", {
76-
from: deployer,
77-
args: [
78-
config.WETH,
79-
config.v2VaultFactory,
80-
config.v2Inventory,
81-
config.sushiRouter,
82-
positionManager.address,
83-
vaultFactory.address,
84-
inventoryStaking.address,
85-
],
86-
log: true,
52+
const { migratorZap } = await deployMigratorZap({
53+
hre,
54+
vaultFactory: vaultFactory.address,
55+
positionManager: positionManager.address,
56+
inventoryStaking: inventoryStaking.address,
8757
});
88-
89-
const isMigratorZapExcludedFromFees =
90-
await vaultFactoryContract.excludedFromFees(migratorZap.address);
91-
if (!isMigratorZapExcludedFromFees) {
92-
// MigratorZap doesn't deduct fees
93-
console.log("Setting fee exclusion for MigratorZap in V3...");
94-
await execute(
95-
"NFTXVaultFactoryUpgradeableV3",
96-
{ from: deployer },
97-
"setFeeExclusion",
98-
migratorZap.address,
99-
true
100-
);
101-
console.log("Fee exclusion set for MigratorZap in V3");
102-
}
103-
104-
console.warn(
105-
"[NOTE!] Set fee exclusion for MigratorZap in V2 of the protocol"
106-
);
10758
};
10859
export default func;
10960
func.tags = ["Zaps"];
File renamed without changes.

deploy/individual/NFPM.ts

Lines changed: 0 additions & 98 deletions
This file was deleted.

0 commit comments

Comments
 (0)