@@ -14,12 +14,12 @@ use primitives::{
14
14
Channel , ValidatorId ,
15
15
} ;
16
16
use serde:: { Deserialize , Serialize } ;
17
+ use serde_hex:: { SerHexOpt , StrictPfx } ;
17
18
use serde_json:: Value ;
18
19
use std:: convert:: TryFrom ;
19
20
use std:: error:: Error ;
20
21
use std:: fs;
21
22
use tiny_keccak:: Keccak ;
22
- use web3:: transports:: Http ;
23
23
use web3:: {
24
24
contract:: { Contract , Options } ,
25
25
futures:: Future ,
@@ -205,9 +205,11 @@ impl Adapter for EthereumAdapter {
205
205
Some ( identity) => {
206
206
207
207
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" ) ) ?;
209
210
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" ) ) ?;
211
213
212
214
let privilege_level: U256 = contract
213
215
. query (
@@ -277,18 +279,6 @@ fn map_error(err: &str) -> AdapterError {
277
279
AdapterError :: Failed ( err. to_string ( ) )
278
280
}
279
281
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
-
292
282
// Ethereum Web Tokens
293
283
#[ derive( Clone , Debug , Serialize , Deserialize ) ]
294
284
pub struct Payload {
0 commit comments