Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth2207 committed Dec 29, 2023
1 parent 52533d7 commit 221245d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
12 changes: 6 additions & 6 deletions orderbook-rs/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ use url::ParseError;
#[derive(Error, Debug)]
pub enum RainOrderbookError {
#[error("Invalid RPC URL")]
InvalidRPC(#[from] ParseError),
InvalidRPC(#[from] ParseError),

#[error("Invalid Contract Function Call")]
InvalidContractFunctionCall(#[from] ContractError<Provider<Http>>),
InvalidContractFunctionCall(#[from] ContractError<Provider<Http>>),

#[error("Invalid Address")]
InvalidAddress(#[from] FromHexError),
InvalidAddress(#[from] FromHexError),

#[error("Failed to confirm transaction")]
TransactionConfirmationError(#[from] ProviderError),
TransactionConfirmationError(#[from] ProviderError),

#[error("Error in Transaction")]
TransactionError(#[from] SignerMiddlewareError<Provider<Http>, Ledger>),
TransactionError(#[from] SignerMiddlewareError<Provider<Http>, Ledger>),

#[error("Failed to fetch Transaction Receipt")]
TransactionReceiptError
TransactionReceiptError,
}
3 changes: 1 addition & 2 deletions orderbook-rs/src/gasoracle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use reqwest::{header::AUTHORIZATION, Client};
use url::Url;

/// Bloacknative Base Url for fetching blockprices
static BLOCKNATIVE_BLOCKPRICES_URL: &str =
"https://api.blocknative.com/gasprices/blockprices";
static BLOCKNATIVE_BLOCKPRICES_URL: &str = "https://api.blocknative.com/gasprices/blockprices";

/// Blocknative Gas Oracle.
/// Returns max priority fee and max fee from blocknative api.
Expand Down
3 changes: 1 addition & 2 deletions orderbook-rs/src/interpreter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ pub async fn get_disp(
deployer_npe2: Address,
rpc_url: String,
) -> Result<(Address, Address, Address), RainOrderbookError> {

let provider = Provider::<Http>::try_from(rpc_url.clone())?;

let deployer_npe2_address = H160::from_str(&deployer_npe2.to_string())?;
let deployer_npe2_address = H160::from_str(&deployer_npe2.to_string())?;
let deployer_npe2 =
IExpressionDeployerV3::new(deployer_npe2_address, Arc::new(provider.clone()));

Expand Down
2 changes: 1 addition & 1 deletion orderbook-rs/src/orderbook/add_order/v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub async fn add_ob_order(
) -> Result<Vec<u8>, RainOrderbookError> {
let (_, _, rain_parser) = get_disp(deployer_address, rpc_url.clone()).await?;
let (bytecode, constants) =
parse_rainstring(rain_parser, rainlang_order_string, rpc_url.clone()).await?;
parse_rainstring(rain_parser, rainlang_order_string, rpc_url.clone()).await?;

let evaluable_config = EvaluableConfigV3 {
deployer: deployer_address,
Expand Down
6 changes: 2 additions & 4 deletions orderbook-rs/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ pub async fn execute_transaction(
let pending_tx = client.send_transaction(tx, None).await?;

info!("Transaction submitted. Awaiting block confirmations...");
let tx_confimration = pending_tx.confirmations(1).await?;
let tx_confimration = pending_tx.confirmations(1).await?;

let tx_receipt = match tx_confimration {
Some(receipt) => receipt,
None => return Err(RainOrderbookError::TransactionReceiptError),
Expand All @@ -76,6 +76,4 @@ pub async fn execute_transaction(
hex::encode(tx_receipt.transaction_hash.as_bytes())
);
Ok(tx_receipt)


}

0 comments on commit 221245d

Please sign in to comment.