I have to track user activity in DEX smart contract and do some validation/operation based on that information.

DEX itself does not API to retrieve that info, but emit events, so is there any way to read transaction logs from the smart contract?


DEX smart contract in TRON blockchain: https://tronscan.org/#/contract/TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE/code


Here the Smart Contract itself with the events I am interested:

pragma solidity ^0.5.8;

interface IJustswapExchange {
  event TokenPurchase(address indexed buyer, uint256 indexed trx_sold, uint256 indexed tokens_bought);
  event TrxPurchase(address indexed buyer, uint256 indexed tokens_sold, uint256 indexed trx_bought);
  event AddLiquidity(address indexed provider, uint256 indexed trx_amount, uint256 indexed token_amount);
  event RemoveLiquidity(address indexed provider, uint256 indexed trx_amount, uint256 indexed token_amount);

   Smart contract code goes here ...

P.S. If possible I will need events filtered by the first argument.


Ethereum equivalent contract with events: https://etherscan.io/address/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984#code

contract Uni {
    event Transfer(address indexed from, address indexed to, uint256 amount);
  • Yes, there is... – goodvibration Sep 26 at 9:48
  • Can you provide details? I am new to blockchain, will be grateful if you share resources)) – Armen Yeganyan Sep 26 at 9:50
  • Can you provide the contract source code, and its address on the network? – goodvibration Sep 26 at 10:09
  • Its Justswap (analog of uniswap for TRON) Here is the contract itself: tronscan.org/#/contract/TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE/code – Armen Yeganyan Sep 26 at 10:12
  • Post the code as part of your question in plain text (no links or images), and only the relevant code (in your case, the prototype of the event that you're interested in). – goodvibration Sep 26 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.