简单的 ERC20 代币
ERC20 代币合约具有以下特点:
– 预铸您的总供应量。
– 没有铸币功能。
这使用户可以轻松了解代币的未来供应。
allowance(address,address) :See {IERC20-allowance}.approve(address,uint256) :See {IERC20-approve}. NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: – `spender` cannot be the zero address.balanceOf(address) :See {IERC20-balanceOf}.decimals() :Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless this function is overridden; NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.decreaseAllowance(address,uint256) :Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: – `spender` cannot be the zero address. – `spender` must have allowance for the caller of at least `subtractedValue`.increaseAllowance(address,uint256) :Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: – `spender` cannot be the zero address.name() :Returns the name of the token.symbol() :Returns the symbol of the token, usually a shorter version of the name.totalSupply() :See {IERC20-totalSupply}.transfer(address,uint256) :See {IERC20-transfer}. Requirements: – `to` cannot be the zero address. – the caller must have a balance of at least `amount`.transferFrom(address,address,uint256) :
See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: – `from` and `to` cannot be the zero address. – `from` must have a balance of at least `amount`. – the caller must have allowance for “from“’s tokens of at least `amount`.
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。