In this blog post, we’ll look at how to swap tokens on DeFi exchanges, and bridge USDC to different blockchains. These are some of the most essential skills for moving money around in the DeFi ecosystem.
We’ll start out by setting up our console view, and configuring our DeFi wallet. Be sure to have your private key for your wallet. You can get this from your MetaMask wallet, as discussed in previous tutorials.
Next, we’ll make a swap on TraderJoe. We want USDC, so we’ll swap some of our AVAX. Our exchange will be TraderJoe, Token in will be AVAX, and Token out will be USDC. The amount will be $12, as this will help us in the next step.
As always, it’s important to log everything we do on the blockchain. Let’s drag our log object command over and fill it with the #txinfo variable from the previous command.
Finally, we’ll use the bridge usdc command to bridge the tokens from one network to another. For amount, we’ll put 12, because this is the minimum amount that we can bridge. The chain in will be Avalance, and the chain out will be BinanceSmartChain.
Finally, we’ll log our last transaction.
And that’s it! Now we can use that AVAX that we transferred from Coinbase, turn it into USDC or any other token, and move it across blockchains to work with different DeFi tools!
Hope this was helpful. See you next time.
ui console view
config defi wallet("")
swap tokens("TraderJoe","AVAX","USDC",1.238,#txinfo)
log object(#txinfo)
bridge usdc(12,"Avalanche","BinanceSmartChain",#txinfo)
log object(#txinfo)