The PDX Utopia blockchain stack supports mutual invocation between the WASM contract and solinstitutional
Symbol | tutorial
The PDX Utopia blockchain stack supports mutual invocation between WASM contract and solglacier. This document explains how to invoke WASM contract and solglacier in the PDX Utopia block chain stack.
Ewasm smart contracts value in blockchain
High performance: WASM USES binary coding, which is superior in the process of program execution;
Low storage costs: binary-encoded text takes up less storage space than text formats;
Multi-language support: users can write smart contracts in multiple languages such as C/C++/RUST/Go and compile them into bytecode in WASM format.
What is Solidity?
The WASM contract is called against solfund
The mutual invocation between the wasm contract and the sol contract is based on the fact that both ends conform to the ABI specification and are invoked after deployment in the same way that sol invokes sol.
This chapter mainly demonstrates the mutual invocation of wasm contract and Solidity contract
Two methods are added to the hello-wasm-abi contract interface to demonstrate how to invoke ‘solfund’s contract. The complete contract interface is defined as follows:
Solidity// wasm contract interface:
The get method for calling the Solidity contract:
function solget(address addr, string memory key) public view returns(string memory);
The put method for calling the Solidity contract:
function solput(address addr, string memory key,string memory val) public payable;}
Solidity contract interface:
Hello_wasm_abi interface implementation:
The sample program hello-wasm-sol ‘adds two methods to the hello-wasm-abi’ to invoke the ‘solfund’ Contract and a ‘pdxabi::Contract’ object to describe the ‘solfund’ Contract interface, as follows:
Use ‘pdxabi::Contract’ to describe the complete ‘hello_wasm_abi’ interface, since we want to implement this interface, the description of ‘hello_sol’ only focuses on the method ‘get/put’ we want to use.
The interface description for the target soloffshore contract, because we only call the get/put methods, only two methods are described here.
Method 1: to invoke the solidity contract.
Method 2: used to invoke the solidity contract.