0

I'm developing a contract where I should be able to pay multiple user's addresses. I'm using TRON blockchain. I can use the TRONIDE developer API to send funds. But they recently shutdown their API for some reason so I think the better option would be to use the smart contract itself.

I can populate the address and the equivalent amount to transfer to each address and then pay the total amount from my DAPP.

{
'address1' : 10000,
'address2' : 20000,
'address3' : 50000
}

This would be my object.

So I'll create a DAPP to send 80000 in total and this object to my contract and my contract will distribute the funds accordingly.

I tried the below code but I keep getting errors (Mentioned below) Please help.

function performBonusCredit(string[][] _toPayArgs) external payable {
        //Perform send function here
    }
TypeError: Data location must be "calldata" for parameter in external function, but none was given.
function performBonusCredit(string toPayArgs) external payable {
                            ^--------------^

1 Answer 1

1

Just add calldata to the parameter. So the signature should be:

function performBonusCredit(string[][] calldata _toPayArgs) external payable {

You can read more about these data location markers here: https://docs.soliditylang.org/en/v0.8.0/types.html#data-location

1
  • Hi, I solved the issue by using uint256[] memory topayargs array declaration. Now I have an issue in calling this function from DAPP. When I send the array through the calling function, the values shows as 'NaN'. Jan 19, 2021 at 9:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.