mirror of
https://github.com/forta-network/go-multicall.git
synced 2026-05-11 02:26:42 +00:00
CanFail unpack error
This commit is contained in:
parent
fa1d05a4e7
commit
c1a22458bf
1 changed files with 6 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ package multicall
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||||
|
|
@ -82,7 +83,11 @@ func (caller *Caller) calls(opts *bind.CallOpts, calls ...*Call) ([]*Call, error
|
||||||
for i, result := range results {
|
for i, result := range results {
|
||||||
call := calls[i] // index always matches
|
call := calls[i] // index always matches
|
||||||
call.Failed = !result.Success
|
call.Failed = !result.Success
|
||||||
if err := call.Unpack(result.ReturnData); err != nil && !call.CanFail {
|
if err := call.Unpack(result.ReturnData); err != nil {
|
||||||
|
if call.CanFail {
|
||||||
|
log.Println(fmt.Errorf("failed to unpack call outputs at index [%d]: %v", i, err))
|
||||||
|
continue
|
||||||
|
}
|
||||||
return calls, fmt.Errorf("failed to unpack call outputs at index [%d]: %v", i, err)
|
return calls, fmt.Errorf("failed to unpack call outputs at index [%d]: %v", i, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue