Skip to content

Commit

Permalink
chore: use core-sdk in tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewlilley committed Oct 29, 2021
1 parent 9c83b67 commit e08b6b6
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions tasks/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { task } = require("hardhat/config")

const { ethers: { constants: { MaxUint256 }}, utils: { defaultAbiCoder }} = require("ethers")
const { MINICHEF_ADDRESS } = require("@sushiswap/sdk")
const { MINICHEF_ADDRESS } = require("@sushiswap/core-sdk")

const fs = require("fs")

Expand Down Expand Up @@ -299,44 +299,44 @@ task("deploy:complex-rewarder", "Deploy ComplexRewarder")
}
});

task("deploy:clone-rewarder", "Deploy CloneRewarder")
.addParam("rewardToken", "Reward Token")
.addParam("lpToken", "LP Token")
.addOptionalParam("rewardRate", "Reward Rate", 0)
.setAction(async function ({ rewardToken, lpToken, rewardRate }, { getChainId, deployments }, runSuper) {
const { deployer, dev } = await getNamedAccounts();
const { deploy } = deployments;
// task("deploy:clone-rewarder", "Deploy CloneRewarder")
// .addParam("rewardToken", "Reward Token")
// .addParam("lpToken", "LP Token")
// .addOptionalParam("rewardRate", "Reward Rate", 0)
// .setAction(async function ({ rewardToken, lpToken, rewardRate }, { getChainId, deployments }, runSuper) {
// const { deployer, dev } = await getNamedAccounts();
// const { deploy } = deployments;

const chainId = await getChainId();
// const chainId = await getChainId();

let miniChefAddress;
// let miniChefAddress;

if (chainId === "31337") {
miniChefAddress = (await deployments.get("MiniChefV2")).address;
} else if (chainId in MINICHEF_ADDRESS) {
miniChefAddress = MINICHEF_ADDRESS[chainId];
} else {
throw Error("No MINICHEF!");
}
// if (chainId === "31337") {
// miniChefAddress = (await deployments.get("MiniChefV2")).address;
// } else if (chainId in MINICHEF_ADDRESS) {
// miniChefAddress = MINICHEF_ADDRESS[chainId];
// } else {
// throw Error("No MINICHEF!");
// }

const { address } = await deploy("CloneRewarderTime", {
from: deployer,
args: [miniChefAddress],
log: true,
deterministicDeployment: false,
});
// const { address } = await deploy("CloneRewarderTime", {
// from: deployer,
// args: [miniChefAddress],
// log: true,
// deterministicDeployment: false,
// });

console.log(`CloneRewarder deployed at ${address}`)
// console.log(`CloneRewarder deployed at ${address}`)

const cloneRewarder = await ethers.getContract("CloneRewarderTime");
// const cloneRewarder = await ethers.getContract("CloneRewarderTime");

const data = defaultAbiCoder.encode(['address', 'address', 'uint256', 'address'], [rewardToken, dev, rewardRate, lpToken])
// const data = defaultAbiCoder.encode(['address', 'address', 'uint256', 'address'], [rewardToken, dev, rewardRate, lpToken])

await (await cloneRewarder.init(data)).wait()
// await (await cloneRewarder.init(data)).wait()

if ((await complexRewarder.owner()) !== dev) {
console.log("Transfer ownership of CloneRewarderTime to dev");
await (await cloneRewarder.transferOwnership(dev, true, false)).wait();
}
});
// if ((await complexRewarder.owner()) !== dev) {
// console.log("Transfer ownership of CloneRewarderTime to dev");
// await (await cloneRewarder.transferOwnership(dev, true, false)).wait();
// }
// });

0 comments on commit e08b6b6

Please sign in to comment.