Replies: 2 comments 1 reply
-
感谢你的提案!为了方便 APP 提案序列号管理,我已将原 APP-20 和 APP-721 改为 APP-2 和 APP-3,并在 READM.me 中增加了说明。 此外,APP 作为产品想法征集提案,更专注于应用层,希望可以带来更多好玩,有创新性的应用提案。 |
Beta Was this translation helpful? Give feedback.
1 reply
-
Nice, I would look at https://hackmd.io/8DiMkhuNThOb_ooTWKqxaw - many tokens are already using this standard in AO |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Abstract
The following standard allows for the implementation of a standard API for tokens within smart contracts. This standard provides basic functionality to transfer tokens, as well as allow tokens to be approved so they can be spent by another on-chain third party.
Motivation
A standard interface allows any tokens on AO to be re-used by other applications: from wallets to decentralized exchanges. It also have the same interface with the ERC-20 standard, so that all the ERC-20 tokens can be bridged into and back AO.
Specification
Handlers
name
Returns the name of the token - e.g.
"MyToken"
.symbol
Returns the symbol of the token. E.g. "HIX".
decimals
Returns the number of decimals the token uses - e.g.
8
, means to divide the token amount by100000000
to get its user representation.totalSupply
Returns the total token supply.
balanceOf
Returns the account balance of another account with address
_owner
.transfer
Transfers
_value
amount of tokens to address_to
.The function SHOULD message with
Error:APP20/NotEnoughBalanceError
if the message caller's account balance does not have enough tokens to spend.transferFrom
Transfers
_value
amount of tokens from address_from
to address_to
.The
transferFrom
method is used for a withdraw workflow, allowing contracts to transfer tokens on your behalf.This can be used for example to allow a contract to transfer tokens on your behalf and/or to charge fees in sub-currencies.
The function SHOULD message with
Error:APP20/NotAuthorized
unless the_from
account has deliberately authorized the sender of the message via some mechanism.approve
Allows
_spender
to withdraw from your account multiple times, up to the_value
amount. If this function is called again it overwrites the current allowance with_value
.allowance
Returns the amount which
_spender
is still allowed to withdraw from_owner
.Messages
Transfer
MUST trigger when tokens are transferred, including zero value transfers.
A token contract which creates new tokens SHOULD trigger a Transfer event with the
_from
address set to0x0
when tokens are created.Approval
MUST trigger on any successful call to
approve(address _spender, uint256 _value)
.Implementation
There are already have the
token blueprints
there. But here we will write another more standard version of it, that we can mirror all the resources/assets outside of AO world.摘要
以下标准允许在智能合约中实现代币的标准 API。此标准提供转移代币的基本功能,并允许批准代币,以便其他链上第三方可以使用它们。
动机
标准接口允许其他应用程序重新使用 AO 上的任何代币:从钱包到去中心化交易所。它还具有与 ERC-20 标准相同的接口,因此所有 ERC-20 代币都可以桥接进 AO 并返回。
规范
Handlers
name
返回代币的名称 - 例如
MyToken
。symbol
返回代币的符号。例如
HIX
。decimals
返回代币使用的小数位数 - 例如
8
,表示将代币数量除以100000000
以获得其用户表示。totalSupply
返回代币总供应量。
balanceOf
返回地址为
_owner
的另一个帐户的帐户余额。transfer
将
_value
数量的代币转移到地址_to
。如果消息调用者的帐户余额没有足够的代币可供使用,则该函数应该发送
Error:APP20/NotEnoughBalanceError
消息。transferFrom
将
_value
数量的代币从地址_from
转移到地址_to
。transferFrom
方法用于提取工作流,允许合约代表您转移代币。例如,这可用于允许合约代表您转移代币和/或以子货币收取费用。
除非
_from
帐户已通过某种机制故意授权消息发送者,否则该函数应发送Error:APP20/NotAuthorized
消息。approve
允许
_spender
多次从您的帐户中提取,最高金额为_value
。如果再次调用此函数,它将用_value
覆盖当前限额。allowance
返回
_spender
仍被允许从_owner
提取的金额。Messages
Transfer
在转移代币时必须触发,包括零值转移。
创建新代币的代币合约应在创建代币时触发转移事件,并将
_from
地址设置为0x0
。Approval
必须在成功调用
approve(address _spender, uint256 _value)
时触发。实现
那里已经有
token blueprints
。但在这里我们将编写另一个更标准的版本,以便我们可以镜像 AO 世界之外的所有资源/资产。Beta Was this translation helpful? Give feedback.
All reactions