-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1669 from morpho-org/fix/upgrade-tests
Fix upgrade tests
- Loading branch information
Showing
9 changed files
with
82 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
pragma solidity ^0.8.0; | ||
|
||
import {SafeTransferLib, ERC20} from "@rari-capital/solmate/src/utils/SafeTransferLib.sol"; | ||
|
||
import {PercentageMath} from "@morpho-dao/morpho-utils/math/PercentageMath.sol"; | ||
import {Math} from "@morpho-dao/morpho-utils/math/Math.sol"; | ||
import {WadRayMath} from "@morpho-dao/morpho-utils/math/WadRayMath.sol"; | ||
|
||
import {BaseConfig} from "config/BaseConfig.sol"; | ||
import "@forge-std/console.sol"; | ||
import "@forge-std/Test.sol"; | ||
|
||
contract ProdTest is Test, BaseConfig { | ||
// Show block number for reproducibility. | ||
function testShowBlockNumber() public view { | ||
console.log("Testing at block", block.number); | ||
} | ||
|
||
// Needed because AAVE packs the balance struct. | ||
function deal( | ||
address underlying, | ||
address user, | ||
uint256 amount | ||
) internal override { | ||
if (underlying == aave) { | ||
uint256 balance = ERC20(underlying).balanceOf(user); | ||
|
||
if (amount > balance) { | ||
ERC20(underlying).transfer(user, amount - balance); | ||
} else { | ||
vm.prank(user); | ||
ERC20(underlying).transfer(address(this), balance - amount); | ||
} | ||
|
||
return; | ||
} | ||
|
||
super.deal(underlying, user, amount); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters