mirror of
https://github.com/status-im/status-go.git
synced 2025-01-12 07:35:02 +00:00
68464d949c
- router logic splitted into two more logical functions - locked amount validation improved - hop and swap processors cached data kept per from/to chain and from/to token - Clear function which clears the local cache is added - process of evaluating `amountToSend` if more than a single network is locked is improved - optimized params for require approval function
28 lines
921 B
Go
28 lines
921 B
Go
package pathprocessor
|
|
|
|
import (
|
|
"fmt"
|
|
"math/big"
|
|
|
|
ethTypes "github.com/ethereum/go-ethereum/core/types"
|
|
|
|
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
|
"github.com/ethereum/go-ethereum/common"
|
|
"github.com/status-im/status-go/account"
|
|
"github.com/status-im/status-go/eth-node/types"
|
|
)
|
|
|
|
func getSigner(chainID uint64, from types.Address, verifiedAccount *account.SelectedExtKey) bind.SignerFn {
|
|
return func(addr common.Address, tx *ethTypes.Transaction) (*ethTypes.Transaction, error) {
|
|
s := ethTypes.NewLondonSigner(new(big.Int).SetUint64(chainID))
|
|
return ethTypes.SignTx(tx, s, verifiedAccount.AccountKey.PrivateKey)
|
|
}
|
|
}
|
|
|
|
func makeKey(fromChain, toChain uint64, fromTokenSymbol, toTokenSymbol string) string {
|
|
if fromTokenSymbol != "" || toTokenSymbol != "" {
|
|
return fmt.Sprintf("%d-%d-%s-%s", fromChain, toChain, fromTokenSymbol, toTokenSymbol)
|
|
}
|
|
return fmt.Sprintf("%d-%d", fromChain, toChain)
|
|
}
|