Skip to content

Commit c834e06

Browse files
authored
Merge pull request #296 from Midas-Protocol/feat/more-beefy4626-assets
testing different cake LP tokens with the BeefyERC4626
2 parents be12ca5 + 7d8c326 commit c834e06

15 files changed

+263
-240
lines changed

contracts/compound/strategies/BeefyERC4626.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ contract BeefyERC4626 is MidasERC4626 {
9595

9696
// takes as argument the internal ERC4626 shares to redeem
9797
// returns the external BeefyVault shares to withdraw
98-
function convertToBeefyVaultShares(uint256 shares) public returns (uint256) {
98+
function convertToBeefyVaultShares(uint256 shares) public view returns (uint256) {
9999
uint256 supply = totalSupply;
100100
return supply == 0 ? shares : shares.mulDivUp(beefyVault.balanceOf(address(this)), supply);
101101
}

contracts/compound/strategies/MidasERC4626.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ abstract contract MidasERC4626 is ERC4626, Ownable, Pausable {
7676
address receiver,
7777
address owner
7878
) public override returns (uint256 assets) {
79-
uint256 supply = totalSupply;
8079
if (msg.sender != owner) {
8180
uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.
8281

contracts/test/AlpacaERC4626Test.t.sol

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,8 @@ contract AlpacaERC4626Test is BaseTest {
247247
assertEq(alpacaERC4626.balanceOf(address(this)), erc4626BalBefore - expectedErc4626SharesNeeded, "!erc4626 supply");
248248

249249
// Test that the ERC4626 holds the expected amount of beefy shares
250-
assertEq(
251-
mockVault.balanceOf(address(alpacaERC4626)),
252-
beefyShares - expectedBeefySharesNeeded,
250+
assertTrue(
251+
diff(mockVault.balanceOf(address(alpacaERC4626)), beefyShares - expectedBeefySharesNeeded) <= 1,
253252
"!beefy share balance"
254253
);
255254

@@ -281,9 +280,8 @@ contract AlpacaERC4626Test is BaseTest {
281280
assertEq(alpacaERC4626.balanceOf(address(1)), erc4626BalBefore - expectedErc4626SharesNeeded, "!erc4626 supply");
282281

283282
// Test that the ERC4626 holds the expected amount of beefy shares
284-
assertEq(
285-
mockVault.balanceOf(address(alpacaERC4626)),
286-
beefyShares - expectedBeefySharesNeeded,
283+
assertTrue(
284+
diff(mockVault.balanceOf(address(alpacaERC4626)), beefyShares - expectedBeefySharesNeeded) <= 1,
287285
"!beefy share balance"
288286
);
289287

0 commit comments

Comments
 (0)