forked from powswap/powswap-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSushiMaker.js
41 lines (32 loc) · 1.26 KB
/
SushiMaker.js
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
const { WETH, Token } = require("@sushiswap/sdk")
module.exports = async function ({ ethers: { getNamedSigner }, getNamedAccounts, deployments }) {
const { deploy } = deployments
const { deployer, dev } = await getNamedAccounts()
const chainId = await getChainId()
const factory = await ethers.getContract("UniswapV2Factory")
const bar = await ethers.getContract("SushiBar")
const sushi = await ethers.getContract("SushiToken")
let wethAddress;
if (chainId === '31337') {
wethAddress = (await deployments.get("WETH9Mock")).address
} else if (chainId === '10001') {
wethAddress = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'
} else if (chainId in WETH) {
wethAddress = WETH[chainId].address
} else {
throw Error("No WETH!")
}
await deploy("SushiMaker", {
from: deployer,
args: [factory.address, bar.address, sushi.address, wethAddress],
log: true,
deterministicDeployment: false
})
const maker = await ethers.getContract("SushiMaker")
if (await maker.owner() !== dev) {
console.log("Setting maker owner")
await (await maker.transferOwnership(dev, true, false)).wait()
}
}
module.exports.tags = ["SushiMaker"]
module.exports.dependencies = ["UniswapV2Factory", "UniswapV2Router02", "SushiBar", "SushiToken"]