Skip to content

Instantly share code, notes, and snippets.

@z0r0z
z0r0z / LilSuperfluidNFT.sol
Created March 12, 2022 00:26
A simple token streaming manager represented by NFTs
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.10;
import 'https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol';
import 'https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol';
/// @title lil superfluid nft
/// @author Miguel Piedrafita, Ross Campbell
/// modified from (https://github.com/m1guelpf/lil-web3/blob/main/src/LilSuperfluid.sol)
/// @notice A simple token streaming manager represented by NFTs
@brockelmore
brockelmore / pushable_array.sol
Created January 19, 2022 23:20
Pushable array datatype for solidity
// SPDX-License-Identifier: UNLICENSE
pragma solidity >=0.8.0 <0.9.0;
// NOT TESTED - USE AT YOUR OWN RISK
// Supports 32 byte word types. Could be easily extended to multiword types by
// passing in the size of the elements as well though
struct PushableArray {
@hrkrshnn
hrkrshnn / generic.org
Last active April 21, 2024 01:51
Some generic writeup about common gas optimizations, etc.

Upgrade to at least 0.8.4

Using newer compiler versions and the optimizer gives gas optimizations and additional safety checks for free!

The advantages of versions 0.8.* over <0.8.0 are:

  • Safemath by default from 0.8.0 (can be more gas efficient than some library based safemath).
  • Low level inliner from 0.8.2, leads to cheaper runtime gas. Especially relevant when the contract has small functions. For
# Ethereum helper methods
# source this in your .bashrc or .zshrc file with `. ~/.ethrc`
# --- Solidity sandbox ---
# https://github.com/maurelian/solidity-sandbox
scratch() {
dir=$(pwd)
cd ~/Documents/projects/solidity-sandbox || exit
bash newTest.sh $1
cd "$dir" || exit
@peterVG
peterVG / ipfs-on-raspberry-pi.md
Last active April 28, 2024 22:34
Put IPFS decentralized storage on your Raspberry Pi with USB storage

I put IPFS on a Raspberry Pi and so should you!

Total cost of joining the decentralized storage revolution with your own lo-fi node: $124 USD

raspberry-ipfs