CosmWasm compatible version: 0.16
npm install
If you want to use precompiled wasm artifacts - jump to start localterra
- https://github.com/Nexus-Protocol/basset-vault-contracts (
v1.7.0
tag) - https://github.com/terraswap/terraswap (
3ae1c1252ffcfff0a5b6f67d8a87a1604edae3a3
commit) - https://github.com/astroport-fi/astroport-core (
v1.0.1
tag) - https://github.com/Nexus-Protocol/services-contracts (
v1.4.3
tag) - https://github.com/CosmWasm/cosmwasm-plus (
v0.9.0
tag)
In cosmwasm-plus
project directory create bash file:
# Optimized builds
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/workspace-optimizer:0.11.5
and execute it. It will create artifacts
directory with *.wasm
files.
Now change paths to artifacts here
git clone --depth 1 git@github.com:terra-money/LocalTerra.git
cd LocalTerra
git fetch --tags
,git checkout tags/v0.5.0
docker pull terramoney/localterra-core:bombay
- go to
config/config.toml
in localterra, comment out this entire section:
# # How long we wait for a proposal block before prevoting nil
# timeout_propose = "3s"
# # How much timeout_propose increases with each round
# timeout_propose_delta = "500ms"
# # How long we wait after receiving +2/3 prevotes for “anything” (ie. not a single block or nil)
# timeout_prevote = "1s"
# # How much the timeout_prevote increases with each round
# timeout_prevote_delta = "500ms"
# # How long we wait after receiving +2/3 precommits for “anything” (ie. not a single block or nil)
# timeout_precommit = "1s"
# # How much the timeout_precommit increases with each round
# timeout_precommit_delta = "500ms"
# # How long we wait after committing a block, before starting on the new
# # height (this gives us a chance to receive some more precommits, even
# # though we already have +2/3).
# timeout_commit = "5s"
and replace it with
timeout_precommit = "200ms"
timeout_propose = "200ms"
timeout_propose_delta = "200ms"
timeout_prevote = "200ms"
timeout_prevote_delta = "200ms"
timeout_precommit_delta = "200ms"
timeout_commit = "200ms"
docker-compose up
start localterra before run scripts.
npm run upload-basset-vault
- full upload cycle (governance, psi token, psi-ust swap pair, community pool, basset vault, nasset-psi swap pair)
npm run airdrop -- instantiate
- instantiate airdrop contractnpm run calc-airdrop -- merkle-root -G gov_stakers.txt -O airdrop_output -T 100000000 -C ./src/airdrop/default_psi_to_anc_ratio.json
- calculate merkle tree for airdrop and save csv & json files with<address>;<anc_tokens>;<psi_tokens>;<psi_to_anc_ratio>
datanpm run calc-airdrop -- users-proof --stage 1 -G gov_stakers.txt -O users_airdrop_data -T 100000000 -C ./src/airdrop/default_psi_to_anc_ratio.json
- saves json with users proof and claimable psi tokens amountnpm run airdrop -- register-merkle-tree -A terra1lk26r9kcysvd3g2lfmsuavf7s5g59wnyu5u6fh -R asdsadyhsafdsfdsfdsgsdfsdfs
- register merkle root (asdsadyhsafdsfdsfdsgsdfsdfs
) in airdrop contract (terra1lk26r9kcysvd3g2lfmsuavf7s5g59wnyu5u6fh
)npm run calc-airdrop -- send-airdrop -G gov_stakers.txt -T 100000000 -C ./src/airdrop/default_psi_to_anc_ratio.json
- send airdrop to all accounts, split to transactions with max 1000 messages
npm run staking-lp -- instantiate
- instantiate LP staking contractnpm run staking-lp -- add-distribution {start_date} {end_date} {tokens_amount} -A {staking_contract_addr}
- add new staking distribution schedule, for example:npm run staking-lp -- add-distribution 2021-03-17T11:00:00 2021-03-18T11:00:00 1000 -A terra1qeedgtvrtjkqjn6fkezddjjlrwxmt5peafp8fx
npm run staking-lp -- query-state -A terra1qeedgtvrtjkqjn6fkezddjjlrwxmt5peafp8fx
- query state of staking LP contract (terra1qeedgtvrtjkqjn6fkezddjjlrwxmt5peafp8fx
)
npm run vesting -- instantiate
- instantiate vesting contractnpm run vesting -- add-vesting {address} {start_date} {end_date} {cliff_end_date} {tokens_amount} -A {vesting_contract_addr}
- add new vesting, for example:npm run vesting -- add-vesting terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v 2021-03-17T11:00:00 2021-03-18T11:00:00 2021-03-18T11:00:00 1000 -A terra1u3zhxxmqq9fkuxmuzkzlzjgzerejqpk64xpmx8
npm run vesting -- query-state -A terra1ef44l7ayrzcjr7980gjqdqmndgy3cw04gtaj25
- query state of vesting contract (terra1qeedgtvrtjkqjn6fkezddjjlrwxmt5peafp8fx
)
npm run lp-simulation
- run lp simulation (provide liquidity, buy some tokens in loop, return token price at the end)
npm run rebalance
- run cycle that sendRebalance
message to bAsset vault if needed
npm run honest-work
- run cycle that sendHonestWork
(claim ANC rewards, sell them, buy PSI token) message to bAsset vault
npm run claim-lp-rewards
- run cycle that claim nAsset holding rewards for PSI-nAsset liquidity pool with some delay
start localterra before run scripts.
Add CONTRACT_SCRIPTS_PATH
env variable to your .bash_profile
or .zshrc
export CONTRACTS_SCRIPTS_PATH=<path-to-your-cloned-repo>/contracts_scripts
example:
export CONTRACTS_SCRIPTS_PATH=/Users/stevenli/Documents/github/contracts_scripts
npm run psi-distr-integration-tests
- run psi distribution integration testsnpm run bvault-integration-tests
- run basset vault integration tests
Make sure you ran everything in ### Integration tests setup
Clone the NexPrism repos into your local computer:
git clone https://github.com/Nexus-Protocol/nex-prism-convex
Generate the .wasm files for the integration tests
cd nex-prism-convex
./integration_tests_build.sh # alternatively: sh integration_tests_build.sh
Go back to contract_scripts
run
npm run nex-prism-integration-tests