How AppLayer achieves a seamless integration between C++ and EVM contracts.
Achieving seamless integration between C++ and EVM contracts revolves around the uniformity in the encoding and decoding of arguments. By standardizing these processes, we ensure that calls between different contract types are handled efficiently without the need for separate mechanisms for each.
The evmc_message struct
We do this by using the evmc_message struct, aligning the call structures between C++ and EVM environments. This uniformity simplifies the interaction framework and reduces the potential for errors and data mismanagement:
ContractHost plays a critical role in distinguishing whether a contract is implemented in C++ or EVM and executing it accordingly. Below is an example illustrating how C++ contracts can invoke functions in other contracts, whether they are C++ or EVM: