1

Everybody loves testrpc, except me. So, I like to write unit test against real parity dev chain node. The question is how to fast forward timestamp(create new blocks) ?

function advanceBlock() {
  return new Promise((resolve, reject) => {
    web3.currentProvider.sendAsync({
      jsonrpc: '2.0',
      method: 'evm_mine',
      id: Date.now(),
    }, (err, res) => {
      return err ? reject(err) : resolve(res)
    })
  })
}

Need to create similar way for parity --chain dev

the only way that I could find right now is by overwriting now variable in MockedContract:

pragma solidity ^0.4.15;

import '../../contracts/WhitelistedCappedCrowdsale.sol';
contract WhitelistedCappedCrowdsaleMock is WhitelistedCappedCrowdsale {
    uint64 public time = now;

    function getTime() public contstant returns(uint64) {
       return time;
    }

    function setTime(uint64 _time) public {
        time = _time;
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.