feat: Replace non-available solidity instructions on OVM

This commit is contained in:
miguelmtzinf 2021-07-29 18:20:43 +02:00
parent 7708bc6d2f
commit 72b5da643b
4 changed files with 12 additions and 4 deletions

View File

@ -1,6 +1,8 @@
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
import {IERC20} from './IERC20.sol';
/**
* @dev Collection of functions related to the address type
*/
@ -52,7 +54,9 @@ library Address {
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, 'Address: insufficient balance');
// require(address(this).balance >= amount, 'Address: insufficient balance');
uint256 balance = IERC20(0x4200000000000000000000000000000000000006).balanceOf(address(this));
require(balance >= amount, 'Address: insufficient balance');
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{value: amount}('');

View File

@ -43,7 +43,8 @@ contract WalletBalanceProvider {
**/
function balanceOf(address user, address token) public view returns (uint256) {
if (token == MOCK_ETH_ADDRESS) {
return user.balance; // ETH balance
// return user.balance; // ETH balance
return IERC20(0x4200000000000000000000000000000000000006).balanceOf(user);
// check if token is actually a contract
} else if (token.isContract()) {
return IERC20(token).balanceOf(user);

View File

@ -3,6 +3,6 @@ pragma solidity 0.6.12;
contract SelfdestructTransfer {
function destroyAndTransfer(address payable to) external payable {
selfdestruct(to);
// selfdestruct(to);
}
}

View File

@ -15,6 +15,8 @@
pragma solidity >=0.4.22 <=0.6.12;
import {IERC20} from '../../../dependencies/openzeppelin/contracts/IERC20.sol';
contract WETH9 {
string public name = 'Wrapped Ether';
string public symbol = 'WETH';
@ -45,7 +47,8 @@ contract WETH9 {
}
function totalSupply() public view returns (uint256) {
return address(this).balance;
// return address(this).balance;
return IERC20(0x4200000000000000000000000000000000000006).balanceOf(address(this));
}
function approve(address guy, uint256 wad) public returns (bool) {