diff --git a/protocol/contracts/libraries/LibLockedUnderlying.sol b/protocol/contracts/libraries/LibLockedUnderlying.sol index 9db9ebc11a..3dfd5baa16 100644 --- a/protocol/contracts/libraries/LibLockedUnderlying.sol +++ b/protocol/contracts/libraries/LibLockedUnderlying.sol @@ -5,7 +5,6 @@ pragma solidity ^0.8.20; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {LibRedundantMath256} from "contracts/libraries/LibRedundantMath256.sol"; import {AppStorage, LibAppStorage} from "./LibAppStorage.sol"; -import {console} from "forge-std/console.sol"; /** * @title LibLockedUnderlying @@ -27,9 +26,6 @@ library LibLockedUnderlying { uint256 recapPercentPaid ) external view returns (uint256 lockedUnderlying) { AppStorage storage s = LibAppStorage.diamondStorage(); - console.log("getLockedUnderlying"); - console.log(s.sys.silo.unripeSettings[unripeToken].balanceOfUnderlying); - console.log(getPercentLockedUnderlying(unripeToken, recapPercentPaid)); return s .sys @@ -67,7 +63,6 @@ library LibLockedUnderlying { uint256 recapPercentPaid ) private view returns (uint256 percentLockedUnderlying) { uint256 unripeSupply = IERC20(unripeToken).totalSupply().div(DECIMALS); - console.log(unripeSupply); if (unripeSupply < 1_000_000) return 0; // If < 1_000_000 Assume all supply is unlocked. if (unripeSupply > 90_000_000) { if (recapPercentPaid > 0.1e6) { diff --git a/protocol/contracts/libraries/LibUnripe.sol b/protocol/contracts/libraries/LibUnripe.sol index 268866ee30..731ffaa697 100644 --- a/protocol/contracts/libraries/LibUnripe.sol +++ b/protocol/contracts/libraries/LibUnripe.sol @@ -12,7 +12,6 @@ import {Call, IWell} from "contracts/interfaces/basin/IWell.sol"; import {IWellFunction} from "contracts/interfaces/basin/IWellFunction.sol"; import {LibLockedUnderlying} from "./LibLockedUnderlying.sol"; import {LibFertilizer} from "./LibFertilizer.sol"; -import {console} from "forge-std/console.sol"; /** * @title LibUnripe @@ -206,7 +205,6 @@ library LibUnripe { if (totalUsdNeeded == 0) { return 1e6; // if zero usd needed, full recap has happened } - console.log("total usd needed:", totalUsdNeeded); return s.sys.fert.recapitalized.mul(DECIMALS).div(totalUsdNeeded); } diff --git a/protocol/contracts/libraries/Minting/LibWellMinting.sol b/protocol/contracts/libraries/Minting/LibWellMinting.sol index f3df1a9b04..2dd38f958a 100644 --- a/protocol/contracts/libraries/Minting/LibWellMinting.sol +++ b/protocol/contracts/libraries/Minting/LibWellMinting.sol @@ -232,6 +232,10 @@ library LibWellMinting { try IInstantaneousPump(pumps[0].target).readInstantaneousReserves(well, pumps[0].data) returns (uint[] memory instReserves) { + // if well is not initialized, return 0. + if (instReserves.length == 0) { + return 0; + } // well, reserves, snapshot, lookback (int256 deltaB, , , ) = getDeltaBInfoFromWell(well, instReserves, new bytes(0), 0); return (deltaB); diff --git a/protocol/test/foundry/silo/Oracle.t.sol b/protocol/test/foundry/silo/Oracle.t.sol index 306a9cf326..869ec83954 100644 --- a/protocol/test/foundry/silo/Oracle.t.sol +++ b/protocol/test/foundry/silo/Oracle.t.sol @@ -175,23 +175,20 @@ contract OracleTest is TestHelper { _ethChainlinkOracle, _ethTimeout, _xEthChainlinkOracle, - _xEthTimeout, - _token + _xEthTimeout ); ( address ethChainlinkOracle, uint256 ethTimeout, address xEthChainlinkOracle, - uint256 xEthTimeout, - address token + uint256 xEthTimeout ) = deployedOracle.decodeData(data); assertEq(ethChainlinkOracle, _ethChainlinkOracle); assertEq(ethTimeout, _ethTimeout); assertEq(xEthChainlinkOracle, _xEthChainlinkOracle); assertEq(xEthTimeout, _xEthTimeout); - assertEq(token, _token); } function testGetOracleImplementationForToken() public { diff --git a/protocol/test/foundry/sun/Gauge.t.sol b/protocol/test/foundry/sun/Gauge.t.sol index 343825f828..be470a2651 100644 --- a/protocol/test/foundry/sun/Gauge.t.sol +++ b/protocol/test/foundry/sun/Gauge.t.sol @@ -291,7 +291,7 @@ contract GaugeTest is TestHelper { uint256 totalUnderlying = bs.getTotalUnderlying(C.UNRIPE_BEAN); assertEq( bs.getLockedBeansUnderlyingUnripeBean(), - (totalUnderlying * 0.4363321054081788e18) / 1e18 + (totalUnderlying * 0.4587658967980477e18) / 1e18 ); } @@ -314,7 +314,7 @@ contract GaugeTest is TestHelper { burntBeans = bound(burntBeans, 0, 10000000e6 - 1e6); uint256 lockedBeansPercent = burnBeansAndCheckLockedBeans(burntBeans); // 1e-12% precision. - assertApproxEqRel(lockedBeansPercent, 0.4587658968e18, 1e6); // see {LibLockedUnderlying} + assertApproxEqRel(lockedBeansPercent, 0.458765896798e18, 1e6); // see {LibLockedUnderlying} } function test_lockedBeansSupply5Million(uint256 burntBeans) public { diff --git a/protocol/test/foundry/utils/BasinDeployer.sol b/protocol/test/foundry/utils/BasinDeployer.sol index 7823eefa80..c54c711fd8 100644 --- a/protocol/test/foundry/utils/BasinDeployer.sol +++ b/protocol/test/foundry/utils/BasinDeployer.sol @@ -10,9 +10,10 @@ import {C} from "contracts/C.sol"; ////// INTERFACES ////// import {Call, IAquifer} from "contracts/interfaces/basin/IAquifer.sol"; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import {MockPump} from "contracts/mocks/well/MockPump.sol"; /** - * @title TestHelper + * @title BasinDeployer * @author Brean * @notice Test helper contract for Beanstalk tests. */ @@ -216,6 +217,9 @@ contract BasinDeployer is Utils { address[2] memory wellAddressAndNonBeanToken, address pump ) internal returns (address) { + // initialize pump with 0 values. + uint256[] memory _init0 = new uint256[](2); + MockPump(pump).updateNoBytes(wellAddressAndNonBeanToken[0], _init0); return deployWellAtAddressNoData( wellAddressAndNonBeanToken[0],