近日,由Jordi Baylina, Jacques Dafflon和Thomas Shababi创建的新代币标准ERC777将很快完成,旨在取代现有的ERC20标准。那么,新的ERC777有什么新的特点呢?
ERC777的特点
降费提速:在ERC777标准中,一些高级交易——比如在去中心化交易合约中进行代币兑换——能够在一次交易中完成,而不是像过去那样分成两笔交易才能完成,这样的话,不仅代币兑换成本大幅降低(更便宜),而且兑换速度也能变得更快。
向后兼容:ERC777兼容与ERC20兼容的所有应用程序,包括EtherDelta,IDEX,0x等。它具有ERC20所有的功能,同时还有附加功能。
避免代币丢失:ERC777相对于ERC20的另一个优势是,防止以太币生态系统中不必要的加密货币损失。因为与ERC777兼容的地址能够拒绝某些特定类型的Token传入事件,例如来自黑名单地址的Token传入事件。
支持发送数据:ERC777可以像以太坊那样发送交易数据,调用智能合约的功能,使得可以使用超出以太坊本地可定制容量的Token。
ERC777规范ERC777Token (Token Contract)
interface ERC777Token {
function name() public view returns (string);
function symbol() public view returns (string);
function totalSupply() public view returns (uint256);
function balanceOf(address owner) public view returns (uint256);
function granularity() public view returns (uint256);
function defaultOperators() public view returns (address[]);
function authorizeOperator(address operator) public;
function revokeOperator(address operator) public;
function isOperatorFor(address operator, address tokenHolder) public view returns (bool);
function send(address to, uint256 amount, bytes data) public;
function operatorSend(address from, address to, uint256 amount, bytes data, bytes operatorData) public;
function burn(uint256 amount, bytes data) public;
function operatorBurn(address from, uint256 amount, bytes data, bytes operatorData) public;
event Sent(
address indexed operator,
address indexed from,
address indexed to,
uint256 amount,
bytes data,
bytes operatorData
);
event Minted(address indexed operator, address indexed to, uint256 amount, bytes operatorData);
event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);
event AuthorizedOperator(address indexed operator, address indexed tokenHolder);
event RevokedOperator(address indexed operator, address indexed tokenHolder);
}
符合标准的代币必须实现以上接口。代币必须通过ERC820向自己的地址注册ERC777接口。
View Functions
name function
returns: Name of the token 返回代币的名称
symbol function
returns: Symbol of the token 返回代币的符号(简称)
totalSupply function
returns: Total supply of tokens currently in circulation. 返回代币的发行总量
balanceOf function
returns: Amount of token held by tokenHolder in the token contract. 返回该地址的代币余额。
granularity function
returns: The smallest non-divisible part of the token. 返回代币最小的不可分割的货币单位。
NOTE: defaultOperators and isOperatorFor are also view functions. They are defined under the operators for consistency.
Operators
operator 是一个允许发送或销毁代币的地址,它代表另外一个地址。当一个地址成为一个代币持有者的 operator时,必须触发 AuthorizedOperator 事件。当代币持有者的operator补撤销时,RevokedOperator 事件必须被触发。
此外,代币也可以定义默认的Operator。默认的Operator隐式地对所有代币持有者授权。当定义了defaultOperators时,AuthorizedOperator 不能被触发 。
Sending Tokens
Sent event
代币从一个地址发送到另一个地址的事件。
send function
从一个地址发送一定量的代币到另一个地址。
operatorSend function
从一个地址发送一定量的代币到另一个地址。
Minting Tokens
铸币标志是产生新代币的行为。Erc777有意没有定义铸币函数,主要考虑是不限制Erc777标准的使用,因为每个代币都有特定的铸币过程。
Burning Tokens
ERC777定义了两个函数来销毁代币 (burn and operatorBurn)。这让钱包或代币DApp允许代币持有者更加容易的销毁代币,同时,代币合约也可定义其他销毁代币的函数。
ERC777的未来
在ERC20之后,提出过很多新的提案,来试图改进它,如ERC223、ERC677。但是它们要么会出现新的重大漏洞,要么只是略对ERC作了修改,并无实质上的创新。直到ERC777的出现,才看到了新时代来临的曙光,ERC777标准将允许代币持有者获得更多的控制权和更容易的交易。
预计ERC777协议将于今年8月份完成,其规范具体内容可参见:
https://eips.ethereum.org/EIPS/eip-777
ERC777能否超越ERC-20代币标准?或许只有时间才能给出答案。
✅ @lazeman, I gave you an upvote on your post! Please give me a follow and I will give you a follow in return and possible future votes!
Thank you in advance!
ok, thks!
Congratulations @lazeman! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!
Congratulations @lazeman! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Do not miss the last post from @steemitboard:
Vote for @Steemitboard as a witness to get one more award and increased upvotes!