Skip to content

Commit

Permalink
Merge pull request #922 from Setheum-Labs/v0.9.81-dev
Browse files Browse the repository at this point in the history
Checkout Submodules to v0.9.81-dev branches
  • Loading branch information
balqaasem authored Dec 31, 2023
2 parents 6576da5 + 9ec71ac commit 52bf73f
Show file tree
Hide file tree
Showing 44 changed files with 256 additions and 266 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ Setheum's Blockchain Network node Implementation in Rust, Substrate FRAME and Se

## Introduction

### SETHEUM means "Secure, Evergreen, Truthful, Heterogeneous, Economically Unbiased Market".
### SETHEUM means `Salam Ethereum`, it also means `The house of gifts` from the name `Seth/Shith` meaning `gift` in hebrew, it also stands for `Secure, Evergreen, Truthful, Heterogeneous, Economically Unbiased Market`.

Setheum is founded, initiated and facilitated by Muhammad-Jibril B.A. of Setheum Labs, Slixon Technologies and Setheum Foundation to build, steward and support the development and advancement of Ethical Web3 with the Network, its ecosystem and its community to foster the development and adoption of ethical decentralised finance by and Web3 in general by building and supporting interoperable Secure, Scalable and Decentralized Web3 Infrastructure.
Setheum also deploys Advanced Incentivization mechanisms and economic models modeled under the Jurisdiction of Islamic Finance.
Setheum is founded, initiated and facilitated by Muhammad-Jibril B.A. of Setheum Labs, Slixon Technologies and OpenWeb3 Foundation, to build, steward and support the development and advancement of Ethical Web3 with the Network, its ecosystem and its community to foster the development and adoption of ethical decentralised finance by and Web3 in general by building and supporting interoperable Secure, Scalable and Decentralized Web3 Infrastructure.
Setheum also deploys Advanced Incentivization mechanisms and economic models modeled under the Jurisdiction of Islamic Finance which gave birth to the concept of Subchains in Setheum as well as the first Subchain, the [Khalifa Blockchain Project](https://github.com/Khalifa-Blockchain/) optimized for Confidential Smart Contracts and DeFi.

## Getting Started

Expand Down
2 changes: 1 addition & 1 deletion chassis/lib-serml/airdrop/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub mod module {
pub trait Config: frame_system::Config {
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;

/// The Currency for managing assets related to the SERP (Setheum Elastic Reserve Protocol).
/// The Currency for managing assets.
type MultiCurrency: MultiCurrencyExtended<Self::AccountId, CurrencyId = CurrencyId, Balance = Balance>;

/// The maximum size of an airdrop list
Expand Down
19 changes: 7 additions & 12 deletions chassis/lib-serml/airdrop/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ pub const ALICE: AccountId = AccountId32::new([2u8; 32]);
pub const BOB: AccountId = AccountId32::new([3u8; 32]);
pub const SETR: CurrencyId = CurrencyId::Token(TokenSymbol::SETR);
pub const SETUSD: CurrencyId = CurrencyId::Token(TokenSymbol::SETUSD);
pub const SETM: CurrencyId = CurrencyId::Token(TokenSymbol::SETM);
pub const SERP: CurrencyId = CurrencyId::Token(TokenSymbol::SERP);
pub const SEE: CurrencyId = CurrencyId::Token(TokenSymbol::SEE);
pub const DNAR: CurrencyId = CurrencyId::Token(TokenSymbol::DNAR);
pub const HELP: CurrencyId = CurrencyId::Token(TokenSymbol::HELP);

Expand Down Expand Up @@ -105,10 +104,9 @@ parameter_types! {
];
pub const SetterCurrencyId: CurrencyId = SETR; // Setter currency ticker is SETR/
pub const GetSetUSDId: CurrencyId = SETUSD; // SetDollar currency ticker is SETUSD/
pub const GetNativeCurrencyId: CurrencyId = SETM; // Setheum native currency ticker is SETM/
pub const GetSerpCurrencyId: CurrencyId = SERP; // Setheum native currency ticker is SETM/
pub const GetDinarCurrencyId: CurrencyId = DNAR; // Setheum native currency ticker is SETM/
pub const GetHelpCurrencyId: CurrencyId = HELP; // Setheum native currency ticker is SETM/
pub const GetNativeCurrencyId: CurrencyId = SEE; // Setheum native currency ticker is SEE/
pub const GetDinarCurrencyId: CurrencyId = DNAR; // Setheum native currency ticker is SEE/
pub const GetHelpCurrencyId: CurrencyId = HELP; // Setheum native currency ticker is SEE/
pub const AirdropPalletId: PalletId = PalletId(*b"set/drop");
pub const MaxAirdropListSize: usize = 4;
}
Expand Down Expand Up @@ -155,12 +153,9 @@ impl Default for ExtBuilder {
(ALICE, SETUSD, 1000),
(BOB, SETUSD, 1000),
(TREASURY, SETUSD, 1000),
(ALICE, SETM, 1000),
(BOB, SETM, 1000),
(TREASURY, SETM, 1000),
(ALICE, SERP, 1000),
(BOB, SERP, 1000),
(TREASURY, SERP, 1000),
(ALICE, SEE, 1000),
(BOB, SEE, 1000),
(TREASURY, SEE, 1000),
(ALICE, DNAR, 1000),
(BOB, DNAR, 1000),
(TREASURY, DNAR, 1000),
Expand Down
2 changes: 1 addition & 1 deletion chassis/lib-serml/atomic-swap/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// use primitives::{Amount, TokenSymbol};

// Currencies constants - CurrencyId/TokenSymbol
// pub const SETM: CurrencyId = CurrencyId::Token(TokenSymbol::SETM);
// pub const SEE: CurrencyId = CurrencyId::Token(TokenSymbol::SEE);
// pub const SETR: CurrencyId = CurrencyId::Token(TokenSymbol::SETR);
// pub const SETUSD: CurrencyId = CurrencyId::Token(TokenSymbol::SETUSD);

Expand Down
3 changes: 1 addition & 2 deletions chassis/lib-serml/currencies/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,12 @@ pub type AccountId = AccountId32;
pub type BlockNumber = u64;

// Currencies constants - CurrencyId/TokenSymbol
pub const SERP: CurrencyId = CurrencyId::Token(TokenSymbol::SERP);
pub const DNAR: CurrencyId = CurrencyId::Token(TokenSymbol::DNAR);
pub const HELP: CurrencyId = CurrencyId::Token(TokenSymbol::HELP);
pub const SETR: CurrencyId = CurrencyId::Token(TokenSymbol::SETR);
pub const SETUSD: CurrencyId = CurrencyId::Token(TokenSymbol::SETUSD);

pub const NATIVE_CURRENCY_ID: CurrencyId = CurrencyId::Token(TokenSymbol::SETM);
pub const NATIVE_CURRENCY_ID: CurrencyId = CurrencyId::Token(TokenSymbol::SEE);
pub const X_TOKEN_ID: CurrencyId = CurrencyId::Token(TokenSymbol::SETUSD);

impl frame_system::Config for Runtime {
Expand Down
4 changes: 2 additions & 2 deletions chassis/lib-serml/dex-oracle/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use support::SwapLimit;
pub type AccountId = u128;
pub type BlockNumber = u64;

pub const SETM: CurrencyId = CurrencyId::Token(TokenSymbol::SETM);
pub const SEE: CurrencyId = CurrencyId::Token(TokenSymbol::SEE);
pub const SETUSD: CurrencyId = CurrencyId::Token(TokenSymbol::SETUSD);
pub const DNAR: CurrencyId = CurrencyId::Token(TokenSymbol::DNAR);
pub const LP_SETUSD_DNAR: CurrencyId =
Expand All @@ -50,7 +50,7 @@ mod dex_oracle {

parameter_types! {
pub static SETUSDDNARPair: TradingPair = TradingPair::from_currency_ids(SETUSD, DNAR).unwrap();
pub static SETMDNARPair: TradingPair = TradingPair::from_currency_ids(SETM, DNAR).unwrap();
pub static SETMDNARPair: TradingPair = TradingPair::from_currency_ids(SEE, DNAR).unwrap();
pub const BlockHashCount: u64 = 250;
}

Expand Down
10 changes: 5 additions & 5 deletions chassis/lib-serml/dex-oracle/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ fn disable_average_price_work() {
Error::<Runtime>::InvalidCurrencyId
);
assert_noop!(
DexOracle::disable_average_price(Origin::signed(1), SETM, DNAR),
DexOracle::disable_average_price(Origin::signed(1), SEE, DNAR),
Error::<Runtime>::AveragePriceMustBeEnabled
);

Expand Down Expand Up @@ -149,7 +149,7 @@ fn update_average_price_interval_work() {
Error::<Runtime>::InvalidCurrencyId
);
assert_noop!(
DexOracle::update_average_price_interval(Origin::signed(1), SETM, DNAR, 0),
DexOracle::update_average_price_interval(Origin::signed(1), SEE, DNAR, 0),
Error::<Runtime>::AveragePriceMustBeEnabled
);
assert_noop!(
Expand Down Expand Up @@ -256,7 +256,7 @@ fn on_initialize_work() {
))
);
set_pool(&SETMDNARPair::get(), 1000, 1000);
assert_ok!(DexOracle::enable_average_price(Origin::signed(1), SETM, DNAR, 2000));
assert_ok!(DexOracle::enable_average_price(Origin::signed(1), SEE, DNAR, 2000));
assert_eq!(
DexOracle::cumulatives(SETMDNARPair::get()),
(U256::from(0), U256::from(0), 0)
Expand Down Expand Up @@ -347,7 +347,7 @@ fn on_initialize_work() {
))
);

// elapsed time is lt the update interval of SETM/DNAR, update average price of SETM/DNAR after try
// elapsed time is lt the update interval of SEE/DNAR, update average price of SEE/DNAR after try
// update cumulatives.
set_pool(&SETMDNARPair::get(), 1000, 2000);
Timestamp::set_timestamp(2100);
Expand Down Expand Up @@ -478,7 +478,7 @@ fn on_initialize_work() {
))
);

// update average prices of SETUSD/DNAR and SETM/DNAR
// update average prices of SETUSD/DNAR and SEE/DNAR
set_pool(&SETUSDDNARPair::get(), 1000, 100);
set_pool(&SETMDNARPair::get(), 1000, 1000);
Timestamp::set_timestamp(7000);
Expand Down
2 changes: 1 addition & 1 deletion chassis/lib-serml/evm-accounts/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl orml_tokens::Config for Runtime {
}

parameter_types! {
pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::SETM);
pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::SEE);
}

