-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathChallenge1.t.sol
43 lines (33 loc) · 1.28 KB
/
Challenge1.t.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import {Test, console} from "forge-std/Test.sol";
import {Challenge1} from "../../src/Challenge1.sol";
import {NFTFlags} from "../../src/NFTFlags.sol";
contract Challenge1Test is Test {
Challenge1 challenge1;
NFTFlags nftFlags;
address ADMIN;
address PLAYER;
function setUp() public {
ADMIN = msg.sender;
PLAYER = address(this);
nftFlags = new NFTFlags(ADMIN);
vm.prank(ADMIN);
nftFlags.enable();
challenge1 = new Challenge1(address(nftFlags));
vm.prank(ADMIN);
nftFlags.addAllowedMinter(address(challenge1));
}
function test_challenge1() public {
vm.startPrank(PLAYER, PLAYER);
// Step 1: Register a team
challenge1.registerTeam("Team Name", 2);
// DONE: You should have obtained the flag for challenge #1
assertTrue(nftFlags.hasMinted(PLAYER, 1));
}
// required because this is a contract, which needs an ERC721Receiver implementation
// if you're not using a contract (you probably shouldn't for this challenge), you can ignore this
function onERC721Received(address, address, uint256, bytes calldata) external pure returns (bytes4) {
return this.onERC721Received.selector;
}
}