Tracking Functions [SOLVED]


I would like your help to get data from functions that are within a contract. I need to track the amount of dividends that will be distributed to holders. Can I do this using Moralis?

I put some functions down here as an example.

uint256 public totalShares;
uint256 public totalDividends;
uint256 public totalDistributed;
uint256 public dividendsPerShare;
uint256 public dividendsPerShareAccuracyFactor = 10 ** 36;

uint256 currentIndex;

I appreciate your attention,

Hey @mrkt2

You can easily fetch this info using our web3API

Take a look at Moralis.Web3API.runContractFunction

For example you can run read-only functions wich contain needed variables :man_mechanic:

1 Like

Hi, thanks for the reply.

Unfortunately this doesn’t solve my problem, I’ve already tested all the functions that are inside the ABI, what I need is to access values stored inside the variables, is this possible externally?

Can I access values from functions that are not in the ABI?

are you sure you have the complete abi?
you can also edit an existing abi for a function and change its name there

1 Like

yes, I copied the ABI from bscscan and pasted it directly into the web3API session of admin.moralis.

I even edited the ABI putting the function that didn’t have in the original ABI but exists in the contract and it returned {}.

the other functions that exist in the ABI worked perfectly.

I need to track the contract dividends.

If you want to track events I suggest you to use Sync and Watch Contract Events

1 Like

If you want us to help you with debugging, please provide at least a link to the contract and the required function :raised_hands:

1 Like

I think I managed to solve it.

I compiled the Solidity contract in my environment and generated the ABI of all contracts within the main contract that is available in bscscan, after that I used the same method as before and got the answers from those functions that were not in the main ABI.

In addition I had to search the dividend payer contract to paste in the POST request of the moralis API.

Well, this was made easier thanks to the Moralis team, so I have to thank you very much for that.

If I have problems in the continuity of my work, I’ll get in touch with you.