From 33619f1b3e9eb4a7bceeeca3a343353de102b469 Mon Sep 17 00:00:00 2001 From: Mark Paul Date: Fri, 26 May 2023 21:15:01 +1000 Subject: [PATCH] v1.0.0 deployed to mainnet from this commit and signed off. Ready for release tag --- .gitignore | 5 +- interaction/mainnet.snippets.sh | 244 ++++++++++++++++++++++++++++++++ 2 files changed, 248 insertions(+), 1 deletion(-) create mode 100644 interaction/mainnet.snippets.sh diff --git a/.gitignore b/.gitignore index e555a55..59e9eb8 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,7 @@ erdpy.data-storage.json .DS_Store -mxpy.data-storage.json \ No newline at end of file +mxpy.data-storage.json + +deployOutputMainnet +deploy-mainnet.interaction.json \ No newline at end of file diff --git a/interaction/mainnet.snippets.sh b/interaction/mainnet.snippets.sh new file mode 100644 index 0000000..a4806a8 --- /dev/null +++ b/interaction/mainnet.snippets.sh @@ -0,0 +1,244 @@ +PROXY=https://gateway.multiversx.com +CHAIN_ID="1" + +ADDRESS=$(mxpy data load --key=address-mainnet) + +TOKEN="ITHEUM-df6f26" +TOKEN_HEX="0x$(echo -n ${TOKEN} | xxd -p -u | tr -d '\n')" + +deployLedgerMainnet(){ + mxpy --verbose contract deploy \ + --bytecode output-docker/data_market/data_market.wasm \ + --outfile deployOutputMainnet \ + --metadata-not-readable \ + --metadata-payable-by-sc \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --gas-limit 150000000 \ + --send \ + --recall-nonce \ + --ledger \ + --ledger-address-index 0 \ + --outfile="./interaction/deploy-mainnet.interaction.json" || return + + TRANSACTION=$(mxpy data parse --file="./interaction/deploy-mainnet.interaction.json" --expression="data['emittedTransactionHash']") + ADDRESS=$(mxpy data parse --file="./interaction/deploy-mainnet.interaction.json" --expression="data['contractAddress']") + + mxpy data store --key=address-mainnet --value=${ADDRESS} + mxpy data store --key=deployTransaction-mainnet --value=${TRANSACTION} +} + +# if you interact without calling deploy(), then you need to 1st run this to restore the vars from data +restoreDeployDataMainnet() { + TRANSACTION=$(mxpy data parse --file="./interaction/deploy-mainnet.interaction.json" --expression="data['emittedTransactionHash']") + ADDRESS=$(mxpy data parse --file="./interaction/deploy-mainnet.interaction.json" --expression="data['contractAddress']") +} + +initializeContractMainnet(){ + # $1 = token identifier of the collection to be traded + # $2 = token identifier of the accepted token payment + # $3 = maximum payment fee per SFT + # $4 = treasury address + + token_identifier_collection="0x$(echo -n ${1} | xxd -p -u | tr -d '\n')" + token_identifier_payment="0x$(echo -n ${2} | xxd -p -u | tr -d '\n')" + treasury_address="0x$(mxpy wallet bech32 --decode ${4})" + + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --gas-limit=8000000 \ + --function "initializeContract" \ + --arguments $token_identifier_collection $token_identifier_payment $3 $treasury_address \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --ledger \ + --ledger-address-index 0 \ + --send || return +} + +pauseContractMainnet(){ + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --gas-limit=6000000 \ + --function "setIsPaused" \ + --arguments 1 \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --ledger \ + --ledger-address-index 0 \ + --send || return +} + +unPauseContractMainnet(){ + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --gas-limit=6000000 \ + --function "setIsPaused" \ + --arguments 0 \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --ledger \ + --ledger-address-index 0 \ + --send || return +} + +setTreasuryAddressMainnet(){ + # $1 = treasury address + + treasury_address="0x$(mxpy wallet bech32 --decode ${1})" + + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --gas-limit=6000000 \ + --function "setTreasuryAddress" \ + --arguments $treasury_address \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --ledger \ + --ledger-address-index 0 \ + --send || return +} + +setAdministratorMainnet(){ + # $1 = administrator address + + administrator_address="0x$(mxpy wallet bech32 --decode ${1})" + + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --gas-limit=6000000 \ + --function "setAdministrator" \ + --arguments $administrator_address \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --ledger \ + --ledger-address-index 0 \ + --send || return +} + +setDiscountsMainnet(){ + # $1 = seller discount + # $2 = buyer discount + + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --gas-limit=6000000 \ + --function "setDiscounts" \ + --arguments ${1} ${2} \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --ledger \ + --ledger-address-index 0 \ + --send || return +} + +setFeesMainnet(){ + # $1 = seller fee + # $2 = buyer fee + + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --gas-limit=6000000 \ + --function "setFees" \ + --arguments ${1} ${2} \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --ledger \ + --ledger-address-index 0 \ + --send || return +} + +addAcceptedTokenMainnet(){ + # $1 = token identifier + + token_identifier="0x$(echo -n ${1} | xxd -p -u | tr -d '\n')" + + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --gas-limit=6000000 \ + --function "addAcceptedToken" \ + --arguments $token_identifier \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --ledger \ + --ledger-address-index 0 \ + --send || return +} + +addAcceptedPaymentMainnet(){ + # $1 =token identifier + # $2 = maximum payment fee per SFT + + token_identifier="0x$(echo -n ${1} | xxd -p -u | tr -d '\n')" + + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --gas-limit=6000000 \ + --function "addAcceptedPayment" \ + --arguments $token_identifier $2 \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --ledger \ + --ledger-address-index 0 \ + --send || return +} + +setClaimsContractMainnet(){ + # $1 = claims contract address + + claims_address="0x$(mxpy wallet bech32 --decode ${1})" + + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --gas-limit=6000000 \ + --function "setClaimsContract" \ + --arguments $claims_address \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --ledger \ + --ledger-address-index 0 \ + --send || return +} + +setRoyaltiesClaimTokenMainnet(){ + # $1 = token identifier + + token_identifier="0x$(echo -n ${1} | xxd -p -u | tr -d '\n')" + + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --gas-limit=6000000 \ + --function "setRoyaltiesClaimToken" \ + --arguments $token_identifier \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --ledger \ + --ledger-address-index 0 \ + --send || return +} + +setClaimIsEnabledMainnet(){ + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --gas-limit=6000000 \ + --function "setClaimIsEnabled" \ + --arguments 1 \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --ledger \ + --ledger-address-index 0 \ + --send || return +} + +setClaimIsDisabledMainnet(){ + mxpy --verbose contract call ${ADDRESS} \ + --recall-nonce \ + --gas-limit=6000000 \ + --function "setClaimIsEnabled" \ + --arguments 0 \ + --proxy ${PROXY} \ + --chain ${CHAIN_ID} \ + --ledger \ + --ledger-address-index 0 \ + --send || return +}