diff --git a/modules/cdp_engine/src/lib.rs b/modules/cdp_engine/src/lib.rs index 5d929f073d..aa08f4495b 100644 --- a/modules/cdp_engine/src/lib.rs +++ b/modules/cdp_engine/src/lib.rs @@ -364,12 +364,19 @@ impl Module { if let Some((_, account_id)) = key { // TODO: liquidate unsafe cdp before emergency shutdown, settle cdp with debit when emergency shutdown occurs. if Self::is_unsafe_cdp(currency_id, &account_id) { - if let Err(e) = Self::submit_unsigned_liquidation_tx(currency_id, account_id) { + if let Err(e) = Self::submit_unsigned_liquidation_tx(currency_id, account_id.clone()) { debug::debug!( target: "cdp-engine offchain worker", "faild to submit unsigned liquidation tx: {:?}", e, ); + } else { + debug::info!( + target: "cdp-engine offchain worker", + "successfully submit unsigned liquidation tx for CDP: \n AccountId - {:?} \n CurrencyId: {:?}", + account_id, + currency_id, + ); } } } @@ -700,7 +707,7 @@ impl frame_support::unsigned::ValidateUnsigned for Module { Ok(ValidTransaction { priority: TransactionPriority::max_value(), requires: vec![], - provides: vec![], + provides: vec![(>::block_number(), currency_id, who).encode()], longevity: 64_u64, propagate: true, }) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index d5c0491d6c..3ee3974078 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -578,7 +578,6 @@ impl system::offchain::CreateTransaction for Runtim system::CheckWeight::::new(), orml_oracle::CheckOperator::::new(), module_accounts::ChargeTransactionPayment::::from(tip), - module_cdp_engine::AutomaticLiquidationValidation::::new(), ); let raw_payload = SignedPayload::new(call, extra) .map_err(|e| { @@ -686,7 +685,7 @@ construct_runtime!( Auction: orml_auction::{Module, Storage, Call, Event}, AuctionManager: module_auction_manager::{Module, Storage, Call, Event}, Loans: module_loans::{Module, Storage, Call, Event}, - CdpEngine: module_cdp_engine::{Module, Storage, Call, Event, Config}, + CdpEngine: module_cdp_engine::{Module, Storage, Call, Event, Config, ValidateUnsigned}, Honzon: module_honzon::{Module, Storage, Call, Event}, Dex: module_dex::{Module, Storage, Call, Event}, CdpTreasury: module_cdp_treasury::{Module, Storage, Call, Config, Event}, @@ -715,7 +714,6 @@ pub type SignedExtra = ( system::CheckWeight, orml_oracle::CheckOperator, module_accounts::ChargeTransactionPayment, - module_cdp_engine::AutomaticLiquidationValidation, ); /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic;