Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9b596d0
add struct currency
baidang201 May 14, 2024
e69db9e
init currency pallet
baidang201 May 14, 2024
44546f5
init erc-20 pallet
baidang201 May 15, 2024
a32f76b
impl erc-20 transfer
baidang201 May 16, 2024
ac656e7
intergrate erc20 transfer to currencies module
baidang201 May 17, 2024
f48da71
add ggx-tokens
baidang201 May 20, 2024
15db345
export GGXCurrencies pallet
baidang201 May 20, 2024
8483f97
update MAXIMUM_BLOCK_WEIGHT
baidang201 May 21, 2024
75cbbb3
add CurrencyId to pallet dex
baidang201 May 21, 2024
51c3ce8
update tranfer ref_time to 100_000_000_000
baidang201 May 22, 2024
df36ae9
update dex mock
baidang201 May 22, 2024
eafd352
fix dex mock.rs
baidang201 May 23, 2024
bfd6b1f
clean code for pallet-erc20
baidang201 May 23, 2024
fabb133
fix currencies testcase
baidang201 May 24, 2024
5722aa0
fix dex testcase
baidang201 May 24, 2024
0afa8f4
remove unused import
baidang201 May 24, 2024
dc19101
add deploy erc20 in currencies mock.rs
baidang201 May 27, 2024
609f7a3
1 fix balance_of 2 fix tranfer testcase
baidang201 May 28, 2024
54dd640
Merge branch 'main' into erc-20
baidang201 May 28, 2024
8cda2a4
add deposit_erc20/withdraw_erc20 testcase for dex
baidang201 May 28, 2024
359bb35
fix cargo clippy
baidang201 May 28, 2024
82104c8
allow from_over_into
baidang201 May 28, 2024
d4b789c
update DexConfig
baidang201 May 29, 2024
c3fa936
use ForeignAsset in node/src/runtime/mainnet.rs
baidang201 May 29, 2024
b4f6aab
update runtime metadata for test
baidang201 May 29, 2024
8478c29
add erc20 testdata
baidang201 May 30, 2024
130cc87
clean code
baidang201 May 30, 2024
3a7625e
update test metadata
baidang201 May 30, 2024
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
124 changes: 124 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ members = [
"node",
"precompiles/session",
"precompiles/zk-groth16-verify",
"primitives",
"runtime/sydney",
"runtime/brooklyn",
"runtime/runtime-common",
Expand All @@ -24,9 +25,11 @@ repository = "https://github.com/ggxchain/ggxnode/"
# General purpose dependencies
assert_cmd = "2.0.2"
async-trait = "0.1"
bstringify = { version = "0.1.2" }
cfg-if = "1.0"
clap = { version = "4.1", features = ["derive"] }
derive_more = { version = "0.99" }
ethereum-types = { version = "0.14.0", default-features = false }
env_logger = "0.10.0"
ethers = { version = "2.0.4" }
futures = "0.3.28"
Expand Down Expand Up @@ -159,6 +162,8 @@ substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/pa
substrate-frame-rpc-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
substrate-test-utils = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43", default-features = false }


# Frontier Client
fc-cli = { version = "1.0.0-dev", git = "https://github.com/AstarNetwork/frontier.git", branch = "polkadot-v0.9.43" }
Expand Down Expand Up @@ -196,8 +201,10 @@ ggxchain-runtime-brooklyn = { path = "runtime/brooklyn", default-features = fals
ggxchain-runtime-sydney = { path = "runtime/sydney", default-features = false }
pallet-evm-precompile-session = { path = "precompiles/session", default-features = false }
pallet-evm-precompile-zk-groth16-verify = { path = "precompiles/zk-groth16-verify", default-features = false }
ggx-primitives = { path = "primitives", default-features = false }
runtime-common = { path = "runtime/runtime-common", default-features = false }


# Astar
astar-primitives = { git = "https://github.com/AstarNetwork/Astar.git", rev = "df73ca435bbfa30548bb2446b5dbb58492c928bb", default-features = false }
pallet-chain-extension-xvm = { version = "0.1.0", git = "https://github.com/AstarNetwork/Astar.git", rev = "df73ca435bbfa30548bb2446b5dbb58492c928bb", default-features = false }
Expand Down Expand Up @@ -256,6 +263,7 @@ ark-std = { version = "0.4.0", default-features = false }

# Orml dependencies
orml-asset-registry = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "28a2e6f0df9540d91db4018c7ecebb8bfc217a2a", default-features = false }
orml-utilities = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "28a2e6f0df9540d91db4018c7ecebb8bfc217a2a", default-features = false }
orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "28a2e6f0df9540d91db4018c7ecebb8bfc217a2a", default-features = false }
orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "28a2e6f0df9540d91db4018c7ecebb8bfc217a2a", default-features = false }

