IERC20.sol 2.7 KB

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