forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
629 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package batching | ||
|
||
import ( | ||
"github.com/ethereum-optimism/optimism/op-service/sources/batching/rpcblock" | ||
"github.com/ethereum/go-ethereum" | ||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/core/types" | ||
"github.com/ethereum/go-ethereum/rpc" | ||
) | ||
|
||
type EventCall struct { | ||
topics [][]common.Hash | ||
to []common.Address | ||
} | ||
|
||
func NewEventCall(q ethereum.FilterQuery) *EventCall { | ||
return &EventCall{ | ||
topics: q.Topics, | ||
to: q.Addresses, | ||
} | ||
} | ||
|
||
func (b *EventCall) ToBatchElemCreator() (BatchElementCreator, error) { | ||
return func(block rpcblock.Block) (any, rpc.BatchElem) { | ||
out := new([]types.Log) | ||
return out, rpc.BatchElem{ | ||
Method: "eth_getFilterLogs", | ||
Args: []interface{}{b.topics, b.to[0], block.ArgValue()}, | ||
Result: &out, | ||
} | ||
}, nil | ||
} | ||
|
||
func (c *EventCall) HandleResult(result interface{}) (*CallResult, error) { | ||
res := result.(*[]types.Log) | ||
return &CallResult{out: []interface{}{*res}}, nil | ||
} |
Oops, something went wrong.