Skip to content

Commit e77629f

Browse files
authored
Merge pull request #291 from VenusProtocol/feat/VEN-3197
[VEN-3197] technical article about VenusERC4626
2 parents ba56ce3 + 190bd37 commit e77629f

File tree

10 files changed

+1212
-0
lines changed

10 files changed

+1212
-0
lines changed

.gitbook/assets/erc4626-deposit.svg

Lines changed: 58 additions & 0 deletions
Loading

.gitbook/assets/erc4626-flow-diagram.svg

Lines changed: 61 additions & 0 deletions
Loading

.gitbook/assets/erc4626-withdraw.svg

Lines changed: 43 additions & 0 deletions
Loading

SUMMARY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
* [Shortfall and auctions](technical-reference/reference-technical-articles/shortfall-and-auctions.md)
6565
* [Token Converters](technical-reference/reference-technical-articles/token-converters.md)
6666
* [Two Kinks Interest Rate Curve](technical-reference/reference-technical-articles/two-kinks-interest-rate-curve.md)
67+
* [VenusERC4626 Vaults](technical-reference/reference-technical-articles/venus-erc-4626.md)
6768
* [XVS Bridge](technical-reference/reference-technical-articles/xvs-bridge.md)
6869
* [Core Pool](technical-reference/reference-core-pool/README.md)
6970
* [Comptroller](technical-reference/reference-core-pool/comptroller/README.md)
@@ -104,6 +105,9 @@
104105
* [Comptroller](technical-reference/reference-isolated-pools/comptroller/README.md)
105106
* [Comptroller](technical-reference/reference-isolated-pools/comptroller/comptroller.md)
106107
* [ComptrollerStorage](technical-reference/reference-isolated-pools/comptroller/comptroller-storage.md)
108+
* [VenusERC4626](technical-reference/reference-isolated-pools/erc4626/README.md)
109+
* [VenusERC4626](technical-reference/reference-isolated-pools/erc4626/venus-erc4626.md)
110+
* [VenusERC4626Factory](technical-reference/reference-isolated-pools/erc4626/venus-erc4626-factory.md)
107111
* [VToken](technical-reference/reference-isolated-pools/vtoken/README.md)
108112
* [VToken](technical-reference/reference-isolated-pools/vtoken/vtoken.md)
109113
* [VTokenInterfaces](technical-reference/reference-isolated-pools/vtoken/vtoken-interfaces.md)
@@ -182,6 +186,7 @@
182186
* [Governance](deployed-contracts/governance.md)
183187
* [XVS Omnichain](deployed-contracts/xvs-omnichain.md)
184188
* [Token Converters](deployed-contracts/token-converters.md)
189+
* [VenusERC4626](deployed-contracts/venus-erc4626.md)
185190

186191
## Services
187192

