Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,354 changes: 1,640 additions & 714 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ panic = 'unwind'
[workspace]
members = [
'node',
'pallets/ocex',
'pallets/pdex-migration',
'runtime',
'contracts/uniswap_v2',
]


#[patch."https://github.com/open-web3-stack/open-runtime-module-library.git"]
[patch."https://github.com/open-web3-stack/open-runtime-module-library.git"]
orml-vesting = { git = "https://github.com/Gauthamastro/open-runtime-module-library.git", branch="gj-substrate-master"}
orml-currencies = { git = "https://github.com/Gauthamastro/open-runtime-module-library.git", branch="gj-substrate-master"}
orml-tokens = { git = "https://github.com/Gauthamastro/open-runtime-module-library.git", branch="gj-substrate-master"}
orml-traits = { git = "https://github.com/Gauthamastro/open-runtime-module-library.git", branch="gj-substrate-master"}
orml-vesting = { git = "https://github.com/Gauthamastro/open-runtime-module-library.git", branch="gj-substrate-master"}
16 changes: 8 additions & 8 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ sc-authority-discovery = { git = "https://github.com/paritytech/substrate", bra
sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus-babe-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus-epochs = { git = "https://github.com/paritytech/substrate", branch = "master" }
grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" ,package="sc-finality-grandpa"}
grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", package="sc-finality-grandpa"}
sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
Expand All @@ -66,7 +66,7 @@ sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "mas
sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
grandpa-primitives = { git = "https://github.com/paritytech/substrate", branch = "master" , package="sp-finality-grandpa"}
grandpa-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", package="sp-finality-grandpa"}
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
Expand All @@ -81,7 +81,7 @@ sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", br
sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" }

#Primitives
polkadex-primitives = { git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git", branch = 'gj-substrate-master'}
polkadex-primitives = { git = "https://github.com/Polkadex-Substrate/polkadex-primitives.git", branch = 'master'}
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }


Expand All @@ -98,15 +98,15 @@ futures = "0.3.9"
tempfile = "3.1.0"
assert_cmd = "1.0"
nix = "0.19"
serde_json = "1.0"
serde_json = "1.0.68"
regex = "1"
platforms = "1.1"
async-std = { version = "1.6.5", features = ["attributes"] }
soketto = "0.4.2"
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus-epochs = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master", version = "4.0.0-dev" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master", version = "0.10.0-dev" }
sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master", version = "0.10.0-dev" }
sc-consensus-epochs = { git = "https://github.com/paritytech/substrate", branch = "master", version = "0.10.0-dev" }


[features]
Expand Down
13 changes: 11 additions & 2 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use sp_runtime::{traits::{IdentifyAccount, Verify}, Perbill};
use node_polkadex_runtime::{SessionKeys};
use node_polkadex_runtime::{
wasm_binary_unwrap, AuthorityDiscoveryConfig, BabeConfig, BalancesConfig,
CouncilConfig, IndicesConfig,
CouncilConfig, IndicesConfig, PolkadexOcexConfig,
OrmlVestingConfig, SessionConfig, StakerStatus, PDEXMigrationConfig,
StakingConfig, SudoConfig, SystemConfig, TechnicalCommitteeConfig, TokensConfig
};
Expand Down Expand Up @@ -177,6 +177,9 @@ pub fn authority_keys_from_seed(
)
}

#[allow(non_upper_case_globals)]
pub const OCEXGenesisAccount: PalletId = PalletId(*b"polka/ga");

