Skip to content

Instantly share code, notes, and snippets.

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

ross z0r0z

💭
codin qualia 🪄
View GitHub Profile
@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
@z0r0z
z0r0z / CTX.sol
Created January 15, 2024 09:30
Dollars-to-donuts exchange. Demo: Circle <> Tether. Smol Swap Lego.
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.19;
/// @notice Dollars-to-donuts exchange.
/// Put in one thing for another thing.
contract CTX {
IERC20 constant C = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); // Circle dollars.
IERC20 constant T = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7); // Tether dollars.
uint256 constant F = 1; // Fee is just a lil bit. Placeholder. Someone should do the math.
@z0r0z
z0r0z / FlashPot.sol
Last active January 10, 2024 03:26
flash-lendable ETH wrapper with elastic shares
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.4;
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
/*///////////////////////////////////////////////////////////////
@z0r0z
z0r0z / Soulbinder.sol
Last active December 29, 2023 10:20
Bind your Soul to an NFT deed
// SPDX-License-Identifier: GPL-v3.0-or-later
pragma solidity >=0.8.0;
import 'https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol';
import 'https://github.com/kalidao/kali-contracts/blob/main/contracts/libraries/Base64.sol';
/// @notice Bind your Soul to an NFT Deed.
contract Soulbinder is ERC721("Soulbinder", "SOUL") {
/// -----------------------------------------------------------------------
/// Soul Logic
@z0r0z
z0r0z / Account.sol
Last active November 10, 2023 21:04
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.19;
/// @notice Receiver mixin for ETH and safe-transferred ERC721 and ERC1155 tokens.
/// @author Solady (https://github.com/Vectorized/solady/blob/main/src/accounts/Receiver.sol)
///
/// @dev Note:
/// - Handles all ERC721 and ERC1155 token safety callbacks.
/// - Collapses function table gas overhead and code size.
/// - Utilizes fallback so unknown calldata will pass on.
@z0r0z
z0r0z / GeneralizedGrimoire.md
Created January 5, 2022 02:15
MCV Grimoire for Investment Clubs, in github markdown with generalized references to allow for more options in chain and code references.

OPERATING AGREEMENT OF [[DAO LLC NAME]]

This Operating Agreement (this “Agreement”) sets forth the rights and obligations among [[DAO LLC NAME]], a Delaware limited liability company (the “Org”) and the members of the Org.

BACKGROUND

A. The Org has been formed for the purposes contemplated by this Agreement by the filing with the Secretary of State of the State of Delaware of a Certificate of Formation (the “Certificate”) in accordance with the Delaware Limited Liability Company Act (the “Delaware LLC Act”).

B. This Agreement is being entered into for the purposes of organizing and establishing the governance and operations of the Org and the rights and obligations of membership in the Org.

@z0r0z
z0r0z / AssetContractShared.sol
Last active July 12, 2023 14:05
Let us verify the contract source code of the most popular ERC1155 - OpenSea Shared Storefront (OPENSTORE) - 0x495f947276749ce646f68ac8c248420045cb7b5e
pragma solidity ^0.5.12;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
@z0r0z
z0r0z / ERC223ish.sol
Last active July 10, 2023 14:48
ERC223-like token for discussion in Final standard process.
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
/// @dev ERC223ish
/// @author z0r0z
contract ERC223ish {
event Approval(address indexed from, address indexed to, uint amt);
event Transfer(address indexed from, address indexed to, uint amt);
event Transfer(address indexed from, address indexed to, uint amt, bytes data);
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol";
import "https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol";
struct OTC {
address to;
ERC20 tkn0;
uint256 tkn0amt;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
error DeploymentFailed();
address constant TURNSTILE = 0xEcf044C5B4b867CFda001101c617eCd347095B44;
/// @notice Minimal proxy library.
/// @author Modified from Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibClone.sol)
library LibClone {