diff --git a/lib/kakarot b/lib/kakarot index 4f81efca0..da0a8b33f 160000 --- a/lib/kakarot +++ b/lib/kakarot @@ -1 +1 @@ -Subproject commit 4f81efca01c63b144c150ba23ea834ad2ecab612 +Subproject commit da0a8b33f4ca82ccc8f0518e764f048ab6860d87 diff --git a/src/contracts/erc20.rs b/src/contracts/erc20.rs index b8572cfee..960e35dd5 100644 --- a/src/contracts/erc20.rs +++ b/src/contracts/erc20.rs @@ -12,6 +12,7 @@ use starknet_abigen_parser::cairo_types::CairoArrayLegacy; use starknet_crypto::FieldElement; use crate::contracts::kakarot_contract::KakarotCoreReader; +use crate::contracts::kakarot_contract::Uint256 as CairoUint256; use crate::models::block::EthBlockId; use crate::models::felt::Felt252Wrapper; use crate::starknet_client::constants::TX_ORIGIN_ZERO; @@ -54,15 +55,14 @@ impl EthereumErc20

{ let gas_limit = felt!("0x100000"); let gas_price = felt!("0x1"); - let value = FieldElement::ZERO; - let (_, return_data, success) = kakarot_reader + let (_, return_data, success, _) = kakarot_reader .eth_call( &origin.into(), &self.address, &gas_limit, &gas_price, - &value, + &CairoUint256 { low: FieldElement::ZERO, high: FieldElement::ZERO }, &calldata.len().into(), &CairoArrayLegacy(calldata), ) diff --git a/src/starknet_client/mod.rs b/src/starknet_client/mod.rs index a80cd29e0..46f07a7d5 100644 --- a/src/starknet_client/mod.rs +++ b/src/starknet_client/mod.rs @@ -35,6 +35,7 @@ use self::errors::EthApiError; use self::helpers::{prepare_kakarot_eth_send_transaction, split_u256, try_from_u8_iterator}; use crate::contracts::erc20::EthereumErc20; use crate::contracts::kakarot_contract::KakarotContract; +use crate::contracts::kakarot_contract::Uint256 as KakarotUint256; use crate::models::balance::{FutureTokenBalance, TokenBalances}; use crate::models::block::{BlockWithTxHashes, BlockWithTxs, EthBlockId}; use crate::models::errors::ConversionError; @@ -113,7 +114,10 @@ impl KakarotClient

{ let gas_price = into_via_try_wrapper!(request.gas_price.unwrap_or_default()); - let value = into_via_try_wrapper!(request.value.unwrap_or_default()); + let value = { + let value = request.value.unwrap_or_default(); + split_u256::(value) + }; debug!("origin: {:?}", origin); debug!("to: {:?}", to); @@ -122,10 +126,18 @@ impl KakarotClient

{ debug!("value: {:?}", value); debug!("calldata: {:?}", calldata); - let (_, return_data, success) = self + let (_, return_data, success, _gas_used) = self .kakarot_contract .reader - .eth_call(&origin, &to, &gas_limit, &gas_price, &value, &calldata.len().into(), &CairoArrayLegacy(calldata)) + .eth_call( + &origin, + &to, + &gas_limit, + &gas_price, + &KakarotUint256 { low: value[0], high: value[1] }, + &calldata.len().into(), + &CairoArrayLegacy(calldata), + ) .block_id(starknet_block_id) .call() .await?;