Skip to content

Commit

Permalink
safeMath
Browse files Browse the repository at this point in the history
  • Loading branch information
Brean0 committed Aug 2, 2023
1 parent ce8d3e4 commit e7785d0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions protocol/contracts/ecosystem/price/BeanstalkPrice.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;

import "./CurvePrice.sol";
import {WellPrice, C} from "./WellPrice.sol";
import {WellPrice, C, SafeMath} from "./WellPrice.sol";

contract BeanstalkPrice is CurvePrice, WellPrice {

using SafeMath for uint256;

struct Prices {
uint256 price;
Expand All @@ -20,13 +20,11 @@ contract BeanstalkPrice is CurvePrice, WellPrice {
p.ps[0] = getCurve();
p.ps[1] = getConstantProductWell(C.BEAN_ETH_WELL);



for (uint256 i = 0; i < p.ps.length; i++) {
p.price += p.ps[i].price * p.ps[i].liquidity;
p.price += p.ps[i].price.mul(p.ps[i].liquidity);
p.liquidity += p.ps[i].liquidity;
p.deltaB += p.ps[i].deltaB;
}
p.price /= p.liquidity;
p.price = p.price.div(p.liquidity);
}
}

0 comments on commit e7785d0

Please sign in to comment.