Asset Changes - Explained
Dive into the Asset Changes API with this detailed example of simulating a transaction to swap 1 USDC for UNI using Uniswap V2.
The beauty of simulation is that we can use any from address!
Let’s simulate a transaction using the Asset Changes API and explain the results.
We will swap 1 USDC for UNI using Uniswap V2 as our example.
curl
Response
User address - 0x07eee3bfdfa311f6f06d419c8ccca08a6efdd162 USDC contract - 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 USDC / UNI pool - 0xEBFb684dD2b01E698ca6c14F10e4f289934a54D6 Uniswap RouterV2 - 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D UNI contract - 0x1f9840a85d5af5bf1d1762f925bdaddc4201f984
-
User (
from) sends 1 USDC (contractAddress) to the Uniswap USDC / UNI pool (to).json -
The USDC / UNI pool (
from) sends 0.186 UNI (contractAddress) to the user (to).json -
1 USDC was swapped for 0.186 UNI 🎉