Skip to content

Instantly share code, notes, and snippets.

const advanceBlockAtTime = (time) => {
return new Promise((resolve, reject) => {
web3.currentProvider.send(
{
jsonrpc: "2.0",
method: "evm_mine",
params: [time],
id: new Date().getTime(),
},
(err, _) => {
{
"jsonrpc": "2.0",
"method": "evm_mine",
"params": ["NUMBER_OF_SECONDS"],
"id": 1
}
describe("when the stream did start but not end", function() {
beforeEach(async function() {
await advanceBlockAtTime(
now
.plus(STANDARD_TIME_OFFSET)
.plus(5)
.toNumber(),
);
});
t0 1565455128964
Call to sablier.withdraw took 115.92673601210117 milliseconds.
1) makes the withdrawal
// Not what you want
advanceTimeAndBlock = async (time) => {
await advanceTime(time)
await advanceBlock()
return Promise.resolve(web3.eth.getBlock('latest'))
}
let snapshot;
let snapshotId;
before(async () => {
snapshot = await takeSnapshot();
snapshotId = snapshot.result;
});
after(async () => {
await revertToSnapshot(snapshotId);
takeSnapshot = async () => {
return new Promise((resolve, reject) => {
web3.currentProvider.send(
{
jsonrpc: "2.0",
method: "evm_snapshot",
id: new Date().getTime(),
},
(err, snapshotId) => {
if (err) {
balance.should.bignumber.satisfy(function(num) {
return (
num.isEqualTo(newBalance.minus(amount)) || num.isEqualTo(newBalance.minus(amount).plus(ONE_UNIT))
);
});
describe("when the stream did start but not end", function() {
const amount = new BigNumber(5).multipliedBy(1e18).toString(10);
beforeEach(async function() {
await web3.utils.advanceBlockAtTime(
now
.plus(STANDARD_TIME_OFFSET)
.plus(5)
.toNumber(),
);
@PaulRBerg
PaulRBerg / solcovBug.txt
Created August 22, 2019 23:30
Logs for the @0x/sol-coverage bug
Config {
_deepCopy: [ 'compilers' ],
_values:
{ truffle_directory:
'/Users/paulrberg/Projects/Sablier/Sablier/packages/payroll/node_modules/truffle',
working_directory: '/Users/paulrberg/Projects/Sablier/Sablier/packages/payroll',
network: 'development',
networks:
{ development: [Object],
kovan: [Object],