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    fn deserialize_response(response: Vec<u8>) -> Result<Self::Response, String> {
26        Ok(response)
27    }
28
29    fn serialize_response(response: Self::Response) -> Result<Vec<u8>, String> {
30        Ok(response)
31    }
32}
33
34impl ServiceAbi for EvmAbi {
35    type Query = EvmQuery;
36    type QueryResponse = Vec<u8>;
37}