0

I'm building a defi dashboard. I need to value a DeFi wallet. I can value individual tokens that trade on a dex, and even LP receipts. But I'm having trouble with protocols like Adamant Finance, which do not give you a token receipt in your wallet. For example, this wallet has a $50 position in an Adamant vault (as of 1/5/2022). How would I detect this position and calculate its value using blockchain data, for example from PolygonScan?

https://debank.com/profile/0x704111edbee29d79a92c4f21e70a5396aedcc44a?chain=matic

1 Answer 1

1

For protocols that do not return a share token and keep the deposit logic inside their smart contract, you need to provide a custom implementation. This means integrating projects one by one.

You may be able to check the history of an account to see which protocols the wallet interacted with and use the custom integration to calculate the value of the deposits. Or the other way around by scanning protocols for the user's address.

For examples you can always check open-source implementations such as DefiLlama (although this is more on the TVL side) or Zapper feature submissions (some include instructions).

2
  • Thanks for the reply. As a dashboard developer, I'm naturally hoping for a generic solution rather than a custom implementation. Could I scan transaction history against a list of protocol deposit addresses? Does such a list exist? On DefiLama, how would I use it to calculate the Adamant value? I'm looking at github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/… and see the function async function valueInGauge(chain, block, GAUGE, HOLDER, transformAddress=a=>a) but how do I figure out what values these parameters take for the sample wallet I'm looking at? Commented Jan 5, 2022 at 18:50
  • Unfortunately I don't think there's such a list, open-source. There are maybe protocols with similar implementations e.g. Uniswap forks where you can reuse code, maybe some patterns you can identify, but most have unique methods to find out positions. For Adamant, I'm not very familiar with it specifically, but I guess you can check their vault addresses (maybe github.com/eepdev/vaults/blob/main/current_vaults.json). Had a quick look at one of the contracts and there seems to be a balanceOf(user) method polygonscan.com/address/…
    – razgraf
    Commented Jan 5, 2022 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.