Skip to content

Instantly share code, notes, and snippets.

View cygaar's full-sized avatar

cygaar cygaar

View GitHub Profile
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import {ERC721A} from "erc721a/contracts/ERC721A.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
error MintLimitExceeded();
contract SampleNFT is ERC721A, Ownable {
uint256 public constant MINT_LIMIT = 10;
@cygaar
cygaar / SampleNFT.vy
Created March 5, 2023 01:12
Sample NFT contract written in Vyper
# @version 0.3.7
# @dev Implementation of ERC-721 non-fungible token standard.
# Modified from: https://github.com/vyperlang/vyper/blob/master/examples/tokens/ERC721.vy
from vyper.interfaces import ERC165
from vyper.interfaces import ERC721
implements: ERC721
implements: ERC165
@cygaar
cygaar / ERC165.sol
Created November 20, 2022 18:09
RareSkills Challenge #3
//SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.15;
import '@openzeppelin/contracts/utils/introspection/ERC165.sol';
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
contract Award is ERC721 {
constructor() ERC721('Award', 'A') {
_mint(msg.sender, 1337);
}
contract OptimizedAttacker {
constructor(address victim) payable {
NotRareToken nrt = NotRareToken(victim);
unchecked {
uint256 startingId = nrt.balanceOf(nrt.ownerOf(1));
for (uint i = 1; i <= 150; ++i) {
nrt.mint();
}
for (uint i = 1; i <= 150; ++i) {
nrt.transferFrom(address(this), msg.sender, startingId + i);
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppellin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract ERC721VestedWithdrawals is Ownable, ReentrancyGuard, ERC721 {
@cygaar
cygaar / EIP.sol
Last active September 7, 2022 21:08
interface IERC6000 {
/// @notice Emitted when a subscription expiration changes
/// The zero address for subscriber indicates that the subscription was canceled.
/// @dev When a subscription is canceled, the expiration value should also be 0.
event SubscriptionUpdate(address indexed subscriber, uint256 indexed tokenId, uint256 expiration);
/// @notice Renews the subscription to an NFT
/// Throws if `tokenId` is not a valid NFT
/// @param tokenId The NFT to renew the subscription for
function renewSubscription(uint256 tokenId) external payable;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppellin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract ERC721RestrictedMarkets is Ownable, ERC721 {
mapping(address => bool) private _approvedMarketplaces;
error SteveAokiNotAllowed();
address public STEVE_AOKI = 0xe4bbcbff51e61d0d95fcc5016609ac8354b177c4;
function transferFrom(
address from,
address to,
uint256 tokenId
) public override {
if (to == STEVE_AOKI) {
pragma solidity ^0.8.4;
import "erc721a/contracts/ERC721A.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
contract ERC721AMock is Ownable, ERC2981, ERC721A {
mapping(uint256 => uint256) private royaltyOverrides;
constructor(string memory name_, string memory symbol_) ERC721A(name_, symbol_) {}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../token/ERC1155/ERC1155.sol";
/**
* @title ERC1155Mock
* This mock just publicizes internal functions for testing purposes
*/