Skip to content

Commit a78d7bf

Browse files
committed
Update polkavm docs
1 parent 3c94b8e commit a78d7bf

File tree

2 files changed

+9
-56
lines changed

2 files changed

+9
-56
lines changed

docs/PolkaVM/PolkaVMv2.drawio.png

165 KB
Loading

docs/PolkaVM/polkavm_pallet.md

Lines changed: 9 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# PolkaVM Pallet
22

3-
This document describe: key features of PolkaVM v2 - v3 pallet.
4-
High level design could be found at `docs/PolkaVM/PolkaVMv2.drawio`.
3+
This document describe: key features of PolkaVM v2.
4+
[High level design](https://github.com/QuantumFusion-network/spec/blob/main/docs/PolkaVM/PolkaVMv2.drawio).
5+
![alt text](docs/PolkaVM/PolkaVMv2.drawio.png)
56

67
Polka VM Pallet has two type of extrinsic: uploading PolkaVM compiled blob and execute it via given address.
78
Both extrinsics are avaliable via Substrate RPC.
@@ -18,63 +19,15 @@ could be found in `Polka VM Blob hashing & addressing`. In short word: smart con
1819
- Smart contracts execution support GAS (more details in `GAS` section).
1920

2021
## PolkaVM Blob hashing & addressing
21-
Desing could be found at `docs/PolkaVM/blob_hashing_addressing.md`.
22+
[Desing](https://github.com/QuantumFusion-network/spec/blob/main/docs/PolkaVM/blob_hashing_addressing.md)
2223

2324
## GAS
24-
PolkaVM pallet supports GAS using PolkaVM feature
25-
(https://github.com/paritytech/polkavm) for current integration of PolkaVM into Substrate.
26-
Team planing to improve this solution in the future.
27-
28-
## Functions
25+
PolkaVM pallet supports GAS using [PolkaVM gas](https://github.com/paritytech/polkavm).
2926

27+
## Storage
28+
[Design](https://github.com/QuantumFusion-network/spec/blob/main/docs/PolkaVM/smart_contract_storage.md) and [example](https://github.com/QuantumFusion-network/qf-polkavm-sdk/blob/main/examples/example-smart-contract/src/main.rs).
29+
[Modeling](https://github.com/QuantumFusion-network/spec/blob/main/docs/PolkaVM/qfPolkaVM-X_O_game_modeling.md) of the X|O game by using [qf-polkavm-sdk](https://github.com/QuantumFusion-network/qf-polkavm-sdk/tree/main) and [storage api](https://github.com/QuantumFusion-network/qf-polkavm-sdk/blob/main/src/lib.rs#L145).
3030

3131
## QF Framework for Smart Contracts PolkaVM v2
32-
33-
The first implementation of the QF Framework is too low level, team understand it. It was done for testing integration of two runtimes.
34-
Here is an example of Smart contract code:
35-
36-
```rust
37-
#![no_std]
38-
#![no_main]
39-
40-
#[panic_handler]
41-
fn panic(_info: &core::panic::PanicInfo) -> ! {
42-
unsafe {
43-
core::arch::asm!("unimp", options(noreturn));
44-
}
45-
}
46-
47-
#[polkavm_derive::polkavm_import]
48-
extern "C" {
49-
fn balance() -> u64;
50-
fn print() -> u64;
51-
fn transfer(address_idx: u32, balance_idx: u32) -> u64;
52-
}
53-
54-
#[polkavm_derive::polkavm_export]
55-
extern "C" fn call_balance() -> u64 {
56-
unsafe { balance() }
57-
}
58-
59-
#[polkavm_derive::polkavm_export]
60-
extern "C" fn call_print() -> u64 {
61-
unsafe { print() }
62-
}
63-
64-
#[polkavm_derive::polkavm_export]
65-
extern "C" fn call_transfer() -> u64 {
66-
unsafe { transfer(0, 0) }
67-
}
68-
```
69-
70-
Supported functions:
71-
- transfer(A, b): trasfering tokens,
72-
- balance(): get balance info,
73-
- print(): for logging.
74-
75-
All of this avaliable in QF DevNet (http://dev.qfnetwork.xyz).
76-
77-
## QF Framework for Smart Contracts PolkaVM v3
78-
79-
Planned that next version includes the next features: `https://github.com/QuantumFusion-network/spec/issues/9`.
32+
Please find example of the contract [here](https://github.com/QuantumFusion-network/qf-polkavm-sdk/blob/main/examples/example-smart-contract/src/main.rs). For getting starting also please read [readme](https://github.com/QuantumFusion-network/qf-polkavm-sdk/blob/main/README.md).
8033

0 commit comments

Comments
 (0)