-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdeploy_topup.ts
72 lines (66 loc) · 1.95 KB
/
deploy_topup.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// When running the script with `npx hardhat run <script>` you'll find the Hardhat
// Runtime Environment's members available in the global scope.
import { ethers } from "hardhat";
const {
UPKEEP_ID,
KEEPER_REGISTRY_V2_1,
DAI_TOKEN,
LINK_TOKEN,
NETWORK_PAYMENT_ADAPTER,
DAI_USD_PRICE_FEED,
LINK_USD_PRICE_FEED,
SWAP_ROUTER_V3,
SLIPPAGE_TOLERANCE_BPS,
UNISWAP_PATH,
} = process.env;
async function main() {
// Hardhat always runs the compile task when running scripts with its command
// line interface.
//
// If this script is run directly using `node` you may want to call compile
// manually to make sure everything is compiled
// await hre.run('compile');
if (
!UPKEEP_ID ||
!KEEPER_REGISTRY_V2_1 ||
!DAI_TOKEN ||
!LINK_TOKEN ||
!NETWORK_PAYMENT_ADAPTER ||
!DAI_USD_PRICE_FEED ||
!LINK_USD_PRICE_FEED ||
!SWAP_ROUTER_V3 ||
!SLIPPAGE_TOLERANCE_BPS ||
!UNISWAP_PATH
) {
throw new Error("Missing required env variable(s)!");
}
const pathElements = UNISWAP_PATH.split(",").map((el) => el.trim());
const pathEncoded = ethers.utils.solidityPack(
pathElements.map((_, idx) => (idx % 2 === 0 ? "address" : "uint24")),
pathElements
);
const DssVestTopUp = await ethers.getContractFactory("DssVestTopUp");
const topUp = await DssVestTopUp.deploy(
UPKEEP_ID,
KEEPER_REGISTRY_V2_1,
DAI_TOKEN,
LINK_TOKEN,
NETWORK_PAYMENT_ADAPTER,
DAI_USD_PRICE_FEED,
LINK_USD_PRICE_FEED,
SWAP_ROUTER_V3,
SLIPPAGE_TOLERANCE_BPS,
pathEncoded
);
await topUp.deployed();
console.log("DssVestTopUp deployed to:", topUp.address);
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});