impl orml_currencies::Config for Runtime {
Expand Down
2 changes: 1 addition & 1 deletion chassis/lib-serml/evm-manager/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl orml_tokens::Config for Runtime {
}

parameter_types! {
pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::SETM);
pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::SEE);
}

impl orml_currencies::Config for Runtime {
Expand Down
34 changes: 17 additions & 17 deletions chassis/lib-serml/evm-manager/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fn name_works() {
EvmCurrencyIdMapping::<Runtime>::set_erc20_mapping(erc20_address())
}));
assert_eq!(
EvmCurrencyIdMapping::<Runtime>::name(CurrencyId::Token(TokenSymbol::SETM)),
EvmCurrencyIdMapping::<Runtime>::name(CurrencyId::Token(TokenSymbol::SEE)),
Some(b"Setheum".to_vec())
);
assert_eq!(
Expand All @@ -116,7 +116,7 @@ fn name_works() {
);

assert_eq!(
EvmCurrencyIdMapping::<Runtime>::name(CurrencyId::DexShare(DexShare::Token(TokenSymbol::SETM), DexShare::Token(TokenSymbol::SETUSD))),
EvmCurrencyIdMapping::<Runtime>::name(CurrencyId::DexShare(DexShare::Token(TokenSymbol::SEE), DexShare::Token(TokenSymbol::SETUSD))),
Some(b"LP Setheum - SetDollar".to_vec())
);

Expand All @@ -131,7 +131,7 @@ fn name_works() {
);

assert_eq!(
EvmCurrencyIdMapping::<Runtime>::name(CurrencyId::DexShare(DexShare::Token(TokenSymbol::SETM), DexShare::Erc20(erc20_address_not_exists()))),
EvmCurrencyIdMapping::<Runtime>::name(CurrencyId::DexShare(DexShare::Token(TokenSymbol::SEE), DexShare::Erc20(erc20_address_not_exists()))),
None
);

Expand All @@ -153,8 +153,8 @@ fn symbol_works() {
EvmCurrencyIdMapping::<Runtime>::set_erc20_mapping(erc20_address())
}));
assert_eq!(
EvmCurrencyIdMapping::<Runtime>::symbol(CurrencyId::Token(TokenSymbol::SETM)),
Some(b"SETM".to_vec())
EvmCurrencyIdMapping::<Runtime>::symbol(CurrencyId::Token(TokenSymbol::SEE)),
Some(b"SEE".to_vec())
);
assert_eq!(
EvmCurrencyIdMapping::<Runtime>::symbol(CurrencyId::Erc20(erc20_address())),
Expand All @@ -168,7 +168,7 @@ fn symbol_works() {

assert_eq!(
EvmCurrencyIdMapping::<Runtime>::symbol(CurrencyId::DexShare(
DexShare::Token(TokenSymbol::SETM),
DexShare::Token(TokenSymbol::SEE),
DexShare::Token(TokenSymbol::SETUSD)
)),
Some(b"LP_SETM_SETUSD".to_vec())
Expand All @@ -192,7 +192,7 @@ fn symbol_works() {

assert_eq!(
EvmCurrencyIdMapping::<Runtime>::symbol(CurrencyId::DexShare(
DexShare::Token(TokenSymbol::SETM),
DexShare::Token(TokenSymbol::SEE),
DexShare::Erc20(erc20_address_not_exists())
)),
None
Expand All @@ -219,7 +219,7 @@ fn decimals_works() {
EvmCurrencyIdMapping::<Runtime>::set_erc20_mapping(erc20_address())
}));
assert_eq!(
EvmCurrencyIdMapping::<Runtime>::decimals(CurrencyId::Token(TokenSymbol::SETM)),
EvmCurrencyIdMapping::<Runtime>::decimals(CurrencyId::Token(TokenSymbol::SEE)),
Some(18)
);
assert_eq!(
Expand All @@ -234,7 +234,7 @@ fn decimals_works() {

assert_eq!(
EvmCurrencyIdMapping::<Runtime>::decimals(CurrencyId::DexShare(
DexShare::Token(TokenSymbol::SETM),
DexShare::Token(TokenSymbol::SEE),
DexShare::Token(TokenSymbol::SETUSD)
)),
Some(18)
Expand Down Expand Up @@ -277,7 +277,7 @@ fn encode_evm_address_works() {
EvmCurrencyIdMapping::<Runtime>::set_erc20_mapping(erc20_address())
}));
assert_eq!(
EvmCurrencyIdMapping::<Runtime>::encode_evm_address(CurrencyId::Token(TokenSymbol::SETM)),
EvmCurrencyIdMapping::<Runtime>::encode_evm_address(CurrencyId::Token(TokenSymbol::SEE)),
H160::from_str("0x0000000000000000000000000000000001000000").ok()
);
assert_eq!(
Expand All @@ -292,7 +292,7 @@ fn encode_evm_address_works() {

assert_eq!(
EvmCurrencyIdMapping::<Runtime>::encode_evm_address(CurrencyId::DexShare(
DexShare::Token(TokenSymbol::SETM),
DexShare::Token(TokenSymbol::SEE),
DexShare::Token(TokenSymbol::SETUSD)
)),
H160::from_str("0x0000000000000000000000010000000000000005").ok()
Expand Down Expand Up @@ -324,7 +324,7 @@ fn encode_evm_address_works() {

assert_eq!(
EvmCurrencyIdMapping::<Runtime>::encode_evm_address(CurrencyId::DexShare(
DexShare::Token(TokenSymbol::SETM),
DexShare::Token(TokenSymbol::SEE),
DexShare::Erc20(erc20_address_not_exists())
)),
None
Expand Down Expand Up @@ -352,9 +352,9 @@ fn decode_evm_address_works() {
}));
assert_eq!(
EvmCurrencyIdMapping::<Runtime>::decode_evm_address(
EvmCurrencyIdMapping::<Runtime>::encode_evm_address(CurrencyId::Token(TokenSymbol::SETM)).unwrap()
EvmCurrencyIdMapping::<Runtime>::encode_evm_address(CurrencyId::Token(TokenSymbol::SEE)).unwrap()
),
Some(CurrencyId::Token(TokenSymbol::SETM))
Some(CurrencyId::Token(TokenSymbol::SEE))
);
assert_eq!(
EvmCurrencyIdMapping::<Runtime>::decode_evm_address(
Expand All @@ -374,13 +374,13 @@ fn decode_evm_address_works() {
assert_eq!(
EvmCurrencyIdMapping::<Runtime>::decode_evm_address(
EvmCurrencyIdMapping::<Runtime>::encode_evm_address(CurrencyId::DexShare(
DexShare::Token(TokenSymbol::SETM),
DexShare::Token(TokenSymbol::SEE),
DexShare::Token(TokenSymbol::SETUSD)
))
.unwrap(),
),
Some(CurrencyId::DexShare(
DexShare::Token(TokenSymbol::SETM),
DexShare::Token(TokenSymbol::SEE),
DexShare::Token(TokenSymbol::SETUSD)
))
);
Expand Down Expand Up @@ -414,7 +414,7 @@ fn decode_evm_address_works() {
);

// decode invalid evm address
// CurrencyId::DexShare(DexShare::Token(TokenSymbol::SETM),
// CurrencyId::DexShare(DexShare::Token(TokenSymbol::SEE),
// DexShare::Erc20(erc20_address_not_exists()))
assert_eq!(
EvmCurrencyIdMapping::<Runtime>::decode_evm_address(
Expand Down
2 changes: 1 addition & 1 deletion chassis/lib-serml/evm/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl orml_tokens::Config for Runtime {
}

parameter_types! {
pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::SETM);
pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::SEE);
}

impl orml_currencies::Config for Runtime {
Expand Down
2 changes: 1 addition & 1 deletion chassis/lib-serml/nft/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ impl SerpTreasury<AccountId> for MockSerpTreasury {
}
}

pub const NATIVE_CURRENCY_ID: CurrencyId = CurrencyId::Token(TokenSymbol::SETM);
pub const NATIVE_CURRENCY_ID: CurrencyId = CurrencyId::Token(TokenSymbol::SEE);

parameter_types! {
pub const GetNativeCurrencyId: CurrencyId = NATIVE_CURRENCY_ID;
Expand Down
4 changes: 2 additions & 2 deletions chassis/lib-serml/prices/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,13 @@ fn access_price_of_dex_share_currency() {
#[test]
fn access_price_of_other_currency() {
ExtBuilder::default().build().execute_with(|| {
assert_eq!(PricesModule::access_price(SETM), Some(Price::saturating_from_integer(0)));
assert_eq!(PricesModule::access_price(SEE), Some(Price::saturating_from_integer(0)));
assert_eq!(PricesModule::access_price(SETR), Some(Price::saturating_from_rational(1, 4)));

mock_oracle_update();

assert_eq!(
PricesModule::access_price(SETM),
PricesModule::access_price(SEE),
Some(Price::saturating_from_integer(30u128))
); // 30 USD, right shift the decimal point (18-12) places
assert_eq!(
Expand Down
2 changes: 1 addition & 1 deletion chassis/lib-serml/transaction-payment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ pub mod module {
#[pallet::config]
pub trait Config: frame_system::Config {
/// Native currency id, the actual received currency type as fee for
/// treasury. Should be SETM
/// treasury. Should be SEE
#[pallet::constant]
type NativeCurrencyId: Get<CurrencyId>;

Expand Down
8 changes: 4 additions & 4 deletions chassis/lib-serml/transaction-payment/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub type BlockNumber = u64;
pub const ALICE: AccountId = AccountId::new([1u8; 32]);
pub const BOB: AccountId = AccountId::new([2u8; 32]);
pub const CHARLIE: AccountId = AccountId::new([3u8; 32]);
pub const SETM: CurrencyId = CurrencyId::Token(TokenSymbol::SETM);
pub const SEE: CurrencyId = CurrencyId::Token(TokenSymbol::SEE);
pub const SETR: CurrencyId = CurrencyId::Token(TokenSymbol::SETR);
pub const SETUSD: CurrencyId = CurrencyId::Token(TokenSymbol::SETUSD);
pub const DNAR: CurrencyId = CurrencyId::Token(TokenSymbol::DNAR);
Expand Down Expand Up @@ -284,7 +284,7 @@ impl SerpTreasury<AccountId> for MockSerpTreasury {
}

parameter_types! {
pub const GetNativeCurrencyId: CurrencyId = SETM;
pub const GetNativeCurrencyId: CurrencyId = SEE;
}

parameter_types! {
Expand Down Expand Up @@ -322,7 +322,7 @@ parameter_types! {
pub const TradingPathLimit: u32 = 4;
pub GetStableCurrencyExchangeFee: (u32, u32) = (1, 200); // 0.5%
pub EnabledTradingPairs: Vec<TradingPair> = vec![
TradingPair::from_currency_ids(SETUSD, SETM).unwrap(),
TradingPair::from_currency_ids(SETUSD, SEE).unwrap(),
TradingPair::from_currency_ids(SETUSD, DNAR).unwrap(),
];
}
Expand All @@ -343,7 +343,7 @@ impl module_dex::Config for Runtime {
parameter_types! {
pub MaxSwapSlippageCompareToOracle: Ratio = Ratio::saturating_from_rational(1, 2);
pub static TransactionByteFee: u128 = 1;
pub DefaultFeeSwapPathList: Vec<Vec<CurrencyId>> = vec![vec![SETUSD, SETM], vec![DNAR, SETUSD, SETM]];
pub DefaultFeeSwapPathList: Vec<Vec<CurrencyId>> = vec![vec![SETUSD, SEE], vec![DNAR, SETUSD, SEE]];
}

thread_local! {
Expand Down
Loading

0 comments on commit 52bf73f

Please sign in to comment.