Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ngjupeng committed Sep 23, 2024
0 parents commit 27947bd
Show file tree
Hide file tree
Showing 821 changed files with 141,391 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Issue Overview

Provide a brief summary of the issue, including the motivation for addressing it, the problems it presents, and any features required to resolve it.

## Proposed Solutions or Ideas

Outline your proposed solution or share any ideas you have for discussing or resolving the issue.
11 changes: 11 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Task name here

Fixes #relevant-issue-here

## Types of change

- [ ] Feature
- [ ] Bug
- [ ] Enhancement

## Comments (optional)
47 changes: 47 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Lint

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
ci:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
node: [lts/*]

steps:
- name: Checkout
uses: actions/checkout@master

- name: Setup node env
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: yarn

- name: Install dependencies
run: yarn install --immutable

- name: Install foundry-toolchain
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Run foundry node, deploy contracts (& generate contracts typescript output)
env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
run: yarn chain::eth & yarn deploy::eth

- name: Run nextjs lint
run: yarn next:lint --max-warnings=0

- name: Check typings on nextjs
run: yarn next:check-types
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# dependencies
node_modules

# yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# eslint
.eslintcache

# misc
.DS_Store

# IDE
.vscode
.idea

# cli
dist
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "packages/foundry/lib/forge-std"]
path = packages/foundry/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "packages/foundry/lib/openzeppelin-contracts"]
path = packages/foundry/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "packages/foundry/lib/solidity-bytes-utils"]
path = packages/foundry/lib/solidity-bytes-utils
url = https://github.com/gnsps/solidity-bytes-utils
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged --verbose
21 changes: 21 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const path = require("path");

const buildNextEslintCommand = (filenames) =>
`yarn next:lint --fix --file ${filenames
.map((f) => path.relative(path.join("packages", "nextjs"), f))
.join(" --file ")}`;

const checkTypesNextCommand = () => "yarn next:check-types";

const buildHardhatEslintCommand = (filenames) =>
`yarn hardhat:lint-staged --fix ${filenames
.map((f) => path.relative(path.join("packages", "hardhat"), f))
.join(" ")}`;

module.exports = {
"packages/nextjs/**/*.{ts,tsx}": [
buildNextEslintCommand,
checkTypesNextCommand,
],
"packages/hardhat/**/*.{ts,tsx}": [buildHardhatEslintCommand],
};
541 changes: 541 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-typescript.cjs

Large diffs are not rendered by default.

783 changes: 783 additions & 0 deletions .yarn/releases/yarn-3.2.3.cjs

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
enableColors: true

nmHoistingLimits: workspaces

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: "@yarnpkg/plugin-typescript"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.2.3.cjs
86 changes: 86 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Welcome to Scaffold-ETH 2 Contributing Guide

Thank you for investing your time in contributing to Scaffold-ETH 2!

This guide aims to provide an overview of the contribution workflow to help us make the contribution process effective for everyone involved.

## About the Project

Scaffold-ETH 2 is a minimal and forkable repo providing builders with a starter kit to build decentralized applications on Ethereum.

Read the [README](README.md) to get an overview of the project.

### Vision

The goal of Scaffold-ETH 2 is to provide the primary building blocks for a decentralized application.

The repo can be forked to include integrations and more features, but we want to keep the master branch simple and minimal.

### Project Status

The project is under active development.

You can view the open Issues, follow the development process and contribute to the project.

## Getting started

You can contribute to this repo in many ways:

- Solve open issues
- Report bugs or feature requests
- Improve the documentation

Contributions are made via Issues and Pull Requests (PRs). A few general guidelines for contributions:

- Search for existing Issues and PRs before creating your own.
- Contributions should only fix/add the functionality in the issue OR address style issues, not both.
- If you're running into an error, please give context. Explain what you're trying to do and how to reproduce the error.
- 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.
- If applicable, please edit the README.md file to reflect the changes.

### Issues

Issues should be used to report problems, request a new feature, or discuss potential changes before a PR is created.

#### Solve an issue

