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 / 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 / FlashPotBorrow.sol
Created December 27, 2021 00:02
test flash borrowing on flashpot - just send a fee's worth of ETH to this address then call flashBorrow (using 0 address for 'address')
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.4;
import "https://github.com/Rari-Capital/solmate/blob/audit-fixes/src/utils/SafeTransferLib.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/interfaces/IERC3156FlashLender.sol";
contract FlashPotBorrow is IERC3156FlashBorrower {
using SafeTransferLib for address;
@z0r0z
z0r0z / SocialGraphNFT.sol
Created December 27, 2021 22:07
NFT that is a social graph where ID holders can add new ID holders through overridden transfers
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
import "https://github.com/Rari-Capital/solmate/blob/audit-fixes/src/tokens/ERC721.sol";
/// @notice NFT that is a social graph where ID holders can add new ID holders.
contract SocialGraphNFT is ERC721("Social Graph NFT", "SGNFT") {
string public baseURI;
uint256 public tokenIdCounter;
@z0r0z
z0r0z / MultiSigNFT.sol
Created December 28, 2021 17:32
EIP-712-signed multi-signature contract with NFT ids for signers.
// SPDX-License-Identifier: GPL-3.0-or-later
import "https://github.com/Rari-Capital/solmate/blob/audit-fixes/src/tokens/ERC721.sol";
error NoGovParity();
error NoExecParity();
error SigBounds();
@z0r0z
z0r0z / NFTerc20.sol
Created December 31, 2021 03:31
ceci n'est pas une NFT
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0;
/// @notice BasicAF ERC20-compatible NFT implementation.
contract NFTerc20 {
string public name;
string public symbol;
string public tokenURI;
uint8 constant public decimals = 0;
uint public totalSupply = 1;
@z0r0z
z0r0z / gist:eabf7cdbfd54fdc249390137e60fdd87
Created December 31, 2021 17:43
whitelisted, conditioned, time-restricted
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
/// @notice Basic ERC20 implementation.
contract TestERC20 {
string public name;
string public symbol;
uint8 constant public decimals = 18;
uint256 public totalSupply;
@z0r0z
z0r0z / Accredrop.sol
Created January 2, 2022 03:59
Token drop with balance-based accreditation check
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.4;
import "https://github.com/lexDAO/Kali/blob/main/contracts/libraries/SafeTransferLib.sol";
/// @notice Minimal ERC-20 interface.
interface IERC20minimal {
function balanceOf(address account) external view returns (uint256);
}
@z0r0z
z0r0z / DAO Representation Agreement.md
Last active March 11, 2022 17:32
Agreement to establish off-chain representation on behalf of DAO. Can be useful to manage legal operations regardless of DAO legal structure.

DAO REPRESENTATION AGREEMENT

This DAO REPRESENTATION AGREEMENT (this “Agreement”) is made as of [[Effective Date]], by and between [[DAO Name]] (the “DAO”)[, a [[DAO Legal Structure]]] rooted on the [[Blockchain Name]], chainId:[[chainId]] at the public key [[DAO Public Key]] (the “Public Key”), and [[Representative Name]], a [[Representative Legal Structure]] (the “Representative”).

RECITALS

WHEREAS, the DAO desires to engage the Representative to manage its legal operational concerns, and the Representative desires to offer such services on the terms set forth herein;

NOW, THEREFORE, in consideration of the mutual covenants, agreements, representations and warranties contained herein, and intending to be legally bound hereby, the parties hereto hereby agree as follows:

@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 / MultiSig.sol
Created January 7, 2022 02:03
EIP-712-signed multi-signature contract.
// SPDX-License-Identifier: GPL-3.0-or-later
error NoExecParity();
error NoSigParity();
error NotSigner();
error SigOutOfOrder();