Skip to content

Commit

Permalink
fix: parse into Address upfront
Browse files Browse the repository at this point in the history
  • Loading branch information
Maikol committed Feb 8, 2024
1 parent 4de90ad commit 6410b30
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions availability-oracle/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl RewardsManagerContract {
pub async fn new(
signing_key: &SecretKey,
url: Url,
rewards_manager_contract: String,
rewards_manager_contract: Address,
logger: Logger,
) -> Self {
let http_client = reqwest::ClientBuilder::new()
Expand All @@ -44,8 +44,7 @@ impl RewardsManagerContract {
.unwrap()
.with_chain_id(chain_id);
let provider = Arc::new(SignerMiddleware::new(provider, wallet));
let address: Address = rewards_manager_contract.parse().unwrap();
let contract = RewardsManagerABI::new(address, provider.clone());
let contract = RewardsManagerABI::new(rewards_manager_contract, provider.clone());
Self { contract, logger }
}
}
Expand Down
3 changes: 2 additions & 1 deletion availability-oracle/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mod util;
use common::prelude::*;
use common::prometheus;
use contract::*;
use ethers::abi::Address;
use ipfs::*;
use manifest::{Abi, DataSource, Manifest, Mapping};
use network_subgraph::*;
Expand Down Expand Up @@ -126,7 +127,7 @@ struct Config {
env = "REWARDS_MANAGER_CONTRACT",
help = "The address of the rewards manager contract"
)]
pub rewards_manager_contract: String,
pub rewards_manager_contract: Address,

#[structopt(long, env = "RPC_URL", help = "RPC url for the network")]
pub url: Url,
Expand Down

0 comments on commit 6410b30

Please sign in to comment.