Skip to content

lumoswiz/BowTiedDirtySanta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dirty Santa NFT

An NFT project inspired by a BowTiedPickle post.

Setup

  • Install Foundry.
  • To run all tests, in command line enter:
forge test

Exercise Description

Problem specification from project brief:

  • ERC-721 NFT
    • Changed some private mappings to internal. Mappings changed: _owners, _balances, tokenApprovals.
  • Public mint
    • Minting enabled upon contract deployment.
    • Maximum mintable: 1000.
  • After minting, users can swap their NFT for another eligible NFT.
    • Users can steal an eligible targetTokenId by offering up their NFT with tokenId in exchange.
  • Each wallet can only hold one NFT at any time.
    • Checked in the _beforeTokenTransfer hook.
  • Each NFT can only be stolen twice, then it is protected from future swap attempts.
    • Tracked in the stolenCount mapping.
  • Swaps and minting disabled on Sun Dec 25 2022 00:00:00 GMT+0000.

Optional specifications:

  • Instant reveal.
    • Fake _baseURIExtended storage variable initialised in the constructor.
  • Pricing mechanism (e.g. VRGDA, Dutch auction).
    • Discrete GDA implemented (see acknowledgements for references used).

Testing

Test coverage:

  • test_initialPrice: price should be INITIAL_PRICE when 0 days passed and 0 NFTs sold.
  • test_mintNFT: user can mint an NFT.
  • test_cannotUnderpayForNFT: user cannot underpay for an NFT.
  • test_cannotMintMoreThanOneNFT: user cannot mint more than one NFT (wallet limit holds).
  • test_mintingStopsAtChristmas: at Sun Dec 25 2022 00:00:00 GMT+0000, users cannot mint an NFT.
  • test_cannotReceiveNFTWhenAlreadyOwnOne: user cannot receive an NFT from another wallet if they already own one (wallet limit holds).
  • test_steal: a user that owns an NFT, can steal the NFT of another user assuming conditions for stealing are satisfied.
  • test_cannotStealBeyondChristmas: users cannot steal an NFT from another user after Sun Dec 25 2022 00:00:00 GMT+0000.
  • test_cannotStealTokenIdThatDoesNotExist: user cannot steal a tokenId that doesn't exist.
  • test_cannotStealWithTokenIdNotOwned: user cannot steal an NFT with a tokenID that they don't own.
  • test_cannotBeStolenMoreThanTwice: a tokenId that has already been stolen twice, cannot be stolen again by another user.
  • test_tokenURI: emits tokenURI for tokenId = 0 (after minting).

Acknowledgements

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published