Skip to content

Commit

Permalink
Merge branch 'master' into JBA-Khalifa-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
balqaasem authored Dec 31, 2023
2 parents c32f465 + dda9dbb commit 11c2462
Show file tree
Hide file tree
Showing 45 changed files with 478 additions and 438 deletions.
34 changes: 30 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Scalable
* Secure

Setheum's Blockchain Network node Implementation in Rust, Substrate FRAME and Setheum SERML, ready for hacking :rocket:
Setheum's Blockchain Network node Implementation in Rust, ready for hacking :rocket:

<div align="center">

Expand All @@ -29,10 +29,32 @@ 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/Sheeth` meaning `gift` in hebrew and the name of the Prophet Sheeth/Seth,
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 via its Khalifa DeFi Subchain.

Setheum is a secure, confidential and interoperable decentralised internet cloud compute and storage blockchain network with EVM and WASM smart contracts,
web3 and web 2 Support. The intent of the Setheum Network is to improve upon Web3 and solve the blockchain trilemma with a mixture of approaches and a recipe
formed from what we have seen and considered to be some of the best solutions in the field, improving on scalability, security, mass adoption, diversity,
and ethics while preserving decentralisation and democratisation. Setheum intends to be the most scalable blockchain network in the world while providing
confidentiality for smart contracts, Cloud Computing and Storage Infrastructure for Web3 based Internet Solutions and Interoperability with both Web2 and
other Web3 Networks. The Setheum DAGESTAN architecture powers the network to be the most scalable network in the world; it enables near instant finality,
high throughput, high scalability and interoperability for the Setheum Network.

Setheum, founded November 2019, achieves a high level of equilibrium in the trilemma by leveraging a Directed Acyclic Graph(DAG) to build the blockchain consensus
making it a Blockchain via DAG, achieve instant finality, high throughput and very fast blocktime while preserving network security and having a fairly decentralised network,
Setheum’s consensus system leans towards achieving high scalability and high security with an ethical, decent and equitably high level of decentralisation.

Setheum is EVM(Ethereum Virtual Machine) compatible for smart contracts to thrive on its super fast blockchain, the entire chain is upgradable and forkless
enabling forkless upgrades as Setheum is built with the Substrate framework using the Rust programming language. Ethical DeFi Suite powers the Ethical DeFi revolution
on Setheum, being on the fastest public blockchain network in the world and leveraging all the benefits that come with being on Setheum, making it a DeFi optimised blockchain
especially exceptional for DeFi applications and solutions.

Ethical DeFi Suite is the DeFi powerhouse of the Setheum Network, providing all kinds of top notch DeFi protocols including a cutting-edge AMM DEX, modules,
Decentralised Liquid Staking for Setheum SE and ethical zero-interest halal stablecoins that gives us the properties of both Fiat and Crypto with SlickUSD (USSD)
and the Setter (SETR) using an Ethical Collateralized Debt Position (ECDP) mechanism that is over-Collateralized and multi-Collateralised and stable
without compromising decentralisation or economic stability, offering zero-interest loans of stable cryptocurrencies that has scalable value and trust,
setheum provides just that, backed by crypto assets with efficient zero-interest loans.

## Getting Started

Expand Down Expand Up @@ -266,3 +288,7 @@ For a look, check [./LICENSES](./LICENSES/README.md)
1. [Apache-2.0](./Apache-2.0.md)
2. [BUSL-1.1](./BUSL-1.1.md)
3. [GPL3](./GPL3.md)


### TODO
Update licenses and restructure repo
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
Loading

0 comments on commit 11c2462

Please sign in to comment.