Skip to content

Instantly share code, notes, and snippets.

View PedroCailleret's full-sized avatar
๐Ÿ’œ

PedroCailleret

๐Ÿ’œ
View GitHub Profile
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.19;
contract Hello {
uint constant HELLO_WORLD =
269407141610545570464702413956129;
function getString() public pure returns(string memory)
{
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.19;
//prettier-ignore
abstract contract TwoFactor {
////////////////////////////////////////////////////////////////
// ERRORS //
////////////////////////////////////////////////////////////////
@PedroCailleret
PedroCailleret / BadgeVerifier.sol
Last active March 24, 2023 05:21
otoco badge verifier for entity access control
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "./IOtoCoMasterV2.sol";
uint256 constant STATICGAS = 0x7530;
bytes4 constant ISOWNER = 0x2f54bf6e;
bytes4 constant TOKEN = 0xfc0c546a;
bytes4 constant BALANCEOF = 0x70a08231;
bytes4 constant GETMANAGER = 0xd5009584;
@PedroCailleret
PedroCailleret / p2packed.sol
Last active December 20, 2022 05:22
p2pix but w uint packs instead of deposit structs
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
/// ______ __
/// .-----.|__ |.-----.|__|.--.--.
/// | _ || __|| _ || ||_ _|
/// | __||______|| __||__||__.__|
/// |__| |__|
///
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.4;
/// @title Counters
/// @author buf0t9
/// @author Modified from OpenZeppelin Contracts
/// (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Counters.sol)
/// @notice Provides counters that can only be incremented, decrementedor reset.
/// @dev Include with `using Counters for Counters.Counter;`
@PedroCailleret
PedroCailleret / UniversalWrapper.sol
Created August 22, 2022 20:11 — forked from z0r0z/UniversalWrapper.sol
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";
// SPDX-License-Identifier: MIT
// t11s god himself
// โœ… make mintPrice constant
// ๐Ÿ”ด consider removing creators
// ๐Ÿ”ด consider removing ourMessage
// โœ… make heartURIs a mapping of uint256s
// โœ… don't use OZ counters
// โœ… dont use a uint8 for the loop counter (its gonna get cast to 256 bits as thats the evm wordsize)
// โœ… dont cast to a uint8 for digit
// ๐Ÿ”ด the "slow down" ratelimit in mint is basically useless, consider removing
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
/// THIS IS A WIP. IT'S BROKEN!
/// DON'T GET THIS EVEN NEAR PRODUCTION
/// _ _ _ _ _ |_|_
/// (_|_\| | |\/(_||_|| |
///
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.4;
/// @author 0xtr4aum4
/// @notice This is a quick demo on how to revert custom errors with inline assembly.
/// @dev 0x3ececff8
error PushFailed();
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.4;
/// @author 0xtr4um4
/// @notice This is a quick demo on how to read custom types (enum) of a struct
/// nested in a mapping from storage using assembly when considering read value
/// to be fetched through not tightly packed/optimized storage slots.