linera_sdk/abis/
evm.rs

1// Copyright (c) Zefchain Labs, Inc.
2// SPDX-License-Identifier: Apache-2.0
3
4//! An ABI for applications that implement an EVM runtime.
5use linera_base::{
6    abi::{ContractAbi, ServiceAbi},
7    vm::EvmQuery,
8};
9
10/// An ABI for applications that implement an EVM runtime.
11#[derive(PartialEq)]
12pub struct EvmAbi;
13
14impl ContractAbi for EvmAbi {
15    type Operation = Vec<u8>;
16    type Response = Vec<u8>;
17
18    fn deserialize_operation(operation: Vec<u8>) -> Result<Self::Operation, String> {
19        Ok(operation)
20    }
21
22    fn serialize_operation(operation: &Self::Operation) -> Result<Vec<u8>, String> {
23        Ok(operation.to_vec())
24    }
25
26    fn deserialize_response(response: Vec<u8>) -> Result<Self::Response, String> {
27        Ok(response)
28    }
29
30    fn serialize_response(response: Self::Response) -> Result<Vec<u8>, String> {
31        Ok(response)
32    }
33}
34
35impl ServiceAbi for EvmAbi {
36    type Query = EvmQuery;
37    type QueryResponse = Vec<u8>;
38}