Skip to content

Instantly share code, notes, and snippets.

// SPDX-License-Identifier: Unlicense
pragma solidity >=0.8.4;
/// @title Create2Utility
/// @author Paul Razvan Berg
/// @dev Forked from OpenZeppelin
/// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.5.0/contracts/utils/Create2.sol
contract Create2Utility {
/// @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the
/// `bytecodeHash` or `salt` will result in a new destination address.
@PaulRBerg
PaulRBerg / print-github-secret.yaml
Last active March 8, 2022 18:17
Simple workflow to print a GitHub Secret because GitHub doesn't offer this feature yet
name: "Echo GitHub secret"
on:
push:
branches:
- "main"
jobs:
print-github-secret:
runs-on: "ubuntu-latest"
@PaulRBerg
PaulRBerg / rename-git.tag.sh
Created October 20, 2021 15:03
Utility Bash script to rename git tags
#!/bin/bash
git tag $NEW $OLD
git tag -d $OLD
git push origin $NEW :$OLD
import { Signer } from "@ethersproject/abstract-signer";
import { keccak256 } from "@ethersproject/keccak256";
import {
H_TOKEN_MATURITY_ONE_YEAR,
USDC_DECIMALS,
USDC_NAME,
USDC_SYMBOL,
WBTC_DECIMALS,
WBTC_NAME,
WBTC_SYMBOL,
@PaulRBerg
PaulRBerg / getRandomBytes32.ts
Created September 10, 2021 15:43
Random bytes32 generator written in TypeScript
export function getRandomBytes32(): string {
const length: number = 64;
const array: number[] = [...Array(length)];
const number: string = array.map(() => Math.floor(Math.random() * 16).toString(16)).join("");
return "0x" + number;
}
@PaulRBerg
PaulRBerg / src-maps-bug-2nd-case.json
Last active September 6, 2021 17:38
Solidity source maps bug 2nd case
{
"deployedBytecode": "6080604052600436106100695760003560e01c80638da5cb5b116100435780638da5cb5b146100d55780639d1595681461010d578063d29d44ee1461013157600080fd5b806309924a40146100755780631cff79cd146100975780634b3f2889146100c057600080fd5b3661007057005b600080fd5b34801561008157600080fd5b5061009561009036600461054a565b610151565b005b6100aa6100a5366004610488565b61019b565b6040516100b7919061057f565b60405180910390f35b3480156100cc57600080fd5b506100956102e4565b3480156100e157600080fd5b506000546100f5906001600160a01b031681565b6040516001600160a01b0390911681526020016100b7565b34801561011957600080fd5b5061012360015481565b6040519081526020016100b7565b34801561013d57600080fd5b5061009561014c366004610466565b61037b565b6000546001600160a01b031633146101965760005460405163cc6bdb1d60e01b81526001600160a01b0390911660048201523360248201526044015b60405180910390fd5b600155565b6000546060906001600160a01b031633146101de5760005460405163cc6bdb1d60e01b81526001600160a01b03909116600482015233602482015260440161018d565b6001600160a01b03831661020557604051630a04e
@PaulRBerg
PaulRBerg / src-maps-bug-1st-case.json
Last active September 6, 2021 17:40
Solidity source maps bug 1st case
{
"deployedBytecode": "6080604052600436106100695760003560e01c80638da5cb5b116100435780638da5cb5b146100d55780639d1595681461010d578063d29d44ee1461013157600080fd5b806309924a40146100755780631cff79cd146100975780634b3f2889146100c057600080fd5b3661007057005b600080fd5b34801561008157600080fd5b5061009561009036600461054a565b610151565b005b6100aa6100a5366004610488565b61019b565b6040516100b7919061057f565b60405180910390f35b3480156100cc57600080fd5b506100956102e4565b3480156100e157600080fd5b506000546100f5906001600160a01b031681565b6040516001600160a01b0390911681526020016100b7565b34801561011957600080fd5b5061012360015481565b6040519081526020016100b7565b34801561013d57600080fd5b5061009561014c366004610466565b61037b565b6000546001600160a01b031633146101965760005460405163cc6bdb1d60e01b81526001600160a01b0390911660048201523360248201526044015b60405180910390fd5b600155565b6000546060906001600160a01b031633146101de5760005460405163cc6bdb1d60e01b81526001600160a01b03909116600482015233602482015260440161018d565b6001600160a01b03831661020557604051630a04e
@PaulRBerg
PaulRBerg / sourceMaps.txt
Created September 5, 2021 12:29
Source maps for Adder.sol
64:152:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;85:129;;;;;;:::i;:::-;192:5;;85:129;;;;413:25:1;;;401:2;386:18;85:129:0;;;;;;;14:248:1;82:6;90;143:2;131:9;122:7;118:23;114:32;111:52;;;159:1;156;149:12;111:52;-1:-1:-1;;182:23:1;;;252:2;237:18;;;224:32;;-1:-1:-1;14:248:1:o
@PaulRBerg
PaulRBerg / deployedBytecode.txt
Created September 5, 2021 12:28
Deployed bytecode for Adder.sol
6080604052348015600f57600080fd5b506004361060285760003560e01c8063771602f714602d575b600080fd5b603c6038366004604e565b0190565b60405190815260200160405180910390f35b60008060408385031215606057600080fd5b5050803592602090910135915056fea164736f6c6343000807000a
@PaulRBerg
PaulRBerg / opcodes.txt
Last active September 5, 2021 12:31
Opcodes for Adder.sol
PUSH1
0x80
PUSH1
0x40
MSTORE
CALLVALUE
DUP1
ISZERO
PUSH1
0xF