Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Airdrop Indirect Calculation #325

@shotaronowhere

Description

@shotaronowhere

Object.entries(liquidityHoldersAtTimestamp).map(([holderAddress, tokenBalanceMapping]) => {
if (!users[holderAddress]) {
users[holderAddress] = initialUser;
}
users[holderAddress]["indirectHolding"] =
(users[holderAddress]["indirectHolding"] ?? 0) +
Object.entries(tokenBalanceMapping).reduce((acc, [tokenId, tokenBalance]) => {

if (event.type === "mint") {
tokenBalances[origin][token0.id] = (tokenBalances[origin][token0.id] || 0) + Number(amount0);
tokenBalances[origin][token1.id] = (tokenBalances[origin][token1.id] || 0) + Number(amount1);
} else {
tokenBalances[origin][token0.id] = (tokenBalances[origin][token0.id] || 0) - Number(amount0);
tokenBalances[origin][token1.id] = (tokenBalances[origin][token1.id] || 0) - Number(amount1);
}

IIUC, liquidity events consist of mint and burn logs. Doesn't this miss transfers? If you mint a LP position from acount0, transfer it to account1, then burn it from account1, it wouldn't reflect in the indirect holdings?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions