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 3boxVerification.txt
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
✅ did:3:bafyreibj65scex56egywsjogkoymcirx4epjlrpwlzmwuqbkgy3toyxe6y ✅
Create your profile today to start building social connection and trust online at https://3Box.io/
@paulrberg
paulrberg / typechain-v4-error.txt
Created Nov 9, 2020
TypeChain v4 error in solidity-template repo
View typechain-v4-error.txt
Compiling...
Compiled 2 contracts successfully
Creating TypeChain artifacts in directory typechain for target ethers-v5
An unexpected error occurred:
SyntaxError: '=' expected. (8:15)
6 | import { Contract, ContractFactory, Overrides } from "@ethersproject/contracts";
7 |
> 8 | import type { Greeter } from "./Greeter";
| ^
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@paulrberg
paulrberg / CarefulMath.sol
Created Aug 14, 2020
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.6.10+commit.00c0fcaf.js&optimize=true&gist=
View CarefulMath.sol
/* SPDX-License-Identifier: LGPL-3.0-or-later */
pragma solidity ^0.6.10;
/**
* @title CarefulMath
* @author Compound
* @notice Exponential module for storing fixed-precision decimals.
* @dev Derived from OpenZeppelin's SafeMath library
*/
abstract contract CarefulMath {
@paulrberg
paulrberg / testotron.ts
Created Aug 13, 2020
Logging block timestamps
View testotron.ts
import { BigNumber } from "@ethersproject/bignumber";
import { Signer } from "@ethersproject/abstract-signer";
import { waffle } from "@nomiclabs/buidler";
import { expect } from "chai";
export function shouldBehaveLikeGreeter(_signers: Signer[]): void {
describe("1st Block", function () {
beforeEach(async function () {
await waffle.provider.send("evm_setNextBlockTimestamp", [1597348800]);
const blockTimestamp: BigNumber = await this.testotron.getBlockTimestamp();
@paulrberg
paulrberg / augmentations.d.ts
Created Jul 29, 2020
Augmenting the Context type used by Mocha in beforeEach, it, etc.
View augmentations.d.ts
import { Erc20 } from "../typechain/Erc20";
declare module "mocha" {
export interface Context {
token: Token;
}
}
View rebalancePseudocode.sol
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);
View call-exception.log
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 Jun 2, 2020
Makes the solidity vscode extension crash
View SbErc20.sol
/* 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";
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
You can’t perform that action at this time.