ERC20 function to detect trading volume

Does someone know how to keep track of trading volume per address in a 24h timeframe? I want to use it as a condition so I can apply various effects for it.

If you could post a comprehensive list of all the conditional type functions that’d be great. I only know of the last gas/assuming last gas price.
I didn’t see an in-built function for detecting Uniswap liquidity and trading volume per exchange, per address, per time.

1 Like

Hi @catmoot,

Welcome to the community :wave:

Can you share a bit more detail about what you are trying to do? It wasn’t clear if you were trying to do this onchain or offchain?

Pure volume farming instead of liquidity farming. I need my smart contract to detect each person’s trading volume after 24 hours.

A person has like 1000$ worth of tokens and he trades 5000$ worth in volume under 24 hours. And I’d like my smart contract to differentiate between AMM and manual market exchanges. With AMM exchanges there’ll be natural slippage.

I’d like to do it onchain, meaning no external price feed software like chainlink oracles or whatever coinmarketcap uses. If that’s not possible I guess I’ll just use a price feed for better or for the worse, but it needs to individually detect each person’s trading volume so my smart contract may do something positive/negative depending their trading volume.

1 Like

Hi @catmoot,

I am not sure how you would do this. Perhaps tracking all transfers for a token in rolling windows of time, but this feels like it would be expensive in terms of gas.

You could look to see if you could use ideas from ERC20Snapshot

Unfortunately I don’t think I can give much input on this. Hopefully someone in the community might be able to give input.

Hi @catmoot,

Did you come up with a solution?