Skip to content

Instantly share code, notes, and snippets.

View z0r0z's full-sized avatar
💭
codin qualia 🪄

ross z0r0z

💭
codin qualia 🪄
View GitHub Profile
@DanielVF
DanielVF / erc20.sol
Last active February 7, 2023 21:25
Event Only Cursed ERC20
pragma solidity >=0.8.17;
// Cursed ERC20 that does everything in events.
// by @danielvf, based solmate by @transmissions11
abstract contract ERC20 {
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 amount);
string public name;
@Amxx
Amxx / UniversalWrapper.sol
Last active August 9, 2023 08:08
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.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/interfaces/IERC20.sol";
import "@openzeppelin/contracts/interfaces/IERC721.sol";
import "@openzeppelin/contracts/interfaces/IERC721Receiver.sol";
import "@openzeppelin/contracts/interfaces/IERC1155.sol";
import "@openzeppelin/contracts/interfaces/IERC1155Receiver.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
@Vectorized
Vectorized / YulSnippets.sol
Last active April 29, 2023 21:55
Solidity Yul Assembly Snippets
// SPDX-License-Identifier: MIT
// Author: vectorized.eth
pragma solidity ^0.8.0;
pragma abicoder v2;
// DISCLAIMER:
// This is experimental software and is provided on an "as is" and "as available" basis.
// We do not give any warranties and will not be liable for any loss incurred through any use of this codebase.
library Base64 {
@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