Skip to content

Commit

Permalink
docs: updated devnet snippets after final devnet deployment, updated …
Browse files Browse the repository at this point in the history
…README
  • Loading branch information
newbreedofgeek committed Mar 19, 2024
1 parent 46211c0 commit 9191b94
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 43 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Understanding this document is also easier if one knows how [ESDT token transact

## Itheum deployed contract addresses

| Devnet | Mainnet |
| ------ | ------- |
| | |
| Devnet | Mainnet |
| -------------------------------------------------------------- | ------- |
| erd1qqqqqqqqqqqqqpgq4xqxlq8p8zenrq4f0htgcwjzdlwmrhwdfsxsmavcuq | |

## Endpoints

Expand All @@ -26,7 +26,7 @@ See `devnet.snippets.sh` for list of available endpoints for user testing.

- Uses `multiversx-sc-* 0.47.5` (In v1.0.0, we used 0.47.5) SDK libs (see Cargo.toml)
- Building requires minimum **mxpy 9.5.1** (In v1.0.0, we used mxpy 9.5.1). Check version using `mxpy --version`
- To build the project, requires minimum Rust version `1.76.0-nightly` (In v1.0.0, we used 1.76.0-nightly). Check your Rust version by running `rustc --version`. To update your Rust, run `rustup update`. To set to nightly run `rustup default nightly`. Note that `mxpy deps install rust --overwrite` also brings in it's own compatible rust version so running `rustup default nightly` might have a higher rust version than what is used via `mxpy deps install rust --overwrite`.
- To build the project, requires minimum Rust version `1.78.0-nightly` (In v1.0.0, we used 1.78.0-nightly). Check your Rust version by running `rustc --version`. To update your Rust, run `rustup update`. To set to nightly run `rustup default nightly`. Note that `mxpy deps install rust --overwrite` also brings in it's own compatible rust version so running `rustup default nightly` might have a higher rust version than what is used via `mxpy deps install rust --overwrite`.
- After you make sure you have the minimum Rust version you can then begin development. After you clone repo and before you run build, deploy or run the tests - follow these steps (most likely only needed the 1st time)
- [Upgrades] Note that when we upgrade smart contract, we should again follow the steps below too as lib version may have changed (but for upgrade I skipped the rustup default nightly cmd and did the others)

Expand Down
59 changes: 20 additions & 39 deletions interaction/devnet.snippets.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PROXY=https://devnet-gateway.multiversx.com
CHAIN_ID="D"

WALLET="../wallet2.pem"
USER="../wallet2.pem"
WALLET="./wallet.pem"
USER="./wallet2.pem"

ADDRESS=$(mxpy data load --key=address-devnet)
DEPLOY_TRANSACTION=$(mxpy data load --key=deployTransaction-devnet)
Expand All @@ -11,12 +11,12 @@ TOKEN="ITHEUM-fce905"
TOKEN_HEX="0x$(echo -n ${TOKEN} | xxd -p -u | tr -d '\n')"

# to deploy from last reprodubible build, we need to change or vice versa
# --bytecode output/datanftmint.wasm \
# --bytecode output/core-mx-life-bonding-sc.wasm \
# to
# --bytecode output-docker/datanftmint/datanftmint.wasm \
# --bytecode output-docker/core-mx-life-bonding-sc/core-mx-life-bonding-sc.wasm \
deploy(){
mxpy --verbose contract deploy \
--bytecode output/core-mx-life-bonding-sc.wasm \
--bytecode output-docker/core-mx-life-bonding-sc/core-mx-life-bonding-sc.wasm \
--outfile deployOutput \
--metadata-not-readable \
--metadata-payable-by-sc \
Expand Down Expand Up @@ -53,6 +53,15 @@ upgrade(){
--send || return
}

# if you interact without calling deploy(), then you need to 1st run this to restore the vars from data
restoreDeployData() {
TRANSACTION=$(mxpy data parse --file="./interaction/deploy-devnet.interaction.json" --expression="data['emittedTransactionHash']")
ADDRESS=$(mxpy data parse --file="./interaction/deploy-devnet.interaction.json" --expression="data['contractAddress']")

# after we upgraded to mxpy 8.1.2, mxpy data parse seems to load the ADDRESS correctly but it breaks when used below with a weird "Bad address" error
# so, we just hardcode the ADDRESS here. Just make sure you use the "data['contractAddress'] from the latest deploy-devnet.interaction.json file
ADDRESS="erd1qqqqqqqqqqqqqpgq4xqxlq8p8zenrq4f0htgcwjzdlwmrhwdfsxsmavcuq"
}

setAdministrator(){
# $1 = address
Expand All @@ -70,7 +79,6 @@ setAdministrator(){
--send || return
}


setContractStateActive(){
mxpy --verbose contract call ${ADDRESS} \
--recall-nonce \
Expand All @@ -82,7 +90,6 @@ setContractStateActive(){
--send || return
}


setContractStateInactive(){
mxpy --verbose contract call ${ADDRESS} \
--recall-nonce \
Expand All @@ -94,10 +101,7 @@ setContractStateInactive(){
--send || return
}



setAcceptedCallers(){

# $1 = address

address="0x$(mxpy wallet bech32 --decode ${1})"
Expand All @@ -113,9 +117,7 @@ setAcceptedCallers(){
--send || return
}


setBondToken(){

mxpy --verbose contract call ${ADDRESS} \
--recall-nonce \
--pem=${WALLET} \
Expand All @@ -127,11 +129,9 @@ setBondToken(){
--send || return
}


setPeriodsBonds(){

setPeriodsBonds(){
# $1 = lockPeriod
# $2 = bonds
# $2 = bond

mxpy --verbose contract call ${ADDRESS} \
--recall-nonce \
Expand All @@ -144,9 +144,7 @@ setPeriodsBonds(){
--send || return
}


setMinimumPenalty(){

# $1 = minimumPenalty

mxpy --verbose contract call ${ADDRESS} \
Expand All @@ -158,11 +156,9 @@ setMinimumPenalty(){
--proxy ${PROXY} \
--chain ${CHAIN_ID} \
--send || return

}

setMaximumPenalty(){

setMaximumPenalty(){
# $1 = maximumPenalty

mxpy --verbose contract call ${ADDRESS} \
Expand All @@ -177,7 +173,6 @@ setMaximumPenalty(){
}

setWithdrawPenalty(){

# $1 = withdrawPenalty

mxpy --verbose contract call ${ADDRESS} \
Expand All @@ -191,8 +186,6 @@ setWithdrawPenalty(){
--send || return
}



sanction(){
# $1 = token identifier
# $2 = nonce
Expand All @@ -212,10 +205,8 @@ sanction(){
--proxy ${PROXY} \
--chain ${CHAIN_ID} \
--send || return

}


modifyBond(){
# $1 = token identifier
# $2 = nonce
Expand All @@ -231,13 +222,9 @@ modifyBond(){
--proxy ${PROXY} \
--chain ${CHAIN_ID} \
--send || return

}



withdraw(){

# $1 = token identifier
# $2 = nonce

Expand All @@ -252,12 +239,9 @@ withdraw(){
--proxy ${PROXY} \
--chain ${CHAIN_ID} \
--send || return

}


renew(){

renew(){
# $1 = token identifier
# $2 = nonce

Expand All @@ -274,10 +258,7 @@ renew(){
--send || return
}



renewWithNewLockPeriod(){

renewWithNewLockPeriod(){
# $1 = token identifier
# $2 = nonce
# $3 = lockPeriod
Expand All @@ -293,4 +274,4 @@ renewWithNewLockPeriod(){
--proxy ${PROXY} \
--chain ${CHAIN_ID} \
--send || return
}
}

0 comments on commit 9191b94

Please sign in to comment.