Skip to content

Commit

Permalink
feat: extra checks to ignore possible double counting
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtekgrinder committed Dec 19, 2024
1 parent 1a25e03 commit 2fe4bf0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions projects/rings/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const sdk = require("@defillama/sdk");
const { getLogs } = require('../helper/cache/getLogs');
const { ZeroAddress } = require("ethers");

module.exports = {
methodology: 'TVL counts the tokens deposited in the boring vaults.',
Expand Down Expand Up @@ -60,7 +61,7 @@ Object.keys(config).forEach(chain => {
// Compute balances based on the enter and exit logs for each asset
depositLogs.forEach(log => {
const { to, amount, asset } = log
if (amount == 0) {
if (amount == 0 || asset == ZeroAddress || to == ZeroAddress) {
return;
}
if (!balances[asset]) {
Expand All @@ -72,10 +73,9 @@ Object.keys(config).forEach(chain => {
balances[asset][to] += amount;
}
})

withdrawLogs.forEach(log => {
const { from, amount, asset } = log
if (amount == 0) {
if (amount == 0 || asset == ZeroAddress || from == ZeroAddress) {
return;
}
if (!balances[asset]) {
Expand Down

0 comments on commit 2fe4bf0

Please sign in to comment.