The PDX Utopia block chain stack calls the wasm smart contract using soloutflow
Wasm smart contracts are invoked using solfund
Define the ABI
> defines the Contract object in ‘hello-wasm-abi/ SRC /abi.rs’, including <br> in the’ hello-wasm ‘sample;
> ‘put/get/getcounter’ three methods’ ABI ‘description, note, we can not directly use’ JSON ‘to describe’ ABI ‘;
> must define the declaration using ‘pdxabi::Contract’.
The following three steps are recommended to generate the ABI:
1. Write ‘contract interface’ using ‘solglacial’;
2. Compile ‘contract interface’ with ‘remix’ to get the corresponding ‘ABI’ description;
3. Pdxabi ::Contract ‘;
After deploying the wasm contract, you can use the contract address and contract interface to instantiate the contract in the remix for easier testing.
Solidity Contract Interface
In the [Remix IDE] (http://remix.ethereum.org/#optimize=false&version=soljson-v0.5.3+commit.10d17f24.js&evmVersion=null&appVersion=0.7.7) write contract interface, and compile solidity.
Deployment and use
* deploy the contract in the same way as the ‘hello-wasm’ sample
[the README. Md] (https://github.com/PDXbaap/ewasm-rust-demo/blob/master/README.md) about ` deployment ` description:
* invoke contract:If ‘web3’ series’ SDK ‘is used,’ JSON ABI ‘+’ Contract Address ‘can be used to instantiate the Contract and make a call. If’ remix IDE ‘is used for test calls,You can use the ‘solmuddy Contract Interface’ + ‘Contract Address’ to instantiate the Contract and invoke the SDK and remix IDE provided by web3 for more information see the web3 foundation.
Solidity invokes the Wasm contract
With ` sol ` contracts to invoke ` wasm ` contracts, and ` sol ` call ` sol ` the same way, the assumption has been deployed ` hello — wasm — abi ` this contract, and get the address ` 0 xda3ce11d916ffba4a1289cef66a7f142ec5a0f74 `, through ` hello — wasm — abi ` contract interface and address can instantiate the contract, after usage and ` sol ` call ` sol ` consistent.
Such as:
Hello-wasm -abi contract interface
Call the wasm contract method
After deploying the ‘foobar’ contract, use the ‘hello-wasm-abi’ contract address:
` 0 xda3ce11d916ffba4a1289cef66a7f142ec5a0f74 ` respectively as the first parameter to invoke ` fetch ` and ` set ` method, complete the ` hello — wasm — abi ` contracts ` get ` and ` put ` calls.
– the public chain of PDX –
PDX public chain aims to build a public block chain ecosystem. As a public block chain IaaS, it helps enterprise customers, developer groups and ordinary users to enjoy the convenience and fun brought by block chain with powerful underlying patented technology.
The PDX public chain asserts that data sovereignty belongs to the user.
– join the community
The official Telegram
https://t.me/PDXann
https://t.me/PDXbaap
https://t.me/PDX_EngVIP
The official medium
https://medium.com/@pdxbaap
Official English twitter
https://twitter.com/PDXbaap
The official Facebook
https://www.facebook.com/PDXbaap
Official microblog PDXchain
https://weibo.com/PDXbaap/home
Published at Sat, 11 Jan 2020 08:43:59 +0000
{flickr|100|campaign}
