function collectPresent() external {
if (balanceOf(msg.sender) > 0) {
revert SantasList__AlreadyCollected();
}
}
function buyPresent(address presentReceiver) external {
i_santaToken.burn(presentReceiver);
_mintAndIncrement();
}
pragma solidity 0.8.22;
import {Test} from "forge-std/Test.sol";
import {SantasList} from "../src/SantasList.sol";
import {SantaToken} from "../src/SantaToken.sol";
contract BuyPresentNoCap is Test {
SantasList santasList;
SantaToken santaToken;
address santa = makeAddr("santa");
address buyer = makeAddr("buyer");
address tokenSource1 = makeAddr("tokenSource1");
address tokenSource2 = makeAddr("tokenSource2");
uint256 constant CHRISTMAS = 1_703_480_381;
function setUp() public {
vm.prank(santa);
santasList = new SantasList();
santaToken = SantaToken(santasList.getSantaToken());
address[2] memory sources = [tokenSource1, tokenSource2];
for (uint i = 0; i < 2; i++) {
vm.startPrank(santa);
santasList.checkList(sources[i], SantasList.Status.EXTRA_NICE);
santasList.checkTwice(sources[i], SantasList.Status.EXTRA_NICE);
vm.stopPrank();
}
vm.warp(CHRISTMAS + 1);
vm.prank(tokenSource1);
santasList.collectPresent();
vm.prank(tokenSource2);
santasList.collectPresent();
}
function test_buyerReceivesMultipleNFTs() public {
vm.startPrank(buyer);
santasList.buyPresent(tokenSource1);
santasList.buyPresent(tokenSource2);
vm.stopPrank();
assertEq(santasList.balanceOf(buyer), 2);
}
}
function buyPresent(address presentReceiver) external {
if (balanceOf(presentReceiver) > 0) {
revert SantasList__AlreadyCollected();
}
i_santaToken.burn(msg.sender);
_safeMint(presentReceiver, s_tokenCounter++);
}