From f305dc16fb91ec6526292ab039c8dd29a66f619b Mon Sep 17 00:00:00 2001 From: riley-stride <104941670+riley-stride@users.noreply.github.com> Date: Sun, 26 Mar 2023 04:06:34 -0400 Subject: [PATCH] airdrop testing (#688) Co-authored-by: vish-stride --- app/upgrades/v8/upgrades.go | 2 +- dockernet/scripts/airdrop.sh | 142 +++++++++++++++++++++++++- dockernet/scripts/airdrop/airdrop1.sh | 64 ++++++++++++ dockernet/scripts/airdrop/airdrop2.sh | 92 +++++++++++++++++ dockernet/scripts/airdrop/airdrop3.sh | 113 ++++++++++++++++++++ dockernet/scripts/airdrop/airdrop4.sh | 64 ++++++++++++ 6 files changed, 473 insertions(+), 4 deletions(-) create mode 100644 dockernet/scripts/airdrop/airdrop1.sh create mode 100644 dockernet/scripts/airdrop/airdrop2.sh create mode 100644 dockernet/scripts/airdrop/airdrop3.sh create mode 100644 dockernet/scripts/airdrop/airdrop4.sh diff --git a/app/upgrades/v8/upgrades.go b/app/upgrades/v8/upgrades.go index ea7b777a21..b1bbd44bc6 100644 --- a/app/upgrades/v8/upgrades.go +++ b/app/upgrades/v8/upgrades.go @@ -82,7 +82,7 @@ func CreateUpgradeHandler( autopilotParams := autopilottypes.DefaultParams() autopilotKeeper.SetParams(ctx, autopilotParams) - ctx.Logger().Info("Running module mogrations...") + ctx.Logger().Info("Running module migrations...") return mm.RunMigrations(ctx, configurator, vm) } } diff --git a/dockernet/scripts/airdrop.sh b/dockernet/scripts/airdrop.sh index b3b4c78ab3..cf45caa846 100644 --- a/dockernet/scripts/airdrop.sh +++ b/dockernet/scripts/airdrop.sh @@ -2,6 +2,12 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) source ${SCRIPT_DIR}/../config.sh +# CLEANUP if running tests twice, clear out and re-fund accounts +$STRIDE_MAIN_CMD keys delete distributor-test -y &> /dev/null || true +$GAIA_MAIN_CMD keys delete hosttest -y &> /dev/null || true +$STRIDE_MAIN_CMD keys delete airdrop-test -y &> /dev/null || true +$OSMO_MAIN_CMD keys delete host-address-test -y &> /dev/null || true + # First, start the network with `make start-docker` # Then, run this script with `bash dockernet/scripts/airdrop.sh` @@ -41,19 +47,149 @@ $STRIDE_MAIN_CMD query bank balances stride1nf6v2paty9m22l3ecm7dpakq2c92ueyununa # NOTE: You can claim here using the CLI, or from the frontend! # Claim 20% of the free tokens echo "Claiming fee amount..." -$STRIDE_MAIN_CMD tx claim claim-free-amount --from airdrop-test --gas 400000 +$STRIDE_MAIN_CMD tx claim claim-free-amount --from airdrop-test --gas 400000 -y sleep 5 echo "Balance after claim:" $STRIDE_MAIN_CMD query bank balances stride1nf6v2paty9m22l3ecm7dpakq2c92ueyununayr # Stake, to claim another 20% echo "Staking..." -$STRIDE_MAIN_CMD tx staking delegate stridevaloper1nnurja9zt97huqvsfuartetyjx63tc5zrj5x9f 100ustrd --from airdrop-test --gas 400000 +$STRIDE_MAIN_CMD tx staking delegate stridevaloper1nnurja9zt97huqvsfuartetyjx63tc5zrj5x9f 100ustrd --from airdrop-test --gas 400000 -y sleep 5 echo "Balance after stake:" $STRIDE_MAIN_CMD query bank balances stride1nf6v2paty9m22l3ecm7dpakq2c92ueyununayr # Liquid stake, to claim the final 60% of tokens echo "Liquid staking..." -$STRIDE_MAIN_CMD tx stakeibc liquid-stake 1000 uatom --from airdrop-test --gas 400000 +$STRIDE_MAIN_CMD tx stakeibc liquid-stake 1000 uatom --from airdrop-test --gas 400000 -y sleep 5 echo "Balance after liquid stake:" $STRIDE_MAIN_CMD query bank balances stride1nf6v2paty9m22l3ecm7dpakq2c92ueyununayr + + + +## Test airdrop flow for chains who have non-standard coin types (not type 118). +# For example Evmos is using coin type 60, while Stride uses 118. Therefore, we can't map Evmos <> Stride addresses, because the one-way mapping works like this +# seed phrase ----> Evmos address (e.g. evmos123z469cfejeusvk87ufrs5520wmdxmmlc7qzuw) +# ----> Stride address (e.g. stride19uvw0azm9u0k6vqe4e22cga6kteskdqq3ulj6q) +# and there is no function that can map between the two addresses. + +# evmos airdrop-test address: cosmos16lmf7t0jhaatan6vnxlgv47h2wf0k5lnhvye5h (rly2) +# to test, we don't need to use evmos, just an address from a different mnemonic (can come from a coin_type 118 chain) +# here we choose to use an osmosis address with a new menmonic since we don't have an Evmos binary set up + +echo "Testing airdrop for coin types != 118..." + +# Transfer uatom from gaia to stride, so that we can liquid stake later +$GAIA_MAIN_CMD tx bank send cosmos1uk4ze0x4nvh4fk0xm4jdud58eqn4yxhrgl2scj cosmos16lmf7t0jhaatan6vnxlgv47h2wf0k5lnhvye5h 1uatom --from ${GAIA_VAL_PREFIX}1 -y + +# setup: set an airdrop allocation for the mechanically converted stride address, converted using utils.ConvertAddressToStrideAddress() +# mechanically-converted stride address: stride18y9zdh00fr2t6uw20anr6e89svqmfddgxfsxkh +$STRIDE_MAIN_CMD tx claim set-airdrop-allocations stride stride16lmf7t0jhaatan6vnxlgv47h2wf0k5ln58y9qm 1 --from distributor-test -y +sleep 5 + +# 1. Overwrite incorrectly-derived stride address associated with an airdrop account with the proper Stride address (e.g. stride1abc...xyz) +# a. query the claims module to verify that the airdrop-eligible address is as expected +$STRIDE_MAIN_CMD q claim claim-record stride stride16lmf7t0jhaatan6vnxlgv47h2wf0k5ln58y9qm + +# b. ibc-transfer from Osmo to Stride to change the airdrop account to stride1qz677nj82mszxjuh4mzy52zv5md5qrgg60pxpc +# Memo: { +# "autopilot": { +# "stakeibc": { +# "stride_address": "stride1qz677nj82mszxjuh4mzy52zv5md5qrgg60pxpc", +# }, +# "claim": { +# } +# }, +# } +# Receiver: "xxx" +memo='{"autopilot": {"receiver": "stride1qz677nj82mszxjuh4mzy52zv5md5qrgg60pxpc","claim": { "stride_address": "stride1qz677nj82mszxjuh4mzy52zv5md5qrgg60pxpc", "airdrop_id": "stride" } }}' +$GAIA_MAIN_CMD tx ibc-transfer transfer transfer channel-0 "$memo" 1uatom --from rly2 -y + +# c. query the claims module +# - to verify nothing is eligible from the old address anymore stride18y9zdh00fr2t6uw20anr6e89svqmfddgxfsxkh +# - to get the updated airdrop-eligible address's eligible amount from stride1qz677nj82mszxjuh4mzy52zv5md5qrgg60pxpc +$STRIDE_MAIN_CMD q claim claim-record stride stride16lmf7t0jhaatan6vnxlgv47h2wf0k5ln58y9qm +$STRIDE_MAIN_CMD q claim claim-record stride stride1qz677nj82mszxjuh4mzy52zv5md5qrgg60pxpc + + # d. claim the airdrop from this address +# $STRIDE_MAIN_CMD tx claim claim-free-amount --from stride1qz677nj82mszxjuh4mzy52zv5md5qrgg60pxpc + + # e. verify the vesting account is created for stride1qz677nj82mszxjuh4mzy52zv5md5qrgg60pxpc +# $STRIDE_MAIN_CMD q auth account stride1qz677nj82mszxjuh4mzy52zv5md5qrgg60pxpc + + + +### Test airdrop reset and multiple claims flow + # The Stride airdrop occurs in batches. We need to test three batches. + + # SETUP + # 1. Create a new airdrop that rolls into its next batch in just 30 seconds + # - include the add'l param that makes each batch 30 seconds long (after the first batch) + # 2. Set the airdrop allocations + +# Create the airdrop, so that the airdrop account can claim tokens +# $STRIDE_MAIN_CMD tx claim create-airdrop stride2 $(date +%s) 30 ustrd --from distributor-test -y +# sleep 5 +# Set airdrop allocations +# $STRIDE_MAIN_CMD tx claim set-airdrop-allocations stride2 stride1kd3z076usuqytj9rdfqnqaj9sdyx9aq5j2lqs5 1 --from distributor-test -y +# sleep 5 + + # BATCH 1 + # 3. Claim the airdrop +# $STRIDE_MAIN_CMD tx claim claim-free-amount --from stride1kd3z076usuqytj9rdfqnqaj9sdyx9aq5j2lqs5 + + # 4. Check that the claim worked +# $STRIDE_MAIN_CMD q bank balances stride1kd3z076usuqytj9rdfqnqaj9sdyx9aq5j2lqs5 + + # 5. Query to check airdrop vesting account was created (w/ correct amount) +# $STRIDE_MAIN_CMD q auth account stride1kd3z076usuqytj9rdfqnqaj9sdyx9aq5j2lqs5 + + + # BATCH 2 + # 6. Wait 30 seconds +# sleep 30 + # 7. Claim the airdrop +# $STRIDE_MAIN_CMD tx claim claim-free-amount --from stride1kd3z076usuqytj9rdfqnqaj9sdyx9aq5j2lqs5 + + # 8. Check that the claim worked +# $STRIDE_MAIN_CMD q bank balances stride1kd3z076usuqytj9rdfqnqaj9sdyx9aq5j2lqs5 + + # 9. Query to check airdrop vesting account was created (w/ correct amount) +# $STRIDE_MAIN_CMD q auth account stride1kd3z076usuqytj9rdfqnqaj9sdyx9aq5j2lqs5 + + # BATCH 3 + # 10. Wait 30 seconds +# sleep 30 + # 11. Claim the airdrop +# $STRIDE_MAIN_CMD tx claim claim-free-amount --from stride1kd3z076usuqytj9rdfqnqaj9sdyx9aq5j2lqs5 + + # 12. Check that the claim worked +# $STRIDE_MAIN_CMD q bank balances stride1kd3z076usuqytj9rdfqnqaj9sdyx9aq5j2lqs5 + + # 13. Query to check airdrop vesting account was created (w/ correct amount) +# $STRIDE_MAIN_CMD q auth account stride1kd3z076usuqytj9rdfqnqaj9sdyx9aq5j2lqs5 + + + +### Test staggered airdrops + +# create airdrop 1 with a 60 day start window, 60 sec reset, claim, sleep 35 +# $STRIDE_MAIN_CMD tx claim create-airdrop airdrop1 $(date +%s) 60 ustrd --from distributor-test -y +# sleep 5 +# $STRIDE_MAIN_CMD tx claim set-airdrop-allocations airdrop1 stride1kd3z076usuqytj9rdfqnqaj9sdyx9aq5j2lqs5 1 --from distributor-test -y +# sleep 5 +# $STRIDE_MAIN_CMD tx claim claim-free-amount --from stride1kd3z076usuqytj9rdfqnqaj9sdyx9aq5j2lqs5 +# sleep 35 + +# # create airdrop 2 with a 60 day start window, 60 sec reset, claim, sleep 35 +# $STRIDE_MAIN_CMD tx claim create-airdrop airdrop1 $(date +%s) 60 stuatom --from distributor-test -y +# sleep 5 +# $STRIDE_MAIN_CMD tx claim set-airdrop-allocations airdrop1 stride1kd3z076usuqytj9rdfqnqaj9sdyx9aq5j2lqs5 1 --from distributor-test -y +# sleep 5 +# $STRIDE_MAIN_CMD tx claim claim-free-amount --from stride1kd3z076usuqytj9rdfqnqaj9sdyx9aq5j2lqs5 +# sleep 35 + +# # airdrop 1 resets +# $STRIDE_MAIN_CMD q bank balances stride1kd3z076usuqytj9rdfqnqaj9sdyx9aq5j2lqs5 +# $STRIDE_MAIN_CMD tx claim claim-free-amount --from stride1kd3z076usuqytj9rdfqnqaj9sdyx9aq5j2lqs5 +# $STRIDE_MAIN_CMD q bank balances stride1kd3z076usuqytj9rdfqnqaj9sdyx9aq5j2lqs5 + diff --git a/dockernet/scripts/airdrop/airdrop1.sh b/dockernet/scripts/airdrop/airdrop1.sh new file mode 100644 index 0000000000..01ca898088 --- /dev/null +++ b/dockernet/scripts/airdrop/airdrop1.sh @@ -0,0 +1,64 @@ +### AIRDROP TESTING FLOW +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +source ${SCRIPT_DIR}/../../config.sh + +# CLEANUP if running tests twice, clear out and re-fund accounts +$STRIDE_MAIN_CMD keys delete airdrop-test -y &> /dev/null || true +$STRIDE_MAIN_CMD keys delete distributor-test -y &> /dev/null || true +$OSMO_MAIN_CMD keys delete host-address-test -y &> /dev/null || true + +# First, start the network with `make start-docker` +# Then, run this script with `bash dockernet/scripts/airdrop.sh` + +# NOTE: First, store the keys using the following mnemonics +# distributor address: stride1z835j3j65nqr6ng257q0xkkc9gta72gf48txwl +# distributor mnemonic: barrel salmon half click confirm crunch sense defy salute process cart fiscal sport clump weasel render private manage picture spell wreck hill frozen before +echo "barrel salmon half click confirm crunch sense defy salute process cart fiscal sport clump weasel render private manage picture spell wreck hill frozen before" | \ + $STRIDE_MAIN_CMD keys add distributor-test --recover + +# airdrop-test address: stride1nf6v2paty9m22l3ecm7dpakq2c92ueyununayr +# airdrop claimer mnemonic: royal auction state december october hip monster hotel south help bulk supreme history give deliver pigeon license gold carpet rabbit raw wool fatigue donate +echo "royal auction state december october hip monster hotel south help bulk supreme history give deliver pigeon license gold carpet rabbit raw wool fatigue donate" | \ + $STRIDE_MAIN_CMD keys add airdrop-test --recover + +## AIRDROP SETUP +echo "Funding accounts..." +# Transfer uatom from gaia to stride, so that we can liquid stake later +$GAIA_MAIN_CMD tx ibc-transfer transfer transfer channel-0 stride1nf6v2paty9m22l3ecm7dpakq2c92ueyununayr 1000000uatom --from ${GAIA_VAL_PREFIX}1 -y | TRIM_TX +sleep 5 +# Fund the distributor account +$STRIDE_MAIN_CMD tx bank send val1 stride1z835j3j65nqr6ng257q0xkkc9gta72gf48txwl 600000ustrd --from val1 -y | TRIM_TX +sleep 5 +# Fund the airdrop account +$STRIDE_MAIN_CMD tx bank send val1 stride1nf6v2paty9m22l3ecm7dpakq2c92ueyununayr 1000000000ustrd --from val1 -y | TRIM_TX +sleep 5 +# Create the airdrop, so that the airdrop account can claim tokens +$STRIDE_MAIN_CMD tx claim create-airdrop stride 1679715340 40000000 ustrd --from distributor-test -y | TRIM_TX +sleep 5 +# Set airdrop allocations +$STRIDE_MAIN_CMD tx claim set-airdrop-allocations stride stride1nf6v2paty9m22l3ecm7dpakq2c92ueyununayr 1 --from distributor-test -y | TRIM_TX +sleep 5 + +# AIRDROP CLAIMS +# Check balances before claims +echo "Initial balance before claim:" +$STRIDE_MAIN_CMD query bank balances stride1nf6v2paty9m22l3ecm7dpakq2c92ueyununayr +# NOTE: You can claim here using the CLI, or from the frontend! +# Claim 20% of the free tokens +echo "Claiming fee amount..." +$STRIDE_MAIN_CMD tx claim claim-free-amount --from airdrop-test --gas 400000 -y | TRIM_TX +sleep 5 +echo "Balance after claim:" +$STRIDE_MAIN_CMD query bank balances stride1nf6v2paty9m22l3ecm7dpakq2c92ueyununayr +# Stake, to claim another 20% +echo "Staking..." +$STRIDE_MAIN_CMD tx staking delegate stridevaloper1nnurja9zt97huqvsfuartetyjx63tc5zrj5x9f 100ustrd --from airdrop-test --gas 400000 -y | TRIM_TX +sleep 5 +echo "Balance after stake:" +$STRIDE_MAIN_CMD query bank balances stride1nf6v2paty9m22l3ecm7dpakq2c92ueyununayr +# Liquid stake, to claim the final 60% of tokens +echo "Liquid staking..." +$STRIDE_MAIN_CMD tx stakeibc liquid-stake 1000 uatom --from airdrop-test --gas 400000 -y | TRIM_TX +sleep 5 +echo "Balance after liquid stake:" +$STRIDE_MAIN_CMD query bank balances stride1nf6v2paty9m22l3ecm7dpakq2c92ueyununayr diff --git a/dockernet/scripts/airdrop/airdrop2.sh b/dockernet/scripts/airdrop/airdrop2.sh new file mode 100644 index 0000000000..44d97a4f70 --- /dev/null +++ b/dockernet/scripts/airdrop/airdrop2.sh @@ -0,0 +1,92 @@ +### AIRDROP TESTING FLOW +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +source ${SCRIPT_DIR}/../../config.sh + +# CLEANUP if running tests twice, clear out and re-fund accounts +$STRIDE_MAIN_CMD keys delete distributor-test -y &> /dev/null || true +$GAIA_MAIN_CMD keys delete hosttest -y &> /dev/null || true +$STRIDE_MAIN_CMD keys delete airdrop-test -y &> /dev/null || true +$OSMO_MAIN_CMD keys delete host-address-test -y &> /dev/null || true + +# First, start the network with `make start-docker` +# Then, run this script with `bash dockernet/scripts/airdrop.sh` + +# NOTE: First, store the keys using the following mnemonics +# distributor address: stride1z835j3j65nqr6ng257q0xkkc9gta72gf48txwl +# distributor mnemonic: barrel salmon half click confirm crunch sense defy salute process cart fiscal sport clump weasel render private manage picture spell wreck hill frozen before +echo "barrel salmon half click confirm crunch sense defy salute process cart fiscal sport clump weasel render private manage picture spell wreck hill frozen before" | \ + $STRIDE_MAIN_CMD keys add distributor-test --recover + +## AIRDROP SETUP +echo "Funding accounts..." +# Transfer uatom from gaia to stride, so that we can liquid stake later +$GAIA_MAIN_CMD tx ibc-transfer transfer transfer channel-0 stride1nf6v2paty9m22l3ecm7dpakq2c92ueyununayr 1000000uatom --from ${GAIA_VAL_PREFIX}1 -y | TRIM_TX +sleep 5 +# Fund the distributor account +$STRIDE_MAIN_CMD tx bank send val1 stride1z835j3j65nqr6ng257q0xkkc9gta72gf48txwl 600000ustrd --from val1 -y | TRIM_TX +sleep 5 +# Create the airdrop, so that the airdrop account can claim tokens +$STRIDE_MAIN_CMD tx claim create-airdrop stride 1666792900 40000000 ustrd --from distributor-test -y | TRIM_TX +sleep 5 + +## Test airdrop flow for chains who have non-standard coin types (not type 118). +# For example Evmos is using coin type 60, while Stride uses 118. Therefore, we can't map Evmos <> Stride addresses, because the one-way mapping works like this +# seed phrase ----> Evmos address (e.g. evmos123z469cfejeusvk87ufrs5520wmdxmmlc7qzuw) +# ----> Stride address (e.g. stride19uvw0azm9u0k6vqe4e22cga6kteskdqq3ulj6q) +# and there is no function that can map between the two addresses. + +# evmos airdrop-test address: cosmos16lmf7t0jhaatan6vnxlgv47h2wf0k5lnhvye5h (rly2) +# to test, we don't need to use evmos, just an address from a different mnemonic (can come from a coin_type 118 chain) +# here we choose to use an osmosis address with a new menmonic since we don't have an Evmos binary set up + +echo ">>>Testing airdrop for coin types != 118..." +echo ">>>Testing for ibc-go version 3" +# Transfer uatom from gaia to stride, so that we can liquid stake later +$GAIA_MAIN_CMD tx bank send cosmos1uk4ze0x4nvh4fk0xm4jdud58eqn4yxhrgl2scj cosmos16lmf7t0jhaatan6vnxlgv47h2wf0k5lnhvye5h 1uatom --from ${GAIA_VAL_PREFIX}1 -y | TRIM_TX + +# setup: set an airdrop allocation for the mechanically converted stride address, converted using utils.ConvertAddressToStrideAddress() +# mechanically-converted stride address: stride16lmf7t0jhaatan6vnxlgv47h2wf0k5ln58y9qm +$STRIDE_MAIN_CMD tx claim set-airdrop-allocations stride stride16lmf7t0jhaatan6vnxlgv47h2wf0k5ln58y9qm 1 --from distributor-test -y | TRIM_TX +sleep 5 + +# 1. Overwrite incorrectly-derived stride address associated with an airdrop account with the proper Stride address (e.g. stride1abc...xyz) +# a. query the claims module to verify that the airdrop-eligible address is as expected +$STRIDE_MAIN_CMD q claim claim-record stride stride16lmf7t0jhaatan6vnxlgv47h2wf0k5ln58y9qm + +# b. ibc-transfer from Osmo to Stride to change the airdrop account to stride1jrmtt5c6z8h5yrrwml488qnm7p3vxrrml2kgvl +# Memo: { +# "autopilot": { +# "stakeibc": { +# "stride_address": "stride1jrmtt5c6z8h5yrrwml488qnm7p3vxrrml2kgvl", +# }, +# "claim": { +# } +# }, +# } +# Receiver: "xxx" +memo='{"autopilot": {"receiver": "stride1jrmtt5c6z8h5yrrwml488qnm7p3vxrrml2kgvl","claim": { "stride_address": "stride1jrmtt5c6z8h5yrrwml488qnm7p3vxrrml2kgvl", "airdrop_id": "stride" } }}' +$GAIA_MAIN_CMD tx ibc-transfer transfer transfer channel-0 "$memo" 1uatom --from rly2 -y | TRIM_TX +echo ">>> Waiting for 15 seconds to allow the IBC transfer to complete..." +sleep 15 +# c. query the claims module +# - to verify nothing is eligible from the old address anymore stride16lmf7t0jhaatan6vnxlgv47h2wf0k5ln58y9qm +# - to get the updated airdrop-eligible address's eligible amount from stride1jrmtt5c6z8h5yrrwml488qnm7p3vxrrml2kgvl +echo ">>> Querying the claims module to verify that the airdrop-eligible address is as expected" +echo "> previously eligible account, now should have 0:" +$STRIDE_MAIN_CMD q claim claim-record stride stride16lmf7t0jhaatan6vnxlgv47h2wf0k5ln58y9qm +echo "> new eligible account, now should have 1:" +$STRIDE_MAIN_CMD q claim claim-record stride stride1jrmtt5c6z8h5yrrwml488qnm7p3vxrrml2kgvl + + # liquid stake as a task to increase eligibility, re-check eligibliity +$STRIDE_MAIN_CMD tx stakeibc liquid-stake 1 $ATOM_DENOM --from rly3 -y | TRIM_TX +sleep 5 +echo "> after liquid staking eligiblity should be higher" +$STRIDE_MAIN_CMD q claim claim-record stride stride1jrmtt5c6z8h5yrrwml488qnm7p3vxrrml2kgvl + + # d. claim the airdrop from this address +echo "> Claiming the airdrop from the new address" +$STRIDE_MAIN_CMD tx claim claim-free-amount --from rly3 -y | TRIM_TX +sleep 5 + # e. verify funds are vesting +echo "> Verifying funds are vesting, should be 1." +$STRIDE_MAIN_CMD q claim user-vestings stride1jrmtt5c6z8h5yrrwml488qnm7p3vxrrml2kgvl diff --git a/dockernet/scripts/airdrop/airdrop3.sh b/dockernet/scripts/airdrop/airdrop3.sh new file mode 100644 index 0000000000..15d12bf953 --- /dev/null +++ b/dockernet/scripts/airdrop/airdrop3.sh @@ -0,0 +1,113 @@ +### AIRDROP TESTING FLOW +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +source ${SCRIPT_DIR}/../../config.sh + +# CLEANUP if running tests twice, clear out and re-fund accounts +$STRIDE_MAIN_CMD keys delete distributor-test3 -y &> /dev/null || true +$GAIA_MAIN_CMD keys delete hosttest -y &> /dev/null || true +$STRIDE_MAIN_CMD keys delete airdrop-test -y &> /dev/null || true +$OSMO_MAIN_CMD keys delete host-address-test -y &> /dev/null || true + +# First, start the network with `make start-docker` +# Then, run this script with `bash dockernet/scripts/airdrop.sh` + +# NOTE: First, store the keys using the following mnemonics +# distributor address: stride12lw3587g97lgrwr2fjtr8gg5q6sku33e5yq9wl +# distributor mnemonic: barrel salmon half click confirm crunch sense defy salute process cart fiscal sport clump weasel render private manage picture spell wreck hill frozen before +echo "person pelican purchase boring theme eagle jaguar screen frame attract mad link ribbon ball poverty valley cross cradle real idea payment ramp nature anchor" | \ + $STRIDE_MAIN_CMD keys add distributor-test3 --recover + +# airdrop-test address: stride1nf6v2paty9m22l3ecm7dpakq2c92ueyununayr +# airdrop claimer mnemonic: royal auction state december october hip monster hotel south help bulk supreme history give deliver pigeon license gold carpet rabbit raw wool fatigue donate +echo "royal auction state december october hip monster hotel south help bulk supreme history give deliver pigeon license gold carpet rabbit raw wool fatigue donate" | \ + $STRIDE_MAIN_CMD keys add airdrop-test --recover + +## AIRDROP SETUP +echo "Funding accounts..." +# Transfer uatom from gaia to stride, so that we can liquid stake later +$GAIA_MAIN_CMD tx ibc-transfer transfer transfer channel-0 stride1nf6v2paty9m22l3ecm7dpakq2c92ueyununayr 1000000uatom --from ${GAIA_VAL_PREFIX}1 -y | TRIM_TX +sleep 5 +# Fund the distributor account +$STRIDE_MAIN_CMD tx bank send val1 stride12lw3587g97lgrwr2fjtr8gg5q6sku33e5yq9wl 600000ustrd --from val1 -y | TRIM_TX +sleep 5 +# Fund the airdrop account +$STRIDE_MAIN_CMD tx bank send val1 stride1nf6v2paty9m22l3ecm7dpakq2c92ueyununayr 1000000000ustrd --from val1 -y | TRIM_TX +sleep 5 + +### Test airdrop reset and multiple claims flow + # The Stride airdrop occurs in batches. We need to test three batches. + + # SETUP + # 1. Create a new airdrop that rolls into its next batch in just 30 seconds + # - include the add'l param that makes each batch 30 seconds long (after the first batch) + # 2. Set the airdrop allocations + +# Create the airdrop, so that the airdrop account can claim tokens +echo ">>> Testing multiple airdrop reset and claims flow..." +$STRIDE_MAIN_CMD tx claim create-airdrop stride2 $(date +%s) 30 ustrd --from distributor-test3 -y | TRIM_TX +sleep 5 +# # Set airdrop allocations +$STRIDE_MAIN_CMD tx claim set-airdrop-allocations stride2 stride1kwll0uet4mkj867s4q8dgskp03txgjnswc2u4z 1 --from distributor-test3 -y | TRIM_TX +sleep 5 + +# # BATCH 1 +# # 3. Check eligibility and claim the airdrop +echo "> Checking claim record elibility" +$STRIDE_MAIN_CMD q claim claim-record stride stride1kwll0uet4mkj867s4q8dgskp03txgjnswc2u4z +echo "> Claiming airdrop" +$STRIDE_MAIN_CMD tx claim claim-free-amount --from stride1kwll0uet4mkj867s4q8dgskp03txgjnswc2u4z -y | TRIM_TX +sleep 5 + +# # 5. Query to check airdrop vesting account was created (w/ correct amount) +echo "Verifying funds are vesting, should be 1." +$STRIDE_MAIN_CMD q claim user-vestings stride1jrmtt5c6z8h5yrrwml488qnm7p3vxrrml2kgvl + + + # BATCH 2 + # 6. Wait 30 seconds +echo "> Waiting 30 seconds for next batch..." +sleep 30 + # 7. Claim the airdrop +$STRIDE_MAIN_CMD tx claim claim-free-amount --from stride1kwll0uet4mkj867s4q8dgskp03txgjnswc2u4z -y | TRIM_TX + +# # 8. Query to check airdrop vesting account was created (w/ correct amount) +echo "> Verifying more funds are vesting, should be 2." +$STRIDE_MAIN_CMD q claim user-vestings stride1jrmtt5c6z8h5yrrwml488qnm7p3vxrrml2kgvl + +# # BATCH 3 +# # 10. Wait 30 seconds +echo "> Waiting 30 seconds for next batch..." +sleep 30 +# # 11. Claim the airdrop +$STRIDE_MAIN_CMD tx claim claim-free-amount --from stride1kwll0uet4mkj867s4q8dgskp03txgjnswc2u4z -y | TRIM_TX + +# # 12. Query to check airdrop vesting account was created (w/ correct amount) +echo "> Verifying more funds are vesting, should be 3." +$STRIDE_MAIN_CMD q claim user-vestings stride1jrmtt5c6z8h5yrrwml488qnm7p3vxrrml2kgvl + + + + +# ### Test staggered airdrops + +# # create airdrop 1 with a 60 day start window, 60 sec reset, claim, sleep 35 +# # $STRIDE_MAIN_CMD tx claim create-airdrop airdrop1 $(date +%s) 60 ustrd --from distributor-test3 -y +# # sleep 5 +# # $STRIDE_MAIN_CMD tx claim set-airdrop-allocations airdrop1 stride1kwll0uet4mkj867s4q8dgskp03txgjnswc2u4z 1 --from distributor-test3 -y +# # sleep 5 +# # $STRIDE_MAIN_CMD tx claim claim-free-amount --from stride1kwll0uet4mkj867s4q8dgskp03txgjnswc2u4z +# # sleep 35 + +# # # create airdrop 2 with a 60 day start window, 60 sec reset, claim, sleep 35 +# # $STRIDE_MAIN_CMD tx claim create-airdrop airdrop1 $(date +%s) 60 stuatom --from distributor-test3 -y +# # sleep 5 +# # $STRIDE_MAIN_CMD tx claim set-airdrop-allocations airdrop1 stride1kwll0uet4mkj867s4q8dgskp03txgjnswc2u4z 1 --from distributor-test3 -y +# # sleep 5 +# # $STRIDE_MAIN_CMD tx claim claim-free-amount --from stride1kwll0uet4mkj867s4q8dgskp03txgjnswc2u4z +# # sleep 35 + +# # # airdrop 1 resets +# # $STRIDE_MAIN_CMD q bank balances stride1kwll0uet4mkj867s4q8dgskp03txgjnswc2u4z +# # $STRIDE_MAIN_CMD tx claim claim-free-amount --from stride1kwll0uet4mkj867s4q8dgskp03txgjnswc2u4z +# # $STRIDE_MAIN_CMD q bank balances stride1kwll0uet4mkj867s4q8dgskp03txgjnswc2u4z + diff --git a/dockernet/scripts/airdrop/airdrop4.sh b/dockernet/scripts/airdrop/airdrop4.sh new file mode 100644 index 0000000000..e15484cbca --- /dev/null +++ b/dockernet/scripts/airdrop/airdrop4.sh @@ -0,0 +1,64 @@ +### AIRDROP TESTING FLOW +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +source ${SCRIPT_DIR}/../../config.sh + +# CLEANUP if running tests twice, clear out and re-fund accounts +$STRIDE_MAIN_CMD keys delete distributor-test3 -y &> /dev/null || true +$STRIDE_MAIN_CMD keys delete distributor-test4 -y &> /dev/null || true +$GAIA_MAIN_CMD keys delete hosttest -y &> /dev/null || true +$STRIDE_MAIN_CMD keys delete airdrop-test -y &> /dev/null || true +$OSMO_MAIN_CMD keys delete host-address-test -y &> /dev/null || true + +# First, start the network with `make start-docker` +# Then, run this script with `bash dockernet/scripts/airdrop.sh` + +echo "person pelican purchase boring theme eagle jaguar screen frame attract mad link ribbon ball poverty valley cross cradle real idea payment ramp nature anchor" | \ + $STRIDE_MAIN_CMD keys add distributor-test3 --recover + +# stride1wl22etyhepwmsmycnvt3ragjyv2r5ctrk4emv3 +echo "skill essence buddy slot trim rich acid end ability sketch evoke volcano fantasy visit maze mouse sword squirrel weasel mandate main author zebra lunar" | \ + $STRIDE_MAIN_CMD keys add distributor-test4 --recover + +## AIRDROP SETUP +echo "Funding accounts..." +# Transfer uatom from gaia to stride, so that we can liquid stake later +$GAIA_MAIN_CMD tx ibc-transfer transfer transfer channel-0 stride1wl22etyhepwmsmycnvt3ragjyv2r5ctrk4emv3 1000000uatom --from ${GAIA_VAL_PREFIX}1 -y | TRIM_TX +sleep 5 +# Fund the distributor3 account +$STRIDE_MAIN_CMD tx bank send val1 stride12lw3587g97lgrwr2fjtr8gg5q6sku33e5yq9wl 600000ustrd --from val1 -y | TRIM_TX +sleep 5 +# Fund the distributor4 account +$STRIDE_MAIN_CMD tx bank send val1 stride1wl22etyhepwmsmycnvt3ragjyv2r5ctrk4emv3 600000$ATOM_DENOM --from val1 -y | TRIM_TX +sleep 5 + + +# ### Test staggered airdrops +# airdrop1 is ustrd; airdrop2 is ibc/ATOM. this simplifies telling them apart after testing a reset of airdrop1 before airdrop 2 has a chance to reset. + +# create airdrop 1 with a 60 day start window, 60 sec reset, claim, sleep 35 +$STRIDE_MAIN_CMD tx claim create-airdrop airdrop1 $(date +%s) 60 ustrd --from distributor-test3 -y | TRIM_TX +sleep 5 +$STRIDE_MAIN_CMD tx claim set-airdrop-allocations airdrop1 stride1kwll0uet4mkj867s4q8dgskp03txgjnswc2u4z 1 --from distributor-test3 -y | TRIM_TX +sleep 5 +$STRIDE_MAIN_CMD tx claim claim-free-amount --from stride1kwll0uet4mkj867s4q8dgskp03txgjnswc2u4z -y | TRIM_TX +echo "...Sleeping 35 more sec to wait for reset to complete..." +sleep 35 + +# create airdrop 2 with a 60 day start window, 60 sec reset, claim, sleep 35 +$STRIDE_MAIN_CMD tx claim create-airdrop airdrop1 $(date +%s) 60 $ATOM_DENOM --from distributor-test4 -y | TRIM_TX +sleep 5 +$STRIDE_MAIN_CMD tx claim set-airdrop-allocations airdrop1 stride1kwll0uet4mkj867s4q8dgskp03txgjnswc2u4z 1 --from distributor-test4 -y | TRIM_TX +sleep 5 +$STRIDE_MAIN_CMD tx claim claim-free-amount --from stride1kwll0uet4mkj867s4q8dgskp03txgjnswc2u4z -y | TRIM_TX +echo "...Sleeping 35 more sec to wait for reset to complete..." +sleep 35 + +# airdrop 1 resets +echo "> Query how many funds are vesting before the reset + re-claim" +$STRIDE_MAIN_CMD q claim user-vestings stride1jrmtt5c6z8h5yrrwml488qnm7p3vxrrml2kgvl +echo "> Claiming more funds after reset" +$STRIDE_MAIN_CMD tx claim claim-free-amount --from stride1kwll0uet4mkj867s4q8dgskp03txgjnswc2u4z -y | TRIM_TX +sleep 5 +echo "> Verify more funds are vesting before the reset" +$STRIDE_MAIN_CMD q claim user-vestings stride1jrmtt5c6z8h5yrrwml488qnm7p3vxrrml2kgvl +