Skip to content

Commit

Permalink
refactor(papyrus): remove unnecessary dep + style
Browse files Browse the repository at this point in the history
commit-id:19ed8b4a
  • Loading branch information
Gilad Chase committed Sep 18, 2024
1 parent e57cdb9 commit 5a50f51
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ license-file = "LICENSE"
# TODO: Remove this once udeps is fixed.
alloy-contract = "0.3.5"
alloy-dyn-abi = "0.8.3"
alloy-json-abi = "0.8.3"
alloy-json-rpc = "0.3.5"
alloy-primitives = "0.8.3"
alloy-provider = "0.3.5"
Expand Down
1 change: 0 additions & 1 deletion crates/papyrus_base_layer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ license-file.workspace = true
[dependencies]
alloy-contract.workspace = true
alloy-dyn-abi.workspace = true
alloy-json-abi.workspace = true
alloy-json-rpc.workspace = true
alloy-primitives.workspace = true
alloy-provider.workspace = true
Expand Down
8 changes: 3 additions & 5 deletions crates/papyrus_base_layer/src/ethereum_base_layer_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::future::IntoFuture;

use alloy_contract::{ContractInstance, Interface};
use alloy_dyn_abi::SolType;
use alloy_json_abi::JsonAbi;
use alloy_primitives::Address;
use alloy_provider::network::Ethereum;
use alloy_provider::{Provider, ProviderBuilder, RootProvider};
Expand Down Expand Up @@ -77,12 +76,11 @@ pub struct EthereumBaseLayerContract {

impl EthereumBaseLayerContract {
pub fn new(config: EthereumBaseLayerConfig) -> Result<Self, EthereumBaseLayerError> {
let address = config.starknet_contract_address.parse::<Address>()?;
let address: Address = config.starknet_contract_address.parse()?;
let client = ProviderBuilder::new().on_http(config.node_url.parse()?);

// The solidity contract was pre-compiled, and only the relevant functions were kept.
let abi: JsonAbi =
serde_json::from_str::<JsonAbi>(include_str!("core_contract_latest_block.abi"))?;
let abi = serde_json::from_str(include_str!("core_contract_latest_block.abi"))?;
Ok(Self { contract: ContractInstance::new(address, client, Interface::new(abi)) })
}
}
Expand All @@ -100,7 +98,7 @@ impl BaseLayerContract for EthereumBaseLayerContract {
.provider()
.get_block_number()
.await?
.checked_sub(min_confirmations.unwrap_or(0).into());
.checked_sub(min_confirmations.unwrap_or_default());
let Some(ethereum_block_number) = ethereum_block_number else {
return Ok(None);
};
Expand Down

0 comments on commit 5a50f51

Please sign in to comment.