Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #5

Merged
merged 147 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
4339ec0
feat: first working version
MathisGD Jun 24, 2023
cec83d8
chore: hardhat dependencies
MathisGD Jun 25, 2023
eeaa50b
feat: independent collateral
MathisGD Jun 26, 2023
f66cc1b
test: improve testing
MathisGD Jun 26, 2023
d57e434
fix: minor issues in MathLib
MathisGD Jun 27, 2023
9deb65c
fix: lastUpdate issue
MathisGD Jun 27, 2023
9ba8b9c
fix: minor issues
MathisGD Jun 27, 2023
624ebf6
chore: commit remappings.txt
MathisGD Jun 27, 2023
06b49b2
test: remove broken liquidity test
MathisGD Jun 27, 2023
3d28c31
feat: working batch liquidations
QGarchery Jun 27, 2023
4f80f34
fix: transfer direction, removing int casting
QGarchery Jun 27, 2023
4cb66b1
fix: Math.min
QGarchery Jun 27, 2023
2aee83b
fix: comment safeToUint
QGarchery Jun 27, 2023
9472ff7
feat: 0 amount liquidation and check bucket
QGarchery Jun 27, 2023
15a8e07
fix: empty market issue
MathisGD Jun 27, 2023
5d9137d
test: add liquidation test
QGarchery Jun 28, 2023
31c78bb
Merge remote-tracking branch 'origin/feat/first-working-version' into…
QGarchery Jun 28, 2023
15a6ef8
test: added balance check when two users supply
QGarchery Jun 28, 2023
b993b9e
ci: change name
QGarchery Jun 28, 2023
4b3e532
Merge pull request #1 from morpho-labs/feat/first-working-version
MathisGD Jun 28, 2023
f8e9cd5
feat: multiple markets
MathisGD Jun 27, 2023
42e4ea0
feat: estimate gas cost of batch liquidation
QGarchery Jun 28, 2023
58687e5
test: compare batching with naive solution
QGarchery Jun 28, 2023
93b4661
feat: realize bad debt
QGarchery Jun 28, 2023
60150d4
Merge remote-tracking branch 'origin/feat/liquidation' into test/esti…
QGarchery Jun 28, 2023
f792083
test: add liquidator contract mock
QGarchery Jun 28, 2023
d5b0fae
fix: bucketToLLTV in contract
QGarchery Jun 28, 2023
9a42a7f
fix: bucket with only one borrower
QGarchery Jun 28, 2023
0e2a8e3
feat: allow max liquidations
QGarchery Jun 29, 2023
a65f743
test: add realize bad debt test
QGarchery Jun 29, 2023
62459af
Merge remote-tracking branch 'origin/feat/liquidation' into test/esti…
QGarchery Jun 29, 2023
f7e84a3
test: fix id computation
MathisGD Jul 2, 2023
4e7b586
feat: split entry-points
MathisGD Jul 2, 2023
e901da7
chore: revert file renaming
MathisGD Jul 3, 2023
306a674
style: variable renaming
MathisGD Jul 3, 2023
d81e1ca
fix: user supply share accounting
MathisGD Jul 3, 2023
62e1001
test: unknown market
MathisGD Jul 4, 2023
478fe5b
fix: checkHealth private
MathisGD Jul 4, 2023
3eb9827
style: info renaming
MathisGD Jul 4, 2023
fef155c
chore: settle solidity pragma
MathisGD Jul 4, 2023
bd090ea
test: amount zero
MathisGD Jul 4, 2023
d9add88
chore: prettierrc for ts files
MathisGD Jul 4, 2023
2c7d88b
test: fix amount zero test
MathisGD Jul 4, 2023
e577531
chore: update solidity version
MathisGD Jul 4, 2023
9a990fa
Merge pull request #2 from morpho-labs/feat/multi-market
QGarchery Jul 4, 2023
071b3d0
Merge remote-tracking branch 'origin/dev' into feat/liquidation
QGarchery Jul 4, 2023
49b9450
refactor: after review
QGarchery Jul 4, 2023
c56ba57
refactor: simplify isHealthy
QGarchery Jul 4, 2023
5120b2b
Merge remote-tracking branch 'origin/feat/liquidation' into test/esti…
QGarchery Jul 4, 2023
797011c
fix: from review
QGarchery Jul 4, 2023
0f52553
refactor: small cosmetic fixes
QGarchery Jul 4, 2023
2972f3c
refactor: clearer configuration setup
QGarchery Jul 4, 2023
dd00263
feat: simplify liquidation
MathisGD Jul 4, 2023
3daf34f
test: improve liquidation testing
MathisGD Jul 4, 2023
78817cb
docs: minor comment improvement
MathisGD Jul 4, 2023
d22f355
fix: safeTransfer
MathisGD Jul 4, 2023
2317096
perf: != 0 instead of <
MerlinEgalite Jul 5, 2023
0af912c
refactor: use helper id function to avoid redundant code
MerlinEgalite Jul 5, 2023
5737a62
fix: correct function
MerlinEgalite Jul 5, 2023
6bed777
test: minor improvements
MathisGD Jul 5, 2023
5d4543e
Merge pull request #4 from morpho-labs/feat/liquidation
MathisGD Jul 5, 2023
1554b78
Merge pull request #25 from morpho-labs/fix/safe-transfer
MathisGD Jul 5, 2023
f438dd8
chore: files renaming
MathisGD Jul 4, 2023
0e3b832
fix: pin hh to 2.15
MerlinEgalite Jul 5, 2023
4105749
Merge branch 'dev' of github.com:morpho-labs/blue into perf/check-zero
MerlinEgalite Jul 5, 2023
9fdc2c0
Merge pull request #20 from morpho-labs/chore/files-renaming
MathisGD Jul 5, 2023
1ae8880
perf: same for isHealthy and liquidate
MerlinEgalite Jul 5, 2023
e1290c2
Merge branch 'dev' of github.com:morpho-labs/blue into perf/check-zero
MerlinEgalite Jul 5, 2023
a5d28ab
Merge remote-tracking branch 'origin/dev' into test/estimate-liquidat…
QGarchery Jul 5, 2023
fbaa7c9
Merge branch 'dev' of github.com:morpho-labs/blue into refactor/to-id
MerlinEgalite Jul 5, 2023
c0282d8
feat: id for liquidate + move function upward
MerlinEgalite Jul 5, 2023
3bf3db0
Merge pull request #32 from morpho-labs/refactor/to-id
MathisGD Jul 5, 2023
c20570b
feat: add owner to contract
MerlinEgalite Jul 5, 2023
f877eb5
fix: deployment
MerlinEgalite Jul 5, 2023
0babf30
chore: revert now unnecessary changes to yarn.lock
QGarchery Jul 5, 2023
05b8db6
feat: update file
MerlinEgalite Jul 5, 2023
00e9b42
Merge pull request #35 from morpho-labs/fix/working-hh-version
MathisGD Jul 5, 2023
70cb8b0
test: add test owner
MerlinEgalite Jul 5, 2023
2dc5593
perf: remove accrue interest from supplyCollateral function
MerlinEgalite Jul 5, 2023
d9cb441
docs: add comment
MerlinEgalite Jul 5, 2023
8200797
refactor: capital letters for constants
MerlinEgalite Jul 5, 2023
38b38da
Merge pull request #56 from morpho-labs/refactor/alpha
MerlinEgalite Jul 5, 2023
a1e6fbe
refactor: simplify isHealthy
QGarchery Jul 5, 2023
1b48119
feat: add IRM whitelist
MerlinEgalite Jul 5, 2023
2224683
feat: rename whitelist mapping
MerlinEgalite Jul 5, 2023
4f4f740
Merge pull request #31 from morpho-labs/perf/check-zero
MerlinEgalite Jul 5, 2023
9b9ed18
docs: implement suggestion
MerlinEgalite Jul 5, 2023
a4d3046
feat: use interface
MerlinEgalite Jul 5, 2023
ac5e328
feat: more general IRM
MerlinEgalite Jul 5, 2023
5bc9d6e
refactor: naming
MerlinEgalite Jul 5, 2023
e0ce0f5
test: add tests + remove console log
MerlinEgalite Jul 5, 2023
78c4ca1
perf: save gas
MerlinEgalite Jul 5, 2023
88ccfb9
refactor: remove event
MerlinEgalite Jul 6, 2023
06d5441
fix: removal
MerlinEgalite Jul 6, 2023
b6af9d9
Merge remote-tracking branch 'origin/dev' into test/estimate-liquidat…
QGarchery Jul 6, 2023
ad03870
feat: implement suggestions
MerlinEgalite Jul 6, 2023
f5111f4
refactor: improve hardhat testing style
QGarchery Jul 6, 2023
03a129c
docs: comment on closing a market in gas test
QGarchery Jul 6, 2023
5363c1d
refactor: apply changes
MerlinEgalite Jul 6, 2023
36802db
feat: move function to admin place
MerlinEgalite Jul 6, 2023
2692eb8
refactor: get back to bool
MerlinEgalite Jul 6, 2023
cc22ada
refactor: whitelist -> enable
MerlinEgalite Jul 6, 2023
ffc05c2
test: add missing test + format
MerlinEgalite Jul 6, 2023
4be8657
chore: format pre-commit
MerlinEgalite Jul 6, 2023
bca68b9
chore: use forge install
MerlinEgalite Jul 6, 2023
79848ae
Merge pull request #58 from morpho-labs/refactor/healthy-zero
QGarchery Jul 6, 2023
91e050d
Merge pull request #52 from morpho-labs/perf/remove-accrue-interest-s…
MerlinEgalite Jul 6, 2023
7718133
chore: missing forge install
MerlinEgalite Jul 6, 2023
de937e7
feat: use market instead of id
MerlinEgalite Jul 6, 2023
eced257
feat: enable lLTV
MerlinEgalite Jul 6, 2023
5d383f3
test: add missing test
MerlinEgalite Jul 6, 2023
d36f6a0
feat: internalize owner
MerlinEgalite Jul 6, 2023
f0646f3
Merge pull request #68 from morpho-labs/chore/formatter
MerlinEgalite Jul 6, 2023
4160f54
Merge branch 'feat/owner' of github.com:morpho-labs/blue into feat/ir…
MerlinEgalite Jul 6, 2023
93f0f1c
refactor: renaming irm
MerlinEgalite Jul 6, 2023
d52f15a
chore: increase number of fuzz/invariant on CI
MathisGD Jul 6, 2023
6dd7fca
test: better tests + add one
MerlinEgalite Jul 6, 2023
2ee005b
Merge pull request #43 from morpho-labs/feat/owner
MerlinEgalite Jul 6, 2023
fe71f20
feat: cleaner code
MerlinEgalite Jul 6, 2023
ab45331
Merge branch 'dev' of github.com:morpho-labs/blue into feat/irm-white…
MerlinEgalite Jul 6, 2023
2baa13e
refactor: renaming
MerlinEgalite Jul 6, 2023
fbc94c9
Merge branch 'feat/irm-whitelist' of github.com:morpho-labs/blue into…
MerlinEgalite Jul 6, 2023
4738d93
test: improve tests
MerlinEgalite Jul 6, 2023
c916251
fix: issue with naming
MerlinEgalite Jul 6, 2023
d87e02d
chore: refactor CI yml
MathisGD Jul 7, 2023
4f9fb84
fix: issue with naming
MerlinEgalite Jul 7, 2023
d6963be
feat: remove useless ownable
MerlinEgalite Jul 7, 2023
32337d6
refactor: recreate borrowRate var
MerlinEgalite Jul 7, 2023
79a07d7
test: fix hardat tests
MerlinEgalite Jul 7, 2023
d6f6f2a
fix: using expect correctly
QGarchery Jul 7, 2023
7e4f52c
Merge pull request #74 from morpho-labs/chore/ci-update
MathisGD Jul 7, 2023
2c89aa9
test: capital letters for constants
MerlinEgalite Jul 7, 2023
057e0d7
test: fix test
MerlinEgalite Jul 7, 2023
6c1d842
refactor: remove useless imports
MerlinEgalite Jul 8, 2023
0ceaeda
Merge pull request #59 from morpho-labs/feat/irm-whitelist
MerlinEgalite Jul 8, 2023
3f73928
Merge branch 'dev' of github.com:morpho-labs/blue into feat/enable-lltv
MerlinEgalite Jul 8, 2023
1c23715
Merge remote-tracking branch 'origin/feat/enable-lltv' into test/esti…
QGarchery Jul 8, 2023
e1336df
fix: hardhat test with lltv
QGarchery Jul 8, 2023
99cfa52
refactor: check borrow instead of supply when accruing interests
QGarchery Jul 10, 2023
a51d0de
docs: comment about total supply non-zero
QGarchery Jul 10, 2023
c342527
Merge pull request #73 from morpho-labs/feat/enable-lltv
MerlinEgalite Jul 10, 2023
d872653
refactor: uint -> uint256
MerlinEgalite Jul 10, 2023
0a1b22c
Merge pull request #7 from morpho-labs/test/estimate-liquidation-gas
QGarchery Jul 10, 2023
1c06c05
refactor: removed cached total supply in accrue interests
QGarchery Jul 10, 2023
28a3995
Merge pull request #95 from morpho-labs/refactor/uint256
MerlinEgalite Jul 10, 2023
214e6b5
Merge remote-tracking branch 'origin/dev' into refactor/interests-che…
QGarchery Jul 10, 2023
d998d91
Merge pull request #91 from morpho-labs/refactor/interests-check-borrow
QGarchery Jul 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 8 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
name: test
name: Foundry CI

