In this tutorial, we will be showing you how to exchange USD for AVAX on Coinbase, and then send it to your DeFi wallet using UBot Studio.
- Configure Coinbase and your DeFi Wallet on UBot Studio. This will allow the bot to access your accounts and perform the necessary actions. To do this, simply drag over config coinbase and config defi.
- Log every step of the process to ensure the safety and security of your cryptocurrency. This way, if anything ever goes wrong, you’ll have a thorough log of everything that has happened so that you can figure out exactly where your cryptocurrency is.
- Drag the exchange crypto on coinbase command and set it to buy AVAX with USD.
- Drag the send crypto from coinbase command and set it to send AVAX to your DeFi wallet address.
- Double-check your balances and logs before and after completing the transaction.
By following these simple steps, you’ll be able to efficiently and securely fund your DeFi wallet using UBot Studio. Happy trading!
Here’s the code:
ui in main browser {
ui html snippet("<style>
body \{
background-color: #060606;
\}
.log-view \{
background-color: #282c34!important;
color: white;
\}
</style>
<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/atom-one-dark.min.css\" integrity=\"sha512-Jk4AqjWsdSzSWCSuQTfYRIF84Rq/eV0G2+tu07byYwHcbTGfdmLrHjUSwvzp5HvbiqK4ibmNwdcG49Y5RGYPTg==\" crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\" />
")
ui log view("Log")
}
config coinbase("","","")
config defi wallet("")
log("USD Balance: {$get coinbase balance("USD")}")
log("AVAX Balance: {$get coinbase balance("AVAX")}")
log("Buying AVAX with USD")
exchange crypto on coinbase(2,"AVAX-USD","Buy",#txinfo)
log object(#txinfo)
set(#avax amount,$object entity(#txinfo,"filled_size"),"Global")
log("amount of AVAX purchased: {#avax amount}")
set(#wallet balance before,$get native token balance("Avalanche"),"Global")
log("Current amount in Wallet: {$get native token balance("Avalanche")}")
log("Sending AVAX to Wallet")
send crypto from coinbase(#avax amount,"AVAX",$wallet address("Avalanche"),#txinfo)
wait for condition($get native token balance("Avalanche") > #wallet balance before,#avax amount,60)
wait(10)
log("Amount in wallet after transfer: {$get native token balance("Avalanche")}")