fix(wallet)_: broken swap and bridge for erc20 tokens fixed

This commit is contained in:
Sale Djenic 2024-11-07 14:16:00 +01:00 committed by Anthony Laibe
parent 1940d26c7f
commit 4fc9361f12
4 changed files with 5 additions and 3 deletions

View File

@ -386,7 +386,7 @@ func (h *HopBridgeProcessor) sendOrBuildV2(sendArgs *transactions.SendTxArgs, si
return tx, createBridgeHopErrorResponse(err) return tx, createBridgeHopErrorResponse(err)
} }
bonderKey := makeKey(sendArgs.FromChainID, sendArgs.ToChainID, "", "", (*big.Int)(sendArgs.Value)) bonderKey := makeKey(sendArgs.FromChainID, sendArgs.ToChainID, "", "", (*big.Int)(sendArgs.ValueIn))
bonderFeeIns, ok := h.bonderFee.Load(bonderKey) bonderFeeIns, ok := h.bonderFee.Load(bonderKey)
if !ok { if !ok {
return nil, ErrNoBonderFeeFound return nil, ErrNoBonderFeeFound

View File

@ -212,7 +212,7 @@ func (s *SwapParaswapProcessor) GetContractAddress(params ProcessorInputParams)
func (s *SwapParaswapProcessor) prepareTransaction(sendArgs *MultipathProcessorTxArgs) error { func (s *SwapParaswapProcessor) prepareTransaction(sendArgs *MultipathProcessorTxArgs) error {
slippageBP := uint(sendArgs.SwapTx.SlippagePercentage * 100) // convert to basis points slippageBP := uint(sendArgs.SwapTx.SlippagePercentage * 100) // convert to basis points
key := makeKey(sendArgs.SwapTx.ChainID, sendArgs.SwapTx.ChainIDTo, sendArgs.SwapTx.TokenIDFrom, sendArgs.SwapTx.TokenIDTo, sendArgs.SwapTx.Value.ToInt()) key := makeKey(sendArgs.SwapTx.ChainID, sendArgs.SwapTx.ChainIDTo, sendArgs.SwapTx.TokenIDFrom, sendArgs.SwapTx.TokenIDTo, sendArgs.SwapTx.ValueIn.ToInt())
priceRouteIns, ok := s.priceRoute.Load(key) priceRouteIns, ok := s.priceRoute.Load(key)
if !ok { if !ok {
return ErrPriceRouteNotFound return ErrPriceRouteNotFound
@ -258,7 +258,7 @@ func (s *SwapParaswapProcessor) prepareTransaction(sendArgs *MultipathProcessorT
func (s *SwapParaswapProcessor) prepareTransactionV2(sendArgs *transactions.SendTxArgs) error { func (s *SwapParaswapProcessor) prepareTransactionV2(sendArgs *transactions.SendTxArgs) error {
slippageBP := uint(sendArgs.SlippagePercentage * 100) // convert to basis points slippageBP := uint(sendArgs.SlippagePercentage * 100) // convert to basis points
key := makeKey(sendArgs.FromChainID, sendArgs.ToChainID, sendArgs.FromTokenID, sendArgs.ToTokenID, sendArgs.Value.ToInt()) key := makeKey(sendArgs.FromChainID, sendArgs.ToChainID, sendArgs.FromTokenID, sendArgs.ToTokenID, sendArgs.ValueIn.ToInt())
priceRouteIns, ok := s.priceRoute.Load(key) priceRouteIns, ok := s.priceRoute.Load(key)
if !ok { if !ok {
return ErrPriceRouteNotFound return ErrPriceRouteNotFound

View File

@ -163,6 +163,7 @@ func buildTxForPath(transactor transactions.TransactorIface, path *routes.Path,
MaxPriorityFeePerGas: path.TxPriorityFee, MaxPriorityFeePerGas: path.TxPriorityFee,
// additional fields version 1 // additional fields version 1
ValueIn: path.AmountIn,
ValueOut: path.AmountOut, ValueOut: path.AmountOut,
FromChainID: path.FromChain.ChainID, FromChainID: path.FromChain.ChainID,
ToChainID: path.ToChain.ChainID, ToChainID: path.ToChain.ChainID,

View File

@ -68,6 +68,7 @@ type SendTxArgs struct {
MultiTransactionID wallet_common.MultiTransactionIDType `json:"multiTransactionID"` MultiTransactionID wallet_common.MultiTransactionIDType `json:"multiTransactionID"`
Symbol string `json:"-"` Symbol string `json:"-"`
// additional data - version SendTxArgsVersion1 // additional data - version SendTxArgsVersion1
ValueIn *hexutil.Big `json:"-"`
ValueOut *hexutil.Big `json:"-"` ValueOut *hexutil.Big `json:"-"`
FromChainID uint64 `json:"-"` FromChainID uint64 `json:"-"`
ToChainID uint64 `json:"-"` ToChainID uint64 `json:"-"`