Swap tokens

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
'''defi swap tokens''' is a command that swaps tokens using a decentralized exchange (DEX).
+
'''swap tokens''' is a command that allows you to swap tokens using a decentralized exchange. This action is typically carried out by enterprise users involved in trading or managing diversified portfolios on decentralized exchanges.
 
+
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:''' This represents the DEX you wish to use for the token swap.
+
'''Exchange:''' The decentralized exchange platform on which the token swap will be executed. You can select a specific exchange from the dropdown menu.
  
'''Token In ID:''' The ID of the token that you wish to swap from.
+
'''Token In ID:''' The identifier for the token you want to swap from. You can either select a token from the dropdown menu or enter its contract address.
  
'''Token Out ID:''' The ID of the token that you wish to swap to.
+
'''Token Out ID:''' The identifier for the token you want to swap to. You can either select a token from the dropdown menu or enter its contract address.
  
'''Amount:''' The amount of "Token In ID" that you want to swap.
+
'''Amount:''' The quantity of the 'Token In' that you wish 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'.
+
'''Transaction Info Variable:''' (Optional) The name of a variable you can use to store the transaction information associated with the token swap. If not specified, the default value '#txinfo' is used.
  
 
== Example ==
 
== Example ==
  
 
<pre>
 
<pre>
defi swap tokens("Uniswap", "ETH", "DAI", "1", "#transactionInfo")
+
ui console view
ui text msg("Transaction Info: {#transactionInfo}")
+
config defi wallet("your private key here")
 +
swap tokens("PancakeSwap","0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c","0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82","10")
 +
log("Transaction Info: {#txinfo}")
 
</pre>
 
</pre>
  
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.
+
Note that you should replace "your private key here" with your actual private key. Private keys are sensitive information that should be handled with ultimate care.
 +
 
 +
The output of this script will be the transaction info of the token swap action. For example, it could include details like the transaction hash, the number of gas used, the time at which the transaction was included in a block, etc.
 +
 
 +
The actual output might look something like:
 +
<blockquote>
 +
Transaction Info: {"blockHash":"0x1f51bbceec31819c5ab9a17a73e6cf9a1f412ac85a34005d6ca522a34450dc53","blockNumber":11061824,"contractAddress":null,"cumulativeGasUsed":1690539,"from":"0xe3f3589c4943f8c8a3b2b4c5b5a837c215ba3a8b","gasUsed":21706,"logsBloom":"0x04000000000000040040000000000000000000000000..."}
 +
</blockquote>

Revision as of 18:58, 4 July 2023

swap tokens is a command that allows you to swap tokens using a decentralized exchange. This action is typically carried out by enterprise users involved in trading or managing diversified portfolios on decentralized exchanges.

Parameters

Exchange: The decentralized exchange platform on which the token swap will be executed. You can select a specific exchange from the dropdown menu.

Token In ID: The identifier for the token you want to swap from. You can either select a token from the dropdown menu or enter its contract address.

Token Out ID: The identifier for the token you want to swap to. You can either select a token from the dropdown menu or enter its contract address.

Amount: The quantity of the 'Token In' that you wish to swap.

Transaction Info Variable: (Optional) The name of a variable you can use to store the transaction information associated with the token swap. If not specified, the default value '#txinfo' is used.

Example

ui console view
config defi wallet("your private key here")
swap tokens("PancakeSwap","0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c","0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82","10")
log("Transaction Info: {#txinfo}")

Note that you should replace "your private key here" with your actual private key. Private keys are sensitive information that should be handled with ultimate care.

The output of this script will be the transaction info of the token swap action. For example, it could include details like the transaction hash, the number of gas used, the time at which the transaction was included in a block, etc.

The actual output might look something like:

Transaction Info: {"blockHash":"0x1f51bbceec31819c5ab9a17a73e6cf9a1f412ac85a34005d6ca522a34450dc53","blockNumber":11061824,"contractAddress":null,"cumulativeGasUsed":1690539,"from":"0xe3f3589c4943f8c8a3b2b4c5b5a837c215ba3a8b","gasUsed":21706,"logsBloom":"0x04000000000000040040000000000000000000000000..."}
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox