Skip to content

sudostake/sudostake_contracts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SudoStake

Rust

 

Non-Custodial | Smart Contract Staking | Peer-to-Peer Options Trading Platform.

 

Contracts Description
SudoMod Proxy for minting vaults
Vault Staking with peer-to-peer options trading

 

Preparing for merge

Before you merge the code, make sure it builds and passes all tests using the command below.

$ cargo test

 

Release builds

You can build release artifacts manually like this, which creates a reproducible optimized build for each contract and saves them to the ./artifacts directory:

$ docker run --rm -v "$(pwd)":/code \
  --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
  --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
  cosmwasm/rust-optimizer:0.12.6

 

Working with smart contracts (archwayd)

(See instructions on how to install archwayd)

 

View archwayd config variables

$ open ~/.archway/config/config.toml

 

Testnet block explorer

Constantine-3 test-net on mintscan

 

Add test accounts

$ archwayd keys add <wallet_name> --recover

 

List test accounts

$ archwayd keys list

 

Export variables for use in terminal - Constantine-3

# Export path to your go installation
$ source ~/.profile

$ export CHAIN_ID="constantine-3"

$ export RPC="https://rpc.constantine.archway.tech:443"

$ export NODE=(--node $RPC)

$ export TXFLAG=($NODE --chain-id $CHAIN_ID --gas-prices 20000000000000aconst --gas auto --gas-adjustment 1.3)

 

Export variables for use in terminal - Triomphe

# export path to your go installation
$ source ~/.profile

$ export CHAIN_ID="archway-1"

$ export RPC="https://rpc.mainnet.archway.io:443"

$ export NODE=(--node $RPC)

$ export TXFLAG=($NODE --chain-id $CHAIN_ID --gas-prices 900000000000aarch --gas auto --gas-adjustment 1.3)

 

Query balances

$ archwayd query bank total $NODE

$ archwayd query bank balances $(archwayd keys show -a palingram) $NODE

 

Send funds to other account

$ archwayd tx bank send <sender_account_name> <receiver_address> <amount><denom> $TXFLAG

 

See the list of code uploaded to the testnet

$ archwayd query wasm list-code $NODE

 

Store the contract on the blockchain and get the <CODE_ID>

$ export RES=$(archwayd tx wasm store artifacts/<contract_name.wasm> --from <account_name> $TXFLAG -y --output json -b block)

$ export CODE_ID=$(echo $RES | jq -r '.logs[0].events[-1].attributes[1].value')

$ echo $CODE_ID

 

Get a list of contracts instantiated for <CODE_ID>

$ archwayd query wasm list-contract-by-code $CODE_ID $NODE --output json

 

Prepare the json message payload

$ export INIT='{}'

 

Instantiate the contract

$ archwayd tx wasm instantiate $CODE_ID "$INIT" --from <account_name> --label "CONTRACT LABEL" $TXFLAG -y --no-admin

 

Get the latest contract instantiated for contract with $CODE_ID

$ export CONTRACT=$(archwayd query wasm list-contract-by-code $CODE_ID $NODE --output json | jq -r '.contracts[-1]')

$ echo $CONTRACT

 

Check the contract details

$ archwayd query wasm contract $CONTRACT $NODE

 

Check the contract balance

$ archwayd query bank balances $CONTRACT $NODE

 

query the entire contract state

$ archwayd query wasm contract-state all $CONTRACT $NODE

 

query the data for a storage key in the contract-state directly

$ archwayd query wasm contract-state raw $CONTRACT 636F6E666967 $NODE  --output "json" | jq -r '.data' | base64 -d

 

Calling execute methods

$ export E_PAYLOAD='{"<prop>":{}}'

$ archwayd tx wasm execute $CONTRACT "$E_PAYLOAD" --from palingram $NODE $TXFLAG -y

 

calling query methods

$ export Q_PAYLOAD='{"query_list":{}}'

$ archwayd query wasm contract-state smart $CONTRACT "$Q_PAYLOAD" $NODE --output json

 

Testnet Docs

See TESTNET.md for the complete SudoStake smart contracts testing docs