1
- use crate :: utils:: send_transaction;
1
+ use crate :: utils:: { calculate_storage_slot , send_transaction, send_transaction_rules } ;
2
2
use alloy:: primitives:: { private:: serde:: Deserialize , Address , FixedBytes , U256 } ;
3
3
use alloy:: providers:: { Provider , ProviderBuilder , RootProvider } ;
4
4
use alloy:: signers:: k256:: elliptic_curve:: SecretKey ;
@@ -26,7 +26,6 @@ use crate::types::{
26
26
AlloyProvider , AtomicBridgeCounterparty , AtomicBridgeInitiator , CounterpartyContract ,
27
27
EthAddress , EthHash , InitiatorContract ,
28
28
} ;
29
- use crate :: utils:: { calculate_storage_slot, send_tx_rules} ;
30
29
31
30
const GAS_LIMIT : u128 = 10_000_000_000_000_000 ;
32
31
const RETRIES : u32 = 6 ;
@@ -127,7 +126,7 @@ impl EthClient {
127
126
) -> Result < ( ) , anyhow:: Error > {
128
127
let contract = self . initiator_contract ( ) . expect ( "Initiator contract not set" ) ;
129
128
let call = contract. initialize ( weth. 0 , owner. 0 ) ;
130
- send_transaction ( call. to_owned ( ) , & send_tx_rules ( ) , RETRIES , GAS_LIMIT )
129
+ send_transaction ( call. to_owned ( ) , & send_transaction_rules ( ) , RETRIES , GAS_LIMIT )
131
130
. await
132
131
. expect ( "Failed to send transaction" ) ;
133
132
Ok ( ( ) )
@@ -236,15 +235,14 @@ impl BridgeContractInitiator for EthClient {
236
235
U256 :: from ( time_lock. 0 ) ,
237
236
)
238
237
. value ( U256 :: from ( amount. 0 ) ) ;
239
- let _ =
240
- send_transaction ( call, & send_tx_rules ( ) , RETRIES , GAS_LIMIT )
241
- . await
242
- . map_err ( |e| {
243
- BridgeContractInitiatorError :: GenericError ( format ! (
244
- "Failed to send transaction: {}" ,
245
- e
246
- ) )
247
- } ) ?;
238
+ let _ = send_transaction ( call, & send_transaction_rules ( ) , RETRIES , GAS_LIMIT )
239
+ . await
240
+ . map_err ( |e| {
241
+ BridgeContractInitiatorError :: GenericError ( format ! (
242
+ "Failed to send transaction: {}" ,
243
+ e
244
+ ) )
245
+ } ) ?;
248
246
Ok ( ( ) )
249
247
}
250
248
@@ -267,7 +265,7 @@ impl BridgeContractInitiator for EthClient {
267
265
AtomicBridgeInitiator :: new ( self . initiator_contract_address ( ) ?, & self . rpc_provider ) ;
268
266
let call = contract
269
267
. completeBridgeTransfer ( FixedBytes ( bridge_transfer_id. 0 ) , FixedBytes ( pre_image) ) ;
270
- send_transaction ( call, & send_tx_rules ( ) , RETRIES , GAS_LIMIT )
268
+ send_transaction ( call, & send_transaction_rules ( ) , RETRIES , GAS_LIMIT )
271
269
. await
272
270
. expect ( "Failed to send transaction" ) ;
273
271
Ok ( ( ) )
@@ -280,7 +278,7 @@ impl BridgeContractInitiator for EthClient {
280
278
let contract =
281
279
AtomicBridgeInitiator :: new ( self . initiator_contract_address ( ) ?, & self . rpc_provider ) ;
282
280
let call = contract. refundBridgeTransfer ( FixedBytes ( bridge_transfer_id. 0 ) ) ;
283
- send_transaction ( call, & send_tx_rules ( ) , RETRIES , GAS_LIMIT )
281
+ send_transaction ( call, & send_transaction_rules ( ) , RETRIES , GAS_LIMIT )
284
282
. await
285
283
. expect ( "Failed to send transaction" ) ;
286
284
Ok ( ( ) )
@@ -346,7 +344,7 @@ impl BridgeContractCounterparty for EthClient {
346
344
recipient. 0 . 0 ,
347
345
U256 :: from ( amount. 0 ) ,
348
346
) ;
349
- send_transaction ( call, & send_tx_rules ( ) , RETRIES , GAS_LIMIT )
347
+ send_transaction ( call, & send_transaction_rules ( ) , RETRIES , GAS_LIMIT )
350
348
. await
351
349
. expect ( "Failed to send transaction" ) ;
352
350
Ok ( ( ) )
@@ -364,7 +362,7 @@ impl BridgeContractCounterparty for EthClient {
364
362
let secret: [ u8 ; 32 ] = secret. 0 . try_into ( ) . unwrap ( ) ;
365
363
let call =
366
364
contract. completeBridgeTransfer ( FixedBytes ( bridge_transfer_id. 0 ) , FixedBytes ( secret) ) ;
367
- send_transaction ( call, & send_tx_rules ( ) , RETRIES , GAS_LIMIT )
365
+ send_transaction ( call, & send_transaction_rules ( ) , RETRIES , GAS_LIMIT )
368
366
. await
369
367
. expect ( "Failed to send transaction" ) ;
370
368
Ok ( ( ) )
@@ -379,7 +377,7 @@ impl BridgeContractCounterparty for EthClient {
379
377
& self . rpc_provider ,
380
378
) ;
381
379
let call = contract. abortBridgeTransfer ( FixedBytes ( bridge_transfer_id. 0 ) ) ;
382
- send_transaction ( call, & send_tx_rules ( ) , RETRIES , GAS_LIMIT )
380
+ send_transaction ( call, & send_transaction_rules ( ) , RETRIES , GAS_LIMIT )
383
381
. await
384
382
. expect ( "Failed to send transaction" ) ;
385
383
Ok ( ( ) )
0 commit comments