Swap tokens

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
(Created page with "'''swap tokens''' is a command that swaps an amount of one token for another using a decentralized exchange (DEX). This command is vital for operations dealing with DeFi, whe...")
 
Line 1: Line 1:
'''swap tokens''' is a command that swaps an amount of one token for another using a decentralized exchange (DEX).
+
'''defi swap tokens''' is a command that swaps tokens using a decentralized exchange (DEX).
  
This command is vital for operations dealing with DeFi, where token swaps happen frequently.
+
This command is especially designed for enterprise users who need to swap between different tokens on a DEX.
 +
 
 +
== User Level ==
 +
 
 +
This command is exclusively available for enterprise users.
  
 
== Parameters ==
 
== Parameters ==
  
'''Exchange:''' The decentralized exchange where the token swap will occur.
+
'''Exchange:''' This represents the DEX you wish to use for the token swap.
  
'''Token In ID:''' The input token that will be swapped out.
+
'''Token In ID:''' The ID of the token that you wish to swap from.
  
'''Token Out ID:''' The output token that will be received from the swap.
+
'''Token Out ID:''' The ID of the token that you wish to swap to.
  
'''Amount:''' The amount of the input token to be swapped.
+
'''Amount:''' The amount of "Token In ID" that you want to swap.
  
'''Transaction Info Variable:''' (Advanced, optional) The variable name where transaction information will be stored. The default value is '#txinfo'.
+
'''Transaction Info Variable:''' (Optional) This advanced parameter is the variable to which the transaction details will be stored. If this is not specified, it will default to a variable named '#txinfo'.
  
 
== Example ==
 
== Example ==
  
 
<pre>
 
<pre>
swap tokens("Uniswap", "ETH", "DAI", "1")
+
defi swap tokens("Uniswap", "ETH", "DAI", "1", "#transactionInfo")
 +
ui text msg("Transaction Info: {#transactionInfo}")
 
</pre>
 
</pre>
  
In the example above, the 'swap tokens' command swaps 1 ETH to DAI on the Uniswap network.  
+
In this example, the script swaps one ETH token for the equivalent amount in DAI tokens using the Uniswap DEX. It then displays the transaction info in the UI.
 
+
== Post-Run ==
+
 
+
After running this command, '''RecordTxData''' will be executed to record transaction data.
+
 
+
**Please note:**
+
 
+
Before swapping tokens, ensure you have sufficient balance and approved the DEX to interact with your tokens. Swapping tokens will also incur a gas fee, so ensure you have enough balance of the chain's native token (e.g., ETH for Ethereum-based chains, BNB for Binance Smart Chain, and so on).
+

Revision as of 18:30, 4 July 2023

defi swap tokens is a command that swaps tokens using a decentralized exchange (DEX).

This command is especially designed for enterprise users who need to swap between different tokens on a DEX.

User Level

This command is exclusively available for enterprise users.

Parameters

Exchange: This represents the DEX you wish to use for the token swap.

Token In ID: The ID of the token that you wish to swap from.

Token Out ID: The ID of the token that you wish to swap to.

Amount: The amount of "Token In ID" that you want to swap.

Transaction Info Variable: (Optional) This advanced parameter is the variable to which the transaction details will be stored. If this is not specified, it will default to a variable named '#txinfo'.

Example

defi swap tokens("Uniswap", "ETH", "DAI", "1", "#transactionInfo")
ui text msg("Transaction Info: {#transactionInfo}")

In this example, the script swaps one ETH token for the equivalent amount in DAI tokens using the Uniswap DEX. It then displays the transaction info in the UI.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox