Swap tokens
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.