Last active
November 25, 2021 11:42
-
-
Save toml01/8ec0dcf9dfb2b33f465eca9bf4934eb4 to your computer and use it in GitHub Desktop.
SEFI liquidity mining initialization scripts - testnet
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
#!/bin/bash | |
set -e | |
function wait_for_tx() { | |
until (secretcli q tx "$1"); do | |
sleep 5 | |
done | |
} | |
export wasm_path=build | |
export deployer_name=test | |
export sefi_admin=holotest | |
export revision="2" | |
export viewing_key="123" | |
export sefi_token="secret12q2c5s5we5zn9pq43l0rlsygtql6646my0sqfm" | |
export sefi_hash="c7fe67b243dfedc625a28ada303434d6f5a46a3086e7d2b5063a814e9f9a379d" | |
secretcli tx compute store "${wasm_path}/weight_master.wasm" --from "$deployer_name" --gas 3000000 -b block -y | |
master_code_id=$(secretcli query compute list-code | jq -r '.[-1]."id"') | |
master_code_hash=$(secretcli q compute list-code | jq '.[] | select(.id == '"$master_code_id"') | .data_hash') | |
echo "Stored master: '$master_code_id', '$master_code_hash'" | |
echo "Deploying Master Contract.." | |
export TX_HASH=$( | |
secretcli tx compute instantiate $master_code_id '{"gov_token_addr":"'"$sefi_token"'","gov_token_hash":"'"$sefi_hash"'","minting_schedule":[{"end_block":10000000,"mint_per_block":"1000000000"}]}' --from $deployer_name --gas 1500000 --label master-$revision -b block -y | | |
jq -r .txhash | |
) | |
wait_for_tx "$TX_HASH" "Waiting for tx to finish on-chain..." | |
secretcli q compute tx $TX_HASH | |
master_addr=$(secretcli query compute list-contract-by-code $master_code_id | jq -r '.[-1].address') | |
echo "Setting Master as a SEFI minter" | |
export TX_HASH=$( | |
secretcli tx compute execute "$sefi_token" '{"add_minters":{"minters":["'"$master_addr"'"]}}' --from $sefi_admin --gas 1500000 -b block -y | | |
jq -r .txhash | |
) | |
wait_for_tx "$TX_HASH" "Waiting for tx to finish on-chain..." | |
secretcli q compute tx $TX_HASH | |
echo "Master address: '$master_addr'" |
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
#!/bin/bash | |
set -e | |
function wait_for_tx() { | |
until (secretcli q tx "$1"); do | |
sleep 5 | |
done | |
} | |
export wasm_path=build | |
export deployer_name=test | |
export revision="3" | |
export viewing_key="123" | |
export sefi_token="secret12q2c5s5we5zn9pq43l0rlsygtql6646my0sqfm" | |
export sefi_hash="c7fe67b243dfedc625a28ada303434d6f5a46a3086e7d2b5063a814e9f9a379d" | |
export master_addr="secret109ce73lrzzs64yu6lz3972yguc0wxt808zxz24" | |
export master_code_hash="8C91212DC510387A4305A988D5ABDE87E3902E354596514CF626A947F63081F7" | |
secretcli tx compute store "${wasm_path}/lp_staking.wasm" --from "$deployer_name" --gas 3000000 -b block -y | |
lp_staking_code_id=$(secretcli query compute list-code | jq -r '.[-1]."id"') | |
lp_staking_hash=$(secretcli q compute list-code | jq '.[] | select(.id == '"$lp_staking_code_id"') | .data_hash') | |
echo "Stored lp staking: '$lp_staking_code_id', '$lp_staking_hash'" | |
echo "Deploying Staking Contract.." | |
export TX_HASH=$( | |
secretcli tx compute instantiate $lp_staking_code_id '{"reward_token":{"address":"'"$sefi_token"'", "contract_hash":"'"$sefi_hash"'"},"inc_token":{"address":"'"$sefi_token"'", "contract_hash":"'"$sefi_hash"'"},"reward_sources":[{"address":"'"$master_addr"'", "contract_hash":"'"$master_code_hash"'"}],"viewing_key":"'"$viewing_key"'","token_info":{"name":"lpstaking-v2","symbol":"LPSTAKING-V2"},"prng_seed":"'"$prng_seed"'"}' --from $deployer_name --gas 1500000 --label lp-staking-$revision -b block -y | | |
jq -r .txhash | |
) | |
wait_for_tx "$TX_HASH" "Waiting for tx to finish on-chain..." | |
secretcli q compute tx $TX_HASH | |
lp_staking=$(secretcli query compute list-contract-by-code $lp_staking_code_id | jq -r '.[-1].address') | |
echo "Setting SEFI Staking weight.." | |
export TX_HASH=$( | |
secretcli tx compute execute "$master_addr" '{"set_weights":{"weights":[{"address":"'"$lp_staking"'","hash":'"$lp_staking_hash"',"weight":100}]}}' --from $deployer_name --gas 1500000 -b block -y | | |
jq -r .txhash | |
) | |
wait_for_tx "$TX_HASH" "Waiting for tx to finish on-chain..." | |
secretcli q compute tx $TX_HASH | |
echo "LP Staking address: '$lp_staking'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment