0

I have the following problem, I'm trying to call a function from Solidity function to Solidity modifier:

contract B is A

function checkIfIsValid()
    external pure onlyValidAddresses([manually put few addresses]) // what to put here?
{
    // some work
}

(abstract) Contract A

modifier onlyValidAddresses(address[] memory pAddresses)
{
    //work in a loop
    _;
}

closed as unclear what you're asking by goodvibration, Achala Dissanayake, shane, Rosco Kalis, Nicolas Massart Feb 26 at 10:37

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1

I'm not 100% sure I understood the question.

This?

pragma solidity 0.5.4;

contract A {

    modifier onlyValidAddresses(address[] memory pAddresses)
    {
        //work in a loop
        _;
    }    
}   

contract B is A {
    function checkIfIsValid(address[] calldata addresses)
        external pure onlyValidAddresses(addresses) // what to put here?
    {
        // some work
    }
}

Hope it helps.

  • Your solution will work but it needs to put data from outside for example via web3js. I would like to put data inside solidity from inherited contract to the base contract. – Radeg90 Feb 24 at 0:49
  • I'm afraid I don't understand what you want. As it is, it would go Web3/other contract => B.checkIfIsValue([addressList]) => A.onlyValidAddresses => // work in a loop. The addresses passed into B's function wind up in A's modifier and I thought that was what you wanted to accomplish. – Rob Hitchens - B9lab Feb 24 at 2:28
  • I simply want to build a dynamic array in solidity function and send it to modifier. If it were C# it would look like this: /*external pure*/ onlyValidAddresses(new int[] {0x04Wblabla, 0xadkljgkadljgad, etc}); – Radeg90 Feb 24 at 12:04

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