Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

127
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda