Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

提议:关于智能合约withdraw_asset API方法的修改 #11

Closed
secp256 opened this issue Jan 3, 2019 · 1 comment
Closed

提议:关于智能合约withdraw_asset API方法的修改 #11

secp256 opened this issue Jan 3, 2019 · 1 comment

Comments

@secp256
Copy link
Contributor

secp256 commented Jan 3, 2019

目前withdraw_asset的方法参数如下:

 void withdraw_asset(int64_t from, int64_t to, int64_t asset_id, int64_t amount)

该API的主要作用是,从合约帐户(from)提现一笔资产(asset_id, amount)到指定帐户(to)。
目前合约内调用withdraw_asset,接收帐户(to)是没有任何通知的。
举个例子: 当用户A调用智能合约gxcdice下注,成功与否,只能通过合约的存储表来查询。合约向用户A的转帐,帐户A的交易历史是没有的。
建议:将withdraw_asset接口的实现修改为一个virtual transfer operation,每当withdraw_asset API被调用时,会将virtual transfer operation 交易历史关联到合约帐户(from)和接收帐户(to)。
在网页钱包或者区块浏览器中显示是这样的:

- 虚拟转帐 -- 智能合约gxcluck 向A发送了0.5 GXC, 备注:winer! 
- 调用合约 -- A 调用了智能合约 gxcluck 的 guess 方法

withdraw_asset接口的参数已经固定了,没地方增加memo,需要新增加一个接口,比如inline_transfer

 void inline_transfer(int64_t from, int64_t to, int64_t asset_id, int64_t amount, string memo)
@secp256
Copy link
Contributor Author

secp256 commented Jan 29, 2019

finished.

@secp256 secp256 closed this as completed Jan 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant