-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: sampocs <sam.pochyly@gmail.com> Co-authored-by: ethan <ethan@stridelabs.co> Co-authored-by: ethan-stride <126913021+ethan-stride@users.noreply.github.com> Co-authored-by: riley-stride <104941670+riley-stride@users.noreply.github.com> Co-authored-by: shellvish <104537253+shellvish@users.noreply.github.com> Co-authored-by: Riley Edmunds <riley@stridelabs.co> Co-authored-by: vish-stride <vishal@stridelabs.co>
- Loading branch information
1 parent
8d00ae6
commit a2289f8
Showing
80 changed files
with
24,018 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
## Staketia Integration Tests | ||
* Use the default host chain settings, but shorten the day and stride epochs in `config.sh` | ||
``` | ||
STRIDE_DAY_EPOCH_DURATION="40s" | ||
STRIDE_EPOCH_EPOCH_DURATION="10s" | ||
``` | ||
* Start dockernet | ||
```bash | ||
make start-docker | ||
``` | ||
* As you go through the below flow, watch the `balances.log` and `state.log` files | ||
* Run the setup script to transfer native tokens to Stride and set the withdrawal address | ||
```bash | ||
bash dockernet/scripts/staketia/setup.sh | ||
``` | ||
* Run the liquid stake script. Watch the stToken appear in the validator account and a delegation record be created during the next epoch. | ||
```bash | ||
bash dockernet/scripts/staketia/liquid_stake.sh | ||
``` | ||
* Delegate on the host zone and confirm on stride. Watch the delegated balance increase and the delegation record be removed. | ||
```bash | ||
bash dockernet/scripts/staketia/delegate.sh | ||
``` | ||
* Redeem the stTokens. Watch the stTokens move into the redemption account and the accumulation unbonding record be incremented. A redemption record should also be created. | ||
```bash | ||
bash dockernet/scripts/staketia/redeem_stake.sh | ||
``` | ||
* Wait for the next 4 day epoch and see the unbonding record change to status `UNBONDING_QUEUE`. This may take a few minutes. | ||
* Unbond from the host zone and submit the confirm tx back to stride | ||
```bash | ||
bash dockernet/scripts/staketia/undelegate.sh | ||
``` | ||
* Wait for the unbonding record's status to change to `UNBONDED`, after the tokens have finished unbonding. This will take a couple minutes. | ||
* Sweep the tokens back to stride and confirm the tx. During the next epoch, the native tokens should be returned the redeemer and the redemption record should be removed. | ||
```bash | ||
bash dockernet/scripts/staketia/sweep.sh | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
set -eu | ||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
source ${SCRIPT_DIR}/../../config.sh | ||
|
||
HOST_CHAIN="${HOST_CHAINS[0]}" | ||
HOST_MAIN_CMD=$(GET_VAR_VALUE ${HOST_CHAIN}_MAIN_CMD) | ||
HOST_DENOM=$(GET_VAR_VALUE ${HOST_CHAIN}_DENOM) | ||
|
||
echo ">>> Querying action from records..." | ||
$STRIDE_MAIN_CMD q staketia delegation-records | ||
delegation_amount=$($STRIDE_MAIN_CMD q staketia delegation-records | grep -B 2 "DELEGATION_QUEUE" | grep "native_amount" | NUMBERS_ONLY) | ||
record_id=$($STRIDE_MAIN_CMD q staketia delegation-records | grep -B 3 "DELEGATION_QUEUE" | grep "id" | NUMBERS_ONLY) | ||
sleep 1 | ||
|
||
echo -e "\n>>> Delegating ${delegation_amount}${HOST_DENOM} for record $record_id..." | ||
validator_address=$(GET_VAL_ADDR $HOST_CHAIN 1) | ||
output=$($HOST_MAIN_CMD tx staking delegate $validator_address ${delegation_amount}${HOST_DENOM} \ | ||
--from delegation -y | TRIM_TX) | ||
echo $output | ||
sleep 1 | ||
|
||
echo -e "\n>>> Submitting confirm-delegation tx for record $record_id on Stride..." | ||
tx_hash=$(echo $output | awk '{print $4}') | ||
$STRIDE_MAIN_CMD tx staketia confirm-delegation $record_id $tx_hash --from operator -y | TRIM_TX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#/bin/bash | ||
set -eu | ||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
source ${SCRIPT_DIR}/../../config.sh | ||
|
||
echo ">>> Liquid staking..." | ||
$STRIDE_MAIN_CMD tx staketia liquid-stake 1000000 --from ${STRIDE_VAL_PREFIX}1 -y | TRIM_TX | ||
sleep 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#/bin/bash | ||
set -eu | ||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
source ${SCRIPT_DIR}/../../config.sh | ||
|
||
echo ">>> Redeeming stake..." | ||
$STRIDE_MAIN_CMD tx staketia redeem-stake 1000000 --from ${STRIDE_VAL_PREFIX}1 -y | TRIM_TX | ||
sleep 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
set -eu | ||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
source ${SCRIPT_DIR}/../../config.sh | ||
|
||
HOST_CHAIN="${HOST_CHAINS[0]}" | ||
HOST_MAIN_CMD=$(GET_VAR_VALUE ${HOST_CHAIN}_MAIN_CMD) | ||
HOST_DENOM=$(GET_VAR_VALUE ${HOST_CHAIN}_DENOM) | ||
|
||
reward_address=$($HOST_MAIN_CMD keys show -a reward) | ||
deposit_address=$($STRIDE_MAIN_CMD keys show -a deposit) | ||
fee_address=$($STRIDE_MAIN_CMD q staketia host-zone | grep fee_address | awk '{print $2}') | ||
|
||
echo ">>> Claiming outstanding rewards records..." | ||
$HOST_MAIN_CMD tx distribution withdraw-all-rewards --from delegation -y | TRIM_TX | ||
sleep 5 | ||
|
||
echo -e "\n>>> Querying rewards balance..." | ||
output=$($HOST_MAIN_CMD q bank balances $reward_address --denom $HOST_DENOM) | ||
echo $output | ||
reward_amount=$(echo $output | NUMBERS_ONLY) | ||
sleep 1 | ||
|
||
reinvest_amount=$(echo "scale=0; $reward_amount * 90 / 100" | bc -l) | ||
fee_amount=$(echo "scale=0; $reward_amount * 10 / 100" | bc -l) | ||
|
||
echo -e "\n>>> Sweeping ${reinvest_amount}${HOST_DENOM} for reinvestment..." | ||
output=$($HOST_MAIN_CMD tx ibc-transfer transfer transfer channel-0 $deposit_address ${reinvest_amount}${HOST_DENOM} \ | ||
--from delegation -y | TRIM_TX) | ||
echo $output | ||
sleep 10 | ||
|
||
echo -e "\n>>> Sweeping ${fee_amount}${HOST_DENOM} for fee collection..." | ||
output=$($HOST_MAIN_CMD tx ibc-transfer transfer transfer channel-0 $fee_address ${fee_amount}${HOST_DENOM} \ | ||
--from delegation -y | TRIM_TX) | ||
echo $output | ||
sleep 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
set -eu | ||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
source ${SCRIPT_DIR}/../../config.sh | ||
|
||
HOST_CHAIN="${HOST_CHAINS[0]}" | ||
HOST_MAIN_CMD=$(GET_VAR_VALUE ${HOST_CHAIN}_MAIN_CMD) | ||
HOST_VAL_PREFIX=$(GET_VAR_VALUE ${HOST_CHAIN}_VAL_PREFIX) | ||
HOST_DENOM=$(GET_VAR_VALUE ${HOST_CHAIN}_DENOM) | ||
|
||
echo ">>> Transfering native tokens to stride..." | ||
$HOST_MAIN_CMD tx ibc-transfer transfer transfer channel-0 $(STRIDE_ADDRESS) 10000000${HOST_DENOM} \ | ||
--from ${HOST_VAL_PREFIX}1 -y | TRIM_TX | ||
sleep 10 | ||
|
||
echo ">>> Setting withdrawal address..." | ||
reward_address=$($HOST_MAIN_CMD keys show -a reward) | ||
$HOST_MAIN_CMD tx distribution set-withdraw-addr $reward_address --from delegation -y | TRIM_TX | ||
sleep 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
set -eu | ||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
source ${SCRIPT_DIR}/../../config.sh | ||
|
||
HOST_CHAIN="${HOST_CHAINS[0]}" | ||
HOST_MAIN_CMD=$(GET_VAR_VALUE ${HOST_CHAIN}_MAIN_CMD) | ||
HOST_DENOM=$(GET_VAR_VALUE ${HOST_CHAIN}_DENOM) | ||
|
||
echo ">>> Querying action from records..." | ||
$STRIDE_MAIN_CMD q staketia unbonding-records | ||
unbond_amount=$($STRIDE_MAIN_CMD q staketia unbonding-records | grep -B 2 "UNBONDED" | grep "native_amount" | NUMBERS_ONLY) | ||
record_id=$($STRIDE_MAIN_CMD q staketia unbonding-records | grep -B 4 "UNBONDED" | grep "id" | NUMBERS_ONLY) | ||
sleep 1 | ||
|
||
echo -e "\n>>> Sweeping ${unbond_amount}${HOST_DENOM} for record $record_id..." | ||
claim_address=$($STRIDE_MAIN_CMD keys show -a claim) | ||
output=$($HOST_MAIN_CMD tx ibc-transfer transfer transfer channel-0 $claim_address ${unbond_amount}${HOST_DENOM} \ | ||
--from delegation -y | TRIM_TX) | ||
echo $output | ||
sleep 10 | ||
|
||
echo -e "\n>>> Submitting confirm-sweep tx for record $record_id on Stride..." | ||
tx_hash=$(echo $output | awk '{print $4}') | ||
$STRIDE_MAIN_CMD tx staketia confirm-sweep $record_id $tx_hash --from operator -y | TRIM_TX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
set -eu | ||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
source ${SCRIPT_DIR}/../../config.sh | ||
|
||
HOST_CHAIN="${HOST_CHAINS[0]}" | ||
HOST_MAIN_CMD=$(GET_VAR_VALUE ${HOST_CHAIN}_MAIN_CMD) | ||
HOST_DENOM=$(GET_VAR_VALUE ${HOST_CHAIN}_DENOM) | ||
|
||
echo ">>> Querying action from records..." | ||
$STRIDE_MAIN_CMD q staketia unbonding-records | ||
unbond_amount=$($STRIDE_MAIN_CMD q staketia unbonding-records | grep -B 2 "UNBONDING_QUEUE" | grep "native_amount" | NUMBERS_ONLY) | ||
record_id=$($STRIDE_MAIN_CMD q staketia unbonding-records | grep -B 4 "UNBONDING_QUEUE" | grep "id" | NUMBERS_ONLY) | ||
sleep 1 | ||
|
||
echo -e "\n>>> Unbonding ${unbond_amount}${HOST_DENOM} for record $record_id..." | ||
validator_address=$(GET_VAL_ADDR $HOST_CHAIN 1) | ||
output=$($HOST_MAIN_CMD tx staking unbond $validator_address ${unbond_amount}${HOST_DENOM} \ | ||
--from delegation -y | TRIM_TX) | ||
echo $output | ||
sleep 1 | ||
|
||
echo -e "\n>>> Submitting confirm-undelegation tx for record $record_id on Stride..." | ||
tx_hash=$(echo $output | awk '{print $4}') | ||
$STRIDE_MAIN_CMD tx staketia confirm-undelegation $record_id $tx_hash --from operator -y | TRIM_TX |
Oops, something went wrong.