dsa-connectors/contracts/common/utils.sol

16 lines
459 B
Solidity
Raw Normal View History

2021-02-08 14:31:55 +00:00
pragma solidity ^0.7.0;
import { TokenInterface } from "./interfaces.sol";
abstract contract Utils {
function convertEthToWeth(bool isEth, TokenInterface token, uint amount) internal {
if(isEth) token.deposit{value: amount}();
}
function convertWethToEth(bool isEth, TokenInterface token, uint amount) internal {
if(isEth) {
token.approve(address(token), amount);
token.withdraw(amount);
}
}
}