github.com/MetalBlockchain/subnet-evm@v0.4.9/plugin/evm/message/eth_call_request.go (about)

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