Skip to content

Commit

Permalink
better interaction snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
juliancwirko committed Jan 21, 2023
1 parent b31f49e commit 929ae70
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 62 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@

# Output interactions data
*.interaction.json
mxpy.data-storage.json

.vscode
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "piggybank"
version = "0.5.0"
version = "0.5.1"
authors = ["Julian Ćwirko <[email protected]>"]
edition = "2021"
publish = false
Expand Down
37 changes: 37 additions & 0 deletions interactions/devnet.snippets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
USER_PEM="../walletKey.pem"
PROXY="https://devnet-gateway.multiversx.com"
CHAIN_ID="D"

SC_ADDRESS=$(mxpy data load --key=address-devnet)

## Example values:
# LOCK_EPOCH_TIMESTAMP=1675690008
# AMOUNT_TO_LOCK=1000000000000000000

deploy() {
mxpy --verbose contract deploy --chain=${CHAIN_ID} --project=${PROJECT} --pem=${USER_PEM} --gas-limit=20000000 --proxy=${PROXY} --recall-nonce --outfile="deploy-devnet.interaction.json" --send

SC_ADDRESS=$(mxpy data parse --file="deploy-devnet.interaction.json" --expression="data['contractAddress']")
mxpy data store --key=address-devnet --value=${SC_ADDRESS}

echo ""
echo "Smart contract address: ${SC_ADDRESS}"
}

createPiggy() {
read -p "LOCK_EPOCH_TIMESTAMP: Enter date in future using Unix Epoch timestamp: " LOCK_EPOCH_TIMESTAMP
mxpy --verbose contract call ${SC_ADDRESS} --function="createPiggy" --chain=${CHAIN_ID} --pem=${USER_PEM} --gas-limit=2000000 --proxy=${PROXY} --recall-nonce --arguments ${LOCK_EPOCH_TIMESTAMP} --send
}

addAmount() {
read -p "AMOUNT_TO_LOCK: Enter amount to lock in EGLD (1 = 1000000000000000000): " AMOUNT_TO_LOCK
mxpy --verbose contract call ${SC_ADDRESS} --function="addAmount" --chain=${CHAIN_ID} --pem=${USER_PEM} --gas-limit=2000000 --proxy=${PROXY} --recall-nonce --value=${AMOUNT_TO_LOCK} --send
}

payOut() {
mxpy --verbose contract call ${SC_ADDRESS} --function="payOut" --chain=${CHAIN_ID} --pem=${USER_PEM} --gas-limit=2000000 --proxy=${PROXY} --recall-nonce --send
}

upgrade() {
mxpy --verbose contract upgrade ${SC_ADDRESS} --project=${PROJECT} --chain=${CHAIN_ID} --pem=${USER_PEM} --gas-limit=2000000 --proxy=${PROXY} --recall-nonce --send
}
50 changes: 0 additions & 50 deletions interactions/snippets.sh

This file was deleted.

4 changes: 2 additions & 2 deletions meta/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion meta/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "piggybank-meta"
version = "0.5.0"
version = "0.5.1"
authors = ["Julian Ćwirko <[email protected]>"]
edition = "2021"
publish = false
Expand Down
8 changes: 4 additions & 4 deletions output/piggybank.abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"buildInfo": {
"rustc": {
"version": "1.68.0-nightly",
"commitHash": "4c83bd03a9d94af35c97a6b8b595d40e291af84a",
"commitDate": "2023-01-19",
"commitHash": "5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14",
"commitDate": "2023-01-20",
"channel": "Nightly",
"short": "rustc 1.68.0-nightly (4c83bd03a 2023-01-19)"
"short": "rustc 1.68.0-nightly (5ce39f42b 2023-01-20)"
},
"contractCrate": {
"name": "piggybank",
"version": "0.5.0"
"version": "0.5.1"
},
"framework": {
"name": "multiversx-sc",
Expand Down
Binary file modified output/piggybank.wasm
Binary file not shown.
4 changes: 2 additions & 2 deletions wasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "piggybank-wasm"
version = "0.5.0"
version = "0.5.1"
authors = ["Julian Ćwirko <[email protected]>"]
edition = "2021"
publish = false
Expand Down

0 comments on commit 929ae70

Please sign in to comment.