mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
remove SafeERC20 dependency
This commit is contained in:
parent
f3597f670f
commit
268e749a6d
|
@ -2,7 +2,6 @@
|
|||
pragma solidity ^0.6.8;
|
||||
|
||||
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
||||
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
|
||||
|
||||
import "../libraries/UniversalERC20.sol";
|
||||
import "../mocks/tokens/MintableERC20.sol";
|
||||
|
@ -14,9 +13,8 @@ import "../mocks/tokens/MintableERC20.sol";
|
|||
/// - Mints the tokenToBurn
|
||||
/// - Sends back the tokenToBurn
|
||||
contract MockKyberProxy {
|
||||
using SafeERC20 for IERC20;
|
||||
using SafeERC20 for MintableERC20;
|
||||
using UniversalERC20 for IERC20;
|
||||
using UniversalERC20 for MintableERC20;
|
||||
|
||||
/// @notice The token which the msg.sender of tradeWithHint will burn
|
||||
MintableERC20 public tokenToBurn;
|
||||
|
@ -38,9 +36,9 @@ contract MockKyberProxy {
|
|||
) external payable returns (uint256) {
|
||||
require(tokenToBurn.mint(1 ether), "TRADE_WITH_HINT. Reverted mint()");
|
||||
if (!_fromToken.isETH()) {
|
||||
_fromToken.safeTransferFrom(msg.sender, address(this), _amount);
|
||||
_fromToken.universalTransferFrom(msg.sender, address(this), _amount, false);
|
||||
}
|
||||
tokenToBurn.safeTransfer(msg.sender, 1 ether);
|
||||
tokenToBurn.universalTransfer(msg.sender, 1 ether);
|
||||
return 1 ether;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
pragma solidity ^0.6.8;
|
||||
|
||||
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
||||
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
|
||||
|
||||
import "../mocks/tokens/MintableERC20.sol";
|
||||
|
||||
|
@ -10,8 +9,7 @@ import "../interfaces/IOneSplit.sol";
|
|||
import "../libraries/UniversalERC20.sol";
|
||||
|
||||
contract MockOneSplit is IOneSplit {
|
||||
using SafeERC20 for IERC20;
|
||||
using SafeERC20 for MintableERC20;
|
||||
using UniversalERC20 for MintableERC20;
|
||||
using UniversalERC20 for IERC20;
|
||||
|
||||
MintableERC20 public tokenToBurn;
|
||||
|
@ -57,8 +55,8 @@ contract MockOneSplit is IOneSplit {
|
|||
) public override payable {
|
||||
require(tokenToBurn.mint(10000 ether), "TRADE_WITH_HINT. Reverted mint()");
|
||||
if (!fromToken.isETH()) {
|
||||
fromToken.safeTransferFrom(msg.sender, address(this), amount);
|
||||
fromToken.universalTransferFrom(msg.sender, address(this), amount, false);
|
||||
}
|
||||
tokenToBurn.safeTransfer(msg.sender, 10000 ether);
|
||||
tokenToBurn.universalTransfer(msg.sender, 10000 ether);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ contract OneSplitAdapter is IExchangeAdapter {
|
|||
function approveExchange(IERC20[] calldata _tokens) external override {
|
||||
for (uint256 i = 0; i < _tokens.length; i++) {
|
||||
if (!_tokens[i].isETH()) {
|
||||
_tokens[i].safeApprove(0x1814222fa8c8c1C1bf380e3BBFBd9De8657Da476, UintConstants.maxUintMinus1());
|
||||
_tokens[i].universalApprove(0x1814222fa8c8c1C1bf380e3BBFBd9De8657Da476, UintConstants.maxUintMinus1());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ pragma solidity ^0.6.8;
|
|||
|
||||
import "@openzeppelin/contracts/math/SafeMath.sol";
|
||||
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
||||
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
|
||||
import "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol";
|
||||
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
|
||||
|
||||
|
@ -25,7 +24,6 @@ import "../libraries/UniversalERC20.sol";
|
|||
/// and burn it (sending to address(0) the tokenToBurn)
|
||||
contract TokenDistributor is ReentrancyGuard, VersionedInitializable {
|
||||
using SafeMath for uint256;
|
||||
using SafeERC20 for IERC20;
|
||||
using UniversalERC20 for IERC20;
|
||||
|
||||
struct Distribution {
|
||||
|
|
|
@ -3,14 +3,12 @@ pragma solidity ^0.6.8;
|
|||
|
||||
import "@openzeppelin/contracts/math/SafeMath.sol";
|
||||
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
||||
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
|
||||
import "../interfaces/IFlashLoanReceiver.sol";
|
||||
import "../../interfaces/ILendingPoolAddressesProvider.sol";
|
||||
import "../../libraries/UniversalERC20.sol";
|
||||
|
||||
abstract contract FlashLoanReceiverBase is IFlashLoanReceiver {
|
||||
|
||||
using SafeERC20 for IERC20;
|
||||
using UniversalERC20 for IERC20;
|
||||
using SafeMath for uint256;
|
||||
|
||||
|
|
|
@ -2,13 +2,10 @@
|
|||
pragma solidity ^0.6.8;
|
||||
|
||||
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
||||
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
|
||||
|
||||
import "../libraries/UintConstants.sol";
|
||||
|
||||
interface IExchangeAdapter {
|
||||
using SafeERC20 for IERC20;
|
||||
|
||||
event Exchange(
|
||||
address indexed from,
|
||||
address indexed to,
|
||||
|
|
|
@ -444,9 +444,6 @@ contract LendingPoolCore is VersionedInitializable {
|
|||
);
|
||||
} else {
|
||||
require(msg.value >= _amount, "The amount and the value sent to deposit do not match");
|
||||
//solium-disable-next-line
|
||||
(bool result, ) = _feeAddress.call{ value: _amount, gas: 50000}("");
|
||||
require(result, "Transfer of ETH failed");
|
||||
}
|
||||
IERC20(_token).universalTransferFrom(
|
||||
_user,
|
||||
|
|
|
@ -26,7 +26,7 @@ library UniversalERC20 {
|
|||
|
||||
if (isETH(token)) {
|
||||
(bool result, ) = payable(to).call{value: amount, gas: 50000}("");
|
||||
require(result, "Transfer of ETH failed");
|
||||
require(result, "ETH_TRANSFER_FAILED");
|
||||
} else {
|
||||
token.safeTransfer(to, amount);
|
||||
}
|
||||
|
@ -53,14 +53,14 @@ library UniversalERC20 {
|
|||
(bool result, ) = payable(to).call{value: amount, gas: 50000}(
|
||||
""
|
||||
);
|
||||
require(result, "Transfer of ETH failed");
|
||||
require(result, "ETH_TRANSFER_FAILED");
|
||||
}
|
||||
if (returnExcess && msg.value > amount) {
|
||||
(bool result, ) = msg.sender.call{
|
||||
value: msg.value.sub(amount),
|
||||
gas: 50000
|
||||
}("");
|
||||
require(result, "Transfer of ETH failed");
|
||||
require(result, "ETH_TRANSFER_FAILED");
|
||||
}
|
||||
} else {
|
||||
token.safeTransferFrom(from, to, amount);
|
||||
|
@ -81,7 +81,7 @@ library UniversalERC20 {
|
|||
value: msg.value.sub(amount),
|
||||
gas: 50000
|
||||
}("");
|
||||
require(result, "Transfer of ETH failed");
|
||||
require(result, "ETH_TRANSFER_FAILED");
|
||||
}
|
||||
} else {
|
||||
token.safeTransferFrom(msg.sender, address(this), amount);
|
||||
|
|
|
@ -6,7 +6,7 @@ import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|||
|
||||
import "../../flashloan/base/FlashLoanReceiverBase.sol";
|
||||
import "../tokens/MintableERC20.sol";
|
||||
import "../libraries/UniversalERC20.sol";
|
||||
import "../../libraries/UniversalERC20.sol";
|
||||
|
||||
contract MockFlashLoanReceiver is FlashLoanReceiverBase {
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user