Skip to content

Commit

Permalink
Setup
Browse files Browse the repository at this point in the history
  • Loading branch information
hieronx committed Nov 1, 2024
0 parents commit e01512d
Show file tree
Hide file tree
Showing 142 changed files with 22,658 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .dapprc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export DAPP_REMAPPINGS=$(cat remappings.txt)
2 changes: 2 additions & 0 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SampleContractTest:testFunc1() (gas: 534472)
SampleContractTest:testFunc2() (gas: 534440)
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.gas-snapshot linguist-language=Julia
29 changes: 29 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Tests

on: [push, pull_request]

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

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

- name: Check formatting
run: forge fmt --check

- name: Install dependencies
run: forge install

- name: Check contract sizes
run: forge build --sizes

- name: Run tests
run: forge test
env:
# Only fuzz intensely if we're running this action on a push to main or for a PR going into main:
FOUNDRY_PROFILE: ${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && 'intense' }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/cache
/node_modules
/out
7 changes: 7 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
branch = v1.2.0
[submodule "lib/solmate"]
path = lib/solmate
url = https://github.com/transmissions11/solmate
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"solidity.packageDefaultDependenciesContractsDirectory": "src",
"solidity.packageDefaultDependenciesDirectory": "lib",
"solidity.compileUsingRemoteVersion": "v0.8.15",
"solidity.formatter": "forge",
"search.exclude": { "lib": true },
"files.associations": {
".dapprc": "shellscript",
".gas-snapshot": "julia"
}
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 t11s

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.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# ERC-7540 Reference Implementations • [![CI](https://github.com/ERC4626-Alliance/ERC-7540-Reference/actions/workflows/tests.yml/badge.svg)](https://github.com/ERC4626-Alliance/ERC-7540-Reference/actions/workflows/tests.yml)

Reference implementations for [ERC-7540](https://eips.ethereum.org/EIPS/eip-7540).

This code is unaudited.

#### Controlled Async Deposit ([code](https://github.com/ERC4626-Alliance/ERC-7540-Reference/blob/main/src/ControlledAsyncDeposit.sol))
- Deposits are asynchronous and subject to fulfillment by an owner account
- Redemptions are synchronous (standard ERC4626)

#### Controlled Async Redeem ([code](https://github.com/ERC4626-Alliance/ERC-7540-Reference/blob/main/src/ControlledAsyncRedeem.sol))
- Deposits are synchronous (standard ERC4626)
- Redemptions are asynchronous and subject to fulfillment by an owner account

#### Fully Async Vault ([code](https://github.com/ERC4626-Alliance/ERC-7540-Reference/blob/main/src/FullyAsyncVault.sol))
Inherits from Controlled Async Deposit and Controlled Async Redeem

- Both deposits and redemptions are asynchronous and subject to fulfillment by an owner account

#### Timelocked Async Redeem ([code](https://github.com/ERC4626-Alliance/ERC-7540-Reference/blob/main/src/TimelockedAsyncRedeem.sol))
- Deposits are synchronous (standard ERC4626)
- Redemptions are asynchronous and subject to a 3 day delay
- New redemptions restart the 3 day delay even if the prior redemption is claimable.
- The redemption exchange rate is locked in immediately upon request.

## License
This codebase is licensed under [MIT license](https://github.com/ERC4626-Alliance/ERC-7540-Reference/blob/main/LICENSE).
7 changes: 7 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[profile.default]
solc = "0.8.26"
bytecode_hash = "none"
optimizer_runs = 1000000

[profile.intense.fuzz]
runs = 10000
92 changes: 92 additions & 0 deletions lib/forge-std/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: CI

on:
workflow_dispatch:
pull_request:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

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

- name: Print forge version
run: forge --version

# Backwards compatibility checks.
- name: Check compatibility with 0.8.0
if: always()
run: forge build --skip test --use solc:0.8.0

- name: Check compatibility with 0.7.6
if: always()
run: forge build --skip test --use solc:0.7.6

- name: Check compatibility with 0.7.0
if: always()
run: forge build --skip test --use solc:0.7.0

- name: Check compatibility with 0.6.12
if: always()
run: forge build --skip test --use solc:0.6.12

- name: Check compatibility with 0.6.2
if: always()
run: forge build --skip test --use solc:0.6.2

# via-ir compilation time checks.
- name: Measure compilation time of Test with 0.8.17 --via-ir
if: always()
run: forge build --skip test --contracts test/compilation/CompilationTest.sol --use solc:0.8.17 --via-ir

- name: Measure compilation time of TestBase with 0.8.17 --via-ir
if: always()
run: forge build --skip test --contracts test/compilation/CompilationTestBase.sol --use solc:0.8.17 --via-ir

- name: Measure compilation time of Script with 0.8.17 --via-ir
if: always()
run: forge build --skip test --contracts test/compilation/CompilationScript.sol --use solc:0.8.17 --via-ir

- name: Measure compilation time of ScriptBase with 0.8.17 --via-ir
if: always()
run: forge build --skip test --contracts test/compilation/CompilationScriptBase.sol --use solc:0.8.17 --via-ir

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

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

- name: Print forge version
run: forge --version

- name: Run tests
run: forge test -vvv

fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

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

- name: Print forge version
run: forge --version

- name: Check formatting
run: forge fmt --check
4 changes: 4 additions & 0 deletions lib/forge-std/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cache/
out/
.vscode
.idea
3 changes: 3 additions & 0 deletions lib/forge-std/.gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/ds-test"]
path = lib/ds-test
url = https://github.com/dapphub/ds-test
Loading

0 comments on commit e01512d

Please sign in to comment.