Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
4d4b95f
support bend v1 migration
thorseldon Jul 25, 2024
177f157
add testcases for v1 migration
thorseldon Jul 30, 2024
1aca99b
deploy v1 migration contract
thorseldon Jul 30, 2024
27b79f9
rename setApprovalForAll to setAuthorization
thorseldon Jul 30, 2024
6355e90
add UIPoolLens module
thorseldon Jul 30, 2024
a1c8687
Merge pull request #3 from BendDAO/migration-bendv1
thorseldon Jul 30, 2024
1eaadf2
add getUserAssetList
thorseldon Jul 31, 2024
9d05668
update interest rate when supplyAsCollateral is true
thorseldon Jul 31, 2024
140df73
add getIsolateCollateralDataForCalculation
thorseldon Aug 6, 2024
a41c5d3
update init pool script
thorseldon Aug 8, 2024
b17696f
fix random revert in migrate borrow
thorseldon Aug 12, 2024
448b6a2
new default interest rate model
thorseldon Aug 12, 2024
607c7ff
update init scripts
thorseldon Aug 15, 2024
bb2edf0
updating unstake fine in yield contracts
thorseldon Aug 15, 2024
91e6ca3
fix yield upgrade error
thorseldon Aug 15, 2024
80d3bb3
fix: It's impossible to retrieve collected fines from the yield staki…
thorseldon Aug 15, 2024
8c23827
fix: yield upgrade error
thorseldon Aug 15, 2024
b7228b9
fix: Incorrect unwrapNativeTokenInWallet receiver address #4;
thorseldon Aug 17, 2024
973b282
fix: Protocol should update interest rate after changing rate model i…
thorseldon Aug 17, 2024
d5747d8
fix: Incorrect accounting of utilization, supply / borrow rates due t…
thorseldon Aug 17, 2024
79c5e34
fix: Vulnerable erc20TransferOutBidAmountToLiqudity() will cause inco…
thorseldon Aug 17, 2024
a478a05
fix: Incorrect index used to calculate totalSupply, which invalidates…
thorseldon Aug 17, 2024
63d057b
fix: Users cannot unstake from YiedlETHStakingEtherfi.sol, because Yi…
thorseldon Aug 17, 2024
21d2182
fix: Liquidator can repay the debt and take non-collateral assets fro…
thorseldon Aug 17, 2024
904041a
fix: isolateRedeem() revert in case Revert-on-zero-value-transfers to…
thorseldon Aug 17, 2024
475dd61
fix: User are forced to borrow again in order to unlock their NFTs fr…
thorseldon Aug 17, 2024
b32715d
fix: YieldEthStakingLido lacks a limit on the max stake amount, which…
thorseldon Aug 17, 2024
4120bce
fix: YieldEthStakingEtherfi.protocolDeposit() returns the wrong quant…
thorseldon Aug 17, 2024
d24f292
fix: YieldEthStakingLido.protocolDeposit() returns the wrong quantity…
thorseldon Aug 18, 2024
92eeff8
fix: wrapNativeTokenInWallet() always reverts on Arbitrum #42
thorseldon Aug 18, 2024
cd353db
fix: erc721DecreaseIsolateSupplyOnLiquidate() Missing clear lockerAdd…
thorseldon Aug 18, 2024
a1d705b
fix: isolateRepay() Lack of check onBehalf == nftOwner #44
thorseldon Aug 18, 2024
f06e1e1
fix: Borrower can prevent yield position repayment and closure by the…
thorseldon Aug 20, 2024
ebf564c
Merge branch 'main' into audit/code4rena-fix
thorseldon Aug 21, 2024
d94902c
add comments for delegateERC721
thorseldon Aug 24, 2024
4a69dcf
ensure sender & receiver is same or not
thorseldon Aug 24, 2024
e87791f
Merge pull request #4 from BendDAO/audit/code4rena-fix
thorseldon Aug 24, 2024
9efde33
add batchRepayETH in yield eth
thorseldon Aug 25, 2024
763988c
updating mock yield tokens
thorseldon Aug 26, 2024
1fdbcc1
fix: check asset auth for isolate borrow
thorseldon Aug 27, 2024
68198aa
fix: update rate when change irm
thorseldon Aug 28, 2024
b456517
add ConfiguratorPool for contract size limit
thorseldon Aug 28, 2024
4300834
add more assets to common pool
thorseldon Aug 29, 2024
1af3756
fix: [10] Users are not able to unstake their NFTs
thorseldon Aug 29, 2024
95c98c9
fix: [09] The removed assets (ERC721/ERC20) can't be added again
thorseldon Aug 29, 2024
d226b0d
fix: [08] The NFT of the user is locked, in case the admin updates th…
thorseldon Aug 29, 2024
0f87234
fix: [06] Missing check
thorseldon Aug 29, 2024
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"
}
4 changes: 2 additions & 2 deletions release/abis/BVault.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
},
{
"type": "function",
"name": "setApprovalForAll",
"name": "setAuthorization",
"inputs": [
{
"name": "poolId",
Expand Down Expand Up @@ -521,7 +521,7 @@
},
{
"type": "event",
"name": "SetApprovalForAll",
"name": "SetAuthorization",
"inputs": [
{
"name": "sender",
Expand Down
Loading