fn development_config_genesis() -> GenesisConfig {
testnet_genesis(
vec![authority_keys_from_seed("Alice")],
Expand Down Expand Up @@ -316,6 +319,7 @@ pub fn testnet_genesis(
_initial_nominators: Vec<AccountId>,
root_key: AccountId
) -> GenesisConfig {
let genesis: AccountId = OCEXGenesisAccount.into_account();
const ENDOWMENT: u128 = 20_000 * PDEX;
const STASH: u128 = 2 * PDEX;
// Total Supply in ERC20
Expand Down Expand Up @@ -427,7 +431,12 @@ pub fn testnet_genesis(
pdex_migration: PDEXMigrationConfig {
max_tokens: ERC20_PDEX_SUPPLY,
operation_status: false
}
},
polkadex_ocex: PolkadexOcexConfig {
key: genesis.clone(),
genesis_account: genesis,
},
tokens: TokensConfig{ balances: vec![] }
}
}

Expand Down
53 changes: 53 additions & 0 deletions pallets/ocex/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[package]
name = "polkadex-ocex"
version = "0.1.0"
authors = ["Anonymous"]
edition = "2018"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] }
hex = { version = "2.1.0", package = "rustc-hex", default-features = false }
serde = { version = "1.0.101", optional = true }

frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", version = "4.0.0-dev", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", version = "4.0.0-dev", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", version = "4.0.0-dev", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", version = "4.0.0-dev", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", version = "4.0.0-dev", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false }
polkadex-primitives = { git = "https://github.com/Polkadex-Substrate/polkadex-primitives", branch = "master", default-features=false}
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", version = "4.0.0-dev", default-features = false, optional = true }
orml-tokens = { git = "https://github.com/Gauthamastro/open-runtime-module-library.git", branch="gj-substrate-master", default-features = false }
orml-currencies = { git = "https://github.com/Gauthamastro/open-runtime-module-library.git", branch="gj-substrate-master", default-features = false }
orml-traits = { git = "https://github.com/Gauthamastro/open-runtime-module-library.git", branch="gj-substrate-master", default-features = false }
pallet-balances = {git = "https://github.com/paritytech/substrate", branch = "master", version = "4.0.0-dev", default-features = false }
pallet-substratee-registry = { package="pallet-teerex", git = "https://github.com/Polkadex-Substrate/pallet-substratee-registry", branch = "master", default-features = false }
timestamp= {git = "https://github.com/paritytech/substrate.git", package = "pallet-timestamp",branch = "master", version = "4.0.0-dev", default-features = false}
polkadex-sgx-primitives = {git = "https://github.com/Polkadex-Substrate/polkadexTEE-worker", branch = "monthly-2021-09+1", default-features=false}

[dev-dependencies]
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master", version = "4.0.0-dev", default-features = false }

[features]
default = ["std"]
std = [
"serde",
"hex/std",
"codec/std",
"frame-support/std",
"frame-system/std",
"sp-core/std",
"sp-std/std",
"sp-io/std",
"sp-runtime/std",
"polkadex-primitives/std",
"orml-tokens/std",
"orml-currencies/std",
"orml-traits/std",
"pallet-balances/std",
"pallet-substratee-registry/std",
]
runtime-benchmarks = ["frame-benchmarking"]
81 changes: 81 additions & 0 deletions pallets/ocex/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Polkadex OCEX Pallet

OCEX pallet handles the deposits, withdrawals and off-chain workers for verifying the IPFS snapshots of enclave, and safeguards user funds by initiating emergency shutdown protocol.

## Importing a `polkadex-ocex` pallet

The first thing you need to do to add the `polkadex-ocex` pallet is to import the `polkadex-ocex` crate in your runtime's Cargo.toml file

`runtime/Cargo.toml`

```
[dependencies]
#--snip--
polkadex-ocex = { git = "https://github.com/Polkadex-Substrate/Polkadex", default-features = false }
```

Add the following two lines to the runtime's std feature.

```
[features]
default = ['std']
std = [
#--snip--
"polkadex-ocex/std",
#--snip--
]
```

### Adding the `polkadex-ocex` pallet

`runtime/src/lib.rs`

- Adding to the construct_runtime! Macro

```
PolkadexOcex: polkadex_ocex::{Pallet, Call, Storage, Config<T>, Event<T>}
```

- Runtime Configuration

