Skip to content

Instantly share code, notes, and snippets.

View PaulRBerg's full-sized avatar

Paul Razvan Berg PaulRBerg

View GitHub Profile
@PaulRBerg
PaulRBerg / BiomarkersByCategory.csv
Last active April 3, 2024 06:35
Two CSV versions of my biomarkers database, ordered (i) by category and (ii) by importance. See https://prberg-health.notion.site/4903c065ba664c5bb799c7ade03ba653?v=077dd2df728e4b6a8561d776669a3424&pvs=4
Name Unit Optimal Range Category Subcategory Importance Procedure
Apolipoprotein B (ApoB) mg/dL x<80 Cardiovascular Apolipoproteins Highly Important Blood
Apolipoprotein E (ApoE) mg/dL 23<x<63 Cardiovascular Apolipoproteins Quite Important Blood
Apolipoprotein A1 (ApoA1) mg/dL 131<x Cardiovascular Apolipoproteins Somewhat Important Blood
LDL-C mg/dL x<100 Cardiovascular Lipids Highly Important Blood
VLDL mg/dL x<15 Cardiovascular Lipids Highly Important Blood
HDL-C mg/dL 40<x Cardiovascular Lipids Quite Important Blood
Total Cholesterol mg/dL x<200 Cardiovascular Lipids Quite Important Blood
Triglycerides mg/dL x<100 Cardiovascular Lipids Quite Important Blood
Total Lipids Number 400<x<700 Cardiovascular Lipids Somewhat Important Blood
@PaulRBerg
PaulRBerg / expected-lockup-linear.txt
Created December 18, 2023 15:50
Expected bytecode of the SablierV2LockupLinear contract (V2.1 release) on Ethereum Mainnet
0x60a034620003e757601f196001600160401b03601f62004c523881900382810185168601919084831187841017620003ec57808792606094604052833981010312620003e75783516001600160a01b03928382169291839003620003e7576020918287015196858816809803620003e75760400151948516809503620003e7576200008962000402565b90601c82527f5361626c696572205632204c6f636b7570204c696e656172204e46540000000084830152620000bd62000402565b601181527029a0a116ab1916a627a1a5aaa816a624a760791b8582015230608052600080546001600160a01b031990811688178255600180548216909b178b5596817fbdd36143ee09de60bdefca70680e0f71189b2ed7acee364b53917ad433fdaf808180a38351858111620003d35760039485548c81811c91168015620003c8575b89821014620003b45790818684931162000361575b508890868311600114620002f8578492620002ec575b505060001982871b1c1916908b1b1784555b8151948511620002d8576004958654998b8b811c9b168015620002cd575b828c1014620002ba57848b1162000271575b869798999a50819487116001146200020a57505093620001fe575b505082871b92600019911b1c19161790555b600a541617600a5560095560405161482f9081620004238239608051816145590152f35b
@PaulRBerg
PaulRBerg / actual-lockup-linear.txt
Last active December 18, 2023 15:48
Actual bytecode of the SablierV2LockupLinear contract (V2.1 release) on Ethereum Mainnet
0x60a034620003e757601f196001600160401b03601f62004c523881900382810185168601919084831187841017620003ec57808792606094604052833981010312620003e75783516001600160a01b03928382169291839003620003e7576020918287015196858816809803620003e75760400151948516809503620003e7576200008962000402565b90601c82527f5361626c696572205632204c6f636b7570204c696e656172204e46540000000084830152620000bd62000402565b601181527029a0a116ab1916a627a1a5aaa816a624a760791b8582015230608052600080546001600160a01b031990811688178255600180548216909b178b5596817fbdd36143ee09de60bdefca70680e0f71189b2ed7acee364b53917ad433fdaf808180a38351858111620003d35760039485548c81811c91168015620003c8575b89821014620003b45790818684931162000361575b508890868311600114620002f8578492620002ec575b505060001982871b1c1916908b1b1784555b8151948511620002d8576004958654998b8b811c9b168015620002cd575b828c1014620002ba57848b1162000271575b869798999a50819487116001146200020a57505093620001fe575b505082871b92600019911b1c19161790555b600a541617600a5560095560405161482f9081620004238239608051816143320152f35b
@PaulRBerg
PaulRBerg / constructor-args.txt
Last active December 18, 2023 15:43
Standard JSON input to verify the SablierV2LockupLinear contract (V2.1 release) on Ethereum Mainnet
0x00000000000000000000000079fb3e81aac012c08501f41296ccc145a1e15844000000000000000000000000c3be6bffaeab7b297c03383b4254aa3af2b9a5ba00000000000000000000000023ed5da55af4286c0de55facb414dee2e317f4cb
@PaulRBerg
PaulRBerg / generateAccentColor.sol
Created November 17, 2023 19:52
Function that generates a pseudo-random HSL color
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.19;
/// @notice Generates a pseudo-random HSL color by hashing together the `chainid`, the `sablier` address,
/// and the `streamId`. This will be used as the accent color for the SVG.
function generateAccentColor(address sablier, uint256 streamId) internal view returns (string memory) {
uint256 chainId = block.chainid;
uint32 bitField = uint32(uint256(keccak256(abi.encodePacked(chainId, sablier, streamId))));
unchecked {
uint256 hue = (bitField >> 16) % 360;
@PaulRBerg
PaulRBerg / autogen.sh
Created August 11, 2023 12:16
Shell script to generate Docusaurus site from NatSpec comments, see the original code: https://github.com/sablier-labs/v2-docs/blob/main/scripts/autogen.sh
#!/usr/bin/env bash
# Pre-requisites:
# - foundry (https://getfoundry.sh/)
# - rsync (https://github.com/WayneD/rsync)
# - pnpm (https://pnpm.io)
# - sd (https://github.com/chmln/sd)
# Strict mode: https://gist.github.com/vncsna/64825d5609c146e80de8b1fd623011ca
set -euo pipefail
@PaulRBerg
PaulRBerg / PRBProxyRegistry.bytecode
Created August 9, 2023 16:41
Bytecode for PRBProxyRegistry v4.0.1
6080806040523461001657612599908161001c8239f35b600080fdfe60806040818152600491823610156200001757600080fd5b60009260e08435811c928363092af8131462000fa2575082631ddef5b91462000eef5782634bddd93a1462000b9f5782635cabcdf71462000ada57826361be48591462000a7e5782636383afb214620008e057826366b0182d14620007d957826374912cd2146200074c578263775c300c14620006cd5782639d1bd1591462000608578263aa4b826a1462000525578263b31d1b9914620004bb578263b7fba4d3146200047b578263b96784031462000417578263fa557e9314620001e857508163fb4a4d081462000145575063ffa1ad7414620000f457600080fd5b34620001415781600319360112620001415780516200013d916200011882620011b1565b6005825264342e302e3160d81b602083015251918291602083526020830190620011f1565b0390f35b5080fd5b905034620001e4576020366003190112620001e457620001646200104a565b33845260066020528284205490926001600160a01b0392909183169081620001b8575050620001b1620001aa602095835190620001a18262001194565b8152336200131e565b93620017b6565b5191168152f35b825163bf0b215b60e01b8152339181019182526001600160a01b03909216602082015281906040010390fd
@PaulRBerg
PaulRBerg / IERC165.sol
Created June 23, 2023 12:26
Interfaces for IERC165
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
/// @notice Interface of the ERC165 standard, as defined in https://eips.ethereum.org/EIPS/eip-165. Implementers can
/// declare support of contract interfaces, which can then be queried by other contracts.
/// @dev Credits to OpenZeppelin under MIT license.
interface IERC165 {
/// @notice Returns true if this contract implements the interface defined by `interfaceId`. See the EIP to learn
/// more about how these ids are created.
///
@PaulRBerg
PaulRBerg / viaIR.md
Created May 30, 2023 13:55
Explanation of `--via-ir` setup

Via IR Setup

The contracts will be deployed to the production chains with the --via-ir flag enabled.

Using the Via IR compilation pipeline enables a host of powerful optimizations, albeit at the expense of significantly slower compilation times, which can hinder local development efficiency. However, it is crucial to test our contracts against this optimized version, as this is what end users will ultimately interact with.

In order to strike a balance, we have come up with a setup that allows for efficient development and testing on local machines, while still ensuring compatibility with the IR-enabled version. Our approach involves building and testing the contracts normally on local machines, while leveraging the CI environment to build and test the IR-enabled contracts. This ensures rapid development and testing while providing confidence that the contracts function as intended when deployed (with tests passing both with and without IR enabled).

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.19;
import { Script } from "forge-std/Script.sol";
abstract contract BaseScript is Script {
/// @dev Included to enable compilation of the script without a $MNEMONIC environment variable.
string internal constant TEST_MNEMONIC = "test test test test test test test test test test test junk";
/// @dev Needed for the deterministic deployments.