Skip to content

Commit 7adf94f

Browse files
committed
feat: add docs for 4626 vaults
1 parent 7dd09ca commit 7adf94f

File tree

4 files changed

+631
-0
lines changed

4 files changed

+631
-0
lines changed

SUMMARY.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@
104104
* [Comptroller](technical-reference/reference-isolated-pools/comptroller/README.md)
105105
* [Comptroller](technical-reference/reference-isolated-pools/comptroller/comptroller.md)
106106
* [ComptrollerStorage](technical-reference/reference-isolated-pools/comptroller/comptroller-storage.md)
107+
* [VenusERC4626](technical-reference/reference-isolated-pools/erc4626/README.md)
108+
* [VenusERC4626](technical-reference/reference-isolated-pools/erc4626/venus-erc4626.md)
109+
* [VenusERC4626Factory](technical-reference/reference-isolated-pools/erc4626/venus-erc4626-factory.md)
107110
* [VToken](technical-reference/reference-isolated-pools/vtoken/README.md)
108111
* [VToken](technical-reference/reference-isolated-pools/vtoken/vtoken.md)
109112
* [VTokenInterfaces](technical-reference/reference-isolated-pools/vtoken/vtoken-interfaces.md)
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 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 will receive the liquidity mining rewards.
22+
23+
- **`createdVaults`** (`mapping(address vToken => ERC4626Upgradeable vault)`, public):
24+
Map 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 has been 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 PoolRegistry.
47+
48+
- **`VenusERC4626Factory__ERC4626AlreadyExists()`**
49+
Thrown when a VenusERC4626 vault already exists for the provided vToken.
50+
51+
---
52+
53+
#### constructor
54+
55+
**@custom:oz-upgrades-unsafe-allow constructor**
56+
Disables initializers for upgradeable contract pattern.
57+
58+
---
59+
60+
### Functions
61+
62+
### initialize
63+
64+
Initializes the VenusERC4626Factory contract with 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 will receive 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 upgradeable contract pattern.
90+
91+
---
92+
93+
### setRewardRecipient
94+
95+
Sets a new 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 ACM.
110+
- Throws `ZeroAddressNotAllowed` if the new recipient address is zero.
111+
- Emits `RewardRecipientUpdated` event on update.
112+
113+
---
114+
115+
### setMaxLoopsLimit
116+
117+
Sets a new 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 ACM.
132+
- Emits `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+
- Throws `ZeroAddressNotAllowed` if the vToken address is zero.
159+
- Throws `VenusERC4626Factory__InvalidVToken` if the vToken is not valid.
160+
- Throws `VenusERC4626Factory__ERC4626AlreadyExists` if the vault already exists.
161+
- Emits `CreateERC4626` event on successful creation.
162+
163+
---
164+
165+
### computeVaultAddress
166+
167+
Computes the deterministic address of the vault for a given 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)