diff --git a/deploy/testnet.txt b/deploy/testnet.txt new file mode 100644 index 0000000..9f8553d --- /dev/null +++ b/deploy/testnet.txt @@ -0,0 +1,112 @@ +# intended to be run from root directory +# config on machine +injectived config + { + "chain-id": "injective-888", + "keyring-backend": "os", + "output": "json", + "node": "https://testnet.sentry.tm.injective.network:443/", + "broadcast-mode": "sync" + } + +injectived keys add --recover auction-test +# faucet to add funds - https://testnet.faucet.injective.network/ +# https://bwarelabs.com/faucets/injective-testnet + +export FROM=auction-test +export FROM_ADDR=inj12nn88vtuf893cpfkke23dszpr5uccqj2zqukt6 + +just optimize +injectived tx wasm store ./artifacts/treasurechest_contract-aarch64.wasm --from ${FROM} --yes --gas-prices "160000000inj" --gas-adjustment 1.3 --gas auto + +tx=AC309E601058B623CF4C8F73CEAAAF2C34F7BC0BAE068AF50ED48834F7432287 + +export TREASURE=$(injectived query tx ${tx} |jq -e -r ' .logs[].events[] | select(.type=="cosmwasm.wasm.v1.EventCodeStored").attributes[] | select(.key=="code_id").value ' | tr -d '"') +echo $TREASURE +export TREASURE=8127 + +injectived tx wasm store ./artifacts/injective_auction_pool-aarch64.wasm --from ${FROM} --yes --gas-prices "160000000inj" --gas-adjustment 1.3 --gas auto + +tx=B2EDA45FC77F1B0521386341301FE4C9B8B3844960C2A5BF603E60118856303B + +export AUCTION=$(injectived query tx ${tx} |jq -e -r ' .logs[].events[] | select(.type=="cosmwasm.wasm.v1.EventCodeStored").attributes[] | select(.key=="code_id").value ' | tr -d '"') +echo $AUCTION +export AUCTION=8128 + +## create the test denom +fee_amt=$(injectived query tokenfactory params|jq -r '.params.denom_creation_fee[0].amount') +# fee_amt=1000000000000000000 + +injectived tx tokenfactory create-denom --from $FROM test1 --yes --gas-prices "160000000inj" --gas-adjustment 1.3 --gas auto + +token_tx=84FB36B4FC1A7A70561A54A3AD75F55FD3AFD7F59683CE404648AAC2B97645D4 + +export TOKEN_DENOM=$(injectived query tx ${token_tx}|jq -r '.logs[].events[] | select(.type=="injective.tokenfactory.v1beta1.EventCreateTFDenom").attributes[] | select (.key=="denom").value' |tr -d '"') +echo $TOKEN_DENOM +# export TOKEN_DENOM=factory/inj12nn88vtuf893cpfkke23dszpr5uccqj2zqukt6/test1 + +injectived tx tokenfactory mint 3000${TOKEN_DENOM} --from $FROM --yes --gas-prices "160000000inj" --gas-adjustment 1.3 --gas auto + +tx_mint=78A88CD1592AA9717996E56A451A63E153D3C2E6D3291DE6D346AC767EA26C0C +injectived query tx ${tx_mint} |jq -e '.code' +# should be 0. + +## we need some rewards +for reward in reward1 reward2 reward3 reward4 +do +injectived tx tokenfactory create-denom --from $FROM $reward --yes --gas-prices "160000000inj" --gas-adjustment 1.3 --gas auto +sleep 5 +injectived tx tokenfactory mint 2000factory/$FROM_ADDR/$reward --from $FROM --yes --gas-prices "160000000inj" --gas-adjustment 1.3 --gas auto +sleep 5 +done + +# see them +injectived query bank balances $FROM_ADDR + +# envsubst comes from +# brew install getttext +INIT_MSG=$(envsubst < ./deploy/testnet/treasure.json) +date_label=$(date +"%Y-%m-%d %H:%M") +distribute_amounts="1000factory/$FROM_ADDR/reward1,1500factory/$FROM_ADDR/reward2,300factory/$FROM_ADDR/reward3,600factory/$FROM_ADDR/reward4" + +injectived tx wasm instantiate $TREASURE ${INIT_MSG} \ + --label treasure_${date_label} \ + --admin $FROM_ADDR \ + --amount $distribute_amounts \ + --from $FROM --yes --gas-prices "160000000inj" --gas-adjustment 1.3 --gas auto + +tx_treasure_i=7B7889E11B4C87F255B07B2755E087CCD593A192381F2F3024C9646E98F72F08 + +export TREASURE_CONTRACT=$(injectived query tx $tx_treasure_i|jq -r '.logs[].events[]| select(.type=="cosmwasm.wasm.v1.EventContractInstantiated").attributes[] |select(.key=="contract_address").value '|tr -d '"') +echo $TREASURE_CONTRACT +# inj13m59zu2w62293v4t7g9y2zwhjy6wxtunxl03hj + +injectived query wasm cs smart $TREASURE_CONTRACT '{"config":{}}'|jq +injectived query wasm cs smart $TREASURE_CONTRACT '{"state":{}}'|jq +injectived query bank balances $TREASURE_CONTRACT|jq + +# this should have the admin as $TREASURE_CONTRACT +injectived query tokenfactory denom-authority-metadata $TOKEN_DENOM + +# +injectived tx wasm exec $TREASURE_CONTRACT '{"withdraw":{}}' --amount 10${TOKEN_DENOM} --from $FROM --yes --gas-prices "160000000inj" --gas-adjustment 1.3 --gas auto + +tx_withdraw=9EC41A1CD283EB7CE0F21B868B9A3E65FA7E9275C57913DAE0B223291CF95B32 +injectived query tx $tx_withdraw|jq -r '.logs[].events' >/tmp/events.json + +jq -r < /tmp/events.json -e '(nth(1;.[] |select(.type=="transfer"))).attributes[]|select(.key=="amount").value'|tr ',' '\n' +injectived query bank balances $TREASURE_CONTRACT|jq + +injectived query bank total --denom $TOKEN_DENOM |jq + +injectived tx wasm exec $TREASURE_CONTRACT '{"withdraw":{}}' --amount 2980${TOKEN_DENOM} --from $FROM --yes --gas-prices "160000000inj" --gas-adjustment 1.3 --gas auto +tx_withdraw2=1B609453D36147BFC9E7622230D772C72BACD988FB08AFFB94BE46C0B229398D + +injectived query tx $tx_withdraw2|jq -r '.logs[].events' >/tmp/events2.json +jq -r < /tmp/events2.json -e '(nth(1;.[] |select(.type=="transfer"))).attributes[]|select(.key=="amount").value'|tr ',' '\n' + +injectived tx wasm exec $TREASURE_CONTRACT '{"withdraw":{}}' --amount 10${TOKEN_DENOM} --from $FROM --yes --gas-prices "160000000inj" --gas-adjustment 1.3 --gas auto +tx_withdraw3=372AC06BBD14DC59A9C64AA03CD9302AC9369A96ECB255051BE4BBC12C114E7F + +injectived query tx $tx_withdraw3|jq -r '.logs[].events' >/tmp/events3.json +jq -r < /tmp/events3.json -e '(nth(1;.[] |select(.type=="transfer"))).attributes[]|select(.key=="amount").value'|tr ',' '\n' diff --git a/deploy/testnet/treasure.json b/deploy/testnet/treasure.json new file mode 100644 index 0000000..8f6a747 --- /dev/null +++ b/deploy/testnet/treasure.json @@ -0,0 +1,7 @@ +{ + "denom": "$TOKEN_DENOM", + "owner": "$FROM_ADDR", + "notes": "some random stuff can be here", + "token_factory": "Injective", + "burn_it": true +} \ No newline at end of file