IERC20.sol 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. /**
  4. * @dev Interface of the ERC20 standard as defined in the EIP.
  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(
  56. address sender,
  57. address recipient,
  58. uint256 amount
  59. ) external returns (bool);
  60. /**
  61. * @dev Emitted when `value` tokens are moved from one account (`from`) to
  62. * another (`to`).
  63. *
  64. * Note that `value` may be zero.
  65. */
  66. event Transfer(address indexed from, address indexed to, uint256 value);
  67. /**
  68. * @dev Emitted when the allowance of a `spender` for an `owner` is set by
  69. * a call to {approve}. `value` is the new allowance.
  70. */
  71. event Approval(address indexed owner, address indexed spender, uint256 value);
  72. }