fix(wallet)_: broken swap and bridge for erc20 tokens fixed
This commit is contained in:
parent
1940d26c7f
commit
4fc9361f12
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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:"-"`
|
||||||
|
|
Loading…
Reference in New Issue