Skip to content
This repository has been archived by the owner on Feb 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #35 from Setheum-Labs/serp-0.5.3
Browse files Browse the repository at this point in the history
Upgrade to serp_traits v0.5.3
  • Loading branch information
balqaasem authored Mar 27, 2021
2 parents f5845d1 + 2827435 commit 40ea88c
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 16 deletions.
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
authors = ['Setheum Labs<https://github.com/Setheum-Labs>']
description = 'Provide `Stp258Standard` implementation using `pallet-balances` and `stp258-tokens'
description = 'Provide `Stp258Standard` implementation using `pallet-balances` and `stp258-serp'
edition = '2018'
homepage = 'https://setheum.xyz'
license = 'Apache-2.0 License'
name = 'stp258-currencies'
repository = 'https://github.com/Setheum-Labs/Setheum/'
version = '0.5.2'
version = '0.5.3'

[dependencies]
serde = { version = "1.0.111", optional = true }
Expand All @@ -18,15 +18,15 @@ sp-std = { version = "3.0.0", default-features = false }
frame-support = { version = "3.0.0", default-features = false }
frame-system = { version = "3.0.0", default-features = false }

stp258-traits = { version = '0.5.2', git = "https://github.com/Setheum-Labs/stp258-traits", branch = "tes-markr" }
serp-traits = { version = '0.5.3', git = "https://github.com/Setheum-Labs/serp-traits" }
orml-utilities = { version = "0.4.0", default-features = false }

funty = { version = "1.1.0", default-features = false } # https://github.com/bitvecto-rs/bitvec/issues/105

[dev-dependencies]
sp-core = "3.0.0"
pallet-balances = "3.0.0"
stp258-tokens = { version = "0.5.2", git = "https://github.com/Setheum-Labs/stp258-tokens"}
stp258-serp = { version = "0.5.3", git = "https://github.com/Setheum-Labs/stp258-serp" }

[features]
default = ["std"]
Expand All @@ -38,6 +38,6 @@ std = [
"sp-io/std",
"frame-support/std",
"frame-system/std",
"stp258-traits/std",
"serp-traits/std",
"orml-utilities/std",
]
33 changes: 30 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# STP-258 Currencies
## Setheum Tokenization Protocol 258 Standard
Multi-Currency Stablecoin SERP Module based on `Stp258Standard` built on top of `Stp258Tokens` and `Stp258Traits`.
Multi-Currency Stablecoin SERP Module based on `Stp258Standard` built on top of `Stp258Serp` and `SerpTraits`.

## Overview

The STP258 Currencies module provides a mixed stablecoin system, by configuring a
native currency which implements `Stp258AssetExtended`, and a
multi-currency which implements `Stp258Currency`.

This module is based on the [STP-258 Standard](https://github.com/Setheum-Labs/stp258-standard) built on the [STP-258 Tokens](https://github.com/Setheum-Labs/stp258-tokens) implementing the [STP-258 Traits](https://github.com/Setheum-Labs/stp258-traits).
This module is based on the [STP-258 Standard](https://github.com/Setheum-Labs/stp258-standard) built on the [STP-258 Serp](https://github.com/Setheum-Labs/stp258-serp) implementing the [STP-258 Traits](https://github.com/Setheum-Labs/serp-traits).

### Implementations

Expand All @@ -33,6 +33,33 @@

## Acknowledgement & Reference

This Pallet is built on [STP258 Tokens](https://github.com/Setheum-Labs/stp258-tokens) pallet.
This Pallet is built on [STP258 Serp](https://github.com/Setheum-Labs/stp258-serp) pallet.

This Pallet is inspired by the [ORML Currencies](https://github.com/open-web3-stack/open-runtime-module-library/blob/master/currencies) Pallet developed by [Open Web3 Stack](https://github.com/open-web3-stack/), for reference check [The ORML Repo](https://github.com/open-web3-stack/open-runtime-module-library).

## Test & Build

Run `cargo build` to build.
Run `cargo test` to 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
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use frame_support::{
},
};
use frame_system::{ensure_root, ensure_signed, pallet_prelude::*};
use stp258_traits::{
use serp_traits::{
account::MergeAccount,
arithmetic::{Signed, SimpleArithmetic},
BalanceStatus, Stp258Asset, Stp258AssetExtended, Stp258AssetLockable, Stp258AssetReservable,
Expand Down
12 changes: 6 additions & 6 deletions src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use super::*;
use frame_support::{construct_runtime, parameter_types};
use stp258_traits::parameter_type_with_key;
use serp_traits::parameter_type_with_key;
use sp_core::H256;
use sp_runtime::{
testing::Header,
Expand Down Expand Up @@ -100,7 +100,7 @@ parameter_types! {
pub const AdjustmentFrequency: Blocknumber = ADJUSTMENT_FREQUENCY;
}

impl stp258_tokens::Config for Runtime {
impl stp258_serp::Config for Runtime {
type Event = Event;
type Balance = Balance;
type Amount = i64;
Expand All @@ -117,7 +117,7 @@ impl stp258_tokens::Config for Runtime {
type GetSerperRatio = GetSerperRatio;
type GetSettPayRatio = GetSettPayRatio;
type GetSingleUnit = GetSingleUnit;
type OnDust = stp258_tokens::TransferDust<Runtime, DustAccount>;
type OnDust = stp258_serp::TransferDust<Runtime, DustAccount>;
}

pub const DNAR: CurrencyId = 1;
Expand All @@ -132,7 +132,7 @@ parameter_types! {

impl Config for Runtime {
type Event = Event;
type Stp258Currency = Stp258Tokens;
type Stp258Currency = Stp258Serp;
type Stp258Native = AdaptedStp258Asset;
type GetStp258NativeId = GetStp258NativeId;
type WeightInfo = ();
Expand All @@ -151,7 +151,7 @@ construct_runtime!(
{
System: frame_system::{Module, Call, Storage, Config, Event<T>},
Stp258Currencies: stp258_currencies::{Module, Call, Event<T>},
Stp258Tokens: stp258_tokens::{Module, Storage, Event<T>, Config<T>},
Stp258Serp: stp258_serp::{Module, Storage, Event<T>, Config<T>},
PalletBalances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
}
);
Expand Down Expand Up @@ -215,7 +215,7 @@ impl ExtBuilder {
.assimilate_storage(&mut t)
.unwrap();

stp258_tokens::GenesisConfig::<Runtime> {
stp258_serp::GenesisConfig::<Runtime> {
endowed_accounts: self
.endowed_accounts
.into_iter()
Expand Down
2 changes: 1 addition & 1 deletion src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn stp258_currency_lockable_should_work() {
.build()
.execute_with(|| {
assert_ok!(Stp258Currencies::set_lock(ID_1, SETT, &ALICE, 50 * 10_000));
assert_eq!(Stp258Tokens::locks(&ALICE, SETT).len(), 1);
assert_eq!(Stp258Serp::locks(&ALICE, SETT).len(), 1);
assert_ok!(Stp258Currencies::set_lock(ID_1, DNAR, &ALICE, 50));
assert_eq!(PalletBalances::locks(&ALICE).len(), 1);
});
Expand Down

0 comments on commit 40ea88c

Please sign in to comment.