-
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 a68c893
Showing
35 changed files
with
923 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,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,26 @@ | ||
name: "Multibuild" | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 3 * * 0" # at 3:00am UTC every Sunday | ||
|
||
jobs: | ||
multibuild: | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Check out the repo" | ||
uses: "actions/checkout@v4" | ||
|
||
- name: "Install Bun" | ||
uses: "oven-sh/setup-bun@v1" | ||
|
||
- name: "Install the Node.js dependencies" | ||
run: "bun install --frozen-lockfile" | ||
|
||
- name: "Check that the project can be built with multiple Solidity versions" | ||
uses: "PaulRBerg/foundry-multibuild@v1" | ||
with: | ||
min: "0.8.4" | ||
max: "0.8.26" | ||
skip-test: "true" |
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,16 @@ | ||
# directories | ||
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,15 @@ | ||
{ | ||
"extends": "solhint:recommended", | ||
"rules": { | ||
"avoid-low-level-calls": "off", | ||
"code-complexity": ["error", 8], | ||
"compiler-version": ["error", ">=0.8.12"], | ||
"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,10 @@ | ||
{ | ||
"[solidity]": { | ||
"editor.defaultFormatter": "NomicFoundation.hardhat-solidity" | ||
}, | ||
"[toml]": { | ||
"editor.defaultFormatter": "tamasfe.even-better-toml" | ||
}, | ||
"editor.formatOnSave": true, | ||
"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,43 @@ | ||
# 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 = "shanghai" | ||
fuzz = { runs = 1_000 } | ||
gas_reports = ["SRF20"] | ||
optimizer = true | ||
optimizer_runs = 10_000 | ||
out = "out" | ||
script = "script" | ||
solc = "0.8.26" | ||
src = "src" | ||
test = "test" | ||
|
||
[profile.ci] | ||
fuzz = { runs = 10_000 } | ||
verbosity = 4 | ||
|
||
# Speed up compilation and tests during development | ||
[profile.lite] | ||
optimizer = false | ||
|
||
[doc] | ||
ignore = ["**/*.t.sol"] | ||
out = "docs" | ||
repository = "https://github.com/sablier-labs/stdlib" | ||
|
||
[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,16 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.12; | ||
|
||
// import { SubID } from "./Types.sol"; | ||
|
||
/*////////////////////////////////////////////////////////////////////////// | ||
NATIVE TOKENS | ||
//////////////////////////////////////////////////////////////////////////*/ | ||
|
||
bytes32 constant DEFAULT_SUB_ID = bytes32(0); | ||
|
||
/*////////////////////////////////////////////////////////////////////////// | ||
PRECOMPILES | ||
//////////////////////////////////////////////////////////////////////////*/ | ||
|
||
address constant PRECOMPILE_NATIVE_TOKENS = address(0x7060000000000000000000000000000000000001); |
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: MIT | ||
pragma solidity >=0.8.12; | ||
|
||
error StdLib_UnknownError(string message); |
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,6 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.12; | ||
|
||
type AssetID is uint256; | ||
|
||
type SubID is bytes32; |
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,37 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.12; | ||
|
||
/// @notice Interface for the NativeTokens precompile, which can perform operations on native tokens. | ||
/// @dev It is NOT recommended to use this interface directly. Instead, users should use the {NativeTokens} library. | ||
/// This interface is used by the library to ABI encode the precompile calls. | ||
interface INativeTokens { | ||
function balanceOf(uint256 tokenID, address account) external returns (uint256); | ||
function burn(address holder, bytes32 subID, uint256 amount) external; | ||
function mint(address recipient, bytes32 subID, uint256 amount) external; | ||
function transfer(address from, address to, bytes32 tokenID, uint256 amount) external; | ||
function transferAndCall( | ||
address from, | ||
address to, | ||
bytes32 tokenID, | ||
uint256 amount, | ||
address callee, | ||
bytes calldata data | ||
) | ||
external; | ||
function transferMultiple( | ||
address from, | ||
address[] calldata to, | ||
bytes32[] calldata tokenIDs, | ||
uint256[] calldata amounts | ||
) | ||
external; | ||
function transferMultipleAndCall( | ||
address from, | ||
address[] calldata to, | ||
bytes32[] calldata tokenIDs, | ||
uint256[] calldata amounts, | ||
address callee, | ||
bytes calldata data | ||
) | ||
external; | ||
} |
Oops, something went wrong.