-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of github.com:defi-wonderland/prophet-modules into…
… fix/bytes32-check
- Loading branch information
Showing
8 changed files
with
120 additions
and
30 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; | ||
|
||
contract MockERC20Proxy { | ||
IERC20 public token; | ||
|
||
mapping(uint256 _callCount => mapping(address _account => uint256 _amount)) internal _balancesPerCall; | ||
uint256 internal _calls; | ||
bool internal _mocked; | ||
|
||
constructor(IERC20 _token) { | ||
token = _token; | ||
} | ||
|
||
function mockBalanceOfPerCall(uint256 _callCount, address _account, uint256 _amount) external { | ||
_balancesPerCall[_callCount][_account] = _amount; | ||
_mocked = true; | ||
} | ||
|
||
function balanceOf(address _account) external view returns (uint256 _amount) { | ||
if (_mocked) { | ||
_amount = _balancesPerCall[_calls][_account]; | ||
} else { | ||
_amount = token.balanceOf(_account); | ||
} | ||
} | ||
|
||
// solhint-disable-next-line | ||
fallback() external { | ||
if (_mocked) { | ||
++_calls; | ||
} | ||
(bool _success,) = address(token).call(msg.data); | ||
require(_success, 'MockERC20Proxy: call failed'); | ||
} | ||
} |
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