forked from ava-labs/subnet-evm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eth_call_request.go
33 lines (25 loc) · 992 Bytes
/
eth_call_request.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// (c) 2021-2022, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package message
import (
"context"
"fmt"
"github.com/MetalBlockchain/metalgo/ids"
)
var _ CrossChainRequest = EthCallRequest{}
// EthCallRequest has the JSON Data necessary to execute a new EVM call on the blockchain
type EthCallRequest struct {
RequestArgs []byte `serialize:"true"`
}
// EthCallResponse represents the JSON return value of the executed EVM call
type EthCallResponse struct {
ExecutionResult []byte `serialize:"true"`
}
// String converts EthCallRequest to a string
func (e EthCallRequest) String() string {
return fmt.Sprintf("%#v", e)
}
// Handle returns the encoded EthCallResponse by executing EVM call with the given EthCallRequest
func (e EthCallRequest) Handle(ctx context.Context, requestingChainID ids.ID, requestID uint32, handler CrossChainRequestHandler) ([]byte, error) {
return handler.HandleEthCallRequest(ctx, requestingChainID, requestID, e)
}