23 lines
587 B
Solidity
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));
|
|
}
|
|
}
|