Files
openzeppelin-contracts/contracts/token/SafeERC20.sol
Francisco Giordano c7636bdc4c add safe ERC20 helpers
2017-08-28 17:32:18 -03:00

23 lines
587 B
Solidity

pragma solidity ^0.4.11;
import './ERC20Basic.sol';
import './ERC20.sol';
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure.
*/
library SafeERC20 {
function safeTransfer(ERC20Basic token, address to, uint256 value) internal {
assert(token.transfer(to, value));
}
function safeTransferFrom(ERC20 token, address from, address to, uint256 value) internal {
assert(token.transferFrom(from, to, value));
}
function safeApprove(ERC20 token, address spender, uint256 value) internal {
assert(token.approve(spender, value));
}
}