Skip to content

Commit

Permalink
Add puppeteer and lsm share provider selection
Browse files Browse the repository at this point in the history
  • Loading branch information
albertandrejev committed Oct 29, 2024
1 parent a1c1e70 commit 03bf37f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 20 deletions.
8 changes: 6 additions & 2 deletions scripts/deploy_scripts/.env.instantiate.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ TIMEOUT_LOCAL=1209600
# 14 days
TIMEOUT_REMOTE=1209600

PUPPETEER_TYPE="puppeteer"
LSM_SHARE_PROVIDER_ENABLED="true"

INITIAL_VALIDATORS='[{"valoper_address":"cosmosvaloper1...","weight":10},{"valoper_address":"cosmosvaloper1...","weight":10}]'

NEUTRON_SIDE_PORT_ID="transfer"
Expand All @@ -45,12 +48,13 @@ factory_code_id=
core_code_id=
token_code_id=
distribution_code_id=
staker_code_id=
validators_set_code_id=
puppeteer_code_id=
rewards_manager_code_id=
strategy_code_id=
withdrawal_manager_code_id=
withdrawal_voucher_code_id=
pump_code_id=
splitter_code_id=
splitter_code_id=
lsm_share_bond_provider_code_id=
native_bond_provider_code_id=
40 changes: 23 additions & 17 deletions scripts/deploy_scripts/instantiate.bash
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ KEYRING_BACKEND="${KEYRING_BACKEND:-test}"
DEPLOY_WALLET="${DEPLOY_WALLET:-demowallet1}"
MIN_NTRN_REQUIRED="${MIN_NTRN_REQUIRED:-10}"

PUPPETEER_TYPE="${PUPPETEER_TYPE:-puppeteer}"
LSM_SHARE_PROVIDER_ENABLED="${LSM_SHARE_PROVIDER_ENABLED:-true}"

TARGET_SDK_VERSION="${TARGET_SDK_VERSION:?Variable should be explicitly specified}"
TARGET_BASE_DENOM="${TARGET_BASE_DENOM:?Variable should be explicitly specified}"
NEUTRON_SIDE_TRANSFER_CHANNEL_ID="${NEUTRON_SIDE_TRANSFER_CHANNEL_ID:?Variable should be explicitly specified}"
Expand Down Expand Up @@ -84,25 +87,26 @@ main() {
factory_admin_execute "$factory_address" "$msg" 250000untrn
echo "[OK] Add Native bond provider to the Core contract"

update_msg='{
"add_bond_provider":{
"bond_provider_address": "'"$lsm_share_bond_provider_address"'"
}
}'

msg='{
"wasm":{
"execute":{
"contract_addr":"'"$core_address"'",
"msg":"'"$(echo -n "$update_msg" | jq -c '.' | base64 | tr -d "\n")"'",
"funds": []
if [ "$LSM_SHARE_PROVIDER_ENABLED" == "true" ]; then
update_msg='{
"add_bond_provider":{
"bond_provider_address": "'"$lsm_share_bond_provider_address"'"
}
}
}'

factory_admin_execute "$factory_address" "$msg" 250000untrn
echo "[OK] Add LSM share bond provider to the Core contract"
}'

msg='{
"wasm":{
"execute":{
"contract_addr":"'"$core_address"'",
"msg":"'"$(echo -n "$update_msg" | jq -c '.' | base64 | tr -d "\n")"'",
"funds": []
}
}
}'

factory_admin_execute "$factory_address" "$msg" 250000untrn
echo "[OK] Add LSM share bond provider to the Core contract"
fi

REWARDS_ADDRESS=${REWARDS_ADDRESS:-$rewards_pump_ica_address}
update_msg='{
Expand Down Expand Up @@ -167,6 +171,7 @@ main() {
echo "[chains.packet_filter]"
echo "list = ["
echo " ['$puppeteer_ica_port', '$puppeteer_ica_channel'],"
echo " ['$rewards_pump_ica_port', '$rewards_pump_ica_channel'],"
echo " ['$pump_ica_port', '$pump_ica_channel'],"
echo "]"
echo
Expand All @@ -175,6 +180,7 @@ main() {
echo "[chains.packet_filter]"
echo "list = ["
echo " ['icahost', '$puppeteer_counterparty_channel_id'],"
echo " ['icahost', '$rewards_pump_counterparty_channel_id'],"
echo " ['icahost', '$pump_counterparty_channel_id'],"
echo "]"

Expand Down
3 changes: 3 additions & 0 deletions scripts/deploy_scripts/upload_contracts.bash
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ DEPLOY_WALLET="${DEPLOY_WALLET:-demowallet1}"
MIN_NTRN_REQUIRED="${MIN_NTRN_REQUIRED:-10}"
ARTIFACTS_DIR="${ARTIFACTS_DIR:-../../artifacts}"

PUPPETEER_TYPE="${PUPPETEER_TYPE:-puppeteer}"

source ./utils.bash

echo "DEPLOY_WALLET: $DEPLOY_WALLET"
Expand All @@ -22,6 +24,7 @@ main() {

pre_deploy_check_balance
deploy_wasm_code
deploy_puppeteer_code

echo
echo "CONTRACTS UPLOAD SUCCEDED"
Expand Down
9 changes: 8 additions & 1 deletion scripts/deploy_scripts/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,20 @@ top_up_address() {
}

deploy_wasm_code() {
for contract in factory core distribution puppeteer rewards_manager strategy token validators_set withdrawal_manager withdrawal_voucher pump splitter lsm_share_bond_provider native_bond_provider; do
for contract in factory core distribution rewards_manager strategy token validators_set withdrawal_manager withdrawal_voucher pump splitter lsm_share_bond_provider native_bond_provider; do
store_code "$contract"
code_id="${contract}_code_id"
printf '[OK] %-24s code ID: %s\n' "$contract" "${!code_id}"
done
}

deploy_puppeteer_code() {
store_code "$PUPPETEER_TYPE"
code_id="${PUPPETEER_TYPE}_code_id"
puppeteer_code_id="${!code_id}"
printf '[OK] puppeteer code ID: %s\n' "${puppeteer_code_id}"
}

pre_deploy_check_balance() {
deploy_wallet="$(neutrond keys show "$DEPLOY_WALLET" \
--home "$NEUTRON_HOME" \
Expand Down

0 comments on commit 03bf37f

Please sign in to comment.