Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AgentFi TVL #10667

Merged

Conversation

max-yilang
Copy link
Contributor

  • Fix token addresses issue
  • Add pac finance strategy to TVL

@llamatester
Copy link

The adapter at projects/agentfi exports TVL:

blast                     2.42 M

total                    2.42 M 

@@ -57,8 +57,8 @@ async function getTvlForDexBalancer(agentAddresses, api) {
const reserve1BigN = BigNumber(reserve1)
const token0Balance = lpBalanceBigN.times(reserve0BigN).div(totalBigN)
const token1Balance = lpBalanceBigN.times(reserve1BigN).div(totalBigN)
api.add(RingTokenMappings[address0], token0Balance.toFixed(0))
api.add(RingTokenMappings[address1], token1Balance.toFixed(0))
api.add(RingTokenMappings[address0.toLowerCase()], token0Balance.toFixed(0))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not make any difference

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@g1nt0ki it actually does, I discovered today that the was refactor to use the addresses from the helper on the 14th, and since then defilama stopped updating TVL, run the code and there was error. I think because the some chars in token address from the helper is lowercase, but the token address return from the data read is not, thus it could not find a matching token and throws an error

const ADDRESSES = require('../../helper/coreAssets.json')
const { balanceFetcher, uniV2Lp, tokenAddress } = require('../ca')
const BigNumber = require("bignumber.js");


// underlying token mapping
const RingTokenMappings = {
    // fwUSDB -> USDB
    [ADDRESSES.blast.fwUSDB]: tokenAddress.USDB,
    // fwWETH -> WETH
    [ADDRESSES.blast.fwWETH]: tokenAddress.WETH,
};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway thanks for merging, appreciate the quick response

@g1nt0ki g1nt0ki merged commit f5102f6 into DefiLlama:main Jun 17, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants