Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Paul Razvan Berg paulrberg

💭
I may be slow to respond.
View GitHub Profile
View yarnTscErrors.txt
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
Basic deployment script used in a Buidler project
View deploymentScript.ts
// 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
Dummy test file used for reproducing a Buidler bug
View counter.ts
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
Dummy smart contract used for reproducing a Buidler bug
View Counter.sol
// 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 Feb 27, 2020
Use Argent's approveAndCall
View approveAndCall.js
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 Jan 21, 2020
Function that creates an instance of Apollo Client
View createClient.js
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 Jan 21, 2020
Use Apollo Client with Hooks and web3-react
View ApolloReactManager.js
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",
@paulrberg
paulrberg / EngineToProxy.md
Created Jan 14, 2020
Analogies between the Sablier Money Streaming Engine and the Dapp Proxy
View EngineToProxy.md

Engine to Proxy

Type Money Streaming Engine Dapp Proxy
function createStream createSalary
function withdrawFromStream withdrawFromSalary
function cancelStream cancelSalary
@paulrberg
paulrberg / isDeepTruthy.js
Created Dec 1, 2019
Custom type checking function for the typy library
View isDeepTruthy.js
const { t, addCustomTypes } = require("typy");
addCustomTypes({
isDeepTruthy: input => {
const keys = Object.keys(input);
for (let i = 0; i < keys.length; i += 1) {
const ownProperty = input[keys[i]];
console.log({ i, ownProperty });
if (t(ownProperty).isFalsy) {
return false;
@paulrberg
paulrberg / useEffectWithDelay.js
Last active Nov 30, 2019
Custom Hook for delaying side effects declaratively
View useEffectWithDelay.js
function useEffectWithDelay({ condition = false, func = () => {}, delay = 1000 }) {
useEffect(() => {
if (condition) {
const timeout = setTimeout(func, delay);
return () => {
clearTimeout(timeout);
};
}
return undefined;
You can’t perform that action at this time.