IERC20.sol 2.6 KB

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