1
+ cli-hermes =kubectl exec -it hermes-agoric-osmosis-0 -c relayer -- hermes
2
+ exec-agd =kubectl exec -i agoriclocal-genesis-0 -c validator -- agd
3
+ exec-osmo =kubectl exec -i osmosislocal-genesis-0 -c validator -- osmosisd
4
+ cli-osmo =kubectl exec -i osmosislocal-genesis-0 -c validator -- /bin/bash -c
5
+
6
+ AGORIC_TEST_ADDRESS =$(shell $(exec-agd ) keys show test1 -a --keyring-backend test)
7
+ AGORIC_GENESIS_ADDRESS =$(shell $(exec-agd ) keys show genesis -a --keyring-backend test)
8
+ OSMOSIS_TEST_ADDRESS =$(shell $(exec-osmo ) keys show test1 -a --keyring-backend test)
9
+ OSMOSIS_GENESIS_ADDRESS = $(shell $(exec-osmo ) keys show genesis -a --keyring-backend test)
10
+
11
+ TX_FLAGS =--from $(OSMOSIS_GENESIS_ADDRESS ) --keyring-backend=test --gas=auto --gas-prices 0.1uosmo --gas-adjustment 1.3 --yes --chain-id osmosislocal
12
+ AGD_TX_FLAGS =--from $(AGORIC_GENESIS_ADDRESS ) --keyring-backend=test --gas=auto --gas-prices 0.1ubld --gas-adjustment 1.3 --yes --chain-id agoriclocal
13
+
14
+ CHANNEL_INFO =$(shell $(cli-hermes ) --json query channels --show-counterparty --chain agoriclocal \
15
+ | jq '[.][] | select(.result) | .result[] | select(.chain_id_b == "osmosislocal")')
16
+ AGORIC_OSMOSIS_CHANNEL =$(shell echo '$(CHANNEL_INFO ) ' | jq -r '.channel_a')
17
+ OSMOSIS_AGORIC_CHANNEL =$(shell echo '$(CHANNEL_INFO ) ' | jq -r '.channel_b')
18
+
19
+ REGISTRY_ADDRESS ="osmo1nc5tatafv6eyq7llkr2gv50ff9e22mnf70qgjlv737ktmt4eswrqvlx82r"
20
+ SWAPROUTER_ADDRESS ="osmo14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sq2r9g9"
21
+ SWAP_ADDRESS ="osmo17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgs5yczr8"
22
+
23
+ POOL_ASSET_1_DENOM ="uosmo"
24
+ POOL_ASSET_1_AMOUNT ="250000"
25
+ POOL_ASSET_2_DENOM ="ibc/E7827844CB818EE9C4DB2C159F1543FF62B26213B44CE8029D5CEFE52F0EE596"
26
+
27
+ GET_ROUTE_JSON = '{"get_route":{"input_denom":$(POOL_ASSET_2_DENOM ) ,"output_denom":$(POOL_ASSET_1_DENOM ) }}'
28
+ SET_CHAIN_CHANNEL_LINKS ='{"modify_chain_channel_links":{"operations":[{"operation":"set","source_chain":"agoric","destination_chain":"osmosis","channel_id":$(AGORIC_OSMOSIS_CHANNEL ) },{"operation":"set","source_chain":"osmosis","destination_chain":"agoric","channel_id":$(OSMOSIS_AGORIC_CHANNEL ) }]}}'
29
+ SET_PREFIXES_MSG ='{"modify_bech32_prefixes":{"operations":[{"operation":"set","chain_name":"osmosis","prefix":"osmo"},{"operation":"set","chain_name":"agoric","prefix":"agoric"}]}}'
30
+ GET_CHANNEL_FROM_CHAINS_MSG ='{"get_channel_from_chain_pair":{"source_chain":"osmosis","destination_chain":"agoric"}}'
31
+ GET_PREFIX_FROM_CHAIN_MSG ='{"get_bech32_prefix_from_chain_name":{"chain_name":"osmosis"}}'
32
+
33
+ GOOD_SWAP_MEMO ='{"wasm":{"contract":$(SWAP_ADDRESS ) ,"msg":{"osmosis_swap":{"output_denom":"uosmo","slippage":{"twap":{"window_seconds":10,"slippage_percentage":"20"}},"receiver":"agoric1elueec97as0uwavlxpmj75u5w7yq9dgphq47zx","on_failed_delivery":"do_nothing", "next_memo":{}}}}}'
34
+ BAD_SWAP_MEMO =' \
35
+ {"wasm":{ \
36
+ "contract":"$(SWAP_ADDRESS ) ", \
37
+ "msg":{ \
38
+ "osmosis_swap":{ \
39
+ "output_denom":"uosmo", \
40
+ "slippage":{ \
41
+ "twap":{ \
42
+ "window_seconds":10, \
43
+ "slippage_percentage":"20" \
44
+ } \
45
+ }, \
46
+ "receiver":"$(AGORIC_GENESIS_ADDRESS ) ", \
47
+ "on_failed_delivery":"do_nothing", \
48
+ "next_memo":{} \
49
+ } \
50
+ } \
51
+ }}'
52
+
53
+ print-channel-info :
54
+ @echo $(CHANNEL_INFO )
55
+
56
+ print-agoric-channel :
57
+ @echo $(AGORIC_OSMOSIS_CHANNEL )
58
+
59
+ print-osmosis-channel :
60
+ @echo $(OSMOSIS_AGORIC_CHANNEL )
61
+
62
+ print-osmosis-address :
63
+ echo ' $(AGORIC_GENESIS_ADDRESS)'
64
+
65
+ versions :
66
+ $(cli-hermes ) --version
67
+ $(exec-agd ) version
68
+ $(exec-osmo ) version
69
+
70
+ query-channels :
71
+ $(cli-hermes ) query channels --show-counterparty --chain $(CHAIN )
72
+
73
+ query-balance-osmo :
74
+ $(exec-osmo ) query bank balances $(OSMOSIS_TEST_ADDRESS ) | jq
75
+
76
+ query-balance-agoric :
77
+ $(exec-agd ) query bank balances agoric1elueec97as0uwavlxpmj75u5w7yq9dgphq47zx | jq
78
+
79
+ query-route :
80
+ $(exec-osmo ) q wasm contract-state smart $(SWAPROUTER_ADDRESS ) $(GET_ROUTE_JSON )
81
+
82
+ query-pool-balance :
83
+ $(exec-osmo ) q gamm pool 1 | jq
84
+
85
+ query-tx-osmo :
86
+ $(exec-osmo ) q tx $(TX_HASH ) | jq .
87
+
88
+ query-tx-agoric :
89
+ $(exec-agd ) q tx $(TX_HASH ) | jq .
90
+
91
+ query-channel-from-registry :
92
+ $(exec-osmo ) q wasm contract-state smart $(REGISTRY_ADDRESS ) $(GET_CHANNEL_FROM_CHAINS_MSG ) | jq .
93
+
94
+ query-prefix-from-registry :
95
+ $(exec-osmo ) q wasm contract-state smart $(REGISTRY_ADDRESS ) $(GET_PREFIX_FROM_CHAIN_MSG ) | jq .
96
+
97
+ tx-chain-channel-links :
98
+ $(exec-osmo ) tx wasm execute $(REGISTRY_ADDRESS ) $(SET_CHAIN_CHANNEL_LINKS ) $(TX_FLAGS )
99
+
100
+ tx-bec32-prefixes :
101
+ $(exec-osmo ) tx wasm execute $(REGISTRY_ADDRESS ) $(SET_PREFIXES_MSG ) $(TX_FLAGS )
102
+
103
+ tx-send-xcs-ibc-transfer :
104
+ $(exec-agd ) tx ibc-transfer transfer transfer $(AGORIC_OSMOSIS_CHANNEL ) $(SWAP_ADDRESS ) 125ubld \
105
+ --memo $(GOOD_SWAP_MEMO ) $(AGD_TX_FLAGS )
0 commit comments