on:
workflow_dispatch:
push:
branches:
- main
pull_request:

env:
FOUNDRY_PROFILE: ci

jobs:
check:
test:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -24,16 +18,11 @@ jobs:

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

- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test -vvv
id: test
run: forge test -vvv
env:
FOUNDRY_FUZZ_RUNS: 100000
FOUNDRY_FUZZ_MAX_TEST_REJECTS: 500000
FOUNDRY_INVARIANT_RUNS: 1000
FOUNDRY_INVARIANT_DEPTH: 100
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@ docs/

# Dotenv file
.env

# Node modules
/node_modules

# Hardhat
/types
/cache_hardhat
/artifacts
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[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
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn commitlint --edit "${1}"
5 changes: 5 additions & 0 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

forge install
yarn
5 changes: 5 additions & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

forge install
yarn
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"printWidth": 120
}
3 changes: 0 additions & 3 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
via-ir = true

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
55 changes: 55 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import "@nomicfoundation/hardhat-chai-matchers";
import "@nomicfoundation/hardhat-foundry";
import "@nomicfoundation/hardhat-network-helpers";
import "@nomiclabs/hardhat-ethers";
import "@typechain/hardhat";
import * as dotenv from "dotenv";
import "ethers-maths";
import "hardhat-deal";
import "hardhat-gas-reporter";
import "hardhat-tracer";
import { HardhatUserConfig } from "hardhat/config";
import "solidity-coverage";

