Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
7a28c35e
Unverified
Commit
7a28c35e
authored
Oct 30, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
batching: Give ContractCall more standalone utility.
parent
cd8f6294
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
call.go
op-service/sources/batching/call.go
+7
-3
multicall.go
op-service/sources/batching/multicall.go
+1
-3
No files found.
op-service/sources/batching/call.go
View file @
7a28c35e
...
...
@@ -42,8 +42,12 @@ func NewContractCall(abi *abi.ABI, addr common.Address, method string, args ...i
}
}
func
(
c
*
ContractCall
)
Pack
()
([]
byte
,
error
)
{
return
c
.
Abi
.
Pack
(
c
.
Method
,
c
.
Args
...
)
}
func
(
c
*
ContractCall
)
ToCallArgs
()
(
interface
{},
error
)
{
data
,
err
:=
c
.
Abi
.
Pack
(
c
.
Method
,
c
.
Args
...
)
data
,
err
:=
c
.
Pack
(
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to pack arguments: %w"
,
err
)
}
...
...
@@ -54,12 +58,12 @@ func (c *ContractCall) ToCallArgs() (interface{}, error) {
return
toCallArg
(
msg
),
nil
}
func
(
c
*
ContractCall
)
Unpack
(
hex
hexutil
.
Bytes
)
(
[]
interface
{}
,
error
)
{
func
(
c
*
ContractCall
)
Unpack
(
hex
hexutil
.
Bytes
)
(
*
CallResult
,
error
)
{
out
,
err
:=
c
.
Abi
.
Unpack
(
c
.
Method
,
hex
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to unpack data: %w"
,
err
)
}
return
out
,
nil
return
&
CallResult
{
out
:
out
}
,
nil
}
type
CallResult
struct
{
...
...
op-service/sources/batching/multicall.go
View file @
7a28c35e
...
...
@@ -76,9 +76,7 @@ func (m *MultiCaller) CallLatest(ctx context.Context, calls ...*ContractCall) ([
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to unpack result: %w"
,
err
)
}
callResults
[
i
]
=
&
CallResult
{
out
:
out
,
}
callResults
[
i
]
=
out
}
return
callResults
,
nil
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment