-
Notifications
You must be signed in to change notification settings - Fork 22
Add season2 contracts and challenge pages #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1e0154f
Add season2 contracts and challenge pages
damianmarti e5d0cbd
Move contracts to season folders and change season 1 contract names
damianmarti 4595640
Add season slugs and change season names
damianmarti e5895ab
Add 'Season1' to contract names on deployedContracts
damianmarti 759610f
More margin to seasons
damianmarti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/hardhat/contracts/Challenge1.sol → ...ardhat/contracts/S1/Season1Challenge1.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/hardhat/contracts/Challenge11.sol → ...rdhat/contracts/S1/Season1Challenge11.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
packages/hardhat/contracts/Challenge12.sol → ...rdhat/contracts/S1/Season1Challenge12.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/hardhat/contracts/Challenge2.sol → ...ardhat/contracts/S1/Season1Challenge2.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/hardhat/contracts/Challenge3.sol → ...ardhat/contracts/S1/Season1Challenge3.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/hardhat/contracts/Challenge5.sol → ...ardhat/contracts/S1/Season1Challenge5.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
packages/hardhat/contracts/Challenge9.sol → ...ardhat/contracts/S1/Season1Challenge9.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
carletex marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| //SPDX-License-Identifier: MIT | ||
| pragma solidity >=0.8.0 <0.9.0; | ||
|
|
||
| import "../INFTFlags.sol"; | ||
|
|
||
| contract Season2Challenge10 { | ||
| address public nftContract; | ||
|
|
||
| constructor(address _nftContract) { | ||
| nftContract = _nftContract; | ||
| } | ||
|
|
||
| function mintFlag() public { | ||
| require(msg.sender != tx.origin, "Same address"); | ||
| uint8 senderLast = uint8(abi.encodePacked(msg.sender)[19]); | ||
| uint8 originLast = uint8(abi.encodePacked(tx.origin)[19]); | ||
| uint8 contractFirst = uint8(abi.encodePacked(address(this))[0]); | ||
| uint8 senderFirst = uint8(abi.encodePacked(msg.sender)[0]); | ||
| require((senderLast & 0xF) == (originLast & 0xF), "Wrong sender/origin address"); | ||
| require((senderFirst & 0xF0) == (contractFirst & 0xF0), "Wrong sender/contract address"); | ||
| INFTFlags(nftContract).mint(tx.origin, 10); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| //SPDX-License-Identifier: MIT | ||
| pragma solidity >=0.8.0 <0.9.0; | ||
|
|
||
| import "../RLPReader.sol"; | ||
| import "../INFTFlags.sol"; | ||
|
|
||
| contract Season2Challenge11 { | ||
| using RLPReader for RLPReader.RLPItem; | ||
| using RLPReader for bytes; | ||
|
|
||
| address public nftContract; | ||
| mapping(address => uint256) public blockNumber; | ||
| mapping(address => uint256) public counts; | ||
| mapping(uint256 => bool) public blocks; | ||
|
|
||
| uint256 public constant futureBlocks = 2; | ||
|
|
||
| constructor(address _nftContract) { | ||
| nftContract = _nftContract; | ||
| } | ||
|
|
||
| function preMintFlag() public { | ||
| require(blocks[block.number] == false, "Block already used"); | ||
| blocks[block.number] = true; | ||
| blockNumber[msg.sender] = block.number; | ||
| counts[msg.sender] += 1; | ||
| } | ||
|
|
||
| function mintFlag(bytes memory rlpBytes) public { | ||
| require(blockNumber[msg.sender] != 0, "PreMintFlag first"); | ||
| require(block.number >= blockNumber[msg.sender] + futureBlocks, "Future block not reached."); | ||
| require(block.number < blockNumber[msg.sender] + futureBlocks + 256, "You miss the window. PreMintFlag again."); | ||
|
|
||
| RLPReader.RLPItem[] memory ls = rlpBytes.toRlpItem().toList(); | ||
|
|
||
| uint256 blockNumberFromHeader = ls[8].toUint(); | ||
|
|
||
| require(blockNumberFromHeader == blockNumber[msg.sender] + futureBlocks, "Wrong block"); | ||
|
|
||
| require(blockhash(blockNumberFromHeader) == keccak256(rlpBytes), "Wrong block header"); | ||
|
|
||
| bytes memory mixHash = ls[13].toBytes(); | ||
|
|
||
| uint256 random = uint256(keccak256(abi.encodePacked(mixHash, address(this), msg.sender))) % 10; | ||
|
|
||
| require(random < counts[msg.sender], "Not enough pre-mints"); | ||
|
|
||
| INFTFlags(nftContract).mint(msg.sender, 11); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do https://github.com/BuidlGuidl/ctf.buidlguidl.com/pull/27/files#r2581810234
we could keep this file on the contracts root