movefuns / movetool Goto Github PK
View Code? Open in Web Editor NEWA collection of Move ecosystem DApp tools
Home Page: https://movetool.app
License: Apache License 2.0
A collection of Move ecosystem DApp tools
Home Page: https://movetool.app
License: Apache License 2.0
经常有需求需要转账 100U 等值的 STC,一般的做法是先通过 oracle 来拿到 STC 对 USD 的价格,然后再计算数量,比较麻烦。可以通过合约自动完成这种换算。
首先需要定义一个合约,合约中通过 Oracle 自动换算输入的 usd 为 STC 数额。 Oracle 文档参看 https://github.com/starcoinorg/StarcoinPriceReporter
其次在页面上实现一个转账的界面。
扩展:
在 hallay 网络,部署了一个模块,进入调用合约模块,输入地址:0xd310cc39b6e8b36e5729469fb2f80a10,解析提示没有地址下没有合约,实际上通过 stcscan 可以发现有模块:
https://stcscan.io/halley/address/0xd310cc39b6e8b36e5729469fb2f80a10/codes
Starcoin 的每个账户都有一个 key_rotation_capability
字段,
并且提供了 Account::extract_key_rotation_capability
方法可以把用户的 KeyRotationCapability
拿出来,
同时也提供了 Account::rotate_authentication_key_with_capability
, 可以通过 KeyRotationCapability
重置该 Capbility 原始拥有者的 authentication_key
。
设计一个应用场景,使用 KeyRotationCapability, 比如通过智能合约帮助用户重置 authentication_key。
Starcoin 的每个账户都有一个 withdrawal_capability
字段,
并且提供了 Account::extract_withdraw_capability
方法可以把用户的 WithdrawCapability
拿出来,
同时也提供了 Account::withdraw_with_capability
, 可以通过 WithdrawCapability
从该 Capability 的原拥有者账户提取 Token。
设计一个应用场景,使用 WithdrawCapability
, 比如资产托管。
在页面:https://starcoinorg.github.io/dapps/#/stc/issue/token
发行:1152921504606846976 个Token
发行成功后实际上钱包里是:1,152,921,504,606,847,000 个
猜测和js整数数据精度有关
number超过2 ** 53 - 1就可能损失数据
目前 StarcoinFramework 的错误码查询不太方便, 具体体现在:
目前有 starcoin 命令行工具可以查询,使用方法如下:
starcoin% dev move-explain -a 6
{
"ok": {
"category_code": 6,
"category_name": null,
"reason_code": 0,
"reason_name": null
}
}
该命令行工具每次都需要启动一个 starcoin node,体验不太好;并且错误描述似乎也不够详细。
如果有一个工具能够生成统一的错误码解释表,能很好的方便开发者查询错误。或者做一个更友好的错误码查询工具。
可以设计一些错误码的注释规范等,便于工具捕获信息。
场景:用户通过starcoin-ide/mpm开发了一个合约,并生成了 release blob, 如果能有一个网页版Dapp,用户将blob文件拖拽到网页中,然后点击部署,弹出 starmask,完成签名,部署成功。
问题:
在合约调试中 使用 Debug::print
打印出的结果多由数组组成
在调试中需要打印 hash
、字符串
等,只能打印为数组,调试起来较为不便
需求:
在前端制作工具,方便进行数组转换为 ASCII
字符串,UTF8
字符串,还原 vector vector<vector>,还原带有 vector vector<vector>结构体
现在的批量转账的金额我是统一除了1000000000 的精度值 但是实际上每个token的精度不一样 需要修正一些
token 的精度如何拿到 参考 https://github.com/starcoinorg/starcoin-explorer/blob/main/src/utils/sdk.ts#L149_L161
Batch transfer currently only supports STC, expect to support other Token
https://starcoinorg.github.io/dapps/#/stc/batch/transfer
part of: #3
Build a DApp tools framework
Issue a Token on the webpage, and support some customization options, such as total issue amount, etc.
The most difficult part to achieve this requirement is: How to compile Move code on the webpage?
There are two possible approaches:
初步思路,有两个:
这个稍微复杂一些,因为无法实现两个用户同时出拳,所以必须是异步的,所以先发起交易的一方需要先隐藏自己的出拳。
通过开发这个游戏可以有以下收益:
对这个游戏有其他想法或者建议,也欢迎在评论中提出。如果有其他游戏的构思,可以提交成 issue。
Deploy to dapps.movefuns.org
Dependency: #57
游戏/猜大小页面:https://movetool.app/game/showdown
network: barnard
金额提示的bug,JavaScript 数字相除精度问题。
This Banker Amount: 37.3 , max input amount 3.7299999999999995
max input amount = 37.3 / 10
。
最终显示应该是 3.73
精度如何获取 参考 https://github.com/starcoinorg/starcoin-explorer/blob/main/src/utils/sdk.ts#L149_L161
Provide a web tool to disassemble Move bytecode to text.
auto-deploy to GitHub pages or S3.
money: 200xUSDT
Connect with me if you want to work on this issue:
wechat: 197626581
当一次性转账的目标地址太多时会导致 Gas 超过单个交易的 gas limit,需要分批发送。一批发送多少个不好确定,可以给个默认值,然后由用户可以指定。
比如这个命令行工具中一批是 32 个:
1.前端工具库需求
2.开发周期
Support creation for a dead wallet to burns tokens. x000
Dependency: #57
Provide a web tool to disassemble Move bytecode to text.
Dependency #57
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.