-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f99e2f0
Showing
22 changed files
with
492 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,19 @@ | ||
# EditorConfig http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# All files | ||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.sol] | ||
indent_size = 4 | ||
|
||
[*.tree] | ||
indent_size = 1 |
This file contains 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,3 @@ | ||
export API_KEY_INFURA="YOUR_API_KEY_INFURA" | ||
export MNEMONIC="YOUR_MNEMONIC" | ||
export FOUNDRY_PROFILE="default" |
This file contains 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,2 @@ | ||
custom: "https://omo.so/prberg" | ||
github: "PaulRBerg" |
This file contains 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,38 @@ | ||
#!/usr/bin/env bash | ||
|
||
# https://gist.github.com/vncsna/64825d5609c146e80de8b1fd623011ca | ||
set -euo pipefail | ||
|
||
# Define the input vars | ||
GITHUB_REPOSITORY=${1?Error: Please pass username/repo, e.g. prb/foundry-template} | ||
GITHUB_REPOSITORY_OWNER=${2?Error: Please pass username, e.g. prb} | ||
GITHUB_REPOSITORY_DESCRIPTION=${3:-""} # If null then replace with empty string | ||
|
||
echo "GITHUB_REPOSITORY: $GITHUB_REPOSITORY" | ||
echo "GITHUB_REPOSITORY_OWNER: $GITHUB_REPOSITORY_OWNER" | ||
echo "GITHUB_REPOSITORY_DESCRIPTION: $GITHUB_REPOSITORY_DESCRIPTION" | ||
|
||
# jq is like sed for JSON data | ||
JQ_OUTPUT=`jq \ | ||
--arg NAME "@$GITHUB_REPOSITORY" \ | ||
--arg AUTHOR_NAME "$GITHUB_REPOSITORY_OWNER" \ | ||
--arg URL "https://github.com/$GITHUB_REPOSITORY_OWNER" \ | ||
--arg DESCRIPTION "$GITHUB_REPOSITORY_DESCRIPTION" \ | ||
'.name = $NAME | .description = $DESCRIPTION | .author |= ( .name = $AUTHOR_NAME | .url = $URL )' \ | ||
package.json | ||
` | ||
|
||
# Overwrite package.json | ||
echo "$JQ_OUTPUT" > package.json | ||
|
||
# Make sed command compatible in both Mac and Linux environments | ||
# Reference: https://stackoverflow.com/a/38595160/8696958 | ||
sedi () { | ||
sed --version >/dev/null 2>&1 && sed -i -- "$@" || sed -i "" "$@" | ||
} | ||
|
||
# Rename instances of "PaulRBerg/foundry-template" to the new repo name in README.md for badges only | ||
sedi "/gitpod/ s|PaulRBerg/foundry-template|"${GITHUB_REPOSITORY}"|;" "README.md" | ||
sedi "/gitpod-badge/ s|PaulRBerg/foundry-template|"${GITHUB_REPOSITORY}"|;" "README.md" | ||
sedi "/gha/ s|PaulRBerg/foundry-template|"${GITHUB_REPOSITORY}"|;" "README.md" | ||
sedi "/gha-badge/ s|PaulRBerg/foundry-template|"${GITHUB_REPOSITORY}"|;" "README.md" |
This file contains 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,59 @@ | ||
name: "CI" | ||
|
||
env: | ||
API_KEY_ALCHEMY: ${{ secrets.API_KEY_ALCHEMY }} | ||
FOUNDRY_PROFILE: "ci" | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- "main" | ||
|
||
jobs: | ||
lint: | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Check out the repo" | ||
uses: "actions/checkout@v4" | ||
|
||
- name: "Install Foundry" | ||
uses: "foundry-rs/foundry-toolchain@v1" | ||
|
||
- name: "Install Bun" | ||
uses: "oven-sh/setup-bun@v1" | ||
|
||
- name: "Install the Node.js dependencies" | ||
run: "bun install" | ||
|
||
- name: "Lint the code" | ||
run: "bun run lint" | ||
|
||
- name: "Add lint summary" | ||
run: | | ||
echo "## Lint result" >> $GITHUB_STEP_SUMMARY | ||
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY | ||
build: | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Check out the repo" | ||
uses: "actions/checkout@v4" | ||
|
||
- name: "Install Foundry" | ||
uses: "foundry-rs/foundry-toolchain@v1" | ||
|
||
- name: "Install Bun" | ||
uses: "oven-sh/setup-bun@v1" | ||
|
||
- name: "Install the Node.js dependencies" | ||
run: "bun install" | ||
|
||
- name: "Build the contracts and print their size" | ||
run: "forge build --sizes" | ||
|
||
- name: "Add build summary" | ||
run: | | ||
echo "## Build result" >> $GITHUB_STEP_SUMMARY | ||
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY |
This file contains 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,52 @@ | ||
name: "Create" | ||
|
||
# The workflow will run only when the "Use this template" button is used | ||
on: | ||
create: | ||
|
||
jobs: | ||
create: | ||
# We only run this action when the repository isn't the template repository. References: | ||
# - https://docs.github.com/en/actions/learn-github-actions/contexts | ||
# - https://docs.github.com/en/actions/learn-github-actions/expressions | ||
if: ${{ !github.event.repository.is_template }} | ||
permissions: "write-all" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Check out the repo" | ||
uses: "actions/checkout@v4" | ||
|
||
- name: "Update package.json" | ||
env: | ||
GITHUB_REPOSITORY_DESCRIPTION: ${{ github.event.repository.description }} | ||
run: | ||
./.github/scripts/rename.sh "$GITHUB_REPOSITORY" "$GITHUB_REPOSITORY_OWNER" "$GITHUB_REPOSITORY_DESCRIPTION" | ||
|
||
- name: "Add rename summary" | ||
run: | | ||
echo "## Commit result" >> $GITHUB_STEP_SUMMARY | ||
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY | ||
- name: "Remove files not needed in the user's copy of the template" | ||
run: | | ||
rm -f "./.github/FUNDING.yml" | ||
rm -f "./.github/scripts/rename.sh" | ||
rm -f "./.github/workflows/create.yml" | ||
- name: "Add remove summary" | ||
run: | | ||
echo "## Remove result" >> $GITHUB_STEP_SUMMARY | ||
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY | ||
- name: "Update commit" | ||
uses: "stefanzweifel/git-auto-commit-action@v4" | ||
with: | ||
commit_message: "feat: initial commit" | ||
commit_options: "--amend" | ||
push_options: "--force" | ||
skip_fetch: true | ||
|
||
- name: "Add commit summary" | ||
run: | | ||
echo "## Commit result" >> $GITHUB_STEP_SUMMARY | ||
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY |
This file contains 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,20 @@ | ||
# directories | ||
cache | ||
coverage | ||
node_modules | ||
out | ||
|
||
# files | ||
*.env | ||
*.log | ||
.DS_Store | ||
.pnp.* | ||
lcov.info | ||
package-lock.json | ||
pnpm-lock.yaml | ||
yarn.lock | ||
|
||
# broadcasts | ||
!broadcast | ||
broadcast/* | ||
broadcast/*/31337/ |
This file contains 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,17 @@ | ||
# directories | ||
broadcast | ||
cache | ||
coverage | ||
node_modules | ||
out | ||
|
||
# files | ||
*.env | ||
*.log | ||
.DS_Store | ||
.pnp.* | ||
bun.lockb | ||
lcov.info | ||
package-lock.json | ||
pnpm-lock.yaml | ||
yarn.lock |
This file contains 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,7 @@ | ||
bracketSpacing: true | ||
printWidth: 120 | ||
proseWrap: "always" | ||
singleQuote: false | ||
tabWidth: 2 | ||
trailingComma: "all" | ||
useTabs: false |
This file contains 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,14 @@ | ||
{ | ||
"extends": "solhint:recommended", | ||
"rules": { | ||
"code-complexity": ["error", 8], | ||
"compiler-version": ["error", ">=0.8.4"], | ||
"func-name-mixedcase": "off", | ||
"func-visibility": ["error", { "ignoreConstructors": true }], | ||
"max-line-length": ["error", 120], | ||
"named-parameters-mapping": "warn", | ||
"no-console": "off", | ||
"not-rely-on-time": "off", | ||
"one-contract-per-file": "off" | ||
} | ||
} |
This file contains 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,9 @@ | ||
{ | ||
"[solidity]": { | ||
"editor.defaultFormatter": "NomicFoundation.hardhat-solidity" | ||
}, | ||
"[toml]": { | ||
"editor.defaultFormatter": "tamasfe.even-better-toml" | ||
}, | ||
"solidity.formatter": "forge" | ||
} |
This file contains 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,16 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Paul Razvan Berg | ||
|
||
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. |
This file contains 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,10 @@ | ||
# Sablier Standard Library [![License: MIT][license-badge]][license] | ||
|
||
[license]: https://opensource.org/licenses/MIT | ||
[license-badge]: https://img.shields.io/badge/License-MIT-blue.svg | ||
|
||
This repository contains the Sablier Standard Library. | ||
|
||
## License | ||
|
||
This project is licensed under MIT. |
Binary file not shown.
This file contains 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,34 @@ | ||
# Full reference https://github.com/foundry-rs/foundry/tree/master/crates/config | ||
|
||
[profile.default] | ||
auto_detect_solc = false | ||
block_timestamp = 1717200000 # June 1, 2024 at 00:00 GMT | ||
bytecode_hash = "none" | ||
evm_version = "paris" # See https://www.evmdiff.com/features?name=PUSH0&kind=opcode | ||
fuzz = { runs = 1_000 } | ||
gas_reports = ["*"] | ||
optimizer = true | ||
optimizer_runs = 10_000 | ||
out = "out" | ||
script = "script" | ||
solc = "0.8.25" | ||
src = "src" | ||
test = "test" | ||
|
||
[profile.ci] | ||
fuzz = { runs = 10_000 } | ||
verbosity = 4 | ||
|
||
[fmt] | ||
bracket_spacing = true | ||
int_types = "long" | ||
line_length = 120 | ||
multiline_func_header = "all" | ||
number_underscore = "thousands" | ||
quote_style = "double" | ||
tab_width = 4 | ||
wrap_comments = true | ||
|
||
[rpc_endpoints] | ||
localhost = "http://localhost:8545" | ||
sepolia = "https://sepolia.infura.io/v3/${API_KEY_INFURA}" |
This file contains 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,35 @@ | ||
{ | ||
"name": "@sablier/stdlib", | ||
"description": "Standard library for SabVM", | ||
"version": "1.0.0", | ||
"author": { | ||
"name": "Sablier Labs Ltd", | ||
"url": "https://sablier.com" | ||
}, | ||
"devDependencies": { | ||
"forge-std": "github:foundry-rs/forge-std#v1.8.1", | ||
"prettier": "^3.2.5", | ||
"solhint": "^3.6.2" | ||
}, | ||
"keywords": [ | ||
"blockchain", | ||
"ethereum", | ||
"forge", | ||
"foundry", | ||
"smart-contracts", | ||
"solidity", | ||
"template" | ||
], | ||
"private": true, | ||
"scripts": { | ||
"clean": "rm -rf cache out", | ||
"build": "forge build", | ||
"lint": "bun run lint:sol && bun run prettier:check", | ||
"lint:sol": "forge fmt --check && bun solhint {script,src,test}/**/*.sol", | ||
"prettier:check": "prettier --check \"**/*.{json,md,yml}\" --ignore-path \".prettierignore\"", | ||
"prettier:write": "prettier --write \"**/*.{json,md,yml}\" --ignore-path \".prettierignore\"", | ||
"test": "forge test", | ||
"test:coverage": "forge coverage", | ||
"test:coverage:report": "forge coverage --report lcov && genhtml lcov.info --branch-coverage --output-dir coverage" | ||
} | ||
} |
This file contains 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 @@ | ||
forge-std/=node_modules/forge-std/ |
This file contains 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,4 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity >=0.8.4; | ||
|
||
uint256 constant DEFAULT_SUB_ID = 0; |
This file contains 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,11 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity >=0.8.4; | ||
|
||
abstract contract NativeTokensPrecompile { | ||
/// @notice Transfers a native asset to the specified address. | ||
function pay(address from, address to, uint256 amount) external pure { | ||
from; | ||
to; | ||
amount; | ||
} | ||
} |
This file contains 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,18 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity >=0.8.4; | ||
|
||
library NativeTokens { | ||
/// @notice Transfers a native asset to the specified address. | ||
function pay(address to, uint256 amount) external pure { | ||
to; | ||
amount; | ||
} | ||
|
||
function subscribe(address to) external pure { | ||
to; | ||
} | ||
|
||
function unsubscribe(address from) external pure { | ||
from; | ||
} | ||
} |
Oops, something went wrong.