Skip to content

Conversation

@schottra
Copy link
Contributor

Previous version had a couple of quirks that were not ideal:

  • Technically we would count each of your claimable token accounts as separate addresses. There was also at least one edge case where a swap from one coin to another wouldn't count as any volume for the user involved since they wouldn't have AUDIO balance changes that matched the corresponding changes in the vaults.
  • External wallet txs can't rely on the owner of the account that saw a change in AUDIO corresponding to a vault change in AUDIO because, again, this could go through many layers.

So, alternative approach:

  1. Find balance changes in any AUDIO vault corresponding to a pool we are tracking. This is our volume.
    2a. Attempt to find claimable tokens transfers that occurred in the same tx. If so, credit for the volume goes to the AUDIO user bank of the user whose claimable tokens account(s) were involved. This is based on the sender_eth_address of the claimable tokens transfer.
    2b. If no claimable tokens transfer is found, the fee payer for the transaction gets credit for the volume.

We do still (left) join in the user_change and check the owner to see if it's either pool authority so that migrations don't get counted.

I need to read through this again tomorrow and make sure it makes sense. But I think this covers things more cleanly than the previous approach. Some possible considerations:

  • If for some reason we fail to find a claimable tokens tx with the same signature, we may attribute the volume to a relay fee payer. That shouldn't be the case though.
  • Since we only recently added fee payer tracking, we won't correctly attribute external txs indexed before today (they all get grouped into the null fee payer).
  • I guess, technically, if you were to construct a transaction that sent money through a claimable tokens account and signed it with an external wallet, said account would get credit for the volume. Shouldn't really be doing this outside the app though...right?

As a follow-on, if we see weird data here, we can always set up an exclude list of fee payer addresses. I'd rather not do that unless absolutely necessary, though.

-- Exclude volume from pool migrations
user_change.owner != '` + meteora_dbc.POOL_AUTHORITY_ADDRESS + `'
AND user_change.owner != '` + meteora_damm_v2.POOL_AUTHORITY_ADDRESS + `'
AND vault_change.change > 0
Copy link
Contributor

Choose a reason for hiding this comment

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

or less than, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean, I guessssss

(good catch 😅 )

@schottra schottra merged commit 8b4f164 into main Oct 30, 2025
5 checks passed
@schottra schottra deleted the feepayer-volume-credit branch October 30, 2025 20:43
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