Skip to content

Commit

Permalink
fix_: check if bridge for token exists in ToChainId before returning …
Browse files Browse the repository at this point in the history
…contract address for FromChainId

Signed-off-by: Brian Sztamfater <brian@status.im>
  • Loading branch information
briansztamfater committed Jan 21, 2025
1 parent 27ad41b commit d33b39e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions services/wallet/router/pathprocessor/processor_bridge_hop.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,13 @@ func (h *HopBridgeProcessor) EstimateGas(params ProcessorInputParams) (uint64, e
}

func (h *HopBridgeProcessor) GetContractAddress(params ProcessorInputParams) (common.Address, error) {
// Check if a contract address exists for ToChain
_, _, err := hop.GetContractAddress(params.ToChain.ChainID, params.FromToken.Symbol)
if err != nil {
return common.Address{}, createBridgeHopErrorResponse(err)
}

// Return the contract address for FromChain
address, _, err := hop.GetContractAddress(params.FromChain.ChainID, params.FromToken.Symbol)
return address, createBridgeHopErrorResponse(err)
}
Expand Down

0 comments on commit d33b39e

Please sign in to comment.