Skip to content

Commit 6410b30

Browse files
committed
fix: parse into Address upfront
1 parent 4de90ad commit 6410b30

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

availability-oracle/src/contract.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl RewardsManagerContract {
3030
pub async fn new(
3131
signing_key: &SecretKey,
3232
url: Url,
33-
rewards_manager_contract: String,
33+
rewards_manager_contract: Address,
3434
logger: Logger,
3535
) -> Self {
3636
let http_client = reqwest::ClientBuilder::new()
@@ -44,8 +44,7 @@ impl RewardsManagerContract {
4444
.unwrap()
4545
.with_chain_id(chain_id);
4646
let provider = Arc::new(SignerMiddleware::new(provider, wallet));
47-
let address: Address = rewards_manager_contract.parse().unwrap();
48-
let contract = RewardsManagerABI::new(address, provider.clone());
47+
let contract = RewardsManagerABI::new(rewards_manager_contract, provider.clone());
4948
Self { contract, logger }
5049
}
5150
}

availability-oracle/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ mod util;
88
use common::prelude::*;
99
use common::prometheus;
1010
use contract::*;
11+
use ethers::abi::Address;
1112
use ipfs::*;
1213
use manifest::{Abi, DataSource, Manifest, Mapping};
1314
use network_subgraph::*;
@@ -126,7 +127,7 @@ struct Config {
126127
env = "REWARDS_MANAGER_CONTRACT",
127128
help = "The address of the rewards manager contract"
128129
)]
129-
pub rewards_manager_contract: String,
130+
pub rewards_manager_contract: Address,
130131

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

0 commit comments

Comments
 (0)