Skip to content

Commit

Permalink
Merge branch 'develop' into yield-repo
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/test/policies/Heart.t.sol
#	src/test/policies/YieldRepurchaseFacility.t.sol
#	src/test/sim/RangeSim.sol
  • Loading branch information
0xJem committed Nov 13, 2024
2 parents 34b55d8 + 35b572a commit dc5023b
Show file tree
Hide file tree
Showing 1,898 changed files with 15,884 additions and 311,525 deletions.
8 changes: 8 additions & 0 deletions .env.deploy.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CHAIN=goerli
GUARDIAN_ADDRESS=0x0000000000000000000000000000000000000000
POLICY_ADDRESS=0x0000000000000000000000000000000000000000
EMERGENCY_ADDRESS=0x0000000000000000000000000000000000000000
RPC_URL=CHANGEME
ETHERSCAN_KEY=CHANGEME
DEPLOYER=CHANGEME
PRIVATE_KEY=CHANGEME
89 changes: 89 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Addresses and Chain Information
PRIVATE_KEY= # Deployer private key
ETH_FROM= # Deployer
RPC_URL=
CHAIN=
FORK_RPC_URL=
BLOCK_NUMBER=
GUARDIAN_ADDRESS=
GUARDIAN_PRIVATE_KEY=
POLICY_ADDRESS=
POLICY_PRIVATE_KEY=
GOV_ADDRESS=
GOV_PRIVATE_KEY=
ETHERSCAN_KEY=
FORK_TEST_RPC_URL=

# Contracts

# Bond Contracts
BOND_AGGREGATOR_ADDRESS=
BOND_TELLER_ADDRESS=
BOND_SDA_ADDRESS=

# Tokens
# Goerli
DAI_ADDRESS=0x41e38e70a36150D08A8c97aEC194321b5eB545A5
OHM_ADDRESS=0x0595328847AF962F951a4f8F8eE9A3Bf261e4f6b
STAKING_ADDRESS=0x7263372b9ff6E619d8774aEB046cE313677E2Ec7
# Mainnet
# DAI_ADDRESS=0x6B175474E89094C44Da98b954EedeAC495271d0F
# OHM_ADDRESS=0x64aa3364F17a4D01c6f1751Fd97C2BD3D7e7f1D5
# STAKING_ADDRESS=0xB63cac384247597756545b500253ff8E607a8020

# Price Feeds
# Goerli
OHM_ETH_FEED=0x022710a589C9796dce59A0C52cA4E36f0a5e991A
DAI_ETH_FEED=0xdC8E4eD326cFb730a759312B6b1727C6Ef9ca233
# Mainnet
# OHM_ETH_FEED=0x9a72298ae3886221820B1c878d12D872087D3a23
# DAI_ETH_FEED=0x773616E4d11A78F511299002da57A0a94577F1f4

# Staking Params
REWARD_RATE=64770 # 0.006477% per OIP-119

# Bophades
KERNEL=
INSTR=
TRSRY=
MINTR=
PRICE=
RANGE=
ROLES=
CALLBACK=
OPERATOR=
HEART=
PRICECONFIG=
ROLESADMIN=
TRSRYCUSTODIAN=
DISTRIBUTOR=
FAUCET=
# Old Contracts
AUTHORITY_ADDRESS=0x4A8c9502A34962a2C6d73c5D181dAaeF3dcDc88D

# Simulation configuration items

# Setup
KEYS=1 # Number of sims per seed
EPOCHS=1095 # Number of epochs per sim, 1 year = 1095
EPOCH_DURATION=28800 # 8 hours, Duration of each epoch in seconds
REBALANCE_FREQUENCY=604800 # 7 days, Frequency, in seconds, to rebalance liquidity
MA_DURATION=2592000 # 30 days, duration of moving average in seconds

# Simulation starting values
INITIAL_PRICE=14120000000000000000 # Price of OHM in USD, 18 decimals
MOVING_AVERAGE=14170000000000000000 # 30 DAY MA price, 18 decimals
SUPPLY=25000000000000000 # in OHM, 9 decimals
RESERVES=250000000000000000000000000 # in USD, 18 decimals
LIQUIDITY=25000000000000000000000000 # in USD, 18 decimals

# RBS parameters that are not provided in params.json
CUSHION_DURATION=86400 # 1 day, Cushion duration in seconds
CUSHION_DEBT_BUFFER=100000 # 100%, Percent with 3 decimals, i.e. 1000 = 1%
CUSHION_DEPOSIT_INTERVAL=14400 # 4 hours, Duration of each cushion deposit interval in seconds
REGEN_WAIT=518400 # 6 days, in seconds, time to wait before regenerating reserves.
# This value is the same as 18 positives obs in a row so no more than required to regen on observations
REGEN_THRESHOLD=18 # Number of positive observations to regenerate wall
REGEN_OBSERVE=21 # Number of observations to make at a time to regenerate wall
THRESHOLD_FACTOR=100 # 1%, percent with 2 decimals, i.e. 100 = 1%
MAX_OUTFLOW_RATE=330 # 3.3%, percent with 2 decimals, i.e. 100 = 1%
42 changes: 28 additions & 14 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ on:
- master
pull_request:

env:
ETH_MAINNET_RPC_URL: ${{ secrets.ETH_MAINNET_RPC_URL }}
POLYGON_MAINNET_RPC_URL: ${{ secrets.POLYGON_MAINNET_RPC_URL }}

jobs:
run-ci:
runs-on: ubuntu-latest
Expand All @@ -18,38 +14,56 @@ jobs:
with:
submodules: recursive

- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 20

- uses: pnpm/action-setup@v2
with:
version: 8
version: 9

- name: Install Node dependencies
run: pnpm install

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

- name: Install Foundry dependencies
run: forge install
run: pnpm run build

- name: Run lint check
run: pnpm run lint:check

- name: Run unit tests
run: pnpm run test:unit

- name: Run proposal simulation tests
run: pnpm run test:proposal
env:
FORK_TEST_RPC_URL: ${{ secrets.FORK_TEST_RPC_URL }}

- name: Run fork tests
run: pnpm run test:fork
env:
FORK_TEST_RPC_URL: ${{ secrets.FORK_TEST_RPC_URL }}

- name: Run cross-chain fork tests
run: pnpm run test:crosschainfork
env:
ETH_MAINNET_RPC_URL: ${{ secrets.ETH_MAINNET_RPC_URL }}
POLYGON_MAINNET_RPC_URL: ${{ secrets.POLYGON_MAINNET_RPC_URL }}

# FYI: currently version 1.14
- name: Setup lcov
uses: hrishikesh-kadam/setup-lcov@v1

- name: Run Code Coverage
run: pnpm run test:coverage

- name: Add Artifacts
uses: actions/upload-artifact@v3
with:
name: lcov.info
path: lcov.info

- name: Report Code Coverage
uses: zgosalvez/github-actions-report-lcov@v3
with:
coverage-files: lcov.info
github-token: ${{ secrets.GITHUB_TOKEN }}
update-comment: true
37 changes: 37 additions & 0 deletions .github/workflows/OCG.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: OCG Proposals
on:
push:
branches:
- master
pull_request:

jobs:
run-ci:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: actions/setup-node@v4
with:
node-version: 20

- uses: pnpm/action-setup@v2
with:
version: 9

- name: Install Node dependencies
run: pnpm install

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Install Foundry dependencies
run: pnpm run build

- name: Run proposal simulation tests
run: pnpm run test:proposal
env:
FORK_TEST_RPC_URL: ${{ secrets.FORK_TEST_RPC_URL }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ src/test/sim/sims/*.t.sol
.env_deploy*
docs/
coverage/
/solidity-metrics.html
24 changes: 24 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[submodule "lib/ds-test"]
path = lib/ds-test
url = https://github.com/dapphub/ds-test
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/solmate"]
path = lib/solmate
url = https://github.com/transmissions11/solmate
branch = main
[submodule "lib/solidity-examples"]
path = lib/solidity-examples
url = https://github.com/LayerZero-Labs/solidity-examples
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
branch = v4.8.0
[submodule "lib/clones-with-immutable-args"]
path = lib/clones-with-immutable-args
url = https://github.com/wighawag/clones-with-immutable-args
[submodule "lib/forge-proposal-simulator"]
path = lib/forge-proposal-simulator
url = https://github.com/OlympusDAO/forge-proposal-simulator

10 changes: 10 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"list-marker-space": {
"ul_multi": 1,
"ul_single": 1
},
"ul-indent": {
"indent": 4
},
"MD013": false
}
6 changes: 6 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
out/
docs/
cache/
coverage/
lib/
8 changes: 6 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@ src/test/lib/larping.sol
src/test/mocks/MockModuleWriter.sol
src/test/lib/quabi/Quabi.sol
src/test/sim/RangeSim.sol
src/scripts/Deploy.sol
src/scripts/DeployV2.sol
cache/
coverage/
docs/
lib/
node_modules/
out/
2 changes: 1 addition & 1 deletion .solhintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
src/test/**/*.sol
src/scripts/**/*.sol
src/scripts/**/*.sol
9 changes: 9 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"recommendations": [
"nomicfoundation.hardhat-solidity",
"gruntfuggly.todo-tree",
"ryanluker.vscode-coverage-gutters",
"github.vscode-github-actions",
"d-koppenhagen.file-tree-to-text-generator"
]
}
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"solidity.formatter": "prettier",
"[solidity]": {
"editor.defaultFormatter": "NomicFoundation.hardhat-solidity"
},
"solidity.defaultCompiler": "remote",
"solidity.compileUsingRemoteVersion": "v0.8.15+commit.e14f2714",
"solidity-metrics.file.exclusions.glob": "{**/node_modules,**/mock*,**/test*,**/migrations,**/Migrations.sol,lib,**/external,**/libraries,**/interfaces}",
"solidity.monoRepoSupport": false
}
12 changes: 7 additions & 5 deletions CODE_STD.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,23 @@ The following establishes a coding standard for the Olympus v3/Bophades repo.
- NatSpec comments use `///`
- `/// @notice Natspec comment`
- Contract and function groups or other major sections in SOURCE files should be denoted with
```
- This is to denote sections when scrolling through large files

```solidity
//============================================================================================//
// HEADER //
//============================================================================================//
```
- This is to denote sections when scrolling through large files
- All other sections should be denoted with single line header:
```// ========= HEADER ========= // ```

- All other sections should be denoted with single line header:
`// ========= HEADER ========= //`

## Principles (NOT HARD RULES)

- Aim for clear and succinct code
- Explicit over implicit
- Write code PRIMARILY for humans, not machines
- Comment on WHY, not WHAT. Code should be able to explain "what".
- Aim to write code that is self-documenting
- Meaning clear function names and variables
- Aim for gas-efficiency with above constraints
- Aim for gas-efficiency with above constraints
Loading

0 comments on commit dc5023b

Please sign in to comment.