[SOLVED] Passing variables using moralis.execute

I am trying to interact with a smart contract function using Moralis however, I am not sure how to pass variables to the smartcontract as the function issueTokens takes one.

const options = {
  contractAddress: "0xaa65c1E874a1e094Ed39585b038B54b2E38e6E53",
  functionName: "issueTokens",
  abi: ABI,

I keep getting prompted with the error [’_amount is required’]
fiy (the smart contract is on kovan testnet)

The smartcontract function:

 function issueTokens(uint _amount) public {
        // Only owner can call this function
        require(msg.sender == owner, "caller must be the owner");

        // Issue tokens to all stakers
        for (uint i=0; i<stakers.length; i++) {
            address recipient = stakers[i];
            uint256 balance = stakingBalance[recipient];
            if(balance > 0) {
                dappToken.transfer(recipient, getCalculatedAmount(balance));
            }
        }
    }

Just went through the docs all I had to do is:

const options = {
 contractAddress: "0xaa65c1E874a1e094Ed39585b038B54b2E38e6E53",
  functionName: "issueTokens",
  abi: ABI,
  params: {
    _amount : "1000000000000000000000",
    
  },
};```
1 Like