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

Brendan review remed #775

Merged
merged 26 commits into from
Feb 14, 2024
226 changes: 197 additions & 29 deletions protocol/abi/Beanstalk.json
Original file line number Diff line number Diff line change
Expand Up @@ -5416,6 +5416,30 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOfFinishedGerminatingStalkAndRoots",
"outputs": [
{
"internalType": "uint256",
"name": "gStalk",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "gRoots",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -5459,6 +5483,30 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOfNewAndPartiallyGerminatedStalk",
"outputs": [
{
"internalType": "uint256",
"name": "paritallyGerminatedStalk",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "newlyGerminatedStalk",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -5666,13 +5714,18 @@
{
"inputs": [
{
"internalType": "uint32",
"name": "season",
"type": "uint32"
"internalType": "address",
"name": "token",
"type": "address"
}
],
"name": "getGerminatingRootsForSeason",
"name": "getEvenGerminating",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "",
Expand All @@ -5690,8 +5743,13 @@
"type": "uint32"
}
],
"name": "getGerminatingStalkForSeason",
"name": "getGerminatingStalkAndRootsForSeason",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "",
Expand Down Expand Up @@ -5763,6 +5821,25 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
}
],
"name": "getLegacySeedsPerToken",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -5799,6 +5876,24 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getYoungAndMatureGerminatingTotalStalk",
"outputs": [
{
"internalType": "uint256",
"name": "partiallyGerminatedStalk",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "newlyGerminatedStalk",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
Expand All @@ -5807,8 +5902,13 @@
"type": "address"
}
],
"name": "getSeedsPerToken",
"name": "getOddGerminating",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "",
Expand Down Expand Up @@ -5856,6 +5956,44 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
}
],
"name": "getTotalGerminatingAmount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
}
],
"name": "getTotalGerminatingBdv",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getTotalGerminatingStalk",
Expand Down Expand Up @@ -6166,6 +6304,12 @@
"name": "account",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
Expand Down Expand Up @@ -7025,19 +7169,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getBeanEthTwaUsdLiquidity",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getBeanGaugePointsPerBdv",
Expand Down Expand Up @@ -7147,6 +7278,19 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getGrownStalkIssuedPerGp",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getGrownStalkIssuedPerSeason",
Expand Down Expand Up @@ -7239,11 +7383,11 @@
},
{
"inputs": [],
"name": "getStalkPerGp",
"name": "getTotalBdv",
"outputs": [
{
"internalType": "uint256",
"name": "",
"name": "totalBdv",
"type": "uint256"
}
],
Expand All @@ -7252,11 +7396,11 @@
},
{
"inputs": [],
"name": "getTotalBdv",
"name": "getTotalUsdLiquidity",
"outputs": [
{
"internalType": "uint256",
"name": "totalBdv",
"name": "totalLiquidity",
"type": "uint256"
}
],
Expand All @@ -7265,20 +7409,26 @@
},
{
"inputs": [],
"name": "getTotalUsdLiquidity",
"name": "getTotalWeightedUsdLiquidity",
"outputs": [
{
"internalType": "uint256",
"name": "",
"name": "totalWeightedLiquidity",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getWeightedBeanEthTwaUsdLiquidity",
"inputs": [
{
"internalType": "address",
"name": "well",
"type": "address"
}
],
"name": "getTwaLiquidityForWell",
"outputs": [
{
"internalType": "uint256",
Expand All @@ -7290,8 +7440,14 @@
"type": "function"
},
{
"inputs": [],
"name": "getWeightedTotalLiquidity",
"inputs": [
{
"internalType": "address",
"name": "well",
"type": "address"
}
],
"name": "getWeightedTwaLiquidityForWell",
"outputs": [
{
"internalType": "uint256",
Expand Down Expand Up @@ -7631,6 +7787,18 @@
"name": "season",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "well",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
Expand Down
2 changes: 1 addition & 1 deletion protocol/contracts/beanstalk/AppStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ contract Storage {
* uint256 percentOfDepositedBdv
* ) external view returns (uint256);
* ```
* @param gpSelector The encoded liquidityWeight function selector for the token that pertains to
* @param lwSelector The encoded liquidityWeight function selector for the token that pertains to
* an external view Beanstalk function with the following signature `function liquidityWeight()`
* @param optimalPercentDepositedBdv The target percentage of the total LP deposited BDV for this token. 6 decimal precision.
* @param gaugePoints the amount of Gauge points this LP token has in the LP Gauge. Only used for LP whitelisted assets.
Expand Down
3 changes: 3 additions & 0 deletions protocol/contracts/beanstalk/silo/BDVFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import "contracts/libraries/Well/LibWellBdv.sol";
contract BDVFacet {
using SafeMath for uint256;

/**
* @dev Returns the BDV of a given `amount` of Bean:3Crv LP tokens.
*/
function curveToBDV(uint256 amount) public view returns (uint256) {
return LibBeanMetaCurve.bdv(amount);
}
Expand Down
4 changes: 1 addition & 3 deletions protocol/contracts/beanstalk/silo/ConvertFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ contract ConvertFacet is ReentrancyGuard {
while ((i < stems.length) && (a.active.tokens < maxTokens)) {
// skip any stems that are germinating, due to the ability to
// circumvent the germination process.
// subtract amount from maxTokens.
if (germStem.germinatingStem <= stems[i]) {
maxTokens = maxTokens <= amounts[i] ? 0 : maxTokens.sub(amounts[i]);
i++;
continue;
}
Expand Down Expand Up @@ -247,4 +245,4 @@ contract ConvertFacet is ReentrancyGuard {
LibTokenSilo.Transfer.emitTransferSingle
);
}
}
}
Loading
Loading