4

Truffle 4.0.1

I've got a contract declared "is Pausable" (OpenZeppelin framework) and I want to pause it as part of the deployment logic.

I'm getting an error, however, when invoking pause()

Error: Invalid number of arguments to Solidity function
    at Object.InvalidNumberOfSolidityArgs (/Users/sofend/.nvm/versions/node/v7.5.0/lib/node_modules/truffle/build/cli.bundled.js:43290:16)

The code seems straight-forward enough:

const MyContract = artifacts.require("./MyContract.sol");

module.exports = function (deployer, network, accounts) {

    const owner = accounts[0];

    return deployer.deploy(MyContract, {from: owner})
        .then(function () {

                  return MyContract.deployed().then((instance) => {
                      // pause the  contract
                      instance.pause(/*{from: owner}*/)    // I've tried it passing in the from: owner; tried it with call() etc.
                          .catch(function (error) {
                              console.error(error.stack);
                          })
                      ;
                  })
                      .catch(function (error) {
                          console.error(error.stack);
                      })
                      ;
              }.catch(function (error) {
                  console.error(error.stack);
              })
        );
};

And have tried variations of the call to pause():

.pause.call()

.pause({from: owner})

.pause.call({from: owner})

but all give the same error: Invalid number of arguments to Solidity function

The pause() function isn't declared to take any parameters.

What am I doing wrong?

3
  • 2
    It appear your code is fine. If you are on testrpc I'd try clearing truffle build/ directory, and redeploying, sometimes artifacts (inside build) gets corrupted and truffle gets confused.
    – Ismael
    Nov 5, 2017 at 15:41
  • 1
    I still have no idea what caused it. I've upgraded to Node 8.9.0 and that seems to have sorted things out.
    – sofend
    Nov 6, 2017 at 21:02
  • I had the problem, cleaning build folder did it for me. Dec 6, 2017 at 15:46

0

Your Answer

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