dotenv.config();

const config: HardhatUserConfig = {
defaultNetwork: "hardhat",
networks: {
hardhat: {
chainId: 1,
gasPrice: 0,
initialBaseFeePerGas: 0,
accounts: {
count: 102,
},
},
},
solidity: {
compilers: [
{
version: "0.8.20",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
viaIR: true,
},
},
],
},
mocha: {
timeout: 3000000,
},
typechain: {
outDir: "types/",
externalArtifacts: ["deps/**/*.json"],
},
tracer: {
defaultVerbosity: 1,
gasCost: true,
},
};

export default config;
1 change: 1 addition & 0 deletions lib/solmate
Submodule solmate added at bfc9c2
56 changes: 56 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"scripts": {
"postinstall": "husky install",
"compile": "npx hardhat compile --force",
"test": "npx hardhat test"
},
"dependencies": {
"@ethersproject/abi": "^5.7.0",
"@ethersproject/bytes": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"ethers": "^5.7.2",
"ethers-maths": "^3.5.1",
"lodash": "^4.17.21",
"openzeppelin-contracts": "^4.0.0"
},
"devDependencies": {
"@commitlint/cli": "^17.6.6",
"@commitlint/config-conventional": "^17.6.6",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.6",
"@nomicfoundation/hardhat-foundry": "^1.0.1",
"@nomicfoundation/hardhat-network-helpers": "^1.0.8",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
"@typechain/ethers-v5": "^10.2.1",
"@typechain/hardhat": "^6.1.6",
"@types/chai": "^4.3.5",
"@types/lodash": "^4.14.195",
"@types/mocha": "^10.0.1",
"@types/node": "^20.2.5",
"chai": "^4.3.7",
"dotenv": "^16.1.3",
"hardhat": "2.15",
"hardhat-deal": "^1.3.0",
"hardhat-gas-reporter": "^1.0.9",
"hardhat-tracer": "2.3.2",
"husky": "8.0.3",
"lint-staged": "13.2.2",
"prettier": "^2.8.8",
"solidity-coverage": "^0.8.2",
"ts-node": "^10.9.1",
"typechain": "^8.2.0",
"typescript": "5.0.4"
},
"lint-staged": {
"*.sol": "forge fmt",
"*.js": "yarn prettier",
"*.ts": "yarn prettier",
"*.json": "yarn prettier",
"*.yml": "yarn prettier"
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
}
}
3 changes: 3 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ds-test/=lib/forge-std/lib/ds-test/src/
forge-std/=lib/forge-std/src/
solmate/=lib/solmate/src/
Loading