-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdemo.sh
executable file
·105 lines (73 loc) · 8.47 KB
/
demo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# The script expects the following:
# 1. archwayd configured to a correct testnet node
# 2. archwayd has a key named "test" with gas funds
# 3. "test" address already has some xCONST
# xCONST - sARCH (ratio)
# 1_000_000 -> 262_649 Price: 0.262649
# Reverse:
# 1_000_000 -> 3_807_363 Price: 3.807363
# Pair Direct:
echo "Directly quering estimates from the pair contract:"
archwayd q wasm contract-state smart archway1903dqer5mdy4wen9duxhm7l76gw20vzk2vwm6t7zk305c0m38ldqjncc9f '{ "swap_simulation" : { "swap_from_asset_index" : 0, "swap_to_asset_index" : 1, "amount" : "1000000" } }'
echo "Reverse"
archwayd q wasm contract-state smart archway1903dqer5mdy4wen9duxhm7l76gw20vzk2vwm6t7zk305c0m38ldqjncc9f '{ "swap_simulation" : { "swap_from_asset_index" : 1, "swap_to_asset_index" : 0, "amount" : "1000000" } }'
# Exchange:
echo "\nExpected amounts from the exchange contract:"
archwayd q wasm contract-state smart archway1lhwam0n77ysx7478pw8505ljckqv9ka4lllwxdqaqx573trw6hnssrkgxc '{ "get_expected_receive_amount": { "swap_amount": { "denom": "archway1sdzaas0068n42xk8ndm6959gpu6n09tajmeuq7vak8t9qt5jrp6sjjtnka", "amount" : "1000000" }, "target_denom": "archway1erqguqc3hmfajgu7e2dvgaccx6feu5ru3gyatdxu94p66j9hp7msn2kcqp" } }'
archwayd q wasm contract-state smart archway1lhwam0n77ysx7478pw8505ljckqv9ka4lllwxdqaqx573trw6hnssrkgxc '{ "get_expected_receive_amount": { "swap_amount": { "denom": "archway1erqguqc3hmfajgu7e2dvgaccx6feu5ru3gyatdxu94p66j9hp7msn2kcqp", "amount" : "1000000" }, "target_denom": "archway1sdzaas0068n42xk8ndm6959gpu6n09tajmeuq7vak8t9qt5jrp6sjjtnka" } }'
# Twap:
echo "\nTwap xConst -> sARCH:"
archwayd q wasm contract-state smart archway1lhwam0n77ysx7478pw8505ljckqv9ka4lllwxdqaqx573trw6hnssrkgxc '{ "get_twap_to_now": { "target_denom": "archway1erqguqc3hmfajgu7e2dvgaccx6feu5ru3gyatdxu94p66j9hp7msn2kcqp", "swap_denom": "archway1sdzaas0068n42xk8ndm6959gpu6n09tajmeuq7vak8t9qt5jrp6sjjtnka", "period" : 0 } }'
echo "Twap sARCH -> xConst:"
archwayd q wasm contract-state smart archway1lhwam0n77ysx7478pw8505ljckqv9ka4lllwxdqaqx573trw6hnssrkgxc '{ "get_twap_to_now": { "target_denom": "archway1sdzaas0068n42xk8ndm6959gpu6n09tajmeuq7vak8t9qt5jrp6sjjtnka", "swap_denom": "archway1erqguqc3hmfajgu7e2dvgaccx6feu5ru3gyatdxu94p66j9hp7msn2kcqp", "period" : 0 } }'
# Testing swaps:
echo "\nBalances before swap:"
echo "xCONST:"
archwayd q wasm contract-state smart archway1sdzaas0068n42xk8ndm6959gpu6n09tajmeuq7vak8t9qt5jrp6sjjtnka '{ "balance": { "address": "archway1dvpkaw4wmcn05k7v6c98cv4g9mgdamukghcwk2" } }'
echo "sARCH:"
archwayd q wasm contract-state smart archway1erqguqc3hmfajgu7e2dvgaccx6feu5ru3gyatdxu94p66j9hp7msn2kcqp '{ "balance": { "address": "archway1dvpkaw4wmcn05k7v6c98cv4g9mgdamukghcwk2" } }'
echo "USDC.axv:"
archwayd q wasm contract-state smart archway1mmu32f7hn0fyw8gh57xl5uhaqu4pq5xx59ynf0tju60n2nzha0as3vtmcm '{ "balance": { "address": "archway1dvpkaw4wmcn05k7v6c98cv4g9mgdamukghcwk2" } }'
echo "USDT.axv:"
archwayd q wasm contract-state smart archway12defza8nz2d2a3hgt6tftku28ly5lglsna69j7rpjeukg4pz8qese2326s '{ "balance": { "address": "archway1dvpkaw4wmcn05k7v6c98cv4g9mgdamukghcwk2" } }'
echo "BUSD.axv:"
archwayd q wasm contract-state smart archway1lcxaem4gqnp2mdeh5hawacxlzge8e6wzjaat73ahpf2rclqv9v4sj8e4kf '{ "balance": { "address": "archway1dvpkaw4wmcn05k7v6c98cv4g9mgdamukghcwk2" } }'
# Ratio Swap:
#echo "\nSwapping 10_000_000_000_000 xCONST for sARCH:"
#archwayd tx wasm execute archway1sdzaas0068n42xk8ndm6959gpu6n09tajmeuq7vak8t9qt5jrp6sjjtnka '{ "send" : { "contract": "archway1lhwam0n77ysx7478pw8505ljckqv9ka4lllwxdqaqx573trw6hnssrkgxc", "amount": "10000000000000", "msg": "ewogICJzd2FwIjogewogICAgIm1pbmltdW1fcmVjZWl2ZV9hbW91bnQiOiB7CiAgICAgICJhbW91bnQiOiAiMTAwMDAwMCIsCiAgICAgICJkZW5vbSI6ICJhcmNod2F5MWVycWd1cWMzaG1mYWpndTdlMmR2Z2FjY3g2ZmV1NXJ1M2d5YXRkeHU5NHA2Nmo5aHA3bXNuMmtjcXAiCiAgICB9CiAgfQp9" } }' --gas-prices 900000000000aconst --from test --gas 1600000 -y
#echo "\Sleeping for 5 seconds..."
#sleep 5
# Standard Swap:
echo "\nSwapping 10_000_000_000_000 xCONST for USDC.axv:"
archwayd tx wasm execute archway1sdzaas0068n42xk8ndm6959gpu6n09tajmeuq7vak8t9qt5jrp6sjjtnka '{ "send" : { "contract": "archway1lhwam0n77ysx7478pw8505ljckqv9ka4lllwxdqaqx573trw6hnssrkgxc", "amount": "10000000000000", "msg": "ewogICJzd2FwIjogewogICAgIm1pbmltdW1fcmVjZWl2ZV9hbW91bnQiOiB7CiAgICAgICJhbW91bnQiOiAiMTAwMDAwMCIsCiAgICAgICJkZW5vbSI6ICJhcmNod2F5MW1tdTMyZjdobjBmeXc4Z2g1N3hsNXVoYXF1NHBxNXh4NTl5bmYwdGp1NjBuMm56aGEwYXMzdnRtY20iCiAgICB9CiAgfQp9" } }' --gas-prices 900000000000aconst --from test --gas 1600000 -y
echo "\nSleeping for 5 seconds..."
sleep 5
echo "xCONST:"
archwayd q wasm contract-state smart archway1sdzaas0068n42xk8ndm6959gpu6n09tajmeuq7vak8t9qt5jrp6sjjtnka '{ "balance": { "address": "archway1dvpkaw4wmcn05k7v6c98cv4g9mgdamukghcwk2" } }'
echo "USDC.axv:"
archwayd q wasm contract-state smart archway1mmu32f7hn0fyw8gh57xl5uhaqu4pq5xx59ynf0tju60n2nzha0as3vtmcm '{ "balance": { "address": "archway1dvpkaw4wmcn05k7v6c98cv4g9mgdamukghcwk2" } }'
echo "USDT.axv:"
archwayd q wasm contract-state smart archway12defza8nz2d2a3hgt6tftku28ly5lglsna69j7rpjeukg4pz8qese2326s '{ "balance": { "address": "archway1dvpkaw4wmcn05k7v6c98cv4g9mgdamukghcwk2" } }'
# Stable Swaps:
echo "\nSwapping 1_000_000_000 (u)USDC.axv for USDT.axv"
archwayd tx wasm execute archway1mmu32f7hn0fyw8gh57xl5uhaqu4pq5xx59ynf0tju60n2nzha0as3vtmcm '{ "send" : { "contract": "archway1lhwam0n77ysx7478pw8505ljckqv9ka4lllwxdqaqx573trw6hnssrkgxc", "amount": "1000000000", "msg": "ewogICJzd2FwIjogewogICAgIm1pbmltdW1fcmVjZWl2ZV9hbW91bnQiOiB7CiAgICAgICJhbW91bnQiOiAiOTAwIiwKICAgICAgImRlbm9tIjogImFyY2h3YXkxMmRlZnphOG56MmQyYTNoZ3Q2dGZ0a3UyOGx5NWxnbHNuYTY5ajdycGpldWtnNHB6OHFlc2UyMzI2cyIKICAgIH0KICB9Cn0=" } }' --gas-prices 900000000000aconst --from test --gas 1600000 -y
echo "\nSleeping for 3 seconds..."
sleep 3
echo "\nSwapping 1_000_000_000 (u)USDC.axv for BUSD.axv"
archwayd tx wasm execute archway1mmu32f7hn0fyw8gh57xl5uhaqu4pq5xx59ynf0tju60n2nzha0as3vtmcm '{ "send" : { "contract": "archway1lhwam0n77ysx7478pw8505ljckqv9ka4lllwxdqaqx573trw6hnssrkgxc", "amount": "1000000000", "msg": "ewogICJzd2FwIjogewogICAgIm1pbmltdW1fcmVjZWl2ZV9hbW91bnQiOiB7CiAgICAgICJhbW91bnQiOiAiOTAwIiwKICAgICAgImRlbm9tIjogImFyY2h3YXkxbGN4YWVtNGdxbnAybWRlaDVoYXdhY3hsemdlOGU2d3pqYWF0NzNhaHBmMnJjbHF2OXY0c2o4ZTRrZiIKICAgIH0KICB9Cn0=" } }' --gas-prices 900000000000aconst --from test --gas 1600000 -y
echo "\nSleeping for 5 seconds..."
sleep 5
echo "\nFinal balances:"
echo "xCONST:"
archwayd q wasm contract-state smart archway1sdzaas0068n42xk8ndm6959gpu6n09tajmeuq7vak8t9qt5jrp6sjjtnka '{ "balance": { "address": "archway1dvpkaw4wmcn05k7v6c98cv4g9mgdamukghcwk2" } }'
echo "sARCH:"
archwayd q wasm contract-state smart archway1erqguqc3hmfajgu7e2dvgaccx6feu5ru3gyatdxu94p66j9hp7msn2kcqp '{ "balance": { "address": "archway1dvpkaw4wmcn05k7v6c98cv4g9mgdamukghcwk2" } }'
echo "USDC.axv:"
archwayd q wasm contract-state smart archway1mmu32f7hn0fyw8gh57xl5uhaqu4pq5xx59ynf0tju60n2nzha0as3vtmcm '{ "balance": { "address": "archway1dvpkaw4wmcn05k7v6c98cv4g9mgdamukghcwk2" } }'
echo "USDT.axv:"
archwayd q wasm contract-state smart archway12defza8nz2d2a3hgt6tftku28ly5lglsna69j7rpjeukg4pz8qese2326s '{ "balance": { "address": "archway1dvpkaw4wmcn05k7v6c98cv4g9mgdamukghcwk2" } }'
echo "BUSD.axv:"
archwayd q wasm contract-state smart archway1lcxaem4gqnp2mdeh5hawacxlzge8e6wzjaat73ahpf2rclqv9v4sj8e4kf '{ "balance": { "address": "archway1dvpkaw4wmcn05k7v6c98cv4g9mgdamukghcwk2" } }'
# archwayd tx wasm execute archway1sdzaas0068n42xk8ndm6959gpu6n09tajmeuq7vak8t9qt5jrp6sjjtnka '{ "send" : { "contract": "archway1lhwam0n77ysx7478pw8505ljckqv9ka4lllwxdqaqx573trw6hnssrkgxc", "amount": "501000000", "msg": "ewogICJzd2FwIjogewogICAgIm1pbmltdW1fcmVjZWl2ZV9hbW91bnQiOiB7CiAgICAgICJhbW91bnQiOiAiMTAwMDAwMCIsCiAgICAgICJkZW5vbSI6ICJhY29uc3QiCiAgICB9CiAgfQp9" } }' --gas-prices 900000000000aconst --from test --gas 5000000 -y
# archwayd tx wasm execute archway1lhwam0n77ysx7478pw8505ljckqv9ka4lllwxdqaqx573trw6hnssrkgxc '{ "swap": { "minimum_receive_amount": { "amount": "1000000000", "denom": "archway1sdzaas0068n42xk8ndm6959gpu6n09tajmeuq7vak8t9qt5jrp6sjjtnka" } } }' --gas-prices 900000000000aconst --from test -y --amount 1000000000aconst --gas 1600000
# archwayd tx wasm execute archway1lhwam0n77ysx7478pw8505ljckqv9ka4lllwxdqaqx573trw6hnssrkgxc '{ "swap": { "minimum_receive_amount": { "amount": "1000000", "denom": "archway1sdzaas0068n42xk8ndm6959gpu6n09tajmeuq7vak8t9qt5jrp6sjjtnka" } } }' --gas-prices 900000000000aconst --from test -y --amount 1500000000000000000aconst --gas 1600000