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

[WIP]Audit-Code4rena-2024-12: Compare the different files Without Fix #11

Open
wants to merge 40 commits into
base: audit/code4rena-fix-2024-07
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
231e88a
rename yield liquidationThreshold to collateralFactor
thorseldon Aug 29, 2024
9431903
deploy core contracts for mainnet testing
thorseldon Sep 2, 2024
352358a
add eETH price adapter
thorseldon Sep 2, 2024
c85c460
Merge branch 'feat/eeth-price-adapter' into chore/deploy-mainnet-testing
thorseldon Sep 2, 2024
f75e4e4
deploy yield contracts for mainnet testing
thorseldon Sep 2, 2024
d5afbe0
fix: calcuate liquidat price for getIsolateLiquidateData
thorseldon Sep 3, 2024
7d2736e
update scripts
thorseldon Sep 6, 2024
fd06208
add getYieldStakerAssetData
thorseldon Sep 7, 2024
de68386
add audit reports and update readme
thorseldon Sep 7, 2024
fa4807c
change the user param of yield unstake & repay event
thorseldon Sep 10, 2024
322aaf6
Merge pull request #5 from BendDAO/chore/deploy-mainnet-testing
thorseldon Sep 14, 2024
a1d7bc2
fix isolate liquidate not clear lockerAddr
thorseldon Sep 14, 2024
116492b
add sky usds for staking pool
thorseldon Oct 3, 2024
a88da2a
deploy usds on sepolia
thorseldon Oct 8, 2024
3cf0092
add pool to default irm
thorseldon Oct 8, 2024
9b4bdf5
add usds abi file
thorseldon Oct 9, 2024
cac800c
deploy usds yield on mainnet
thorseldon Oct 10, 2024
e7f5765
using proxy for default irm
thorseldon Oct 26, 2024
e2703bf
updating asset irm
thorseldon Oct 26, 2024
b87fdc5
update asset irm
thorseldon Oct 26, 2024
52f8ded
update scripts
thorseldon Oct 27, 2024
304ef0c
Merge pull request #7 from BendDAO/feat/sky-usds
thorseldon Oct 27, 2024
bf0c410
Merge branch 'main' into feat/irm-add-pool
thorseldon Oct 27, 2024
9f147d0
Merge pull request #6 from BendDAO/feat/irm-add-pool
thorseldon Oct 28, 2024
ab40210
fix compile error
thorseldon Oct 28, 2024
64d2216
update abis for irm
thorseldon Nov 1, 2024
54650df
add token oracle
thorseldon Nov 4, 2024
a0b2958
fix error code
thorseldon Nov 5, 2024
3273a39
add reentrant testcases
thorseldon Nov 11, 2024
e9faf5c
Merge pull request #8 from BendDAO/feat/add-token-oracle
thorseldon Nov 12, 2024
328258f
update defautl irm addresses
thorseldon Nov 13, 2024
eb596ea
add yield for wusd staking
thorseldon Nov 19, 2024
a3e75b2
add testcases
thorseldon Nov 19, 2024
b92e1bf
update deploy scripts
thorseldon Nov 19, 2024
ac67270
only one stake per each nft
thorseldon Nov 22, 2024
f98baab
deploy wusd staking on mainnet
thorseldon Nov 27, 2024
e38a959
add method for query stake plan
thorseldon Dec 2, 2024
5024fb2
Merge pull request #9 from BendDAO/feat/wusd-yield
thorseldon Dec 3, 2024
50fd780
fix getYieldStakerAssetData error
thorseldon Dec 5, 2024
abd0ef8
Merge branch 'main' into audit/code4rena-2024-12
thorseldon Dec 8, 2024
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
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Licensed Work: BendDAO V2 Protocol. The Licensed Work is (c) 2023 BendDAO

Additional Use Grant: Any uses listed and defined at this [LICENSE](./LICENSE.md)

Change Date: The earlier of 1 Octor 2026 or a date specified at v2-license-date.benddao.eth
Change Date: The earlier of 1 September 2027 or a date specified at v2-license-date.benddao.eth

Change License: MIT

Expand Down
98 changes: 29 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,46 @@
```
###### ###### # #######
# # ###### # # ##### # # # # # #
# # # ## # # # # # # # # #
###### ##### # # # # # # # # # # #
# # # # # # # # # # ####### # #
# # # # ## # # # # # # # #
###### ###### # # ##### ###### # # #######
```

# BendDAO Protocol V2

This repository contains the smart contracts source code and markets configuration for BendDAO V2 Protocol. The repository uses Foundry as development environment for compilation, testing and deployment tasks.

---

## What are BendDAO Protocol V2?

TBD
BendDAO V2 Protocol brings you composable lending and leverage. It allows anyone to borrow in an overcollateralized fashion, leverage savings on MakerDAO, leverage stake on Lido, leverage restake with EigenLayer derivatives, bringing together lending and leverage in the same protocol!

---
V2 Protocol has three user sides to it:

Lenders deposit assets to earn passive yield.

## Contracts overview
Borrowers can use ERC20 & ERC721 as collaterals to borrow assets in an overcollateralized fashion.

