From 784b7da5b3cc868e9528cada1ef307f5d19587e6 Mon Sep 17 00:00:00 2001 From: hrls Date: Wed, 27 Nov 2024 16:12:09 +0300 Subject: [PATCH] Add bondExtra staking call --- precompiles/staking/src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/precompiles/staking/src/lib.rs b/precompiles/staking/src/lib.rs index 8c30146..cf2ea03 100644 --- a/precompiles/staking/src/lib.rs +++ b/precompiles/staking/src/lib.rs @@ -99,6 +99,16 @@ where Ok(()) } + #[precompile::public("bondExtra(uint256)")] + fn bond_extra(h: &mut impl PrecompileHandle, max_additional: U256) -> EvmResult<()> { + let max_additional = Self::u256_to_amount(max_additional)?; + + let call = pallet_staking::Call::::bond_extra { max_additional }; + let origin = Some(Runtime::AddressMapping::into_account_id(h.context().caller)); + RuntimeHelper::::try_dispatch(h, origin.into(), call)?; + Ok(()) + } + #[precompile::public("bond(uint256,address)")] fn bond_into(h: &mut impl PrecompileHandle, value: U256, address: Address) -> EvmResult<()> { let value = Self::u256_to_amount(value)?;