Swap tokens
(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 | + | '''defi swap tokens''' is a command that swaps tokens using a decentralized exchange (DEX). |
− | This command is | + | 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:''' | + | '''Exchange:''' This represents the DEX you wish to use for the token swap. |
− | '''Token In ID:''' The | + | '''Token In ID:''' The ID of the token that you wish to swap from. |
− | '''Token Out ID:''' The | + | '''Token Out ID:''' The ID of the token that you wish to swap to. |
− | '''Amount:''' The amount of | + | '''Amount:''' The amount of "Token In ID" that you want to swap. |
− | '''Transaction Info Variable:''' ( | + | '''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 | + | 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. |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + |
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.