Skip to content

Commit

Permalink
chore: tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewlilley committed Feb 21, 2022
1 parent f788772 commit fadc44c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
9 changes: 6 additions & 3 deletions tasks/cpp-deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ChainId, WETH9_ADDRESS, USDC_ADDRESS } from "@sushiswap/core-sdk";
import { task, types } from "hardhat/config";
import { ConstantProductPoolFactory, MasterDeployer } from "../types";

task("cpp:deploy", "Constant Product Pool deploy")
task("cpp-deploy", "Constant Product Pool deploy")
.addOptionalParam(
"tokenA",
"Token A",
Expand All @@ -21,15 +21,18 @@ task("cpp:deploy", "Constant Product Pool deploy")
.setAction(async function ({ tokenA, tokenB, fee, twap, verify }, { ethers, run }) {
const masterDeployer = await ethers.getContract<MasterDeployer>("MasterDeployer");

const constantProductPoolFactory = await ethers.getContract<ConstantProductPoolFactory>("ConstantProductPoolFactory");
const constantProductPoolFactory = await ethers.getContract<ConstantProductPoolFactory>(
"ConstantProductPoolFactory"
);

const deployData = ethers.utils.defaultAbiCoder.encode(
["address", "address", "uint256", "bool"],
[...[tokenA, tokenB].sort(), fee, twap]
);

console.log("1", [...[tokenA, tokenB].sort(), fee, twap]);
const contractTransaction = await masterDeployer.deployPool(constantProductPoolFactory.address, deployData);

console.log("2");
if (!verify) return;

const contractReceipt = await contractTransaction.wait(5);
Expand Down
3 changes: 2 additions & 1 deletion tasks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ import "./cpp-verify";
import "./erc20-allowance";
import "./erc20-approve";
import "./strategy";
import "./whitelist";
import "./whitelist-factory";
import "./whitelist-router";
14 changes: 14 additions & 0 deletions tasks/whitelist-factory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { BENTOBOX_ADDRESS } from "@sushiswap/core-sdk";
import { task } from "hardhat/config";
import { MasterDeployer } from "../types";

task("whitelist-factory", "Whitelist Router on BentoBox").setAction(async function (_, { ethers, getChainId }) {
const masterDeployer = await ethers.getContract<MasterDeployer>("MasterDeployer");

const constantProductPoolFactory = await ethers.getContract<MasterDeployer>("ConstantProductPoolFactory");

if (!(await masterDeployer.whitelistedFactories(constantProductPoolFactory.address))) {
await masterDeployer.addToWhitelist(constantProductPoolFactory.address);
console.log("added cpp factory");
}
});
File renamed without changes.

0 comments on commit fadc44c

Please sign in to comment.