Skip to content

Commit

Permalink
Merge pull request #937 from galacticcouncil/pallet_liquidation
Browse files Browse the repository at this point in the history
feat: on chain liquidation
  • Loading branch information
Roznovjak authored Dec 10, 2024
2 parents ea2c757 + fe18369 commit 23d16f0
Show file tree
Hide file tree
Showing 29 changed files with 2,095 additions and 61 deletions.
45 changes: 42 additions & 3 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ members = [
'pallets/evm-accounts',
'pallets/dynamic-evm-fee',
'pallets/xyk-liquidity-mining',
'pallets/liquidation',
'precompiles/call-permit',
'runtime-mock'
]
Expand Down Expand Up @@ -143,6 +144,7 @@ pallet-xyk-liquidity-mining = { path = "pallets/xyk-liquidity-mining", default-f
pallet-referrals = { path = "pallets/referrals", default-features = false }
pallet-evm-accounts = { path = "pallets/evm-accounts", default-features = false }
pallet-evm-accounts-rpc-runtime-api = { path = "pallets/evm-accounts/rpc/runtime-api", default-features = false }
pallet-liquidation = { path = "pallets/liquidation", default-features = false }

hydra-dx-build-script-utils = { path = "utils/build-script-utils", default-features = false }
scraper = { path = "scraper", default-features = false }
Expand Down
8 changes: 5 additions & 3 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "runtime-integration-tests"
version = "1.25.1"
version = "1.25.2"
description = "Integration tests"
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down Expand Up @@ -41,14 +41,15 @@ pallet-staking = { workspace = true }
pallet-lbp = { workspace = true }
pallet-xyk = { workspace = true }
pallet-evm-accounts = { workspace = true }
pallet-xyk-liquidity-mining = { workspace = true }
pallet-transaction-pause = { workspace = true }
pallet-liquidation = { workspace = true }

pallet-treasury = { workspace = true }
pallet-democracy = { workspace = true }
pallet-scheduler = { workspace = true }
pallet-elections-phragmen = { workspace = true }
pallet-tips = { workspace = true }
pallet-xyk-liquidity-mining = { workspace = true }
pallet-transaction-pause = { workspace = true }

# collator support
pallet-collator-selection = { workspace = true }
Expand Down Expand Up @@ -217,6 +218,7 @@ std = [
"pallet-dynamic-evm-fee/std",
"precompile-utils/std",
"pallet-transaction-pause/std",
"pallet-liquidation/std",
]

# we don't include integration tests when benchmarking feature is enabled
Expand Down
Binary file added integration-tests/evm-snapshot/SNAPSHOT
Binary file not shown.
10 changes: 5 additions & 5 deletions integration-tests/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,7 @@ fn substrate_account_should_pay_gas_with_payment_currency() {
hydradx_runtime::RuntimeOrigin::signed(ALICE.into()),
evm_address,
hydradx_runtime::evm::precompiles::IDENTITY,
vec![].into(),
vec![],
U256::zero(),
1000000,
U256::from(1000000000),
Expand Down Expand Up @@ -1740,26 +1740,26 @@ fn evm_account_always_pays_with_weth_for_evm_call() {
);
assert_ok!(Tokens::set_balance(
RawOrigin::Root.into(),
evm_account().into(),
evm_account(),
WETH,
to_ether(1),
0,
));
assert_ok!(Currencies::update_balance(
hydradx_runtime::RuntimeOrigin::root(),
evm_account().into(),
evm_account(),
HDX,
0,
));
let mut padded_evm_address = [0u8; 32];
padded_evm_address[..20].copy_from_slice(&evm_address.as_bytes());
padded_evm_address[..20].copy_from_slice(evm_address.as_bytes());

// Act
assert_ok!(EVM::call(
hydradx_runtime::RuntimeOrigin::signed(padded_evm_address.into()),
evm_address,
hydradx_runtime::evm::precompiles::IDENTITY,
vec![].into(),
vec![],
U256::zero(),
1000000,
U256::from(1000000000),
Expand Down
1 change: 1 addition & 0 deletions integration-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ mod exchange_asset;
mod fee_calculation;
mod global_account_derivation;
mod insufficient_assets_ed;
mod liquidation;
mod multi_payment;
mod non_native_fee;
mod omnipool_init;
Expand Down
Loading

0 comments on commit 23d16f0

Please sign in to comment.