Skip to content

Commit

Permalink
revert to ping-pong esdt or egld
Browse files Browse the repository at this point in the history
  • Loading branch information
BiancaIalangi committed Dec 10, 2024
1 parent 918332b commit 204acc2
Show file tree
Hide file tree
Showing 44 changed files with 319 additions and 2,235 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ permissions:
jobs:
contracts:
name: Contracts
uses: multiversx/mx-sc-actions/.github/workflows/contracts.yml@v4.0.0
uses: multiversx/mx-sc-actions/.github/workflows/contracts.yml@v3.3.1
with:
rust-toolchain: stable
mx-scenario-go-version: v3.0.0
enable-contracts-size-report: false
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[workspace]
resolver = "2"
members = ["ping-pong", "ping-pong/meta", "ping-pong/interactor"]
members = [
"ping-pong",
"ping-pong/meta"
]
1 change: 1 addition & 0 deletions elrond.workspace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
4 changes: 2 additions & 2 deletions ping-pong/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
path = "src/ping_pong.rs"

[dependencies.multiversx-sc]
version = "0.54.6"
version = "0.52.3"

[dev-dependencies.multiversx-sc-scenario]
version = "0.54.6"
version = "0.52.3"
23 changes: 23 additions & 0 deletions ping-pong/interaction/Ping-pong.erdjs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Ping-pong

First [set up a node terminal](../../../../tutorial/src/interaction/interaction-basic.md).

```javascript
let erdjs = await require('@elrondnetwork/erdjs');
let { erdSys, Egld, wallets: { alice, bob, carol, dan } } = await erdjs.setupInteractive("local-testnet");

let pingPong = await erdSys.loadWrapper("contracts/examples/ping-pong");

await pingPong.sender(alice).gas(150_000_000).call.deploy(Egld(0.5), 2 * 60, null, Egld(1.5));

await pingPong.gas(20_000_000).sender(alice).value(Egld(0.5)).ping("note 1");

await pingPong.sender(bob).value(Egld(0.5)).ping(null);
await pingPong.sender(carol).value(Egld(0.5)).ping(null);

// this fails because of the balance limit of 1.5 egld
await pingPong.sender(dan).value(Egld(0.5).ping(null);

await pingPong.pongAll();

```
Empty file added ping-pong/interaction/out.json
Empty file.
39 changes: 39 additions & 0 deletions ping-pong/interaction/snippets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
PEM_FILE="./ping-pong.pem"
PING_PONG_CONTRACT="output/ping-pong.wasm"

PROXY_ARGUMENT="--proxy=https://devnet-api.multiversx.com"
CHAIN_ARGUMENT="--chain=D"

build_ping_pong() {
(set -x; mxpy --verbose contract build "$PING_PONG_CONTRACT")
}

deploy_ping_pong() {
# local TOKEN_ID=0x45474c44 # "EGLD"
local PING_AMOUNT=1500000000000000000 # 1.5 EGLD
local DURATION=86400 # 1 day in seconds
# local ACTIVATION_TIMESTAMP= # skipped
# local MAX_FUNDS= #skipped

local OUTFILE="out.json"
(set -x; mxpy contract deploy --bytecode="$PING_PONG_CONTRACT" \
--pem="$PEM_FILE" \
$PROXY_ARGUMENT $CHAIN_ARGUMENT \
--outfile="$OUTFILE" --recall-nonce --gas-limit=60000000 \
--arguments ${PING_AMOUNT} ${DURATION} --send \
|| return)

local RESULT_ADDRESS=$(mxpy data parse --file="$OUTFILE" --expression="data['emitted_tx']['address']")
local RESULT_TRANSACTION=$(mxpy data parse --file="$OUTFILE" --expression="data['emitted_tx']['hash']")

echo ""
echo "Deployed contract with:"
echo " \$RESULT_ADDRESS == ${RESULT_ADDRESS}"
echo " \$RESULT_TRANSACTION == ${RESULT_TRANSACTION}"
echo ""
}

number_to_u64() {
local NUMBER=$1
printf "%016x" $NUMBER
}
9 changes: 0 additions & 9 deletions ping-pong/interactor/.gitignore

This file was deleted.

36 changes: 0 additions & 36 deletions ping-pong/interactor/Cargo.toml

This file was deleted.

5 changes: 0 additions & 5 deletions ping-pong/interactor/config.toml

This file was deleted.

Loading

0 comments on commit 204acc2

Please sign in to comment.