An NFT project inspired by a BowTiedPickle post.
- Install Foundry.
- To run all tests, in command line enter:
forge test
Problem specification from project brief:
- ERC-721 NFT
- Changed some private mappings to internal. Mappings changed:
_owners
,_balances
,tokenApprovals
.
- Changed some private mappings to internal. Mappings changed:
- 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 withtokenId
in exchange.
- Users can steal an eligible
- Each wallet can only hold one NFT at any time.
- Checked in the
_beforeTokenTransfer
hook.
- Checked in the
- Each NFT can only be stolen twice, then it is protected from future swap attempts.
- Tracked in the
stolenCount
mapping.
- Tracked in the
- 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.
- Fake
- Pricing mechanism (e.g. VRGDA, Dutch auction).
- Discrete GDA implemented (see acknowledgements for references used).
Test coverage:
test_initialPrice
: price should beINITIAL_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).
- FrankieIsLost for the gradual Dutch auction repo.
- Transmissions11 for VRGDA repo.
- Gradual Dutch Auction article from Paradigm.
- OpenZeppelin: Extending Contracts.
- Solmate.