Skip to content

Commit e5f418f

Browse files
carletexChangoMandamianmartitechnophile-04rin-st
committed
CTF initial code
Co-authored-by: Hunter Chang <[email protected]> Co-authored-by: Damian Martinelli <[email protected]> Co-authored-by: Shiv Bhonde | shivbhonde.eth <[email protected]> Co-authored-by: Rinat <[email protected]> Co-authored-by: Pablo <[email protected]>
0 parents  commit e5f418f

File tree

220 files changed

+30675
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+30675
-0
lines changed

.github/workflows/lint.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
ci:
13+
runs-on: ${{ matrix.os }}
14+
15+
strategy:
16+
matrix:
17+
os: [ubuntu-latest]
18+
node: [lts/*]
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@master
23+
24+
- name: Setup node env
25+
uses: actions/setup-node@v3
26+
with:
27+
node-version: ${{ matrix.node }}
28+
cache: yarn
29+
30+
- name: Install dependencies
31+
run: yarn install --immutable
32+
33+
- name: Run hardhat node, deploy contracts (& generate contracts typescript output)
34+
run: yarn chain & yarn deploy
35+
36+
- name: Run hardhat lint
37+
run: yarn hardhat:lint --max-warnings=0
38+
39+
- name: Run nextjs lint
40+
run: yarn next:lint --max-warnings=0
41+
42+
- name: Check typings on nextjs
43+
run: yarn next:check-types

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# dependencies
2+
node_modules
3+
4+
# yarn
5+
.yarn/*
6+
!.yarn/patches
7+
!.yarn/plugins
8+
!.yarn/releases
9+
!.yarn/sdks
10+
!.yarn/versions
11+
12+
# eslint
13+
.eslintcache
14+
15+
# misc
16+
.DS_Store
17+
18+
# IDE
19+
.vscode
20+
.idea
21+
22+
# cli
23+
dist

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn lint-staged --verbose

.lintstagedrc.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const path = require("path");
2+
3+
const buildNextEslintCommand = (filenames) =>
4+
`yarn next:lint --fix --file ${filenames
5+
.map((f) => path.relative(path.join("packages", "nextjs"), f))
6+
.join(" --file ")}`;
7+
8+
const checkTypesNextCommand = () => "yarn next:check-types";
9+
10+
const buildHardhatEslintCommand = (filenames) =>
11+
`yarn hardhat:lint-staged --fix ${filenames
12+
.map((f) => path.relative(path.join("packages", "hardhat"), f))
13+
.join(" ")}`;
14+
15+
module.exports = {
16+
"packages/nextjs/**/*.{ts,tsx}": [
17+
buildNextEslintCommand,
18+
checkTypesNextCommand,
19+
],
20+
"packages/hardhat/**/*.{ts,tsx}": [buildHardhatEslintCommand],
21+
};

.yarn/plugins/@yarnpkg/plugin-typescript.cjs

Lines changed: 9 additions & 0 deletions
Large diffs are not rendered by default.

.yarn/releases/yarn-3.2.3.cjs

Lines changed: 783 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
enableColors: true
2+
3+
nmHoistingLimits: workspaces
4+
5+
nodeLinker: node-modules
6+
7+
plugins:
8+
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
9+
spec: "@yarnpkg/plugin-typescript"
10+
11+
yarnPath: .yarn/releases/yarn-3.2.3.cjs

CONTRIBUTING.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Welcome to Scaffold-ETH 2 Contributing Guide
2+
3+
Thank you for investing your time in contributing to Scaffold-ETH 2!
4+
5+
This guide aims to provide an overview of the contribution workflow to help us make the contribution process effective for everyone involved.
6+
7+
## About the Project
8+
9+
Scaffold-ETH 2 is a minimal and forkable repo providing builders with a starter kit to build decentralized applications on Ethereum.
10+
11+
Read the [README](README.md) to get an overview of the project.
12+
13+
### Vision
14+
15+
The goal of Scaffold-ETH 2 is to provide the primary building blocks for a decentralized application.
16+
17+
The repo can be forked to include integrations and more features, but we want to keep the master branch simple and minimal.
18+
19+
### Project Status
20+
21+
The project is under active development.
22+
23+
You can view the open Issues, follow the development process and contribute to the project.
24+
25+
## Getting started
26+
27+
You can contribute to this repo in many ways:
28+
29+
- Solve open issues
30+
- Report bugs or feature requests
31+
- Improve the documentation
32+
33+
Contributions are made via Issues and Pull Requests (PRs). A few general guidelines for contributions:
34+
35+
- Search for existing Issues and PRs before creating your own.
36+
- Contributions should only fix/add the functionality in the issue OR address style issues, not both.
37+
- If you're running into an error, please give context. Explain what you're trying to do and how to reproduce the error.
38+
- Please use the same formatting in the code repository. You can configure your IDE to do it by using the prettier / linting config files included in each package.
39+
- If applicable, please edit the README.md file to reflect the changes.
40+
41+
### Issues
42+
43+
Issues should be used to report problems, request a new feature, or discuss potential changes before a PR is created.
44+
45+
#### Solve an issue
46+
47+
Scan through our [existing issues](https://github.com/scaffold-eth/scaffold-eth-2/issues) to find one that interests you.
48+
49+
If a contributor is working on the issue, they will be assigned to the individual. If you find an issue to work on, you are welcome to assign it to yourself and open a PR with a fix for it.
50+
51+
#### Create a new issue
52+
53+
If a related issue doesn't exist, you can open a new issue.
54+
55+
Some tips to follow when you are creating an issue:
56+
57+
- Provide as much context as possible. Over-communicate to give the most details to the reader.
58+
- Include the steps to reproduce the issue or the reason for adding the feature.
59+
- Screenshots, videos etc., are highly appreciated.
60+
61+
### Pull Requests
62+
63+
#### Pull Request Process
64+
65+
We follow the ["fork-and-pull" Git workflow](https://github.com/susam/gitpr)
66+
67+
1. Fork the repo
68+
2. Clone the project
69+
3. Create a new branch with a descriptive name
70+
4. Commit your changes to the new branch
71+
5. Push changes to your fork
72+
6. Open a PR in our repository and tag one of the maintainers to review your PR
73+
74+
Here are some tips for a high-quality pull request:
75+
76+
- Create a title for the PR that accurately defines the work done.
77+
- Structure the description neatly to make it easy to consume by the readers. For example, you can include bullet points and screenshots instead of having one large paragraph.
78+
- Add the link to the issue if applicable.
79+
- Have a good commit message that summarises the work done.
80+
81+
Once you submit your PR:
82+
83+
- We may ask questions, request additional information or ask for changes to be made before a PR can be merged. Please note that these are to make the PR clear for everyone involved and aims to create a frictionless interaction process.
84+
- As you update your PR and apply changes, mark each conversation resolved.
85+
86+
Once the PR is approved, we'll "squash-and-merge" to keep the git commit history clean.

LICENCE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 BuidlGuidl
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
![BuidlGuidl CTF](./packages/nextjs/public/readme-image.jpg?raw=true&v2)
2+
3+
**Welcome to the BuidlGuidl CTF**
4+
5+
⚡️ Live at https://ctf.buidlguidl.com
6+
7+
> [!NOTE]
8+
> This branch contains the code for the BuidlGuidl CTF website.
9+
> If you are looking for the stack to play the CTF, please check the [ctf-extension](https://github.com/buidlGuidl/ctf.buidlguidl.com/tree/ctf-extension) branch.
10+
11+
---
12+
13+
## Setting up the environment
14+
15+
ToDo

package.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"name": "se-2",
3+
"version": "0.0.1",
4+
"private": true,
5+
"workspaces": {
6+
"packages": [
7+
"packages/*"
8+
]
9+
},
10+
"scripts": {
11+
"account": "yarn workspace @se-2/hardhat account",
12+
"chain": "yarn workspace @se-2/hardhat chain",
13+
"compile": "yarn workspace @se-2/hardhat compile",
14+
"deploy": "yarn workspace @se-2/hardhat deploy",
15+
"flatten": "yarn workspace @se-2/hardhat flatten",
16+
"fork": "yarn workspace @se-2/hardhat fork",
17+
"format": "yarn next:format && yarn hardhat:format",
18+
"generate": "yarn workspace @se-2/hardhat generate",
19+
"hardhat-verify": "yarn workspace @se-2/hardhat hardhat-verify",
20+
"hardhat:format": "yarn workspace @se-2/hardhat format",
21+
"hardhat:lint": "yarn workspace @se-2/hardhat lint",
22+
"hardhat:lint-staged": "yarn workspace @se-2/hardhat lint-staged",
23+
"hardhat:test": "yarn workspace @se-2/hardhat test",
24+
"postinstall": "husky install",
25+
"next:build": "yarn workspace @se-2/nextjs build",
26+
"next:check-types": "yarn workspace @se-2/nextjs check-types",
27+
"next:format": "yarn workspace @se-2/nextjs format",
28+
"next:lint": "yarn workspace @se-2/nextjs lint",
29+
"next:serve": "yarn workspace @se-2/nextjs serve",
30+
"precommit": "lint-staged",
31+
"start": "yarn workspace @se-2/nextjs dev",
32+
"test": "yarn hardhat:test",
33+
"vercel": "yarn workspace @se-2/nextjs vercel",
34+
"vercel:yolo": "yarn workspace @se-2/nextjs vercel:yolo",
35+
"verify": "yarn workspace @se-2/hardhat verify",
36+
"ponder:dev": "yarn workspace @se-2/ponder dev",
37+
"ponder:start": "yarn workspace @se-2/ponder start",
38+
"ponder:codegen": "yarn workspace @se-2/ponder codegen",
39+
"ponder:serve": "yarn workspace @se-2/ponder serve",
40+
"ponder:lint": "yarn workspace @se-2/ponder lint",
41+
"ponder:typecheck": "yarn workspace @se-2/ponder typecheck"
42+
},
43+
"devDependencies": {
44+
"husky": "~8.0.3",
45+
"lint-staged": "~13.2.2"
46+
},
47+
"packageManager": "[email protected]",
48+
"engines": {
49+
"node": ">=18.17.0"
50+
}
51+
}

packages/hardhat/.env.example

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Template for Hardhat environment variables.
2+
3+
# To use this template, copy this file, rename it .env, and fill in the values.
4+
5+
# If not set, we provide default values (check `hardhat.config.ts`) so developers can start prototyping out of the box,
6+
# but we recommend getting your own API Keys for Production Apps.
7+
8+
# To access the values stored in this .env file you can use: process.env.VARIABLENAME
9+
ALCHEMY_API_KEY=
10+
DEPLOYER_PRIVATE_KEY=
11+
ETHERSCAN_API_KEY=

packages/hardhat/.eslintignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# folders
2+
artifacts
3+
cache
4+
contracts
5+
node_modules/
6+
typechain-types
7+
# files
8+
**/*.json

packages/hardhat/.eslintrc.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"env": {
3+
"node": true
4+
},
5+
"parser": "@typescript-eslint/parser",
6+
"extends": ["plugin:prettier/recommended", "plugin:@typescript-eslint/recommended"],
7+
"rules": {
8+
"@typescript-eslint/no-unused-vars": ["off"],
9+
"@typescript-eslint/no-explicit-any": ["off"],
10+
"prettier/prettier": [
11+
"warn",
12+
{
13+
"endOfLine": "auto"
14+
}
15+
]
16+
}
17+
}

packages/hardhat/.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# dependencies
2+
node_modules
3+
4+
# env files
5+
.env
6+
7+
# coverage
8+
coverage
9+
coverage.json
10+
11+
# typechain
12+
typechain
13+
typechain-types
14+
15+
# hardhat files
16+
cache
17+
artifacts
18+
19+
# zkSync files
20+
artifacts-zk
21+
cache-zk
22+
23+
# deployments
24+
deployments/localhost
25+
26+
# other
27+
temp

packages/hardhat/.prettierrc.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"arrowParens": "avoid",
3+
"printWidth": 120,
4+
"tabWidth": 2,
5+
"trailingComma": "all",
6+
"overrides": [
7+
{
8+
"files": "*.sol",
9+
"options": {
10+
"printWidth": 120,
11+
"tabWidth": 4,
12+
"singleQuote": false,
13+
"bracketSpacing": true,
14+
"explicitTypes": "always"
15+
}
16+
}
17+
]
18+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//SPDX-License-Identifier: MIT
2+
pragma solidity >=0.8.0 <0.9.0;
3+
4+
import "./INFTFlags.sol";
5+
6+
contract Challenge1 {
7+
address public nftContract;
8+
mapping(address => string) public builderNames;
9+
10+
event BuilderInit(address indexed player, string name);
11+
12+
constructor(address _nftContract) {
13+
nftContract = _nftContract;
14+
}
15+
16+
function registerMe(string memory _name) public {
17+
require(bytes(_name).length > 0, "Name cannot be empty");
18+
19+
builderNames[msg.sender] = _name;
20+
emit BuilderInit(msg.sender, _name);
21+
INFTFlags(nftContract).mint(msg.sender, 1);
22+
}
23+
}

0 commit comments

Comments
 (0)