I am using Remix to write a smart contract. One of the functions checks the block number before paying out a user:
contract MyContract {
uint lastBlockNumber;
// ...
function setLastBlockNumber(uint number) {
lastBlockNumber = number;
}
function claim() public {
if (block.number >= lastBlockNumber + 10) {
msg.sender.transfer(this.balance);
}
}
}
I don't see a way to set the block number in Remix so that I can test that if 10 blocks have passed it will actually pay out the balance. Is this possible, and if so how?
(Background: I'm coming to Solidity from JavaScript. I have noticed a block number field in the Debugger tab, but as far as I can tell that's a way of selecting a transaction to debug. I don't see anything in the Remix documentation about incrementing or setting the block number.)
ganache
. – user19510 Mar 5 '18 at 4:34