Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EBIP-10 #671

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions protocol/contracts/libraries/Convert/LibWellConvert.sol
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ library LibWellConvert {
(uint256 maxBeans, uint beanIndex) = _beansToPeg(well);
require(maxBeans > 0, "Convert: P must be >= 1.");
beansConverted = beans > maxBeans ? maxBeans : beans;
IERC20[] memory tokens = IWell(well).tokens();
C.bean().transfer(well, beans);
C.bean().transfer(well, beansConverted);
lp = IWell(well).sync(
address(this),
minLP
Expand Down
22 changes: 18 additions & 4 deletions protocol/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require("solidity-coverage");
require("hardhat-tracer");
require("@openzeppelin/hardhat-upgrades");
require("dotenv").config();
require("hardhat-contract-sizer");
require("@nomiclabs/hardhat-etherscan");

// BIP 38 migration ----
const { bipMigrateUnripeBean3CrvToBeanEth } = require("./scripts/bips.js");
Expand All @@ -27,16 +27,17 @@ const {
getBean,
getBeanstalkAdminControls,
impersonateBeanstalkOwner,
mintEth
mintEth,
getBeanstalk
} = require("./utils");
const { EXTERNAL, INTERNAL, INTERNAL_EXTERNAL, INTERNAL_TOLERANT } = require("./test/utils/balances.js");
const { BEANSTALK, PUBLIUS, BEAN_3_CURVE } = require("./test/utils/constants.js");
const { BEANSTALK, PUBLIUS, BEAN_3_CURVE, BEAN_ETH_WELL } = require("./test/utils/constants.js");
const { to6 } = require("./test/utils/helpers.js");
//const { replant } = require("./replant/replant.js")
const { task } = require("hardhat/config");
const { TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS } = require("hardhat/builtin-tasks/task-names");
const { bipNewSilo, mockBeanstalkAdmin } = require("./scripts/bips.js");
const { ebip9 } = require("./scripts/ebips.js");
const { ebip9, ebip10 } = require("./scripts/ebips.js");

//////////////////////// UTILITIES ////////////////////////

Expand Down Expand Up @@ -102,6 +103,15 @@ task("sunrise", async function () {
await beanstalkAdmin.forceSunrise();
});

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])

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

task("getTime", async function () {
this.season = await ethers.getContractAt("SeasonFacet", BEANSTALK);
console.log("Current time: ", await this.season.time());
Expand Down Expand Up @@ -212,6 +222,10 @@ task("migrate-bip38", async function () {
await finishBeanEthMigration();
});

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

task("ebip9", async function () {
await ebip9();
})
Expand Down
19 changes: 18 additions & 1 deletion protocol/scripts/ebips.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,22 @@ async function ebip9(mock = true, account = undefined) {
});
}

async function ebip10(mock = true, account = undefined) {
if (account == undefined) {
account = await impersonateBeanstalkOwner();
await mintEth(account.address);
}

await upgradeWithNewFacets({
diamondAddress: BEANSTALK,
facetNames: ["ConvertFacet"],
bip: false,
object: !mock,
verbose: true,
account: account
});
}

async function bipDiamondCut(name, dc, account, mock = true) {
beanstalk = await getBeanstalk();
if (mock) {
Expand All @@ -93,4 +109,5 @@ async function bipDiamondCut(name, dc, account, mock = true) {
exports.ebip6 = ebip6;
exports.ebip7 = ebip7;
exports.ebip8 = ebip8;
exports.ebip9 = ebip9;
exports.ebip9 = ebip9;
exports.ebip10 = ebip10;