1 个不稳定版本
| 0.5.3 | 2021年3月28日 |
|---|
#16 in #mixed
44KB
1K SLoC
STP-258 货币
Setheum 代币化协议 258 标准
基于 Stp258Standard 的多货币稳定币 SERP 模块,建立在 Stp258Serp 和 SerpTraits 之上。
概述
STP258 货币模块通过配置实现 Stp258AssetExtended 的本地货币以及实现 Stp258Currency 的多货币,提供了一个混合稳定币系统。
该模块基于在 STP-258 标准 上构建的 STP-258 Serp,该标准实现了 STP-258 Traits。
实现
stp258 模块为以下 traits 提供实现。
Stp258Currency- 可交换多货币稳定币系统的抽象。Stp258CurrencyExtended- 扩展Stp258Currency,包含额外的辅助类型和方法,如通过给定的有符号整数金额更新余额。
接口
可调用的函数
transfer- 在给定货币中向另一个账户转移一些余额。transfer_native_currency- 在Config::Stp258Native中设置的本地货币内向另一个账户转移一些余额。update_balance- 通过给定的有符号整数金额更新给定货币的余额,需要 root 原因。
致谢 & 参考
此 Pallet 基于 STP-258 Serp Pallet 构建。
此 Pallet 受 ORML Currencies Pallet 的启发,由 Open Web3 Stack 开发,有关参考请查看 ORML 仓库。
测试 & 构建
运行 cargo build 来构建。运行 cargo test 来测试。
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2021-03-05
target: wasm32-unknown-unknown
default: true
- name: Install Wasm toolchain
run: rustup target add wasm32-unknown-unknown
- name: Install clippy
run: rustup component add clippy
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
依赖项
~10-20MB
~285K SLoC