IERC20.sol 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. pragma solidity ^0.5.0;
  2. /**
  3. * @dev Interface of the ERC20 standard as defined in the EIP. Does not include
  4. * the optional functions; to access them see {ERC20Detailed}.
  5. */
  6. interface IERC20 {
  7. /**
  8. * @dev Returns the amount of tokens in existence.
  9. */
  10. function totalSupply() external view returns (uint256);
  11. /**
  12. * @dev Returns the amount of tokens owned by `account`.
  13. */
  14. function balanceOf(address account) external view returns (uint256);
  15. /**
  16. * @dev Moves `amount` tokens from the caller's account to `recipient`.
  17. *
  18. * Returns a boolean value indicating whether the operation succeeded.
  19. *
  20. * Emits a {Transfer} event.
  21. */
  22. function transfer(address recipient, uint256 amount) external returns (bool);
  23. /**
  24. * @dev Returns the remaining number of tokens that `spender` will be
  25. * allowed to spend on behalf of `owner` through {transferFrom}. This is
  26. * zero by default.
  27. *
  28. * This value changes when {approve} or {transferFrom} are called.
  29. */
  30. function allowance(address owner, address spender) external view returns (uint256);
  31. /**
  32. * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
  33. *
  34. * Returns a boolean value indicating whether the operation succeeded.
  35. *
  36. * IMPORTANT: Beware that changing an allowance with this method brings the risk
  37. * that someone may use both the old and the new allowance by unfortunate
  38. * transaction ordering. One possible solution to mitigate this race
  39. * condition is to first reduce the spender's allowance to 0 and set the
  40. * desired value afterwards:
  41. * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
  42. *
  43. * Emits an {Approval} event.
  44. */
  45. function approve(address spender, uint256 amount) external returns (bool);
  46. /**
  47. * @dev Moves `amount` tokens from `sender` to `recipient` using the
  48. * allowance mechanism. `amount` is then deducted from the caller's
  49. * allowance.
  50. *
  51. * Returns a boolean value indicating whether the operation succeeded.
  52. *
  53. * Emits a {Transfer} event.
  54. */
  55. function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
  56. /**
  57. * @dev Emitted when `value` tokens are moved from one account (`from`) to
  58. * another (`to`).
  59. *
  60. * Note that `value` may be zero.
  61. */
  62. event Transfer(address indexed from, address indexed to, uint256 value);
  63. /**
  64. * @dev Emitted when the allowance of a `spender` for an `owner` is set by
  65. * a call to {approve}. `value` is the new allowance.
  66. */
  67. event Approval(address indexed owner, address indexed spender, uint256 value);
  68. }