fix_: logic for checking if the route can be established updated

This commit is contained in:
Sale Djenic 2024-04-18 12:22:28 +02:00 committed by saledjenic
parent 5be610e653
commit c9ee0e04c2
5 changed files with 5 additions and 5 deletions

View File

@ -154,7 +154,7 @@ func (s *CBridge) getTransferConfig(isTest bool) (*cbridge.GetTransferConfigsRes
}
func (s *CBridge) Can(from, to *params.Network, token *token.Token, toToken *token.Token, balance *big.Int) (bool, error) {
if from.ChainID == to.ChainID {
if from.ChainID == to.ChainID || toToken != nil {
return false, nil
}

View File

@ -42,7 +42,7 @@ func (s *ERC1155TransferBridge) Name() string {
}
func (s *ERC1155TransferBridge) Can(from, to *params.Network, token *token.Token, toToken *token.Token, balance *big.Int) (bool, error) {
return from.ChainID == to.ChainID, nil
return from.ChainID == to.ChainID && toToken == nil, nil
}
func (s *ERC1155TransferBridge) CalculateFees(from, to *params.Network, token *token.Token, amountIn *big.Int, nativeTokenPrice, tokenPrice float64, gasPrice *big.Float) (*big.Int, *big.Int, error) {

View File

@ -41,7 +41,7 @@ func (s *ERC721TransferBridge) Name() string {
}
func (s *ERC721TransferBridge) Can(from, to *params.Network, token *token.Token, toToken *token.Token, balance *big.Int) (bool, error) {
return from.ChainID == to.ChainID, nil
return from.ChainID == to.ChainID && toToken == nil, nil
}
func (s *ERC721TransferBridge) CalculateFees(from, to *params.Network, token *token.Token, amountIn *big.Int, nativeTokenPrice, tokenPrice float64, gasPrice *big.Float) (*big.Int, *big.Int, error) {

View File

@ -114,7 +114,7 @@ func (h *HopBridge) Can(from, to *params.Network, token *token.Token, toToken *t
return false, nil
}
if from.ChainID == to.ChainID {
if from.ChainID == to.ChainID || toToken != nil {
return false, nil
}

View File

@ -33,7 +33,7 @@ func (s *TransferBridge) Name() string {
}
func (s *TransferBridge) Can(from, to *params.Network, token *token.Token, toToken *token.Token, balance *big.Int) (bool, error) {
return from.ChainID == to.ChainID, nil
return from.ChainID == to.ChainID && token != nil && toToken == nil, nil
}
func (s *TransferBridge) CalculateFees(from, to *params.Network, token *token.Token, amountIn *big.Int, nativeTokenPrice, tokenPrice float64, gasPrice *big.Float) (*big.Int, *big.Int, error) {