the base fee opcode (#141)

Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
Cyrill Leutwiler
2024-12-19 12:44:15 +01:00
committed by GitHub
parent 3f9771f838
commit 6ad846a285
5 changed files with 379 additions and 365 deletions
@@ -30,7 +30,15 @@ pub fn gas_price<'ctx, D>(
where
D: Dependency + Clone,
{
Ok(context.word_const(1).as_basic_value_enum())
let gas_price_value = context
.build_runtime_call(revive_runtime_api::polkavm_imports::GAS_PRICE, &[])
.expect("the gas_price syscall method should return a value")
.into_int_value();
Ok(context
.builder()
.build_int_z_extend(gas_price_value, context.word_type(), "gas_price")?
.into())
}
/// Translates the `tx.origin` instruction.