IERC20.sol 2.7 KB

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