mirror of
https://github.com/forta-network/go-multicall.git
synced 2026-04-13 13:18:40 +00:00
Merge e8c9613045 into 9467c4ddaa
This commit is contained in:
commit
419fdd72c5
2 changed files with 10 additions and 9 deletions
15
call.go
15
call.go
|
|
@ -39,13 +39,14 @@ func ParseABI(rawJson string) (*abi.ABI, error) {
|
||||||
|
|
||||||
// Call wraps a multicall call.
|
// Call wraps a multicall call.
|
||||||
type Call struct {
|
type Call struct {
|
||||||
CallName string
|
CallName string
|
||||||
Contract *Contract
|
Contract *Contract
|
||||||
Method string
|
Method string
|
||||||
Inputs []any
|
Inputs []any
|
||||||
Outputs any
|
Outputs any
|
||||||
CanFail bool
|
CanFail bool
|
||||||
Failed bool
|
Failed bool
|
||||||
|
UnpackError error
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCall creates a new call using given inputs.
|
// NewCall creates a new call using given inputs.
|
||||||
|
|
|
||||||
|
|
@ -68,10 +68,10 @@ func (caller *Caller) Call(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
|
|
||||||
if err := call.Unpack(result.ReturnData); err != nil {
|
if err := call.Unpack(result.ReturnData); err != nil {
|
||||||
return calls, fmt.Errorf("failed to unpack call outputs at index [%d]: %v", i, err)
|
call.UnpackError = fmt.Errorf("failed to unpack call outputs at index [%d]: %v", i, err)
|
||||||
}
|
}
|
||||||
|
call.Failed = !result.Success || err != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return calls, nil
|
return calls, nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue