dsa-connectors/contracts/common/utils.sol
2021-02-08 20:01:55 +05:30

16 lines
459 B
Solidity

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);
}
}
}