File tree Expand file tree Collapse file tree 2 files changed +19
-17
lines changed Expand file tree Collapse file tree 2 files changed +19
-17
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " fortuna"
3
- version = " 3.2.1 "
3
+ version = " 3.2.2 "
4
4
edition = " 2021"
5
5
6
6
[dependencies ]
Original file line number Diff line number Diff line change 8
8
state:: PebbleHashChain ,
9
9
} ,
10
10
anyhow:: Result ,
11
- ethers:: signers:: {
12
- LocalWallet ,
13
- Signer ,
11
+ ethers:: {
12
+ signers:: {
13
+ LocalWallet ,
14
+ Signer ,
15
+ } ,
16
+ types:: U256 ,
14
17
} ,
15
18
std:: sync:: Arc ,
16
19
} ;
@@ -52,19 +55,18 @@ pub async fn register_provider(opts: &RegisterProviderOptions) -> Result<()> {
52
55
seed : random,
53
56
chain_length : commitment_length,
54
57
} ;
55
-
56
- if let Some ( r) = contract
57
- . register (
58
- fee_in_wei,
59
- commitment,
60
- bincode:: serialize ( & commitment_metadata) ?. into ( ) ,
61
- commitment_length,
62
- bincode:: serialize ( & opts. uri ) ?. into ( ) ,
63
- )
64
- . send ( )
65
- . await ?
66
- . await ?
67
- {
58
+ let call = contract. register (
59
+ fee_in_wei,
60
+ commitment,
61
+ bincode:: serialize ( & commitment_metadata) ?. into ( ) ,
62
+ commitment_length,
63
+ bincode:: serialize ( & opts. uri ) ?. into ( ) ,
64
+ ) ;
65
+ let mut gas_estimate = call. estimate_gas ( ) . await ?;
66
+ let gas_multiplier = U256 :: from ( 2 ) ; //TODO: smarter gas estimation
67
+ gas_estimate = gas_estimate * gas_multiplier;
68
+ let call_with_gas = call. gas ( gas_estimate) ;
69
+ if let Some ( r) = call_with_gas. send ( ) . await ?. await ? {
68
70
tracing:: info!( "Registered provider: {:?}" , r) ;
69
71
}
70
72
You can’t perform that action at this time.
0 commit comments