Expand Down Expand Up @@ -296,7 +304,10 @@ reward-rpc-runtime-api = { git = "https://github.com/ggxchain/interbtc.git", bra
vault-registry-rpc-runtime-api = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false }

# Dex
pallet-currencies = { path = "pallet/currencies", default-features = false }
pallet-erc20 = { path = "pallet/erc-20", default-features = false }
pallet-dex = { path = "pallet/dex", default-features = false }
pallet-ggx-tokens = { path = "pallet/ggx-tokens", default-features = false }

# Supress warnings from the peerset in logs during syncing
# The polkadot did the same in the next release. See:
Expand Down
3 changes: 3 additions & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ replace-rpc.workspace = true
reward-rpc.workspace = true
vault-registry-rpc.workspace = true

# dex
ggx-primitives.workspace = true

[dev-dependencies]
alloy-rlp = { workspace = true }
assert_cmd = { workspace = true }
Expand Down
63 changes: 61 additions & 2 deletions node/src/runtime/mainnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use bitcoin::utils::{
virtual_transaction_size, InputType, TransactionInputMetadata, TransactionOutputMetadata,
};

use ggx_primitives::currency::CurrencyId::ForeignAsset;
pub use ggxchain_runtime_sydney::{btcbridge::CurrencyId::Token, opaque::SessionKeys, *};
use primitives::{CurrencyId, Rate, TokenSymbol::GGXT, VaultCurrencyPair};
use rand::SeedableRng;
Expand Down Expand Up @@ -268,6 +269,43 @@ pub fn testnet_genesis(
.flat_map(|k| vec![(k.clone().0, Token(GGXT), 1 << 70)])
.collect(),
},
ggx_tokens: GGXTokensConfig {
balances: endowed_accounts
.iter()
.flat_map(|k| {
vec![
(
k.clone().0,
ggx_primitives::currency::CurrencyId::Token(
ggx_primitives::currency::TokenSymbol::GGX,
),
1u128 << 70,
),
(
k.clone().0,
ggx_primitives::currency::CurrencyId::Token(
ggx_primitives::currency::TokenSymbol::BTC,
),
1u128 << 70,
),
(
k.clone().0,
ggx_primitives::currency::CurrencyId::Token(
ggx_primitives::currency::TokenSymbol::GGXT,
),
1u128 << 70,
),
(
k.clone().0,
ggx_primitives::currency::CurrencyId::Token(
ggx_primitives::currency::TokenSymbol::USDT,
),
1u128 << 70,
),
]
})
.collect(),
},
oracle: OracleConfig {
authorized_oracles: endowed_accounts
.iter()
Expand Down Expand Up @@ -333,8 +371,29 @@ pub fn testnet_genesis(
min_exchange_rate: Rate::from_inner(loans::DEFAULT_MIN_EXCHANGE_RATE),
},
dex: DexConfig {
asset_ids: vec![8888, 999, 888, 777, 666, 667],
native_asset_id: 8888,
asset_ids: vec![
ggx_primitives::currency::CurrencyId::Token(
ggx_primitives::currency::TokenSymbol::GGX,
),
ForeignAsset(8888),
ForeignAsset(999),
ForeignAsset(888),
ForeignAsset(777),
ForeignAsset(666),
ForeignAsset(667),
ggx_primitives::currency::CurrencyId::Token(
ggx_primitives::currency::TokenSymbol::USDT,
),
ggx_primitives::currency::CurrencyId::Token(
ggx_primitives::currency::TokenSymbol::GGXT,
),
ggx_primitives::currency::CurrencyId::Token(
ggx_primitives::currency::TokenSymbol::BTC,
),
],
native_asset_id: ggx_primitives::currency::CurrencyId::Token(
ggx_primitives::currency::TokenSymbol::GGX,
),
},
}
}
Loading