From 812534f8fc6528fff9b72fd79619c87a7db3a7a4 Mon Sep 17 00:00:00 2001 From: Stephen Skeirik Date: Tue, 17 Dec 2024 22:35:00 -0500 Subject: [PATCH] update README --- README.md | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f5bf552b0..6626f79ad 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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 ---------