Skip to content

Commit

Permalink
Add bondExtra staking call
Browse files Browse the repository at this point in the history
  • Loading branch information
hrls committed Nov 27, 2024
1 parent c66a398 commit 784b7da
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions precompiles/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Runtime>::bond_extra { max_additional };
let origin = Some(Runtime::AddressMapping::into_account_id(h.context().caller));
RuntimeHelper::<Runtime>::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)?;
Expand Down

0 comments on commit 784b7da

Please sign in to comment.