Skip to content

Commit 9d4cd87

Browse files
0xerencodchen
andauthored
Add spawn chain script (#53)
* Fix initialize local node script * add initialize_local.sh * Add quick-start script with comments * Remove irrelevant file Co-authored-by: Xiaoyu Chen <codchen03@gmail.com>
1 parent 736f2e8 commit 9d4cd87

3 files changed

+35
-0
lines changed

scripts/initialize_local.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# min go compiler version >=1.18.2
2+
# gvm use go1.18.2
3+
# build seid
4+
go build -o build/seid ./cmd/seid/
5+
# bootstrap from scratch
6+
rm -rf ~/.sei/
7+
rm -rf ~/test_accounts/
8+
# init chain
9+
./build/seid init demo --chain-id sei
10+
test_account_name=alice
11+
# add test_account_name to keys
12+
./build/seid keys add $test_account_name
13+
./build/seid add-genesis-account $(./build/seid keys show $test_account_name -a) 100000000000000000000usei
14+
# generate genesis tx
15+
./build/seid gentx $test_account_name 70000000000000000000usei --chain-id sei
16+
./build/seid collect-gentxs
17+
cat ~/.sei/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="usei"' > ~/.sei/config/tmp_genesis.json && mv ~/.sei/config/tmp_genesis.json ~/.sei/config/genesis.json
18+
cat ~/.sei/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="usei"' > ~/.sei/config/tmp_genesis.json && mv ~/.sei/config/tmp_genesis.json ~/.sei/config/genesis.json
19+
cat ~/.sei/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="usei"' > ~/.sei/config/tmp_genesis.json && mv ~/.sei/config/tmp_genesis.json ~/.sei/config/genesis.json
20+
cat ~/.sei/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="usei"' > ~/.sei/config/tmp_genesis.json && mv ~/.sei/config/tmp_genesis.json ~/.sei/config/genesis.json
21+
./build/seid start --trace

scripts/initialize_local_test_node.sh

100644100755
File mode changed.
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# ./scripts/initialize_local.sh to spawn chain locally, endpoint is default to localhost:9090
2+
# build the contract to wasm with `cargo build; 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/rust-optimizer:0.12.5`
3+
4+
# upload the code
5+
./build/seid tx wasm store ../matrix-contract/clearing-house-contract/artifacts/clearing_house.wasm -y --from=alice --chain-id=sei --gas=3000000 --fees=100000usei --broadcast-mode=block
6+
# replace addr here with an addr you have privateKey
7+
./build/seid tx wasm instantiate 1 '{"whitelist": ["sei1zywupnfk3t8lvtuzh540vls8mf53r5zuq98wkt"],"use_whitelist":false,"admin":"sei1zywupnfk3t8lvtuzh540vls8mf53r5zuq98wkt"}' -y --no-admin --chain-id=sei --gas=1500000 --fees=15000usei --broadcast-mode=block --label=dex --from=alice
8+
# contract_address highly possible is the same, if not replace
9+
./build/seid tx dex register-contract sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m 1 -y --from=alice --chain-id=sei --fees=10000000usei --gas=500000 --broadcast-mode=block
10+
# register a pair
11+
./build/seid tx dex register-pair sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m usdc sei -y --from=alice --chain-id=sei --fees=10000000usei --gas=500000 --broadcast-mode=block
12+
# order: (position_direction, price, quantity, price_denom, asset_denom, position_effect(open/close), order_type(limit, market,..), leverage)
13+
./build/seid tx dex place-orders sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m Long,1.01,5,usdc,sei,Open,Limit,1 --amount=10000000usei -y --from=alice --chain-id=sei --fees=1000000use
14+
i --gas=50000000 --broadcast-mode=block

0 commit comments

Comments
 (0)