deployed-contracts/venus-erc4626.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# VenusERC4626 - Deployed Contracts
2+
3+
## Ethereum Mainnet
4+
5+
* VenusERC4626Factory: [`0x39cb747453Be3416E659dAeA169540b6F000c885`](https://etherscan.io/address/0x39cb747453Be3416E659dAeA169540b6F000c885)
6+
* VenusERC4626Implementation: [`0x6F0AB9E23f66ceB2b1BA0BB23C0e1f5f089a3cA1`](https://etherscan.io/address/0x6F0AB9E23f66ceB2b1BA0BB23C0e1f5f089a3cA1)
7+
8+
## Sepolia (Ethereum Testnet)
9+
10+
* VenusERC4626Factory: [`0xbf76e9429BA565220d77831A9eC3606434e2106e`](https://sepolia.etherscan.io/address/0xbf76e9429BA565220d77831A9eC3606434e2106e)
11+
* VenusERC4626Implementation: [`0xd1B290832F3094647a063db7C293cD5DF2843255`](https://sepolia.etherscan.io/address/0xd1B290832F3094647a063db7C293cD5DF2843255)
12+
13+
## opBNB Mainnet
14+
15+
* VenusERC4626Factory: [`0x89A5Ce0A6db7e66E53F148B50D879b700dEB81C8`](https://opbnbscan.com/address/0x89A5Ce0A6db7e66E53F148B50D879b700dEB81C8)
16+
* VenusERC4626Implementation: [`0x2C0E328c118d22A549C8CB758C46775b9560A026`](https://opbnbscan.com/address/0x2C0E328c118d22A549C8CB758C46775b9560A026)
17+
18+
## opBNB Testnet
19+
20+
* VenusERC4626Factory: [`0x3dEDBD90EFC6E2257887FF36842337dF0739B8A1`](https://testnet.opbnbscan.com/address/0x3dEDBD90EFC6E2257887FF36842337dF0739B8A1)
21+
* VenusERC4626Implementation: [`0x5b97A053a8c153f5BE27b84370FecD3959D8898f`](https://testnet.opbnbscan.com/address/0x5b97A053a8c153f5BE27b84370FecD3959D8898f)
22+
23+
## Arbitrum One
24+
25+
* VenusERC4626Factory: [`0xC1422B928cb6FC9BA52880892078578a93aa5Cc7`](https://arbiscan.io/address/0xC1422B928cb6FC9BA52880892078578a93aa5Cc7)
26+
* VenusERC4626Implementation: [`0xff2C112F0FC927E89eA1f7ec56D0c76263708Bcb`](https://arbiscan.io/address/0xff2C112F0FC927E89eA1f7ec56D0c76263708Bcb)
27+
28+
## Arbitrum Sepolia
29+
30+
* VenusERC4626Factory: [`0xC6C8249a0B44973673f3Af673e530B85038a0480`](https://sepolia.arbiscan.io/address/0xC6C8249a0B44973673f3Af673e530B85038a0480)
31+
* VenusERC4626Implementation: [`0x3442ACDbCc927cC401236C69a14ca909fC5B14ba`](https://sepolia.arbiscan.io/address/0x3442ACDbCc927cC401236C69a14ca909fC5B14ba)
32+
33+
## ZKSync Mainnet
34+
35+
* VenusERC4626Factory: [`0xDC59Dd76Dd7A64d743C764a9aa8C96Ff2Ea8BAc3`](https://explorer.zksync.io/address/0xDC59Dd76Dd7A64d743C764a9aa8C96Ff2Ea8BAc3)
36+
* VenusERC4626Implementation: [`0xBd86974B3a7348AC153aEFEe5Dc5111246a99c11`](https://explorer.zksync.io/address/0xBd86974B3a7348AC153aEFEe5Dc5111246a99c11)
37+
38+
## ZKSync Sepolia
39+
40+
* VenusERC4626Factory: [`0xa30dcc21B8393A4031cD6364829CDfE2b6D7B283`](https://sepolia.explorer.zksync.io/address/0xa30dcc21B8393A4031cD6364829CDfE2b6D7B283)
41+
* VenusERC4626Implementation: [`0x97ab473c81C5E654B71690e3B4225180C687E3eB`](https://sepolia.explorer.zksync.io/address/0x97ab473c81C5E654B71690e3B4225180C687E3eB)
42+
43+
## Optimism Mainnet
44+
45+
* VenusERC4626Factory: [`0xc801B471F00Dc22B9a7d7b839CBE87E46d70946F`](https://optimistic.etherscan.io/address/0xc801B471F00Dc22B9a7d7b839CBE87E46d70946F)
46+
* VenusERC4626Implementation: [`0x28d408ad7E66c8de66FBf8D6724747250C8B349E`](https://optimistic.etherscan.io/address/0x28d408ad7E66c8de66FBf8D6724747250C8B349E)
47+
48+
## Optimism Sepolia
49+
50+
* VenusERC4626Factory: [`0xc66c4058A8524253C22a9461Df6769CE09F7d61e`](https://sepolia-optimism.etherscan.io/address/0xc66c4058A8524253C22a9461Df6769CE09F7d61e)
51+
* VenusERC4626Implementation: [`0x057E95A55E93DB89610AE2d64653b6384dFE7c0d`](https://sepolia-optimism.etherscan.io/address/0x057E95A55E93DB89610AE2d64653b6384dFE7c0d)
52+
53+
## Base Mainnet
54+
55+
* VenusERC4626Factory: [`0x1A430825B31DdA074751D6731Ce7Dca38D012D13`](https://basescan.org/address/0x1A430825B31DdA074751D6731Ce7Dca38D012D13)
56+
* VenusERC4626Implementation: [`0x1062F74081026eE4777981B75D8DA7e6a5640010`](https://basescan.org/address/0x1062F74081026eE4777981B75D8DA7e6a5640010)
57+
58+
## Base Sepolia
59+
60+
* VenusERC4626Factory: [`0xD13c5527d1a2a8c2cC9c9eb260AC4D9D811a02a4`](https://sepolia.basescan.org/address/0xD13c5527d1a2a8c2cC9c9eb260AC4D9D811a02a4)
61+
* VenusERC4626Implementation: [`0x66A2cC7c0ca012DfBfd7BDC5DC06A315A0269b20`](https://sepolia.basescan.org/address/0x66A2cC7c0ca012DfBfd7BDC5DC06A315A0269b20)
62+
63+
## Unichain Mainnet
64+
65+
* VenusERC4626Factory: [`0x102fEb723C25c67dbdfDccCa3B1c1a6e1a662D2f`](https://uniscan.xyz/address/0x102fEb723C25c67dbdfDccCa3B1c1a6e1a662D2f)
66+
* VenusERC4626Implementation: [`0xE5b7978b0DB9e6d6026d1C79B8174D47295f8117`](https://uniscan.xyz/address/0xE5b7978b0DB9e6d6026d1C79B8174D47295f8117)
67+
68+
## Unichain Sepolia
69+
70+
* VenusERC4626Factory: [`0x1365820B9ba3B1b5601208437a5A24192a12C1fB`](https://sepolia.uniscan.xyz/address/0x1365820B9ba3B1b5601208437a5A24192a12C1fB)
71+
* VenusERC4626Implementation: [`0x7c0160E6638df7e7E6132Da4B60F210c38655D6e`](https://sepolia.uniscan.xyz/address/0x7c0160E6638df7e7E6132Da4B60F210c38655D6e)

security-and-audits.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,29 @@ We firmly believe that the true test of a smart contract's security lies in its
88

99
## Audits
1010

11+
### Venus ERC4626 Vaults
12+
13+
**Scope**: [ERC-4626](https://ethereum.org/en/developers/docs/standards/tokens/erc-4626/) wrapper for Venus markets for isolated pools, enabling seamless integration with external DeFi protocols that follow the ERC-4626 standard.
14+
15+
* [Certik audit report (2025/05/14)](https://github.com/VenusProtocol/isolated-pools/blob/1faa46139aaec06e0eb2e48341bff22cd6c38c6c/audits/129_erc4626_certik_20250514.pdf)
16+
* [Pessimistic audit report (2025/05/02)](https://github.com/VenusProtocol/isolated-pools/blob/1faa46139aaec06e0eb2e48341bff22cd6c38c6c/audits/131_erc4626_pessimistic_20250502.pdf)
17+
* [FairyProof audit report (2025/04/14)](https://github.com/VenusProtocol/isolated-pools/blob/1faa46139aaec06e0eb2e48341bff22cd6c38c6c/audits/130_erc4626_fairyproof_20250414.pdf)
18+
19+
<details>
20+
<summary>Detailed scope</summary>
21+
22+
- Pull request [#497](https://github.com/VenusProtocol/isolated-pools/pull/497) in the `isolated-pools` repository.
23+
- contracts/ERC4626/VenusERC4626.sol
24+
- contracts/ERC4626/VenusERC4626Factory.sol
25+
- contracts/ERC4626/Interfaces/IComptroller.sol
26+
- contracts/ERC4626/Interfaces/IProtocolShareReserve.sol
27+
- contracts/ERC4626/Interfaces/IRewardsDistributor.sol
28+
29+
- Pull request [#137](https://github.com/VenusProtocol/protocol-reserve/pull/137) in the `protocol-reserve` repository
30+
- contracts/Interfaces/IProtocolShareReserve.sol
31+
32+
</details>
33+
1134
### asBNB Oracle
1235

1336
**Scope**: Correlated oracle to get the price of [asBNB](https://bscscan.com/address/0x77734e70b6E88b4d82fE632a168EDf6e700912b6) token on BNB Chain, taking into account first the onchain conversion rate `asBNB` to [`slisBNB`](https://bscscan.com/address/0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B).
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# VenusERC4626
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# VenusERC4626Factory
2+
3+
### Overview
4+
5+
`VenusERC4626Factory` is a factory contract for deploying upgradeable VenusERC4626 vaults as BeaconProxy instances. It manages the deployment, registry, and configuration of vaults, and controls access to sensitive operations via the AccessControlManager (ACM).
6+
7+
# Solidity API
8+
9+
### State Variables
10+
11+
- **`SALT`** (`bytes32`, public constant):
12+
A constant salt value used for deterministic contract deployment.
13+
14+
- **`beacon`** (`UpgradeableBeacon`, public):
15+
The beacon contract for VenusERC4626 proxies.
16+
17+
- **`poolRegistry`** (`PoolRegistryInterface`, public):
18+
The Pool Registry contract.
19+
20+
- **`rewardRecipient`** (`address`, public):
21+
The address that receives the liquidity mining rewards.
22+
23+
- **`createdVaults`** (`mapping(address vToken => ERC4626Upgradeable vault)`, public):
24+
Mapping of vaults created by this factory.
25+
26+
---
27+
28+
### Events
29+
30+
- **`CreateERC4626(VTokenInterface indexed vToken, ERC4626Upgradeable indexed vault)`**
31+
Emitted when a new ERC4626 vault is created.
32+
33+
- `vToken`: The vToken used by the vault.
34+
- `vault`: The vault that was created.
35+
36+
- **`RewardRecipientUpdated(address indexed oldRecipient, address indexed newRecipient)`**
37+
Emitted when the reward recipient address is updated.
38+
- `oldRecipient`: The previous reward recipient address.
39+
- `newRecipient`: The new reward recipient address.
40+
41+
---
42+
43+
### Errors
44+
45+
- **`VenusERC4626Factory__InvalidVToken()`**
46+
Thrown when the provided vToken is not registered in the PoolRegistry.
47+
48+
- **`VenusERC4626Factory__ERC4626AlreadyExists()`**
49+
Thrown when a VenusERC4626 vault already exists for the specified vToken.
50+
51+
---
52+
53+
#### Constructor
54+
55+
**@custom:oz-upgrades-unsafe-allow constructor**
56+
Disables initializers for the upgradeable contract pattern.
57+
58+
---
59+
60+
### Functions
61+
62+
### initialize
63+
64+
Initializes the VenusERC4626Factory contract with the required configuration parameters.
65+
66+
```solidity
67+
function initialize(
68+
address accessControlManager,
69+
address poolRegistryAddress,
70+
address rewardRecipientAddress,
71+
address venusERC4626Implementation,
72+
uint256 loopsLimitNumber
73+
) external initializer
74+
```
75+
76+
#### Parameters
77+
78+
| Name | Type | Description |
79+
| -------------------------- | ------- | --------------------------------------------------------- |
80+
| accessControlManager | address | Address of the Access Control Manager (ACM) contract. |
81+
| poolRegistryAddress | address | Address of the Pool Registry contract. |
82+
| rewardRecipientAddress | address | Address that receives liquidity mining rewards. |
83+
| venusERC4626Implementation | address | Address of the VenusERC4626 implementation contract. |
84+
| loopsLimitNumber | uint256 | The maximum number of loops for the MaxLoopsLimit helper. |
85+
86+
#### Notes
87+
88+
- Can only be called once.
89+
- Disables initializers for the upgradeable contract pattern.
90+
91+
---
92+
93+
### setRewardRecipient
94+
95+
Sets the reward recipient address.
96+
97+
```solidity
98+
function setRewardRecipient(address newRecipient) external
99+
```
100+
101+
#### Parameters
102+
103+
| Name | Type | Description |
104+
| ------------ | ------- | ---------------------------------------- |
105+
| newRecipient | address | The address of the new reward recipient. |
106+
107+
#### Notes
108+
109+
- Controlled by the ACM.
110+
- Reverts with `ZeroAddressNotAllowed` if the new recipient address is zero.
111+
- Emits the `RewardRecipientUpdated` event on update.
112+
113+
---
114+
115+
### setMaxLoopsLimit
116+
117+
Sets the maximum loops limit for internal operations.
118+
119+
```solidity
120+
function setMaxLoopsLimit(uint256 loopsLimit) external
121+
```
122+
123+
#### Parameters
124+
125+
| Name | Type | Description |
126+
| ---------- | ------- | ---------------------------------------- |
127+
| loopsLimit | uint256 | The new maximum number of loops allowed. |
128+
129+
#### Notes
130+
131+
- Controlled by the ACM.
132+
- Emits the `MaxLoopsLimitUpdated` event on success.
133+
134+
---
135+
136+
### createERC4626
137+
138+
Creates a new ERC4626 vault for the specified vToken.
139+
140+
```solidity
141+
function createERC4626(address vToken) external returns (ERC4626Upgradeable vault)
142+
```
143+
144+
#### Parameters
145+
146+
| Name | Type | Description |
147+
| ------ | ------- | ------------------------------------------ |
148+
| vToken | address | The vToken for which the vault is created. |
149+
150+
#### Returns
151+
152+
| Name | Type | Description |
153+
| ----- | ------------------ | -------------------------------- |
154+
| vault | ERC4626Upgradeable | The deployed VenusERC4626 vault. |
155+
156+
#### Notes
157+
158+
- Reverts with `ZeroAddressNotAllowed` if the vToken address is zero.
159+
- Reverts with `VenusERC4626Factory__InvalidVToken` if the vToken is not valid.
160+
- Reverts with `VenusERC4626Factory__ERC4626AlreadyExists` if the vault already exists.
161+
- Emits the `CreateERC4626` event on successful creation.
162+
163+
---
164+
165+
### computeVaultAddress
166+
167+
Computes the deterministic address of the vault for a specified vToken.
168+
169+
```solidity
170+
function computeVaultAddress(address vToken) public view returns (address)
171+
```
172+
173+
#### Parameters
174+
175+
| Name | Type | Description |
176+
| ------ | ------- | -------------------------------------------- |
177+
| vToken | address | The vToken for which to compute the address. |
178+
179+
#### Returns
180+
181+
| Name | Type | Description |
182+
| ------- | ------- | --------------------------- |
183+
| address | address | The computed vault address. |

0 commit comments

Comments
 (0)