fix_: eth and erc20 fixes
This commit is contained in:
parent
2053bd323b
commit
aec567fd9f
|
@ -41,7 +41,7 @@ func (s *TransferBridge) CalculateFees(from, to *params.Network, token *token.To
|
|||
}
|
||||
|
||||
func (s *TransferBridge) PackTxInputData(contractType string, fromNetwork *params.Network, toNetwork *params.Network, from common.Address, to common.Address, token *token.Token, amountIn *big.Int) ([]byte, error) {
|
||||
if token.Symbol == "ETH" {
|
||||
if token.IsNative() {
|
||||
return []byte("eth_sendRawTransaction"), nil
|
||||
} else {
|
||||
abi, err := abi.JSON(strings.NewReader(ierc20.IERC20ABI))
|
||||
|
@ -64,7 +64,7 @@ func (s *TransferBridge) EstimateGas(fromNetwork *params.Network, toNetwork *par
|
|||
return 0, err
|
||||
}
|
||||
|
||||
if token.Symbol == "ETH" {
|
||||
if token.IsNative() {
|
||||
estimation, err = s.transactor.EstimateGas(fromNetwork, from, to, amountIn, input)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
|
@ -96,7 +96,7 @@ func (s *TransferBridge) EstimateGas(fromNetwork *params.Network, toNetwork *par
|
|||
|
||||
func (s *TransferBridge) BuildTx(network, _ *params.Network, fromAddress common.Address, toAddress common.Address, token *token.Token, amountIn *big.Int, bonderFee *big.Int) (*ethTypes.Transaction, error) {
|
||||
toAddr := types.Address(toAddress)
|
||||
if strings.EqualFold(token.Symbol, "ETH") {
|
||||
if token.IsNative() {
|
||||
sendArgs := &TransactionBridge{
|
||||
TransferTx: &transactions.SendTxArgs{
|
||||
From: types.Address(fromAddress),
|
||||
|
|
|
@ -322,10 +322,6 @@ func (t *Transactor) HashTransaction(args SendTxArgs) (validatedArgs SendTxArgs,
|
|||
if err != nil {
|
||||
return validatedArgs, hash, err
|
||||
}
|
||||
if gas < defaultGas {
|
||||
t.log.Info("default gas will be used because estimated is lower", "estimated", gas, "default", defaultGas)
|
||||
gas = defaultGas
|
||||
}
|
||||
} else {
|
||||
gas = uint64(*args.Gas)
|
||||
}
|
||||
|
@ -412,10 +408,6 @@ func (t *Transactor) validateAndBuildTransaction(rpcWrapper *rpcWrapper, args Se
|
|||
if err != nil {
|
||||
return tx, err
|
||||
}
|
||||
if gas < defaultGas {
|
||||
t.log.Info("default gas will be used because estimated is lower", "estimated", gas, "default", defaultGas)
|
||||
gas = defaultGas
|
||||
}
|
||||
}
|
||||
|
||||
tx = t.buildTransactionWithOverrides(nonce, value, gas, gasPrice, args)
|
||||
|
|
Loading…
Reference in New Issue