9
9
cd src/tests/hey-partners
10
10
11
11
# Initializes an account if keys are not present
12
- initialize_output=$( echo -ne ' \n' | aptos init --network custom --rest-url $FULLNODE --faucet-url $FAUCET --assume-yes)
12
+ initialize_output=$( echo -ne ' \n' | movement init --network custom --rest-url $FULLNODE --faucet-url $FAUCET --assume-yes)
13
13
14
- CONFIG_FILE=" .aptos /config.yaml"
14
+ CONFIG_FILE=" .movement /config.yaml"
15
15
16
16
if [ ! -f " $CONFIG_FILE " ]; then
17
17
echo " Initialization failed. Config file not found."
18
18
exit 1
19
19
fi
20
20
21
- aptos move compile
21
+ movement move compile
22
22
23
23
PrivateKey=$( grep ' private_key:' " $CONFIG_FILE " | awk -F' : ' ' {print $2}' | tr -d ' "' )
24
24
25
25
# Lookup the SwapDeployer address
26
- lookup_address_output=$( aptos account lookup-address)
26
+ lookup_address_output=$( movement account lookup-address)
27
27
echo " Lookup Address Output: $lookup_address_output "
28
28
SwapDeployer=0x$( echo " $lookup_address_output " | grep -o ' "Result": "[0-9a-fA-F]\{64\}"' | sed ' s/"Result": "\(.*\)"/\1/' )
29
29
if [ -z " $SwapDeployer " ]; then
@@ -32,7 +32,7 @@ if [ -z "$SwapDeployer" ]; then
32
32
fi
33
33
34
34
# Lookup the ResourceAccountDeployer address test IS expected to fail as long as we can retrieve the account address anyway
35
- test_resource_account_output=$( aptos move test --package-dir " $PATH_TO_REPO /Swap/" \
35
+ test_resource_account_output=$( movement move test --package-dir " $PATH_TO_REPO /Swap/" \
36
36
--filter test_resource_account --named-addresses SwapDeployer=$SwapDeployer ,uq64x64=$SwapDeployer ,u256=$SwapDeployer ,ResourceAccountDeployer=$SwapDeployer )
37
37
echo " Test Resource Account Output: $test_resource_account_output "
38
38
ResourceAccountDeployer=$( echo " $test_resource_account_output " | grep -o ' \[debug\] @[^\s]*' | sed ' s/\[debug\] @\(.*\)/\1/' )
@@ -69,123 +69,123 @@ add_or_update_env "FAUCET" $FAUCET
69
69
70
70
# publish
71
71
echo " Publish uq64x64"
72
- aptos move publish --package-dir $PATH_TO_REPO /uq64x64/ --assume-yes --named-addresses uq64x64=$SwapDeployer
72
+ movement move publish --package-dir $PATH_TO_REPO /uq64x64/ --assume-yes --named-addresses uq64x64=$SwapDeployer
73
73
echo " Publish u256"
74
- aptos move publish --package-dir $PATH_TO_REPO /u256/ --assume-yes --named-addresses u256=$SwapDeployer
74
+ movement move publish --package-dir $PATH_TO_REPO /u256/ --assume-yes --named-addresses u256=$SwapDeployer
75
75
echo " Publish TestCoin"
76
- aptos move publish --package-dir $PATH_TO_REPO /TestCoin/ --assume-yes --named-addresses SwapDeployer=$SwapDeployer
76
+ movement move publish --package-dir $PATH_TO_REPO /TestCoin/ --assume-yes --named-addresses SwapDeployer=$SwapDeployer
77
77
echo " Publish Faucet"
78
- aptos move publish --package-dir $PATH_TO_REPO /Faucet/ --assume-yes --named-addresses SwapDeployer=$SwapDeployer
78
+ movement move publish --package-dir $PATH_TO_REPO /Faucet/ --assume-yes --named-addresses SwapDeployer=$SwapDeployer
79
79
echo " Publish Resource Account"
80
- aptos move publish --package-dir $PATH_TO_REPO /LPResourceAccount/ --assume-yes --named-addresses SwapDeployer=$SwapDeployer
80
+ movement move publish --package-dir $PATH_TO_REPO /LPResourceAccount/ --assume-yes --named-addresses SwapDeployer=$SwapDeployer
81
81
# create resource account & publish LPCoin
82
82
# use this command to compile LPCoin
83
- aptos move compile --package-dir $PATH_TO_REPO /LPCoin/ --save-metadata --named-addresses ResourceAccountDeployer=$ResourceAccountDeployer
83
+ movement move compile --package-dir $PATH_TO_REPO /LPCoin/ --save-metadata --named-addresses ResourceAccountDeployer=$ResourceAccountDeployer
84
84
# get the first arg
85
85
arg1=$( hexdump -ve ' 1/1 "%02x"' $PATH_TO_REPO /LPCoin/build/LPCoin/package-metadata.bcs)
86
86
# get the second arg
87
87
arg2=$( hexdump -ve ' 1/1 "%02x"' $PATH_TO_REPO /LPCoin/build/LPCoin/bytecode_modules/LPCoinV1.mv)
88
88
# This command is to publish LPCoin contract, using ResourceAccountDeployer address. Note: replace two args with the above two hex
89
89
echo " Initialize LPAccount"
90
- aptos move run --function-id ${SwapDeployer} ::LPResourceAccount::initialize_lp_account \
90
+ movement move run --function-id ${SwapDeployer} ::LPResourceAccount::initialize_lp_account \
91
91
--args hex:$arg1 hex:$arg2 --assume-yes
92
92
93
93
echo " Publishing MovementSwap"
94
- aptos move publish --package-dir $PATH_TO_REPO /Swap/ --assume-yes --named-addresses uq64x64=$SwapDeployer ,u256=$SwapDeployer ,SwapDeployer=$SwapDeployer ,ResourceAccountDeployer=$ResourceAccountDeployer
94
+ movement move publish --package-dir $PATH_TO_REPO /Swap/ --assume-yes --named-addresses uq64x64=$SwapDeployer ,u256=$SwapDeployer ,SwapDeployer=$SwapDeployer ,ResourceAccountDeployer=$ResourceAccountDeployer
95
95
96
96
# admin steps
97
97
# TestCoinsV1
98
98
echo " Initialize TestCoinsV1"
99
- aptos move run --function-id ${SwapDeployer} ::TestCoinsV1::initialize --assume-yes
99
+ movement move run --function-id ${SwapDeployer} ::TestCoinsV1::initialize --assume-yes
100
100
echo " Mint USDT TestCoinsV1"
101
- aptos move run --function-id ${SwapDeployer} ::TestCoinsV1::mint_coin \
101
+ movement move run --function-id ${SwapDeployer} ::TestCoinsV1::mint_coin \
102
102
--args address:${SwapDeployer} u64:20000000000000000 \
103
103
--type-args ${SwapDeployer} ::TestCoinsV1::USDT --assume-yes
104
104
echo " Mint BTC TestCoinsV1"
105
- aptos move run --function-id ${SwapDeployer} ::TestCoinsV1::mint_coin \
105
+ movement move run --function-id ${SwapDeployer} ::TestCoinsV1::mint_coin \
106
106
--args address:${SwapDeployer} u64:2000000000000 \
107
107
--type-args ${SwapDeployer} ::TestCoinsV1::BTC --assume-yes
108
108
109
109
# FaucetV1
110
110
echo " Create USDT FaucetV1"
111
- aptos move run --function-id ${SwapDeployer} ::FaucetV1::create_faucet \
111
+ movement move run --function-id ${SwapDeployer} ::FaucetV1::create_faucet \
112
112
--args u64:10000000000000000 u64:1000000000 u64:3600 \
113
113
--type-args ${SwapDeployer} ::TestCoinsV1::USDT --assume-yes
114
114
echo " Create BTC FaucetV1"
115
- aptos move run --function-id ${SwapDeployer} ::FaucetV1::create_faucet \
115
+ movement move run --function-id ${SwapDeployer} ::FaucetV1::create_faucet \
116
116
--args u64:1000000000000 u64:10000000 u64:3600 \
117
117
--type-args ${SwapDeployer} ::TestCoinsV1::BTC --assume-yes
118
118
119
119
# AnimeSwapPool
120
120
echo " add USDT:MOVE pair"
121
- aptos move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::add_liquidity_entry \
121
+ movement move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::add_liquidity_entry \
122
122
--args u64:10000000000 u64:100000000 u64:1 u64:1 \
123
123
--type-args ${SwapDeployer} ::TestCoinsV1::USDT 0x1::aptos_coin::AptosCoin --assume-yes
124
124
echo " add BTC:MOVE pair"
125
- aptos move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::add_liquidity_entry \
125
+ movement move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::add_liquidity_entry \
126
126
--args u64:10000000 u64:100000000 u64:1 u64:1 \
127
127
--type-args ${SwapDeployer} ::TestCoinsV1::BTC 0x1::aptos_coin::AptosCoin --assume-yes
128
128
echo " add BTC:USDT pair"
129
- aptos move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::add_liquidity_entry \
129
+ movement move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::add_liquidity_entry \
130
130
--args u64:100000000 u64:100000000000 u64:1 u64:1 \
131
131
--type-args ${SwapDeployer} ::TestCoinsV1::BTC ${SwapDeployer} ::TestCoinsV1::USDT --assume-yes
132
132
133
133
echo " Finished Admin Functions"
134
134
# user
135
135
# fund
136
136
echo " Request USDT"
137
- aptos move run --function-id ${SwapDeployer} ::FaucetV1::request \
137
+ movement move run --function-id ${SwapDeployer} ::FaucetV1::request \
138
138
--args address:${SwapDeployer} \
139
139
--type-args ${SwapDeployer} ::TestCoinsV1::USDT --assume-yes
140
140
echo " Request BTC"
141
- aptos move run --function-id ${SwapDeployer} ::FaucetV1::request \
141
+ movement move run --function-id ${SwapDeployer} ::FaucetV1::request \
142
142
--args address:${SwapDeployer} \
143
143
--type-args ${SwapDeployer} ::TestCoinsV1::BTC --assume-yes
144
144
# swap (type args shows the swap direction, in this example, swap BTC to APT)
145
145
echo " Swap exact BTC for MOVE"
146
- aptos move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::swap_exact_coins_for_coins_entry \
146
+ movement move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::swap_exact_coins_for_coins_entry \
147
147
--args u64:100 u64:1 \
148
148
--type-args ${SwapDeployer} ::TestCoinsV1::BTC 0x1::aptos_coin::AptosCoin --assume-yes
149
149
# swap
150
150
echo " Swap BTC for exact MOVE"
151
- aptos move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::swap_coins_for_exact_coins_entry \
151
+ movement move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::swap_coins_for_exact_coins_entry \
152
152
--args u64:100 u64:1000000000 \
153
153
--type-args ${SwapDeployer} ::TestCoinsV1::BTC 0x1::aptos_coin::AptosCoin --assume-yes
154
154
# multiple pair swap (this example, swap 100 BTC->APT->USDT)
155
155
echo " Swap BTC for USDT"
156
- aptos move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::swap_exact_coins_for_coins_2_pair_entry \
156
+ movement move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::swap_exact_coins_for_coins_2_pair_entry \
157
157
--args u64:100 u64:1 \
158
158
--type-args ${SwapDeployer} ::TestCoinsV1::BTC 0x1::aptos_coin::AptosCoin ${SwapDeployer} ::TestCoinsV1::USDT --assume-yes
159
159
# add lp (if pair not exist, will auto create lp first)
160
160
echo " Add LP for BTC:MOVE"
161
- aptos move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::add_liquidity_entry \
161
+ movement move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::add_liquidity_entry \
162
162
--args u64:1000 u64:10000 u64:1 u64:1 \
163
163
--type-args ${SwapDeployer} ::TestCoinsV1::BTC 0x1::aptos_coin::AptosCoin --assume-yes
164
164
echo " Remove LP from BTC:MOVE"
165
- aptos move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::remove_liquidity_entry \
165
+ movement move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::remove_liquidity_entry \
166
166
--args u64:1000 u64:1 u64:1 \
167
167
--type-args ${SwapDeployer} ::TestCoinsV1::BTC 0x1::aptos_coin::AptosCoin --assume-yes
168
168
169
169
# Admin cmd example
170
170
echo " Set dao fee"
171
- aptos move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::set_dao_fee_to \
171
+ movement move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::set_dao_fee_to \
172
172
--args address:${SwapDeployer} --assume-yes
173
173
echo " Set admin address"
174
- aptos move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::set_admin_address \
174
+ movement move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::set_admin_address \
175
175
--args address:${SwapDeployer} --assume-yes
176
176
echo " set dao fee"
177
- aptos move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::set_dao_fee \
177
+ movement move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::set_dao_fee \
178
178
--args u64:5
179
179
echo " set swap fee"
180
- aptos move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::set_swap_fee \
180
+ movement move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::set_swap_fee \
181
181
--args u64:30 --assume-yes
182
182
echo " withdraw dao fee"
183
- aptos move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::withdraw_dao_fee \
183
+ movement move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::withdraw_dao_fee \
184
184
--type-args ${SwapDeployer} ::TestCoinsV1::BTC ${SwapDeployer} ::TestCoinsV1::USDT --assume-yes
185
185
echo " pause"
186
- aptos move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::pause --assume-yes
186
+ movement move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::pause --assume-yes
187
187
echo " unpause"
188
- aptos move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::unpause --assume-yes
188
+ movement move run --function-id ${SwapDeployer} ::AnimeSwapPoolV1::unpause --assume-yes
189
189
190
190
echo " Finished User Functions"
191
191
0 commit comments