Terra Bridge enables the cross-chain transfer of all tokens supported by Shuttle, including Terra native tokens, most mAssets, and also other token types from the Terra ecosystem.
For a complete in-depth on the Bridge :
First, we need to create Address pairs. To create this we need to understand the working and find the contracts responsible for these. Since we are only handling LUNA, MIR, UST bridging, it makes it easier.
For a bridging transaction from Terra to Ethereum, the asset is first sent to terra13yxhrk08qvdf5zdc9ss5mwsg5sf7zva9xrgwgc ****address, and then a similar amount of the asset is minted on the Ethereum chain. So one has to track the asset movement into the above address and also, minting events (using udm_events table) on the mainnet contracts.
Similarly, for a bridging transaction from Ethereum to Terra, the asset is burned on the Ethereum chain and then an equivalent amount of assets is released on Terra.
The contracts for the respective wrapped tokens are :
0xd2877702675e6ceb975b4a1dff9fb7baf4c91ea9 — wLUNA0x09a3ecafa817268f77be1283176b946c4ff2e608 — wMIR0xa47c8bf37f92abed4a126bda807a7b7498661acd — wUSTOnce we get these events, we can compare these two to match the addresses. We can do this by choosing pairs that occur within a 5 minute time period and a 5% difference in tokens transacted. This allows us to create an address map. This method isn’t entirely foolproof, however, it works to a great extent.
Once the address pairs are generated, we can find their respective native token balances. LUNA balances can be queried from the daily_balances table. For ETH, however, one has to create the sum of all ETH transactions into an address, subtract from it the ETH out of the address and the gas fees paid. This is easily achievable using udm_events and transactions table of Flipside