From 853d6d7ac1d2be92db541de969c2d953f8453aa5 Mon Sep 17 00:00:00 2001 From: funderbrker Date: Fri, 29 Mar 2024 10:55:33 +0800 Subject: [PATCH 1/5] README update for setup --- protocol/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/protocol/README.md b/protocol/README.md index 52a8ccedf5..5e0fa88d30 100644 --- a/protocol/README.md +++ b/protocol/README.md @@ -38,6 +38,8 @@ The Beanstalk contract is a multi-facet proxy that implements [EIP-2535](https:/ - You'll know you've installed nodejs right if you can run `node --version`and get an ouput like: `vx.x.x` - [Yarn](https://classic.yarnpkg.com/lang/en/docs/install/) - You'll know you've installed yarn right if you can run `yarn --version` And get an output like: `x.x.x` +- Rosetta (Apple Silicon) + - You'll know you've installed Rosetta right if you can execute the solc 0.7.6 binary `.../solc-macosx-amd64-v0.7.6+commit.7338295f --version` ## Installation From 30a04c600861845e50a0dd61b679d600951caefc Mon Sep 17 00:00:00 2001 From: Brean0 Date: Mon, 8 Apr 2024 14:51:23 -0500 Subject: [PATCH 2/5] add mock price deployer task --- protocol/hardhat.config.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/protocol/hardhat.config.js b/protocol/hardhat.config.js index 7906f64425..cebe456ec3 100644 --- a/protocol/hardhat.config.js +++ b/protocol/hardhat.config.js @@ -225,6 +225,16 @@ task("deployBip39", async function () { await bipSeedGauge(); }); +task("deployBeanstalkPrice", async function () { + let json = fs.readFileSync(`./artifacts/contracts/ecosystem/price/BeanstalkPrice.sol/BeanstalkPrice.json`); + await network.provider.send("hardhat_setCode", [ + PRICE, + JSON.parse(json).deployedBytecode, + ]); + priceContract = await ethers.getContractAt('BeanstalkPrice', PRICE) + console.log("BeanstalkPrice deployed at: ", priceContract.address) +}); + task("ebip14", async function () { await ebip14(); }) From 82534d68c32efc501c7ffcf3dc9a5a0abac695a5 Mon Sep 17 00:00:00 2001 From: Brean0 Date: Mon, 8 Apr 2024 14:52:52 -0500 Subject: [PATCH 3/5] add mock price deployer --- protocol/hardhat.config.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/protocol/hardhat.config.js b/protocol/hardhat.config.js index cebe456ec3..6e4208b855 100644 --- a/protocol/hardhat.config.js +++ b/protocol/hardhat.config.js @@ -29,8 +29,8 @@ const { mintEth, getBeanstalk } = require("./utils"); -const { EXTERNAL, INTERNAL, INTERNAL_EXTERNAL, INTERNAL_TOLERANT } = require("./test/utils/balances.js"); -const { BEANSTALK, PUBLIUS, BEAN_3_CURVE, BEAN_ETH_WELL } = require("./test/utils/constants.js"); +const { BEANSTALK, PUBLIUS, BEAN_3_CURVE, PRICE } = require("./test/utils/constants.js"); +const { deployContract } = require("./scripts/contracts.js") const { to6 } = require("./test/utils/helpers.js"); //const { replant } = require("./replant/replant.js") const { task } = require("hardhat/config"); @@ -182,6 +182,17 @@ task("diamondABI", "Generates ABI file for diamond, includes all ABIs of facets" console.log("ABI written to abi/Beanstalk.json"); }); +task("deployBeanstalkPrice", async function () { + let json = fs.readFileSync(`./artifacts/contracts/ecosystem/price/BeanstalkPrice.sol/BeanstalkPrice.json`); + await network.provider.send("hardhat_setCode", [ + PRICE, + JSON.parse(json).deployedBytecode, + ]); + priceContract = await ethers.getContractAt('BeanstalkPrice', PRICE) + console.log("BeanstalkPrice deployed at: ", priceContract.address) +}); + +// BIP // task("marketplace", async function () { const owner = await impersonateBeanstalkOwner(); await mintEth(owner.address); @@ -225,15 +236,8 @@ task("deployBip39", async function () { await bipSeedGauge(); }); -task("deployBeanstalkPrice", async function () { - let json = fs.readFileSync(`./artifacts/contracts/ecosystem/price/BeanstalkPrice.sol/BeanstalkPrice.json`); - await network.provider.send("hardhat_setCode", [ - PRICE, - JSON.parse(json).deployedBytecode, - ]); - priceContract = await ethers.getContractAt('BeanstalkPrice', PRICE) - console.log("BeanstalkPrice deployed at: ", priceContract.address) -}); + +/// EBIPS /// task("ebip14", async function () { await ebip14(); From 27eeaab2f00b11c2e7cfe15d690c76b54aabc1c6 Mon Sep 17 00:00:00 2001 From: Brean0 Date: Mon, 8 Apr 2024 15:18:55 -0500 Subject: [PATCH 4/5] Update Bdv() to support dewhitelisted tokens. --- .../beanstalk/silo/SiloFacet/SiloGettersFacet.sol | 8 +++++++- protocol/hardhat.config.js | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/protocol/contracts/beanstalk/silo/SiloFacet/SiloGettersFacet.sol b/protocol/contracts/beanstalk/silo/SiloFacet/SiloGettersFacet.sol index b897da2546..e250a2ba14 100644 --- a/protocol/contracts/beanstalk/silo/SiloFacet/SiloGettersFacet.sol +++ b/protocol/contracts/beanstalk/silo/SiloFacet/SiloGettersFacet.sol @@ -6,6 +6,7 @@ pragma solidity =0.7.6; pragma experimental ABIEncoderV2; import {AppStorage, Storage, Account} from "contracts/beanstalk/AppStorage.sol"; +import {LibBeanMetaCurve} from "contracts/libraries/Curve/LibBeanMetaCurve.sol"; import {LibLegacyTokenSilo} from "contracts/libraries/Silo/LibLegacyTokenSilo.sol"; import {LibSafeMath128} from "contracts/libraries/LibSafeMath128.sol"; import {LibGerminate} from "contracts/libraries/Silo/LibGerminate.sol"; @@ -148,7 +149,12 @@ contract SiloGettersFacet is ReentrancyGuard { view returns (uint256 _bdv) { - _bdv = LibTokenSilo.beanDenominatedValue(token, amount); + // future dewhitelisted tokens should be added here. + if(token == C.CURVE_BEAN_METAPOOL) { + return LibBeanMetaCurve.bdv(amount); + } else { + return LibTokenSilo.beanDenominatedValue(token, amount); + } } //////////////////////// UTILTIES //////////////////////// diff --git a/protocol/hardhat.config.js b/protocol/hardhat.config.js index 6e4208b855..f917e0e8cd 100644 --- a/protocol/hardhat.config.js +++ b/protocol/hardhat.config.js @@ -192,6 +192,11 @@ task("deployBeanstalkPrice", async function () { console.log("BeanstalkPrice deployed at: ", priceContract.address) }); +task("testPrice", async function () { + priceContract = await ethers.getContractAt('BeanstalkPrice', PRICE) + console.log("Price: ", (await priceContract.price()).toString()) +}); + // BIP // task("marketplace", async function () { const owner = await impersonateBeanstalkOwner(); From 67ae96502d8772cb67b05382c4bb8229036614b4 Mon Sep 17 00:00:00 2001 From: Brean0 Date: Mon, 8 Apr 2024 15:20:04 -0500 Subject: [PATCH 5/5] deployBip39 -> deploy seedGauge --- protocol/hardhat.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/hardhat.config.js b/protocol/hardhat.config.js index f917e0e8cd..c729ddb5da 100644 --- a/protocol/hardhat.config.js +++ b/protocol/hardhat.config.js @@ -237,7 +237,7 @@ task("beanstalkAdmin", async function () { await mockBeanstalkAdmin(); }); -task("deployBip39", async function () { +task("deploySeedGauge", async function () { await bipSeedGauge(); });