From 351c0a8c9c0d485d1827111012e5da6dd78a6bf3 Mon Sep 17 00:00:00 2001 From: CheyenneAtapour Date: Wed, 18 Sep 2024 12:33:04 +0100 Subject: [PATCH] test: Don't assume 0 balance on live wrapper contracts --- src/BaseTokenWrapper.sol | 5 +++++ src/interfaces/IBaseTokenWrapper.sol | 7 +++++++ test/BaseTokenWrapper.t.sol | 1 + 3 files changed, 13 insertions(+) diff --git a/src/BaseTokenWrapper.sol b/src/BaseTokenWrapper.sol index 8da9901..ab99fe6 100644 --- a/src/BaseTokenWrapper.sol +++ b/src/BaseTokenWrapper.sol @@ -103,6 +103,11 @@ abstract contract BaseTokenWrapper is Ownable, IBaseTokenWrapper { return _withdrawToken(amount, to, aTokenOut); } + /// @inheritdoc IBaseTokenWrapper + function borrowToken(uint256 amount, address to) external { + // Implement borrow logic here + } + /// @inheritdoc IBaseTokenWrapper function rescueTokens( IERC20 token, diff --git a/src/interfaces/IBaseTokenWrapper.sol b/src/interfaces/IBaseTokenWrapper.sol index 12b7976..8e217da 100644 --- a/src/interfaces/IBaseTokenWrapper.sol +++ b/src/interfaces/IBaseTokenWrapper.sol @@ -61,6 +61,13 @@ interface IBaseTokenWrapper { PermitSignature calldata signature ) external returns (uint256); + /** + * @notice Borrows the wrapped token from the Pool, unwraps it, sending to the recipient + * @param amount The amount of the token to borrow from the Pool and unwrap + * @param to The address that will receive the unwrapped token + */ + function borrowToken(uint256 amount, address to) external; + /** * @notice Provides way for the contract owner to rescue ERC-20 tokens * @param token The address of the token to withdraw from this contract diff --git a/test/BaseTokenWrapper.t.sol b/test/BaseTokenWrapper.t.sol index be6be7f..3f46a27 100644 --- a/test/BaseTokenWrapper.t.sol +++ b/test/BaseTokenWrapper.t.sol @@ -638,6 +638,7 @@ abstract contract BaseTokenWrapperTest is Test { function testRescueETH() public { uint256 ethAmount = 100 ether; + vm.deal(address(tokenWrapper), 0); assertEq( address(tokenWrapper).balance, 0,