Skip to content

Instantly share code, notes, and snippets.

function rebalance(address user) returns (bool) {
uint currentTimestamp = block.timestamp;
if (currentTimestamp == priorRebalanceTimestamp) {
return true;
}
uint incomingDelta = 0;
for (incomingStream in incomingStreamsOf(user)) {
rebalance(incomingStream.sender);
uint streamBalanceOfRecipient = streamBalanceOfRecipient(incomingStream.id);
Greeter
greet
Deploying a Greeter with greeting: Hello from greeter!
✓ should return the greeting (42ms)
getBlockNumber
Deploying a Greeter with greeting: Hello from greeter!
✓ should sum up the number
ChildGreeter
getBlockNumber
@PaulRBerg
PaulRBerg / SbErc20.sol
Created June 2, 2020 19:10
Makes the solidity vscode extension crash
/* SPDX-License-Identifier: LGPL-3.0-or-later */
pragma solidity ^0.6.8;
import "./ErrorReporter.sol";
import "./SbAdmin.sol";
import "./SbErc20Interface.sol";
import "./SbErc20Storage.sol";
import "./ReentrancyGuard.sol";
src/dataDisplay/Text/index.tsx:16:12 - error TS2345: Argument of type '({ color, theme }: ThemedStyledProps<Pick<DetailedHTMLProps<HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "slot" | ... 255 more ... | "valueLink"> & { ...; } & Props, DefaultTheme>) => string | Disabled' is not assignable to parameter of type 'Interpolation<ThemedStyledProps<Pick<DetailedHTMLProps<HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "slot" | ... 255 more ... | "valueLink"> & { ...; } & Props, DefaultTheme>>'.
Type '({ color, theme }: ThemedStyledProps<Pick<DetailedHTMLProps<HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "slot" | ... 255 more ... | "valueLink"> & { ...; } & Props, DefaultTheme>) => string | Disabled' is not assignable to type 'InterpolationFunction<ThemedStyledProps<Pick<DetailedHTMLProps<HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "slot" | ... 255 more ... | "valueLink"> & { ...; } & Props, DefaultTheme>>'.
Type 'string | Disabled' is not assignab
@PaulRBerg
PaulRBerg / deploymentScript.ts
Created May 22, 2020 15:04
Basic deployment script used in a Buidler project
// We require the Buidler Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
// When running the script with `buidler run <script>` you'll find the Buidler
// Runtime Environment's members available in the global scope.
import bre from "@nomiclabs/buidler";
import { Contract, ContractFactory } from "ethers";
async function main(): Promise<void> {
// Buidler always runs the compile task when running scripts through it.
// If this runs in a standalone fashion you may want to call compile manually
@PaulRBerg
PaulRBerg / counter.ts
Last active May 20, 2020 19:39
Dummy test file used for reproducing a Buidler bug
import chai from "chai";
import { deployContract, solidity } from "ethereum-waffle";
import { waffle } from "@nomiclabs/buidler";
import CounterArtifact from "../artifacts/Counter.json";
import { Counter } from "../typechain/Counter";
chai.use(solidity);
const { expect } = chai;
@PaulRBerg
PaulRBerg / Counter.sol
Created May 20, 2020 01:03
Dummy smart contract used for reproducing a Buidler bug
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity ^0.6.8;
contract Counter {
uint256 public count = 0;
event CountedTo(uint256 number);
function countUp() public returns (uint256) {
@PaulRBerg
PaulRBerg / approveAndCall.js
Created February 27, 2020 11:24
Use Argent's approveAndCall
const data = payrollContract.interface.functions.createSalary.encode([
recipientAddress,
deposit.toString(10),
tokenAddress,
startTime.toString(10),
stopTime.toString(10),
]);
const gasLimit = GAS_LIMITS.tokenApproval + createSalaryGasLimit;
console.log({ data, gasLimit });
try {
@PaulRBerg
PaulRBerg / createClient.js
Created January 21, 2020 18:58
Function that creates an instance of Apollo Client
import typy from "typy";
import { ApolloClient } from "apollo-client";
import { HttpLink } from "apollo-link-http";
import { InMemoryCache } from "apollo-cache-inmemory";
import cacheRedirects from "./cacheRedirects";
import resolvers from "./resolvers";
import typeDefs from "./typeDefs";
@PaulRBerg
PaulRBerg / ApolloReactManager.js
Last active January 21, 2020 20:12
Use Apollo Client with Hooks and web3-react
import React, { useMemo } from "react";
import { ApolloClient } from "apollo-client";
import { ApolloProvider } from "@apollo/react-hooks";
import { HttpLink } from "apollo-link-http";
import { InMemoryCache } from "apollo-cache-inmemory";
import { useWeb3React } from "@web3-react/core";
const CHAIN_IDS_TO_NAMES = {
1: "mainnet",