Skip to content

Commit

Permalink
feat: separate deploy ui script
Browse files Browse the repository at this point in the history
  • Loading branch information
Space-Bean committed Jul 22, 2024
1 parent 36cfc6b commit 3c3995f
Showing 1 changed file with 56 additions and 24 deletions.
80 changes: 56 additions & 24 deletions protocol/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,26 @@ const { upgradeWithNewFacets } = require("./scripts/diamond");
const { BEANSTALK, PUBLIUS, BEAN_3_CURVE, PRICE } = require("./test/utils/constants.js");
const { task } = require("hardhat/config");
const { TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS } = require("hardhat/builtin-tasks/task-names");
const { bipNewSilo, bipMorningAuction, bipSeedGauge, bipMigrateUnripeBeanEthToBeanSteth } = require("./scripts/bips.js");
const { ebip9, ebip10, ebip11, ebip13, ebip14, ebip15, ebip16, ebip17 } = require("./scripts/ebips.js");
const {
bipNewSilo,
bipMorningAuction,
bipSeedGauge,
bipMigrateUnripeBeanEthToBeanSteth
} = require("./scripts/bips.js");
const {
ebip9,
ebip10,
ebip11,
ebip13,
ebip14,
ebip15,
ebip16,
ebip17
} = require("./scripts/ebips.js");

const { finishWstethMigration } = require("./scripts/beanWstethMigration.js");
const { deployBasinV1_1Upgrade } = require("./scripts/basinV1_1.js");
const { getWellContractAt } = require("./utils/well.js");
const { bipMigrateUnripeBeanEthToBeanSteth } = require("./scripts/bips.js");
const { impersonateWsteth, impersonateBean } = require("./scripts/impersonate.js");
const { deployPriceContract } = require("./scripts/price.js");

Expand All @@ -57,11 +70,20 @@ task("buyBeans")
await mintUsdc(PUBLIUS, args.amount);
const signer = await impersonateSigner(PUBLIUS);
await (await getUsdc()).connect(signer).approve(BEAN_3_CURVE, ethers.constants.MaxUint256);
const txn = await (await getBeanMetapool()).connect(signer).exchange_underlying("2", "0", args.amount, "0");
const txn = await (await getBeanMetapool())
.connect(signer)
.exchange_underlying("2", "0", args.amount, "0");
const result = await txn.wait();
console.log("Done", result);
});

task("tryPrice", async function () {
const priceC = await ethers.getContractAt(
"UsdOracle",
"0x3E855Fa86075F506bAdb4d18eFe155eC73e67dB0"
);
console.log(await priceC.getUsdTokenPrice("0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"));
});
task("sellBeans")
.addParam("amount", "The amount of Beans to sell")
.setAction(async (args) => {
Expand Down Expand Up @@ -103,13 +125,13 @@ task("sunrise", async function () {
});

task("sunrise2", async function () {
const lastTimestamp = (await ethers.provider.getBlock('latest')).timestamp;
const hourTimestamp = parseInt(lastTimestamp/3600 + 1) * 3600
await network.provider.send("evm_setNextBlockTimestamp", [hourTimestamp])
const lastTimestamp = (await ethers.provider.getBlock("latest")).timestamp;
const hourTimestamp = parseInt(lastTimestamp / 3600 + 1) * 3600;
await network.provider.send("evm_setNextBlockTimestamp", [hourTimestamp]);

season = await ethers.getContractAt('SeasonFacet', BEANSTALK);
season = await ethers.getContractAt("SeasonFacet", BEANSTALK);
await season.sunrise();
})
});

task("getTime", async function () {
this.season = await ethers.getContractAt("SeasonFacet", BEANSTALK);
Expand Down Expand Up @@ -149,12 +171,12 @@ task("diamondABI", "Generates ABI file for diamond, includes all ABIs of facets"
const files = glob.sync(pattern);
if (module == "silo") {
// Manually add in libraries that emit events
files.push("contracts/libraries/Silo/LibWhitelist.sol")
files.push("contracts/libraries/LibGauge.sol")
files.push("contracts/libraries/Silo/LibLegacyTokenSilo.sol")
files.push("contracts/libraries/Silo/LibGerminate.sol")
files.push("contracts/libraries/Silo/LibWhitelistedTokens.sol")
files.push("contracts/libraries/Minting/LibWellMinting.sol")
files.push("contracts/libraries/Silo/LibWhitelist.sol");
files.push("contracts/libraries/LibGauge.sol");
files.push("contracts/libraries/Silo/LibLegacyTokenSilo.sol");
files.push("contracts/libraries/Silo/LibGerminate.sol");
files.push("contracts/libraries/Silo/LibWhitelistedTokens.sol");
files.push("contracts/libraries/Minting/LibWellMinting.sol");
}
files.forEach((file) => {
const facetName = getFacetName(file);
Expand Down Expand Up @@ -229,39 +251,49 @@ task("deployWstethMigration", async function () {
await bipMigrateUnripeBeanEthToBeanSteth();
});

/// EBIPS ///
task("UI-deployWstethMigration", async function () {
await impersonateBean();
wsteth = await ethers.getContractAt("MockWsteth", "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0");
const stethPerWsteth = await wsteth.stEthPerToken();
await impersonateWsteth();
await wsteth.setStEthPerToken(stethPerWsteth);
await bipMigrateUnripeBeanEthToBeanSteth(true, undefined, true, undefined);
await finishWstethMigration(undefined, true);
});

/// EBIPS ///

task("ebip17", async function () {
await ebip17();
})
});

task("ebip16", async function () {
await ebip16();
})
});

task("ebip15", async function () {
await ebip15();
})
});

task("ebip14", async function () {
await ebip14();
})
});

task("ebip13", async function () {
await ebip13();
})
});

task("ebip11", async function () {
await ebip11();
})
});

task("ebip10", async function () {
await ebip10();
})
});

task("ebip9", async function () {
await ebip9();
})
});

//////////////////////// SUBTASK CONFIGURATION ////////////////////////

Expand Down

0 comments on commit 3c3995f

Please sign in to comment.