You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
765 B
26 lines
765 B
7 years ago
|
pragma solidity ^0.4.18;
|
||
8 years ago
|
|
||
7 years ago
|
import "./ERC20Basic.sol";
|
||
|
import "./ERC20.sol";
|
||
8 years ago
|
|
||
7 years ago
|
|
||
8 years ago
|
/**
|
||
|
* @title SafeERC20
|
||
|
* @dev Wrappers around ERC20 operations that throw on failure.
|
||
8 years ago
|
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
|
||
|
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
|
||
8 years ago
|
*/
|
||
|
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));
|
||
|
}
|
||
|
}
|