Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.

Tutorial: CLI simple adder written in Rust

Andrei Băncioiu edited this page Apr 2, 2020 · 2 revisions

Prerequisites:

  • Have erdpy tools installed.

Steps

Create the project:

erdpy --verbose new --template="adder" --directory="./examples" myadder

Build the project:

erdpy --verbose build ./examples/myadder

Deploy the contract:

Deploy the contract and set an initial value of 100:

erdpy --verbose deploy ./examples/myadder --pem="./examples/keys/alice.pem" --proxy="https://wallet-api.elrond.com" --arguments 100

Inspect the contract address in the output and note it down.

Query contract state

First, let's query the accumulator value, it should have the initial value:

erdpy --verbose query 000000000000000005001d80d94d25a77b5a9a6295d260e3c0e4b53ee8cbb39d --function="getSum" --proxy="https://wallet-api.elrond.com"

Call the contract

Now let's add a value:

erdpy --verbose call 000000000000000005001d80d94d25a77b5a9a6295d260e3c0e4b53ee8cbb39d --pem="./examples/keys/alice.pem" --proxy="https://wallet-api.elrond.com" --function="add" --arguments 0x64

Afterwards, check the state again (call getSum).