@@ -40,7 +40,7 @@ use frame_support::{
4040 } ,
4141 PalletId ,
4242} ;
43- use frame_system:: { pallet_prelude:: OriginFor , RawOrigin } ;
43+ use frame_system:: { ensure_none , pallet_prelude:: OriginFor , RawOrigin } ;
4444use hydradx_traits:: evm:: CallResult ;
4545use hydradx_traits:: evm:: Erc20Mapping ;
4646use hydradx_traits:: gigahdx:: Seize ;
@@ -369,8 +369,13 @@ pub mod pallet {
369369 /// This lets a multi-money-market worker state which market a decision was made
370370 /// against and guarantees the liquidation can never execute against a different one.
371371 ///
372+ /// Unlike `liquidate`, this call is not publicly dispatchable: the origin must be
373+ /// none, and `ValidateUnsigned` rejects externally received transactions, so only
374+ /// a collator's own liquidation worker can submit it. The public permissionless
375+ /// path remains `liquidate`.
376+ ///
372377 /// Parameters:
373- /// - `origin`: Signed origin .
378+ /// - `origin`: Must be none (unsigned transaction) .
374379 /// - `pool`: EVM address of the money-market pool this liquidation targets.
375380 /// - `collateral_asset`: Asset ID used as collateral in the MM position.
376381 /// - `debt_asset`: Asset ID used as debt in the MM position.
@@ -402,7 +407,7 @@ pub mod pallet {
402407 ) ]
403408 #[ allow( clippy:: too_many_arguments) ]
404409 pub fn liquidate_with_pool (
405- _origin : OriginFor < T > ,
410+ origin : OriginFor < T > ,
406411 pool : EvmAddress ,
407412 collateral_asset : AssetId ,
408413 debt_asset : AssetId ,
@@ -411,6 +416,8 @@ pub mod pallet {
411416 route : Route < AssetId > ,
412417 _unsigned_priority : Option < Priority > ,
413418 ) -> DispatchResult {
419+ ensure_none ( origin) ?;
420+
414421 let expected = if collateral_asset == T :: GigaHdx :: gigahdx_asset_id ( ) {
415422 T :: GigaHdx :: pool_contract ( ) . ok_or ( Error :: < T > :: GigaHdxPoolNotSet ) ?
416423 } else {
0 commit comments