From 2b41963d08b0f020ee968855dc07eeb51ea83a6b Mon Sep 17 00:00:00 2001 From: daltoncoder Date: Tue, 17 Oct 2023 18:18:31 -0400 Subject: [PATCH] Return bytecode for the fleek contract --- core/rpc/src/eth.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/rpc/src/eth.rs b/core/rpc/src/eth.rs index 1b89cbcb5..c06ecf512 100644 --- a/core/rpc/src/eth.rs +++ b/core/rpc/src/eth.rs @@ -10,6 +10,7 @@ use ethers::types::{ Transaction, TransactionReceipt as EthersTxnReceipt, TransactionRequest, + H160, H256, H256 as EthH256, }; @@ -26,6 +27,10 @@ use tracing::trace; use crate::handlers::Result; use crate::server::RpcData; +const FLEEK_CONTRACT: H160 = H160([6; 20]); + +const FLEEK_CONTRACT_BYTES: &[u8; 172] = b"73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122012d3570051ca11eb882745693b7b2af91a10ad5074b3486da80280731d9af73164736f6c63430008120033"; + /// Handler for: `eth_sendRawTransaction` pub async fn eth_send_raw_transaction( /////// @@ -138,7 +143,11 @@ pub async fn eth_get_code( ) -> Result { trace!(target: "rpc::eth", ?address, ?block_number, "Serving eth_getCode"); - Ok(Bytes::default()) + if address == FLEEK_CONTRACT { + Ok(Bytes::from_static(FLEEK_CONTRACT_BYTES)) + } else { + Ok(Bytes::default()) + } } // /// Handler for: `eth_getBlockByNumber`