Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

126
Views
TimeCrowdsale.open() always returns as closed after deployed to development network

In a nutshell Im not understanding why my deployed TimedCrowdsale never opens

Deploying a TimeCrowdsale contract to the Truffle development network

In my migration script I deploy the TimeCrowdsale contract. After deployment I realise the crowdsale never gets to open state. Every time i run the debug script i get the same result.

Executing crowdsale_debug.js
crowdsale open?: false
crowdsale opening time: 1641354700
crowdsale closing time: 1641355000

Latest block timestamp: 1641354615

The isOpen() function of the TimedCrowdsale.sol is as follow

function isOpen() public view returns (bool) {
        return block.timestamp >= _openingTime && block.timestamp <= _closingTime;
    }

I know that in testing you can use the openzep testhelpers to advance time. But how will I do so outside of testing?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The block timestamp is lower than the opening time. So this part of the expression returns false

// 1641354615 >= 1641354700 // false
block.timestamp >= _openingTime

which causes the isOpen() function to return false.


You can increase the Ganache (Truffle development network) time using the evm_increaseTime JSON-RPC method, passing it the amount of seconds as the only parameter.

Outside of the test script, you can send a CURL request to your local Ganache network:

curl -X POST \
  http://localhost:7545 \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "evm_increaseTime",
    "params": [
      100000
  ]
}'
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!