智能合约(Smart contract)是依托计算机在网络空间运行的合约,它以信息化方式传播、验证或执行合同,由计算机读取、执行,具备自助的特点。而区块链的去中心化,数据的防篡改,决定了智能合约更加适合于在区块链上来实现
Artificial intelligence technology is one of the core technologies in the era of intelligent industry.AI technology includes machine learning,deep learning,natural language processing,computer vision,etc.The application of these technologies enables the machine to learn,understand and judge independently,and can help industrial enterprises achieve automated,intelligent and efficient production and management.
#notice Convert ETH to Tokens.
#dev User specifies exact input(msg.value).
#dev User cannot specify minimum output or deadline.
#用ETH兑换代币的默认函数,用户只需要指定输入的ETH的数量
public
payable
def __default__():
self.ethToTokenInput(msg.value,1,block.timestamp,msg.sender,msg.sender)
#notice Convert ETH to Tokens.
#dev User specifies exact input(msg.value)and minimum output.所以接收的代币最小值
#param min_tokens Minimum Tokens bought.
#param deadline Time after which this transaction can no longer be executed.
#return Amount of Tokens bought.
#ETH通过msg.value的方式发送给代币合约,代币合约根据所接收到的ETH计算所需支付的代币
public
payable
def ethToTokenSwapInput(min_tokens:uint256,deadline:timestamp)->uint256:
return self.ethToTokenInput(msg.value,min_tokens,deadline,msg.sender,msg.sender)
#notice Convert ETH to Tokens and transfers Tokens to recipient.
#dev User specifies exact input(msg.value)and minimum output
#param min_tokens Minimum Tokens bought.
#param deadline Time after which this transaction can no longer be executed.
#param recipient The address that receives output Tokens.
#return Amount of Tokens bought.
public
payable
def ethToTokenTransferInput(min_tokens:uint256,deadline:timestamp,recipient:address)->uint256: