-
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 67b25fb
Showing
75 changed files
with
19,635 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,55 @@ | ||
START_DATE= | ||
|
||
PRIVATE_KEY= | ||
|
||
# RPC_URL=http://127.0.0.1:8545 | ||
RPC_URL=https://gateway.tenderly.co/public/polygon | ||
|
||
ETHERSCAN_API_KEY= | ||
|
||
OWNER= | ||
|
||
ADMIN= | ||
DEPLOYER= | ||
|
||
USDC_ADDRESS=0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 | ||
USDC_AGGREGATOR_ADDRESS=0xfE4A8cc5b5B2366C1B58Bea3858e81843581b2F7 | ||
|
||
RUSD_ADDRESS= | ||
SRUSD_ADDRESS= | ||
|
||
TERM_ADDRESS= | ||
TERM_ISSUER_ADDRESS= | ||
|
||
SAVING_MODULE_ADDRESS= | ||
PEG_STABILITY_MODULE_ADDRESS= | ||
|
||
CREDIT_ENFORCER_ADDRESS= | ||
ACCOUNT_MANAGER_ADDRESS= | ||
|
||
DURATION=2592000 # 30 days | ||
|
||
ASSET_RATIO_MIN=1050000 | ||
EQUITY_RATIO_MIN=1050000 | ||
LIQUIDITY_RATIO_MIN=1050000 | ||
|
||
SM_DEBT_MAX=10000000000000000000000000 # 10 M | ||
PSM_DEBT_MAX=10000000000000 # 10 M | ||
|
||
TERM_ID=0x0000000000000000000000000000000000000000000000000000000000000008 | ||
TERM_DEBT_MAX=0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff | ||
TERM_DISCOUNT_RATE=100000000 # 0.0001 | ||
|
||
PSM_USDC_RISK_WEIGHT=1000 | ||
|
||
SM_SAVING_RATE=100000000 # 0.0001 | ||
|
||
FUND_NAME="Test Fund 02" | ||
FUND_SYMBOL="TF-02" | ||
|
||
FUND_ADDRESS= | ||
FUND_AGGREGATOR_ADDRESS= | ||
|
||
FUND_ADAPTER_ADDRESS= | ||
|
||
IS_FORK=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,65 @@ | ||
name: Coverage | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
|
||
env: | ||
FOUNDRY_PROFILE: ci | ||
|
||
jobs: | ||
cd: | ||
strategy: | ||
fail-fast: true | ||
|
||
name: Reservoir Coverage Report | ||
runs-on: ubuntu-latest | ||
environment: test | ||
permissions: | ||
id-token: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
token: ${{ secrets.FORTUNABOT_REPOS }} | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Install dependencies | ||
run: | | ||
cd lib/chainlink | ||
yarn install | ||
id: installdep | ||
|
||
- name: Run Forge build | ||
run: | | ||
forge --version | ||
forge build --sizes | ||
id: build | ||
|
||
# Setup using https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | ||
aws-region: us-west-2 | ||
|
||
- name: Publish cod cov badge | ||
run: | | ||
# From https://itnext.io/github-actions-code-coverage-without-third-parties-f1299747064d | ||
total=`forge coverage | tail -1 | cut -d '|' -f 3 | awk '{print $1}' | grep -Eo '[0-9]+\.[0-9]+'` | ||
if (( $(echo "$total <= 50" | bc -l) )) ; then | ||
COLOR=red | ||
elif (( $(echo "$total > 80" | bc -l) )); then | ||
COLOR=green | ||
else | ||
COLOR=orange | ||
fi | ||
curl "https://img.shields.io/badge/coverage-$total%25-$COLOR" > coverage.svg | ||
aws s3 cp coverage.svg s3://${{ vars.COVERAGE_BUCKET_NAME }}/${GITHUB_REF_NAME}/ |
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,50 @@ | ||
name: Build | ||
|
||
on: push | ||
|
||
env: | ||
FOUNDRY_PROFILE: ci | ||
|
||
jobs: | ||
check: | ||
strategy: | ||
fail-fast: true | ||
|
||
name: Reservoir Unit Tests | ||
runs-on: ubuntu-latest | ||
environment: test | ||
env: | ||
ALCHEMY_KEY: ${{ secrets.ALCHEMY_KEY }} | ||
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
token: ${{ secrets.FORTUNABOT_REPOS }} | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Install dependencies | ||
run: | | ||
cd lib/chainlink | ||
yarn install | ||
id: installdep | ||
|
||
- name: Run Forge build | ||
run: | | ||
forge --version | ||
forge build --sizes | ||
id: build | ||
- name: Run Forge tests | ||
run: | | ||
cp .env.template .env | ||
forge test -vvv | ||
id: testrun | ||
|
||
- name: Snapshot Forge Gas in tests | ||
run: | | ||
forge snapshot | ||
id: snapshot |
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,13 @@ | ||
cache/ | ||
out/ | ||
broadcast/ | ||
|
||
# dotenv environment variables file | ||
.env | ||
lcov.info | ||
**/*.swp | ||
|
||
.vscode/ | ||
|
||
.DS_Store | ||
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,14 @@ | ||
[submodule "lib/forge-std"] | ||
path = lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std | ||
[submodule "lib/chainlink"] | ||
path = lib/chainlink | ||
url = https://github.com/smartcontractkit/chainlink | ||
branch = v1.11.0 | ||
[submodule "lib/openzeppelin-contracts"] | ||
path = lib/openzeppelin-contracts | ||
url = https://github.com/OpenZeppelin/openzeppelin-contracts | ||
branch = v4.8.1 | ||
[submodule "lib/offchain-fund"] | ||
path = lib/offchain-fund | ||
url = https://github.com/fortunafi/offchain-fund |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 fortunafi | ||
|
||
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,22 @@ | ||
[![Build](https://github.com/fortunafi/reservoir/actions/workflows/test.yml/badge.svg?branch=wissam/add-code-coverage)](https://github.com/fortunafi/reservoir/actions/workflows/test.yml) | ||
[![Coverage](https://reservoir-code-coverage-public.s3.us-west-2.amazonaws.com/master/coverage.svg?no-cache)](https://github.com/fortunafi/reservoir/actions/workflows/coverage.yml) | ||
|
||
This repository contains the full suite of smart contracts that define the Reservoir protocol. User's are able to | ||
purchase the native stablecoin *rUSD* and exchange it for a fixed term or variable rate yield bearing tokens *trUSD* and | ||
*srUSD*. The liabilities of the protocol are backed by a mix of real world assets (RWA)s and onchain yield bearing assets in lending protocols and AMMs. | ||
|
||
The assets where capital is allocated is fully configurable through governance, and | ||
solvency in the protocol is controlled by ratios set through governance that constrain leverage in the system. | ||
|
||
## Getting Started | ||
|
||
```bash | ||
$ forge install | ||
|
||
$ forge test | ||
``` | ||
|
||
Scripts used for deployment can be found under `bin/`. | ||
|
||
## Audits | ||
|
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 @@ | ||
[profile.default] | ||
src = 'src' | ||
out = 'out' | ||
libs = ['lib'] | ||
solc_version = "0.8.24" | ||
|
||
# See more config options https://github.com/foundry-rs/foundry/tree/master/config |
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 @@ | ||
chainlink/=lib/chainlink/ | ||
ds-test/=lib/forge-std/lib/ds-test/src/ | ||
erc4626-tests/=lib/offchain-fund/lib/openzeppelin-contracts/lib/erc4626-tests/ | ||
forge-std/=lib/forge-std/src/ | ||
offchain-fund/=lib/offchain-fund/ | ||
openzeppelin-contracts/=lib/openzeppelin-contracts/ |
Oops, something went wrong.