TBD
Leverage users can use ERC721 as collaterals to borrow assets to create leverage positions, which can be used across DeFi, NFTs, RWA, etc.

---

## Documentation

TBD
[Doc Hub](https://docs.benddao.xyz)

[User Guide](https://docs.benddao.xyz/portal/v/v2)

[Dev Guide](https://docs.benddao.xyz/developers/v/v2-1)

---

## Audits

TBD
All audits are stored in the [audits](./audits/) folder and [online](https://docs.benddao.xyz/portal/v/v2/security-and-risks/audits).

---

Expand All @@ -32,34 +50,6 @@ A bug bounty is open on Immunefi. The rewards and scope are defined [here](https

---

## Deployment Addresses

TBD

---

## Importing package

Using npm:

```bash
npm install @benddao/bend-v2
```

Using forge:

```bash
forge install @benddao/[email protected]
```

Using git submodules:

```bash
git submodule add @benddao/[email protected] lib/bend-v2
```

---

## Testing with [Foundry](https://github.com/foundry-rs/foundry) 🔨

For testing, make sure `yarn` and `foundry` are installed.
Expand All @@ -74,26 +64,14 @@ npm run test

---

## Testing with Hardhat

Only a few tests are run with Hardhat.

Just run:

```bash
yarn test:hardhat
```

---

## Test coverage

Test coverage is reported using [foundry](https://github.com/foundry-rs/foundry) coverage with [lcov](https://github.com/linux-test-project/lcov) report formatting (and optionally, [genhtml](https://manpages.ubuntu.com/manpages/xenial/man1/genhtml.1.html) transformer).

To generate the `lcov` report, run the following:

```bash
npm run coverage:forge
npm run coverage:lcov
```

The report is then usable either:
Expand All @@ -118,27 +96,7 @@ In the case the storage layout snapshots checked by `storage-layout.sh` are not

## Deployment & Upgrades

### Network mode (default)

Run the Foundry deployment script with:

```bash
npm run deploy:goerli
```

### Local mode

First start a local EVM:

```bash
npm run anvil:goerli
```

Then run the Foundry deployment script in a separate shell:

```bash
npm run deploy:local
```
Documents in the [script](./script/) folder.

---

Expand All @@ -150,4 +108,6 @@ For any questions or feedback, you can send an email to [[email protected]](

## Licensing

The code is under the Business Source License 1.1, see [`LICENSE`](./LICENSE).
The primary license for BendDAO v2 is the Business Source License 1.1 (`BUSL-1.1`), see [`LICENSE`](./LICENSE).

However, some files can also be licensed under `GPL-2.0-or-later` (as indicated in their SPDX headers).
Binary file not shown.
1 change: 1 addition & 0 deletions audits/2024-09-03-BendDAO-V2-Code4rena-Report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[Report URL](https://code4rena.com/reports/2024-07-benddao)
16 changes: 8 additions & 8 deletions config/eth-mainnet.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"chainId": 1,
"rpcAlias": "mainnet",
"forkBlockNumber": 19369370,
"treasury": "0x472FcC65Fab565f75B1e0E861864A86FE5bcEd7B",
"forkBlockNumber": 20659780,
"treasury": "0xA14a73522D2f60D1ff96D52C5A8D1177940227a8",
"wrappedNative": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"ProxyAdmin": "0x0000000000000000000000000000000000000000",
"AddressProvider": "0x0000000000000000000000000000000000000000",
"ACLAdmin": "0xe6b80f77a8B8FcD124aB748C720B7EAEA83dDb4C",
"ACLManager": "0x0000000000000000000000000000000000000000",
"PriceOracle": "0x0000000000000000000000000000000000000000",
"PoolManager": "0x0000000000000000000000000000000000000000"
"ProxyAdmin": "0x3b241a4338f0C3f67aFE0e130ccB653D0Ef3767C",
"AddressProvider": "0xa9Afc955d549D43DB056655b98FaB02870A45Fcd",
"ACLAdmin": "0x868964fa49a6fd6e116FE82c8f4165904406f479",
"ACLManager": "0xfc76aCB1C685fC427894652616feB4E303e4611a",
"PriceOracle": "0x3F8133A472C1d94Be4A562C44c337409c04Ae244",
"PoolManager": "0x0b870d974fB968B2E06798ABBD2563c80933D148"
}
68 changes: 0 additions & 68 deletions release/abis/Configurator.json
Original file line number Diff line number Diff line change
Expand Up @@ -682,74 +682,6 @@
],
"anonymous": false
},
{
"type": "event",
"name": "AssetInterestBorrowDataUpdated",
"inputs": [
{
"name": "poolId",
"type": "uint32",
"indexed": true,
"internalType": "uint32"
},
{
"name": "asset",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "groupId",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "borrowRate",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "borrowIndex",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"type": "event",
"name": "AssetInterestSupplyDataUpdated",
"inputs": [
{
"name": "poolId",
"type": "uint32",
"indexed": true,
"internalType": "uint32"
},
{
"name": "asset",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "supplyRate",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "supplyIndex",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"type": "event",
"name": "Paused",
Expand Down
Loading