Swap tokens
Line 1: | Line 1: | ||
− | '''swap tokens''' is a command that allows you to swap tokens using a decentralized exchange. | + | '''swap tokens''' is a command that allows you to swap tokens using a decentralized exchange. |
+ | |||
+ | By utilizing this command, you can swap a token ("Token In ID") for another token ("Token Out ID") on a given decentralized exchange ("Exchange"). | ||
== Parameters == | == Parameters == | ||
− | '''Exchange:''' The decentralized exchange | + | '''Exchange:''' The decentralized exchange on which you want to conduct the token swap. The available exchanges will be dependent on the "SwapNames" list set in your environment. |
− | '''Token In ID:''' The | + | '''Token In ID:''' The token which you want to swap from. The available tokens will depend on the "CoinNames" list set in your environment. |
− | '''Token Out ID:''' The | + | '''Token Out ID:''' The desired token which you want to acquire from the swap. The available tokens will depend on the "CoinNames" list set in your environment. |
− | '''Amount:''' The | + | '''Amount:''' The amount of the "Token In ID" that you want to swap. |
− | '''Transaction Info Variable:''' ( | + | '''Transaction Info Variable:''' (optional) The variable which stores the transaction information after the swap occurs. Default is '#txinfo'. |
== Example == | == Example == | ||
− | |||
<pre> | <pre> | ||
− | + | swap tokens("PancakeSwap", "BUSD", "BNB", "500", '#transaction details') | |
− | + | alert(#transaction details) | |
− | swap tokens("PancakeSwap"," | + | |
− | + | ||
</pre> | </pre> | ||
− | + | This script conducts a swap operation on PancakeSwap, swapping 500 BUSD for BNB. The details of the transaction are then alerted to the user. | |
− | + | ||
− | + | ||
− | + | Remember, all transactions on blockchain are irreversible, so always double-check before executing a script. The token names and values you replace in the script should match exactly with the actual tokens that exist on the specified blockchain and your wallet's holdings. | |
− | + | ||
− | + | ||
− | + |
Revision as of 19:07, 4 July 2023
swap tokens is a command that allows you to swap tokens using a decentralized exchange.
By utilizing this command, you can swap a token ("Token In ID") for another token ("Token Out ID") on a given decentralized exchange ("Exchange").
Parameters
Exchange: The decentralized exchange on which you want to conduct the token swap. The available exchanges will be dependent on the "SwapNames" list set in your environment.
Token In ID: The token which you want to swap from. The available tokens will depend on the "CoinNames" list set in your environment.
Token Out ID: The desired token which you want to acquire from the swap. The available tokens will depend on the "CoinNames" list set in your environment.
Amount: The amount of the "Token In ID" that you want to swap.
Transaction Info Variable: (optional) The variable which stores the transaction information after the swap occurs. Default is '#txinfo'.
Example
swap tokens("PancakeSwap", "BUSD", "BNB", "500", '#transaction details') alert(#transaction details)
This script conducts a swap operation on PancakeSwap, swapping 500 BUSD for BNB. The details of the transaction are then alerted to the user.
Remember, all transactions on blockchain are irreversible, so always double-check before executing a script. The token names and values you replace in the script should match exactly with the actual tokens that exist on the specified blockchain and your wallet's holdings.