Scan through our [existing issues](https://github.com/scaffold-eth/scaffold-eth-2/issues) to find one that interests you.

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.

#### Create a new issue

If a related issue doesn't exist, you can open a new issue.

Some tips to follow when you are creating an issue:

- Provide as much context as possible. Over-communicate to give the most details to the reader.
- Include the steps to reproduce the issue or the reason for adding the feature.
- Screenshots, videos etc., are highly appreciated.

### Pull Requests

#### Pull Request Process

We follow the ["fork-and-pull" Git workflow](https://github.com/susam/gitpr)

1. Fork the repo
2. Clone the project
3. Create a new branch with a descriptive name
4. Commit your changes to the new branch
5. Push changes to your fork
6. Open a PR in our repository and tag one of the maintainers to review your PR

Here are some tips for a high-quality pull request:

- Create a title for the PR that accurately defines the work done.
- 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.
- Add the link to the issue if applicable.
- Have a good commit message that summarises the work done.

Once you submit your PR:

- 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.
- As you update your PR and apply changes, mark each conversation resolved.

Once the PR is approved, we'll "squash-and-merge" to keep the git commit history clean.
21 changes: 21 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 BuidlGuidl

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Starknet and Eth cross-chain template

This project is a template for creating Starknet and Eth cross-chain applications. It uses the Scaffold-ETH-2 and Scaffold-Starknet-2 libraries to create a project that can be used as a starting point for any starknet and eth application.

### Prerequisites

Check requirements at [scaffold-stark-2](https://github.com/Scaffold-Stark/scaffold-stark-2) and [scaffold-eth-2](https://github.com/scaffold-eth/scaffold-eth-2/tree/foundry) (only the foundryup)

## Getting Started

1. Clone the repo

```bash
git clone https://github.com/Quantum3-Labs/eth-stark-template/tree/main
cd eth-stark-template
```

2. Install dependencies

```bash
yarn install
```

3. Run a local eth network in the first terminal:

```bash
yarn chain::eth
```

4. Run a local starknet network in the second terminal:

```bash
yarn chain::strk
```

5. Copy .env.example to .env and set the correct variables

```bash
cp ./packages/foundry/.env.example ./packages/foundry/.env
cp ./packages/snfoundry/.env.example ./packages/snfoundry/.env
```

6. Deploy your smart contract(s) on the eth network:

```bash
yarn deploy::eth
```

6. Deploy your smart contract(s) on the starknet network:

```bash
yarn deploy::strk
```

7. Run the frontend:

```bash
yarn start
```

8. Visit http://localhost:3000 to see the app
56 changes: 56 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "sse-2",
"version": "0.0.1",
"private": true,
"workspaces": {
"packages": [
"packages/*"
]
},
"scripts": {
"chain::strk": "yarn workspace @sse-2/snfoundry chain",
"deploy::strk": "yarn workspace @sse-2/snfoundry deploy",
"deploy:reset::strk": "yarn workspace @sse-2/snfoundry deploy:reset",
"test::strk": "yarn workspace @sse-2/snfoundry test",
"compile::strk": "yarn workspace @sse-2/snfoundry compile",
"format::strk": "yarn workspace @sse-2/snfoundry format",
"account::eth": "yarn workspace @sse-2/foundry account",
"chain::eth": "yarn workspace @sse-2/foundry chain",
"compile::eth": "yarn workspace @sse-2/foundry compile",
"deploy::eth": "yarn workspace @sse-2/foundry deploy",
"deploy:verify::eth": "yarn workspace @sse-2/foundry deploy:verify",
"flatten::eth": "yarn workspace @sse-2/foundry flatten",
"fork::eth": "yarn workspace @sse-2/foundry fork",
"foundry:format::eth": "yarn workspace @sse-2/foundry format",
"foundry:lint::eth": "yarn workspace @sse-2/foundry lint",
"foundry:test::eth": "yarn workspace @sse-2/foundry test",
"generate::eth": "yarn workspace @sse-2/foundry generate",
"verify::eth": "yarn workspace @sse-2/foundry verify",
"postinstall": "husky install",
"next:build": "yarn workspace @sse-2/nextjs build",
"next:check-types": "yarn workspace @sse-2/nextjs check-types",
"next:format": "yarn workspace @sse-2/nextjs format",
"next:lint": "yarn workspace @sse-2/nextjs lint",
"next:serve": "yarn workspace @sse-2/nextjs serve",
"precommit": "lint-staged",
"start": "yarn workspace @sse-2/nextjs dev",
"vercel": "yarn workspace @sse-2/nextjs vercel",
"vercel:yolo": "yarn workspace @sse-2/nextjs vercel:yolo",
"test": "yarn foundry:test::eth && test::strk",
"format": "yarn next:format && yarn foundry:format::eth && format::strk"
},
"devDependencies": {
"daisyui": "^4.7.3",
"husky": "~8.0.3",
"lint-staged": "~13.2.2",
"pinst": "^3.0.0",
"prettier": "^3.2.5"
},
"dependencies": {
"postcss": "^8.4.38"
},
"packageManager": "[email protected]",
"engines": {
"node": ">=18.17.0"
}
}
3 changes: 3 additions & 0 deletions packages/foundry/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DEPLOYER_PRIVATE_KEY=
ETHERSCAN_API_KEY=
ALCHEMY_API_KEY=
14 changes: 14 additions & 0 deletions packages/foundry/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Compiler files
cache/
out/

# Ignores development broadcast logs
/broadcast/*/31337/
/broadcast/**/dry-run/

# Docs
docs/

# Dotenv file
.env
localhost.json
6 changes: 6 additions & 0 deletions packages/foundry/.prettier.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"arrowParens": "avoid",
"printWidth": 120,
"tabWidth": 2,
"trailingComma": "all"
}
Loading

0 comments on commit 27947bd

Please sign in to comment.