Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
sskeirik committed Dec 18, 2024
1 parent 00a84c1 commit 812534f
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ Then, you can start the ULM locally and load the Wasm VM into it by running:
./scripts/ulm-load-lang ./build/lib/libwasm.so
```

As an example, to deploy a Wasm contract, you can do the following:
As an example, to deploy a Wasm contract and invoke a function on it, you can do the following:

1. Install the python scripts:

Expand All @@ -228,15 +228,29 @@ As an example, to deploy a Wasm contract, you can do the following:
scripts/compile-contract tests/ulm/erc20/erc20.kore > tests/ulm/erc20/erc20.bin
```

3. Deploy the compiled Wasm contract:
3. Generate an account for use in the test

```sh
poetry -C pykwasm run deploy tests/ulm/erc20/erc20.bin
poetry -C pykwasm run python3 -c "from web3 import Web3; w3 = Web3(); acc = w3.eth.account.create(); print(w3.to_hex(acc.key))" > pk_file
```

To invoke a deployed Wasm contract, do the following:
4. Fund the new account

**TODO:** add instructions.
```sh
poetry -C pykwasm fund pk_file http://localhost:8545
```

5. Deploy the compiled Wasm contract from the funded account:

```sh
poetry -C pykwasm run deploy tests/ulm/erc20/erc20.bin http://localhost:8545 pk_file > contract_addr
```

6. Invoke a contract function from the funded account:

```sh
poetry -C pykwasm run call http://localhost:8545 erc20 $(cat contract_addr) pk_file 0 decimals
```

Resources
---------
Expand Down

0 comments on commit 812534f

Please sign in to comment.