@@ -23,7 +23,6 @@ import (
2323 "github.com/ethersphere/bee/v2/pkg/log"
2424 "github.com/ethersphere/bee/v2/pkg/p2p/libp2p"
2525 "github.com/ethersphere/bee/v2/pkg/postage/postagecontract"
26- "github.com/ethersphere/bee/v2/pkg/sctx"
2726 "github.com/ethersphere/bee/v2/pkg/settlement"
2827 "github.com/ethersphere/bee/v2/pkg/settlement/swap"
2928 "github.com/ethersphere/bee/v2/pkg/settlement/swap/chequebook"
@@ -69,7 +68,7 @@ func InitChain(
6968 var versionString string
7069 err = rpcClient .CallContext (ctx , & versionString , "web3_clientVersion" )
7170 if err != nil {
72- logger .Info ("could not connect to backend; in a swap-enabled network a working blockchain node (for xdai network in production, sepolia in testnet) is required; check your node or specify another node using --swap -endpoint." , "backend_endpoint" , endpoint )
71+ logger .Info ("could not connect to backend; in a swap-enabled network a working blockchain node (for xdai network in production, sepolia in testnet) is required; check your node or specify another node using --blockchain-rpc -endpoint." , "backend_endpoint" , endpoint )
7372 return nil , common.Address {}, 0 , nil , nil , fmt .Errorf ("blockchain client get version: %w" , err )
7473 }
7574
@@ -134,7 +133,6 @@ func InitChequebookService(
134133 transactionService transaction.Service ,
135134 chequebookFactory chequebook.Factory ,
136135 initialDeposit string ,
137- deployGasPrice string ,
138136 erc20Service erc20.Service ,
139137) (chequebook.Service , error ) {
140138 chequeSigner := chequebook .NewChequeSigner (signer , chainID )
@@ -144,14 +142,6 @@ func InitChequebookService(
144142 return nil , fmt .Errorf ("initial swap deposit \" %s\" cannot be parsed" , initialDeposit )
145143 }
146144
147- if deployGasPrice != "" {
148- gasPrice , ok := new (big.Int ).SetString (deployGasPrice , 10 )
149- if ! ok {
150- return nil , fmt .Errorf ("deploy gas price \" %s\" cannot be parsed" , deployGasPrice )
151- }
152- ctx = sctx .SetGasPrice (ctx , gasPrice )
153- }
154-
155145 chequebookService , err := chequebook .Init (
156146 ctx ,
157147 chequebookFactory ,
@@ -214,7 +204,6 @@ func InitSwap(
214204 chainID int64 ,
215205 transactionService transaction.Service ,
216206) (* swap.Service , priceoracle.Service , error ) {
217-
218207 var currentPriceOracleAddress common.Address
219208 if priceOracleAddress == "" {
220209 chainCfg , found := config .GetByChainID (chainID )
@@ -260,7 +249,6 @@ func InitSwap(
260249}
261250
262251func GetTxHash (stateStore storage.StateStorer , logger log.Logger , trxString string ) ([]byte , error ) {
263-
264252 if trxString != "" {
265253 txHashTrimmed := strings .TrimPrefix (trxString , "0x" )
266254 if len (txHashTrimmed ) != 64 {
@@ -288,7 +276,6 @@ func GetTxHash(stateStore storage.StateStorer, logger log.Logger, trxString stri
288276}
289277
290278func GetTxNextBlock (ctx context.Context , logger log.Logger , backend transaction.Backend , monitor transaction.Monitor , duration time.Duration , trx []byte , blockHash string ) ([]byte , error ) {
291-
292279 if blockHash != "" {
293280 blockHashTrimmed := strings .TrimPrefix (blockHash , "0x" )
294281 if len (blockHashTrimmed ) != 64 {
@@ -321,27 +308,35 @@ type noOpChequebookService struct{}
321308func (m * noOpChequebookService ) Deposit (context.Context , * big.Int ) (hash common.Hash , err error ) {
322309 return hash , postagecontract .ErrChainDisabled
323310}
311+
324312func (m * noOpChequebookService ) Withdraw (context.Context , * big.Int ) (hash common.Hash , err error ) {
325313 return hash , postagecontract .ErrChainDisabled
326314}
315+
327316func (m * noOpChequebookService ) WaitForDeposit (context.Context , common.Hash ) error {
328317 return postagecontract .ErrChainDisabled
329318}
319+
330320func (m * noOpChequebookService ) Balance (context.Context ) (* big.Int , error ) {
331321 return nil , postagecontract .ErrChainDisabled
332322}
323+
333324func (m * noOpChequebookService ) AvailableBalance (context.Context ) (* big.Int , error ) {
334325 return nil , postagecontract .ErrChainDisabled
335326}
327+
336328func (m * noOpChequebookService ) Address () common.Address {
337329 return common.Address {}
338330}
331+
339332func (m * noOpChequebookService ) Issue (context.Context , common.Address , * big.Int , chequebook.SendChequeFunc ) (* big.Int , error ) {
340333 return nil , postagecontract .ErrChainDisabled
341334}
335+
342336func (m * noOpChequebookService ) LastCheque (common.Address ) (* chequebook.SignedCheque , error ) {
343337 return nil , postagecontract .ErrChainDisabled
344338}
339+
345340func (m * noOpChequebookService ) LastCheques () (map [common.Address ]* chequebook.SignedCheque , error ) {
346341 return nil , postagecontract .ErrChainDisabled
347342}
@@ -358,49 +353,63 @@ func (m noOpChainBackend) Metrics() []prometheus.Collector {
358353func (m noOpChainBackend ) CodeAt (context.Context , common.Address , * big.Int ) ([]byte , error ) {
359354 return common .FromHex (sw3abi .SimpleSwapFactoryDeployedBinv0_6_5 ), nil
360355}
356+
361357func (m noOpChainBackend ) CallContract (context.Context , ethereum.CallMsg , * big.Int ) ([]byte , error ) {
362358 return nil , errors .New ("disabled chain backend" )
363359}
360+
364361func (m noOpChainBackend ) HeaderByNumber (context.Context , * big.Int ) (* types.Header , error ) {
365362 h := new (types.Header )
366363 h .Time = uint64 (time .Now ().Unix ())
367364 return h , nil
368365}
366+
369367func (m noOpChainBackend ) PendingNonceAt (context.Context , common.Address ) (uint64 , error ) {
370368 panic ("chain no op: PendingNonceAt" )
371369}
370+
372371func (m noOpChainBackend ) SuggestGasPrice (context.Context ) (* big.Int , error ) {
373372 panic ("chain no op: SuggestGasPrice" )
374373}
374+
375375func (m noOpChainBackend ) SuggestGasTipCap (context.Context ) (* big.Int , error ) {
376376 panic ("chain no op: SuggestGasPrice" )
377377}
378+
378379func (m noOpChainBackend ) EstimateGas (context.Context , ethereum.CallMsg ) (uint64 , error ) {
379380 panic ("chain no op: EstimateGas" )
380381}
382+
381383func (m noOpChainBackend ) SendTransaction (context.Context , * types.Transaction ) error {
382384 panic ("chain no op: SendTransaction" )
383385}
386+
384387func (m noOpChainBackend ) TransactionReceipt (context.Context , common.Hash ) (* types.Receipt , error ) {
385388 r := new (types.Receipt )
386389 r .BlockNumber = big .NewInt (1 )
387390 return r , nil
388391}
392+
389393func (m noOpChainBackend ) TransactionByHash (context.Context , common.Hash ) (tx * types.Transaction , isPending bool , err error ) {
390394 panic ("chain no op: TransactionByHash" )
391395}
396+
392397func (m noOpChainBackend ) BlockNumber (context.Context ) (uint64 , error ) {
393398 return 4 , nil
394399}
400+
395401func (m noOpChainBackend ) BalanceAt (context.Context , common.Address , * big.Int ) (* big.Int , error ) {
396402 return nil , postagecontract .ErrChainDisabled
397403}
404+
398405func (m noOpChainBackend ) NonceAt (context.Context , common.Address , * big.Int ) (uint64 , error ) {
399406 panic ("chain no op: NonceAt" )
400407}
408+
401409func (m noOpChainBackend ) FilterLogs (context.Context , ethereum.FilterQuery ) ([]types.Log , error ) {
402410 panic ("chain no op: FilterLogs" )
403411}
412+
404413func (m noOpChainBackend ) ChainID (context.Context ) (* big.Int , error ) {
405414 return big .NewInt (m .chainID ), nil
406415}
0 commit comments