Without prompt mentioning version of Dune, ChatGPT provides Dune v1 based query. Limiting the date interval is also possible.
With provided query, it gives an error on Dune:
The error indicating the
INTERVAL 3 MONTH is not being supported. I asked to fix it, and ChatGPT identified the issue.
The lastly provided query gets the expecting tx count.
Then, I tried little more complicated query. The prompt is:
Provide a query that give transaction data of top 5 stablecoins. Time INTERVAL is 3 months. Limit 100000. Value has to be greater than 0.5 ETH.
It looks correct, but if you look carefully, the token address syntax is wrong. It has to be
Correcting it via ChatGPT also works.
Yep, the query works.
So this is final query.
SELECT evt_tx_hash AS tx_hash, contract_address AS token_address, tr."from" AS from_address, tr."to" AS to_address, tr.value AS amount FROM erc20."ERC20_evt_Transfer" tr WHERE contract_address IN ( '\xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', -- USDC '\xdac17f958d2ee523a2206206994597c13d831ec7', -- USDT '\x6b175474e89094c44da98b954eedeac495271d0f', -- DAI '\x57ab1ec28d129707052df4df418d58a2d46d5f51', -- sUSD '\x8e870d67f660d95d5be530380d0ec0bd388289e1' -- PAX ) AND tr.value > 0.5 * 1e18 -- greater than 0.5 ETH AND evt_block_time >= CURRENT_TIMESTAMP - INTERVAL '3 months' ORDER BY evt_block_time DESC LIMIT 100000;