Skip to content

Commit

Permalink
docs: Update runtime and contracts for latest Oasis CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
matevz committed Jan 11, 2024
1 parent dbfd25d commit bb0e804
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
8 changes: 4 additions & 4 deletions docs/contract/confidential-smart-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Since the smart contracts store is public, uploading the Wasm code is
the same as for the non-confidential ones:

```shell
oasis contracts upload hello_world.wasm
oasis contract upload hello_world.wasm
```

<!-- markdownlint-disable line-length -->
Expand All @@ -86,7 +86,7 @@ oasis contracts upload hello_world.wasm

## Confidential Instantiation and Calling

To generate an encrypted transaction, the `oasis contracts` subcommand
To generate an encrypted transaction, the `oasis contract` subcommand
expects a `--encrypted` flag. The client (`oasis` command in our case) will
generate and use an ephemeral keypair for encryption. If the original
transaction was encrypted, the returned transaction result will also be
Expand Down Expand Up @@ -122,7 +122,7 @@ instantiate our smart contract above with a single write to the contract state,
we need to raise the gas limit to `60000`:

```shell
oasis contracts instantiate CODEID '{instantiate: {initial_counter: 42}}' --encrypted --gas-limit 60000
oasis contract instantiate CODEID '{instantiate: {initial_counter: 42}}' --encrypted --gas-limit 400000
```

:::danger
Expand All @@ -146,7 +146,7 @@ calls - in this case `300,000`.
Finally, we make a confidential call:

```shell
oasis contracts call INSTANCEID '{say_hello: {who: "me"}}' --encrypted --gas-limit 60000
oasis contract call INSTANCEID '{say_hello: {who: "me"}}' --encrypted --gas-limit 400000
```

:::tip Call Format
Expand Down
6 changes: 3 additions & 3 deletions docs/contract/hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ The first deployment step that needs to be performed only once for the given
binary is uploading the Wasm binary.

```
oasis contracts upload hello_world.wasm
oasis contract upload hello_world.wasm
```

After successful execution it will show the code ID that you need to use for any
Expand All @@ -143,7 +143,7 @@ arguments. Note that the arguments depend on the contract that is being deployed
and in our hello world case we are simply taking the initial counter value.

```
oasis contracts instantiate CODEID '{instantiate: {initial_counter: 42}}'
oasis contract instantiate CODEID '{instantiate: {initial_counter: 42}}'
```

<!-- TODO: Mention how to send tokens and change the upgrade policy. -->
Expand All @@ -152,7 +152,7 @@ After successful execution it shows the instance ID that you need for calling
the instantiated contract. Next, you can test calling the contract.

```
oasis contracts call INSTANCEID '{say_hello: {who: "me"}}'
oasis contract call INSTANCEID '{say_hello: {who: "me"}}'
```

:::info Example
Expand Down
35 changes: 23 additions & 12 deletions docs/runtime/minimal-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ Since the Runtime SDK requires a nightly version of the Rust toolchain, you need
to specify a version to use by creating a special file called
`rust-toolchain.toml` containing the following information:

![code](../../examples/runtime-sdk/minimal-runtime/rust-toolchain.toml)
<!-- markdownlint-disable line-length -->
![code toml](../../examples/runtime-sdk/minimal-runtime/rust-toolchain.toml "rust-toolchain.toml")
<!-- markdownlint-enable line-length -->

Additionally, due to the requirements of some upstream dependencies, you need to
configure Cargo to always build with specific target CPU platform features
(namely AES-NI and SSE3) by creating a `.cargo/config` file with the following
content:

```toml
```toml title=".cargo/config"
[build]
rustflags = ["-C", "target-feature=+aes,+ssse3"]
rustdocflags = ["-C", "target-feature=+aes,+ssse3"]
Expand Down Expand Up @@ -199,7 +201,7 @@ Now, let's see, if the local network was correctly initialized and the runtime
is ready:

```bash
oasis inspect node-status --network localhost
oasis network status --network localhost
```

If everything is working correctly, you should see the `"status": "ready"`
Expand Down Expand Up @@ -229,8 +231,11 @@ Now, let's add `minimal` runtime to the wallet. By default, `oasis-net-runner`
assigns ID `8000000000000000000000000000000000000000000000000000000000000000`
to the first provided runtime.

```bash
```shell
oasis paratime add localhost minimal 8000000000000000000000000000000000000000000000000000000000000000
```

```
? Description: minimal
? Denomination symbol: TEST
? Denomination decimal places: 9
Expand All @@ -242,8 +247,11 @@ other test users (check the [oasis-sdk testing source] for a complete list).
You can access the accounts by prepending `test:` literal in front of the test
user's name, for example `test:alice`.

```bash
oasis accounts show test:alice --network localhost
```shell
oasis account show test:alice --network localhost
```

```
Address: oasis1qrec770vrek0a9a5lcrv0zvt22504k68svq7kzve
Nonce: 0
Expand All @@ -261,8 +269,11 @@ Balances for all denominations:
Sending some TEST in your runtime should also work. Let's send 0.1 TEST to
Bob's address.

```bash
oasis accounts transfer 0.1 test:bob --network localhost --account test:alice
```shell
oasis account transfer 0.1 test:bob --network localhost --account test:alice
```

```
Unlock your account.
? Passphrase:
You are about to sign the following transaction:
Expand Down Expand Up @@ -321,7 +332,7 @@ to submit some transactions and perform queries.

First, create a `tests` directory and move into it, creating a Go module:

```bash
```shell
go mod init example.com/oasisprotocol/minimal-runtime-client
go mod tidy
```
Expand All @@ -334,13 +345,13 @@ Then create a `test.go` file with the following content:

Fetch the dependencies:

```bash
```shell
go get
```

And build it:

```bash
```shell
go build
```

Expand All @@ -352,7 +363,7 @@ end it will again query and display the final balances of both accounts.

To run the built client do:

```bash
```shell
./minimal-runtime-client
```

Expand Down

0 comments on commit bb0e804

Please sign in to comment.