You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-exchanges/RaDEX/README.md
+16-12
Original file line number
Diff line number
Diff line change
@@ -186,30 +186,34 @@ The first thing that we need to do now is to create four different accounts to u
186
186
187
187
```sh
188
188
OP1=$(resim new-account)
189
+
export PRIV_KEY1=$(echo "$OP1"| sed -nr "s/Private key: ([[:alnum:]_]+)/\1/p")
189
190
export PUB_KEY1=$(echo "$OP1"| sed -nr "s/Public key: ([[:alnum:]_]+)/\1/p")
190
-
export ACC_ADDRESS1=$(echo "$OP1"| sed -nr "s/Account address: ([[:alnum:]_]+)/\1/p")
191
+
export ACC_ADDRESS1=$(echo "$OP1"| sed -nr "s/Account component address: ([[:alnum:]_]+)/\1/p")
191
192
OP2=$(resim new-account)
193
+
export PRIV_KEY2=$(echo "$OP2"| sed -nr "s/Private key: ([[:alnum:]_]+)/\1/p")
192
194
export PUB_KEY2=$(echo "$OP2"| sed -nr "s/Public key: ([[:alnum:]_]+)/\1/p")
193
-
export ACC_ADDRESS2=$(echo "$OP2"| sed -nr "s/Account address: ([[:alnum:]_]+)/\1/p")
195
+
export ACC_ADDRESS2=$(echo "$OP2"| sed -nr "s/Account component address: ([[:alnum:]_]+)/\1/p")
194
196
OP3=$(resim new-account)
197
+
export PRIV_KEY3=$(echo "$OP3"| sed -nr "s/Private key: ([[:alnum:]_]+)/\1/p")
195
198
export PUB_KEY3=$(echo "$OP3"| sed -nr "s/Public key: ([[:alnum:]_]+)/\1/p")
196
-
export ACC_ADDRESS3=$(echo "$OP3"| sed -nr "s/Account address: ([[:alnum:]_]+)/\1/p")
199
+
export ACC_ADDRESS3=$(echo "$OP3"| sed -nr "s/Account component address: ([[:alnum:]_]+)/\1/p")
197
200
OP4=$(resim new-account)
201
+
export PRIV_KEY4=$(echo "$OP4"| sed -nr "s/Private key: ([[:alnum:]_]+)/\1/p")
198
202
export PUB_KEY4=$(echo "$OP4"| sed -nr "s/Public key: ([[:alnum:]_]+)/\1/p")
199
-
export ACC_ADDRESS4=$(echo "$OP4"| sed -nr "s/Account address: ([[:alnum:]_]+)/\1/p")
203
+
export ACC_ADDRESS4=$(echo "$OP4"| sed -nr "s/Account component address: ([[:alnum:]_]+)/\1/p")
200
204
```
201
205
202
206
With the four accounts created, let's give some context as to what we will be doing next. The first thing that we wish to do is to create a number of test tokens that we can use to test out the functionality of the DEX. We would like Account 1 to be the creator of these test tokens and for it to then send some of these tokens to the other accounts so that they can test the DEX. Since Account 1 is the account that will be used for hte creation of the tokens, we need to set it as the default account:
203
207
204
208
```sh
205
-
$ resim set-default-account $ACC_ADDRESS1$PUB_KEY1
209
+
$ resim set-default-account $ACC_ADDRESS1$PUB_KEY1$PRIV_KEY1
206
210
Default account updated!
207
211
```
208
212
209
-
The file[`token_creation_and_funding.rtm`](./transactions/token_creation_and_funding.rtm) contains the instructions needed for account 1 to create 8 different tokens (we will have a total of 9 tokens after this transaction as we do not need to create XRD) and then fund the 3 other accounts created before depositing all of the remaining tokens back into account 1. All of this will be done in one single neat atomically composed transaction that creates the tokens and deposits them into the accounts. To run the transaction file, run the following command:
213
+
The files[`token_creation.rtm`](./transactions/token_creation.rtm), and [`token_funding.rtm`](./transactions/token_funding.rtm) contain the instructions needed for account 1 to create 8 different tokens (we will have a total of 9 tokens after this transaction as we do not need to create XRD) and then fund the 3 other accounts created before depositing all of the remaining tokens back into account 1. To run the transaction file, run the following command:
210
214
211
215
```sh
212
-
resim run transactions/token_creation_and_funding.rtm
216
+
resim run transactions/token_creation.rtm && resim run transactions/token_funding.rtm
213
217
```
214
218
215
219
When this transaction runs, all of the accounts that we had created would now have 100,000 of some of the tokens that we will be using for the testing of the DEX. We can now publish the RaDEX package and also instantiate a new RaDEX component by running the following commands:
@@ -250,7 +254,7 @@ The [`creating_initial_liquidity_pools.rtm`](./transactions/creating_initial_liq
250
254
Now that the process that we will be following is somewhat clear, let's get into running this transaction using Lynn's account. First things first, let's make sure that Lynn's account (Account 1) is set the default account in resim:
251
255
252
256
```sh
253
-
$ resim set-default-account $ACC_ADDRESS1$PUB_KEY1
257
+
$ resim set-default-account $ACC_ADDRESS1$PUB_KEY1$PRIV_KEY1
254
258
Default account updated!
255
259
```
256
260
@@ -293,7 +297,7 @@ Josh has decided to use RaDEX to perform the swap of BTC for USDT as RaDEX has t
293
297
Let's now run the needed transaction manifest file forJosh to perform his swap of BTC for USDT. We first need to switch the default accountin resim to Josh's account by doing the following:
294
298
295
299
```sh
296
-
$ resim set-default-account $ACC_ADDRESS2 $PUB_KEY2
300
+
$ resim set-default-account $ACC_ADDRESS2 $PUB_KEY2 $PRIV_KEY2
297
301
Default account updated!
298
302
```
299
303
@@ -368,7 +372,7 @@ As can be seen in the diagram above, the first step in the transaction is the wi
368
372
Let's now to get to work and try out this transaction. Let's begin by switching to Tim's account:
369
373
370
374
```sh
371
-
$ resim set-default-account $ACC_ADDRESS3 $PUB_KEY3
375
+
$ resim set-default-account $ACC_ADDRESS3 $PUB_KEY3 $PRIV_KEY3
372
376
Default account updated!
373
377
```
374
378
@@ -405,7 +409,7 @@ Alfred has decided that he wants to sell some of the Bitcoin that he owns for US
405
409
Now that we understand what will be done, we can go ahead and perform this transaction. Let's begin by switching over to Alfred's account:
406
410
407
411
```sh
408
-
$ resim set-default-account $ACC_ADDRESS4 $PUB_KEY4
412
+
$ resim set-default-account $ACC_ADDRESS4 $PUB_KEY4 $PRIV_KEY4
409
413
Default account updated!
410
414
```
411
415
@@ -435,7 +439,7 @@ With the last example we are going back to Lynn (Account 1). After providing liq
435
439
Let's begin by switching the default account in resim to be Lynn's account:
436
440
437
441
```sh
438
-
$ resim set-default-account $ACC_ADDRESS1$PUB_KEY1
442
+
$ resim set-default-account $ACC_ADDRESS1$PUB_KEY1$PRIV_KEY1
0 commit comments