How to use the ganache-time-traveler.takeSnapshot function in ganache-time-traveler

To help you get started, we’ve selected a few ganache-time-traveler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aniemerg / yieldtoken / test / treasurer.js View on Github external
it("should allow repo holder to close repo and recieve remaining collateral", async() => {
    const TreasurerInstance = await Treasurer.deployed();
    var series = 2;
    snapShot = await helper.takeSnapshot();
    snapshotId = snapShot['result'];

    //fix margin for account 2 (it is underfunded from wipe test)
    await TreasurerInstance.join({from:accounts[2], value:web3.utils.toWei("1")});
    await TreasurerInstance.make(series, web3.utils.toWei("0"), web3.utils.toWei("1"), {from:accounts[2]}),

    await helper.advanceTimeAndBlock(SECONDS_IN_DAY * 1.5);
    await TreasurerInstance.settlement(series);
    var balance_before = await web3.eth.getBalance(accounts[2]);

    //run close
    const result = await TreasurerInstance.close(series, {from:accounts[2]});

    var balance_after = await web3.eth.getBalance(accounts[2]);
    const tx = await web3.eth.getTransaction(result.tx);
    var balance_after = await web3.eth.getBalance(accounts[2]);

ganache-time-traveler

A ganache utility that simplifies writing time dependent or stateless tests on a local Ethereum blockchain.

ISC
Latest version published 3 years ago

Package Health Score

46 / 100
Full package analysis