I have done some work on captioned subject. For example, I can extract all getter functions (and some constructors as well) of all given smart contracts (in abi json file format). Then i can call (extracted) function of respective contract one by one after deploying (that) contracts on ganache. Now i am facing problem that how to extract setter functions (which take some inputs of 1, 2, 3 or more arguments) name alongwith their parameter's type/name. So that i could caller such setter function with some valid random values.

function abiExpr()
for(i=0; i<sources.length; i++){ // here sources has my contracts in json files

    getterFunctionsObject[i] = [] // making array to store getter function of each contract... I think , its not a good way ... but it working...

    constrObject[i] = [] // making array to store constructor of each contract

  setterFunctionsObject[i] = [] //making array to store setter function of each contract

  settersParameters[i] = []
  settersParameters[i][i] = [] // HERE I AM STUCK, and confused how to achiev..... want to make array to store every parameter of each setter for each contract ... * 

  for (let item of sources[i].abi) {

    if (item.type === "constructor") /// its OK for some constructor


    if (item.type === "function") // its OK 100 % 
      if((item.inputs).length ==0 && item.stateMutability==='view')

    if (item.type === "function") /// its not working .. HOW to achieve ...

            for(t=0 ; t<(item.inputs).length; t++)
              if ((item.inputs[t].name).length>0)

In order to summarize, how to store each parameter of each setter function of each contract. Is there any ABI APIs for my above mentioned tasks? If possible, also need some better coding approach, as i think above code is not good practice.

NOTE: For setter function, I means which take some parameters , and getter function means which just return some output.

1 Answer 1


Tools exist to convert the ABI into a Solidity interface, which contains all of the function names.

The data in an ABI is generic enough that interfaces can be generated to work with ^0.5.0 or ^0.4.22, or earlier if tuple types aren't used.

  • i think, i could not explained well.. actually i have also .sol files .. but i need to deploy, and then call their function automatically without looking into .sol file...
    – Amir Ali
    Nov 17, 2019 at 10:53

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.