Skip to content

Commit 088e29e

Browse files
committed
fix; modify verified payload identity
1 parent 22f0b83 commit 088e29e

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

adapter/src/ethereum.rs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ use primitives::{
1414
Channel, ValidatorId,
1515
};
1616
use serde::{Deserialize, Serialize};
17+
use serde_hex::{SerHexOpt, StrictPfx};
1718
use serde_json::Value;
1819
use std::convert::TryFrom;
1920
use std::error::Error;
2021
use std::fs;
2122
use tiny_keccak::Keccak;
22-
use web3::transports::Http;
2323
use web3::{
2424
contract::{Contract, Options},
2525
futures::Future,
@@ -205,9 +205,11 @@ impl Adapter for EthereumAdapter {
205205
Some(identity) => {
206206

207207
let contract_address = Address::from_slice(identity);
208-
let (_eloop, transport) = web3::transports::Http::new(&self.config.ethereum_network)?;
208+
let (_eloop, transport) = web3::transports::Http::new(&self.config.ethereum_network)
209+
.map_err(|_| map_error("failed to init http transport"))?;
209210
let web3 = web3::Web3::new(transport);
210-
let contract = Contract::from_json(web3.eth(), contract_address, &IDENTITY_ABI)?;
211+
let contract = Contract::from_json(web3.eth(), contract_address, &IDENTITY_ABI)
212+
.map_err(|_| map_error("failed to init identity contract"))?;
211213

212214
let privilege_level: U256 = contract
213215
.query(
@@ -277,18 +279,6 @@ fn map_error(err: &str) -> AdapterError {
277279
AdapterError::Failed(err.to_string())
278280
}
279281

280-
fn get_contract(
281-
config: &Config,
282-
contract_address: Address,
283-
abi: &[u8],
284-
) -> Result<Contract<Http>, Box<dyn Error>> {
285-
let (_eloop, transport) = web3::transports::Http::new(&config.ethereum_network)?;
286-
let web3 = web3::Web3::new(transport);
287-
let contract = Contract::from_json(web3.eth(), contract_address, abi)?;
288-
289-
Ok(contract)
290-
}
291-
292282
// Ethereum Web Tokens
293283
#[derive(Clone, Debug, Serialize, Deserialize)]
294284
pub struct Payload {

0 commit comments

Comments
 (0)