```
parameter_types! {
pub const ProxyLimit: usize = 10; // Max sub-accounts per main account
pub const OcexModuleId: PalletId = PalletId(*b"polka/ex");
pub const OCEXGENESIS_ACCOUNT: PalletId = PalletId(*b"polka/ga");
}

impl polkadex_ocex::Config for Runtime {
type Event = Event;
type OcexId = OcexModuleId;
type GenesisAccount = OCEXGENESIS_ACCOUNT;
type Currency = Currencies;
type ProxyLimit = ProxyLimit;
}
```
### Genesis Configuration
`node/src/chain_spec.rs`
Inside the testnet_genesis function we need to add our pallet's configuration to the returned GenesisConfig object as followed:
```
GenesisConfig {
/* --snip-- */
/*** Add This Block ***/
polkadex_ocex: PolkadexOcexConfig {
key: genesis.clone(),
genesis_account: genesis,
}
/*** End Added Block ***/
}
```
## Dispatchable functions

- `deposit` - Transfers given amount to Enclave.
- `release` - Releases/Transfers given amount to Destination Account, Only Enclave can call this Dispatchable function.
- `withdraw` - Notifies enclave about senders intend to withdraw via on-chain.
- `register` - Registers main Account
- `add_proxy` - Adds Proxy Account for given Main Account.
- `remove_proxy` - Removes Proxy Account for given Main Account.




90 changes: 90 additions & 0 deletions pallets/ocex/src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Polkadex OCEX Pallet

Polkadex Fungible Assets Pallet provides functionality to issue new tokens and offers efficient way to mint, burn and distribute tokens.

## Overview
Polkadex Fungible Assets Pallet provides function for:-
* Creating new tokens.
* Setting Vesting information related to given Asset Id.
* Claiming Vesting amount, set by given Asset Id's creator.
* Setting Metadata of given Asset Id.
* Minting, Burning and Attesting tokens.


## Importing a `polkadex-ocex` pallet

The first thing you need to do to add the `polkadex-ocex` pallet is to import the `polkadex-ocex` crate in your runtime's Cargo.toml file

`runtime/Cargo.toml`

```
[dependencies]
#--snip--
polkadex-ocex = { git = "https://github.com/Polkadex-Substrate/Polkadex", default-features = false }
```

Add the following two lines to the runtime's std feature.

```
[features]
default = ['std']
std = [
#--snip--
"polkadex-ocex/std",
#--snip--
]
```

### Adding the `polkadex-ocex` pallet

`runtime/src/lib.rs`

- Adding to the construct_runtime! Macro

```
PolkadexOcex: polkadex_ocex::{Pallet, Call, Storage, Config<T>, Event<T>}
```

- Runtime Configuration

```
parameter_types! {
pub const ProxyLimit: usize = 10; // Max sub-accounts per main account
pub const OcexModuleId: PalletId = PalletId(*b"polka/ex");
pub const OCEXGENESIS_ACCOUNT: PalletId = PalletId(*b"polka/ga");
}

impl polkadex_ocex::Config for Runtime {
type Event = Event;
type OcexId = OcexModuleId;
type GenesisAccount = OCEXGENESIS_ACCOUNT;
type Currency = Currencies;
type ProxyLimit = ProxyLimit;
}
```
### Genesis Configuration
`node/src/chain_spec.rs`
Inside the testnet_genesis function we need to add our pallet's configuration to the returned GenesisConfig object as followed:
```
GenesisConfig {
/* --snip-- */
/*** Add This Block ***/
polkadex_ocex: PolkadexOcexConfig {
key: genesis.clone(),
genesis_account: genesis,
}
/*** End Added Block ***/
}
```
## Dispatchable functions

- `deposit` -
- `release` -
- `withdraw` -
- `register` - Registers main Account
- `add_proxy` - Adds Proxy Account for given Main Account.
- `remove_proxy` - Removes Proxy Account for given Main Account.




Loading