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 / Escrow.sol
Created November 3, 2022 00:51
based on zora pumpkin spice
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;
/// @dev The ETH transfer has failed.
error ETHTransferFailed();
/// @dev Sends `amount` (in wei) ETH to `to`.
/// Reverts upon failure.
function safeTransferETH(address to, uint256 amount) {
assembly {
@z0r0z
z0r0z / TheGame.sol
Created December 22, 2022 17:49
Solidity implementation of The Game.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract TheGame {
// Nothing to see here yet.
}
@z0r0z
z0r0z / OwnedWithTimer.sol
Last active December 1, 2022 03:59
Simple single owner authorization mixin with timer for guardianship. 👍
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Simple single owner authorization mixin with timer for guardianship.
/// @author Zolidity (https://github.com/z0r0z/zolidity/blob/main/src/auth/OwnedWithTimer.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Owned.sol)
contract OwnedWithTimer {
/// -----------------------------------------------------------------------
/// Events
/// -----------------------------------------------------------------------
@z0r0z
z0r0z / ClubSig.sol
Last active September 24, 2022 19:47
EIP-712-signed multi-signature contract with NFT identifiers for signers and ragequit
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.4;
import "https://github.com/Rari-Capital/solmate/src/tokens/ERC721.sol";
import "https://github.com/kalidao/kali-contracts/blob/main/contracts/utils/NFThelper.sol";
/// @notice Minimal ERC-20 interface.
interface IERC20minimal {
function balanceOf(address account) external view returns (uint256);
@z0r0z
z0r0z / UniversalWrapper.sol
Created August 18, 2022 05:06
Turns any token into a permittable ERC-1155 token.
// 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";
@z0r0z
z0r0z / Subsidized.sol
Last active July 9, 2022 17:26
Subsidized transactions for smart contracts.
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.4;
import {SafeTransferLib} from "https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol";
/// @notice Subsidized transactions for smart contracts.
/// @author z0r0z.eth
abstract contract Subsidized {
using SafeTransferLib for address;
@z0r0z
z0r0z / MockERC1155votes.sol
Last active June 26, 2022 23:35
Compound-like voting extension for ERC1155.
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
import "https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC1155.sol";
import "https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeCastLib.sol";
/// @notice Compound-like voting extension for ERC1155.
/// @author z0r0z.eth
abstract contract ERC1155votes is ERC1155 {
using SafeCastLib for uint256;
@z0r0z
z0r0z / SingleNFT.sol
Last active June 2, 2022 08:20
1-of-1 NFT built on Solmate
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
import "https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol";
/// @notice 1-of-1 NFT.
contract SingleNFT is ERC721 {
string internal URI;
constructor(
@z0r0z
z0r0z / TokenWarrant.sol
Created May 27, 2022 16:45
tokenizing agreement with hashes and payables
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
import 'https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC1155.sol';
contract TokenWarrant is ERC1155 {
mapping(uint256 => string) public metas;
function uri(uint256 id) public override view returns (string memory) {
return metas[id];
@z0r0z
z0r0z / Escrow.sol
Created December 13, 2021 22:04
Escrow for NFT and ERC20 using IERC20
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0;
/// @notice Standard ERC-20 token interface with EIP-2612 {permit} extension.
interface IERC20 {
/// @dev ERC-20:
function allowance(address owner, address spender) external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function totalSupply() external view returns (uint256);