Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
134 changes: 104 additions & 30 deletions docs/contracts/api/base/ERC20Upgradeable.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,22 @@ description: "Modern and gas-efficient upgradeable ERC20 token implementation wi

# ERC20Upgradeable

[Git Source ↗](https://github.com/stakewise/v3-core/blob/c511cd912cb881f60cf2a32d6c5d5f533e5d04b5/contracts/base/ERC20Upgradeable.sol)
[Git Source ↗](https://github.com/stakewise/v3-core/blob/fc70cbe1b3d41bc5f78434830d837aa270ca33bc/contracts/base/ERC20Upgradeable.sol)

**Inherits:** [Initializable ↗](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/proxy/utils/Initializable.sol), [IERC20Permit ↗](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/IERC20Permit.sol), [IERC20 ↗](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol), [IERC20Metadata ↗](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/IERC20Metadata.sol)
**Inherits:** [Initializable ↗](https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/master/contracts/proxy/utils/Initializable.sol), [IERC20Permit ↗](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/IERC20Permit.sol), [IERC20 ↗](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol), [IERC20Metadata ↗](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/IERC20Metadata.sol)

Modern and gas efficient [ERC20 ↗](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol) + [EIP-2612 ↗](https://eips.ethereum.org/EIPS/eip-2612) implementation.
Modern and gas efficient ERC20 + EIP-2612 implementation


## State Variables
### _permitTypeHash

```solidity
bytes32 private constant _permitTypeHash =
keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)")
```


### name
Returns the name of the token.

Expand Down Expand Up @@ -42,36 +50,68 @@ uint8 public constant override decimals = 18


### allowance
Returns the remaining number of tokens that `spender` is allowed
to spend on behalf of `owner`


```solidity
mapping(address => mapping(address => uint256)) public override allowance
```


### nonces
Returns the current nonce for `owner`. This value must be
included whenever a signature is generated for `permit`.
Every successful call to `permit` increases `owner`'s nonce by one. This
prevents a signature from being used multiple times.


```solidity
mapping(address => uint256) public override nonces
```


### _initialChainId
**Note:**
oz-upgrades-unsafe-allow: state-variable-immutable


```solidity
uint256 private immutable _initialChainId
```


### _initialDomainSeparator

```solidity
bytes32 private _initialDomainSeparator
```


### __gap
This empty reserved space is put in place to allow future versions to add new
variables without shifting down storage in the inheritance chain.
See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps


```solidity
uint256[50] private __gap
```


## Functions
### constructor

Constructor

Since the immutable variable value is stored in the bytecode,
its value would be shared among all proxies pointing to a given contract instead of each proxy’s storage.

**Note:**
oz-upgrades-unsafe-allow: constructor


```solidity
constructor() ;
```

### approve

Sets `amount` as the allowance of `spender` over the caller's tokens.

:::custom-warning[Front-Running Risk]
Be aware of potential front-running attacks. See [EIP-20 Discussion ↗](https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729) for details.
:::
Be aware of front-running risks: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729


```solidity
Expand Down Expand Up @@ -99,23 +139,21 @@ function transferFrom(address from, address to, uint256 amount) public virtual o

### permit

Sets `value` as the allowance of `spender` over `owner`'s tokens using a signed approval.

:::custom-warning[Security Considerations]
- The same front-running issues that affect `IERC20-approve` also apply here
- Always verify signatures are using the latest nonce
- Be cautious of signature replay attacks
:::

Sets `value` as the allowance of `spender` over `owner`'s tokens,
given `owner`'s signed approval.
IMPORTANT: The same issues `IERC20-approve` has related to transaction
ordering also apply here.
Emits an `Approval` event.

**Requirements:**
- `spender` cannot be the zero address
- `deadline` must be a timestamp in the future
- `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` over the EIP712-formatted function arguments
- The signature must use `owner`'s current nonce (see `nonces`)

For more information, see [EIP-2612 Specification ↗](https://eips.ethereum.org/EIPS/eip-2612#specification).
Requirements:
- `spender` cannot be the zero address.
- `deadline` must be a timestamp in the future.
- `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
over the EIP712-formatted function arguments.
- the signature must use `owner`'s current nonce (see `nonces`).
For more information on the signature format, see the
https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
section].
CAUTION: See Security Considerations above.


```solidity
Expand All @@ -132,3 +170,39 @@ Returns the domain separator used in the encoding of the signature for `permit`,
```solidity
function DOMAIN_SEPARATOR() public view override returns (bytes32);
```

### _computeDomainSeparator

Computes the hash of the EIP712 typed data

This function is used to compute the hash of the EIP712 typed data


```solidity
function _computeDomainSeparator() private view returns (bytes32);
```

### _transfer

Moves `amount` of tokens from `from` to `to`.
Emits a `Transfer` event.


```solidity
function _transfer(address from, address to, uint256 amount) internal virtual;
```

### __ERC20Upgradeable_init

Initializes the ERC20Upgradeable contract


```solidity
function __ERC20Upgradeable_init(string memory _name, string memory _symbol) internal onlyInitializing;
```
**Parameters**

|Name|Type|Description|
|----|----|-----------|
|`_name`|`string`|The name of the ERC20 token|
|`_symbol`|`string`|The symbol of the ERC20 token|
6 changes: 2 additions & 4 deletions docs/contracts/api/base/Multicall.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ description: "Utility contract for batching multiple function calls into a singl

# Multicall

[Git Source ↗](https://github.com/stakewise/v3-core/blob/c511cd912cb881f60cf2a32d6c5d5f533e5d04b5/contracts/base/Multicall.sol)
[Git Source ↗](https://github.com/stakewise/v3-core/blob/fc70cbe1b3d41bc5f78434830d837aa270ca33bc/contracts/base/Multicall.sol)

**Inherits:** IMulticall

Enables calling multiple methods in a single call to the contract.
Enables calling multiple methods in a single call to the contract


## Functions
Expand All @@ -33,5 +33,3 @@ function multicall(bytes[] calldata data) external override returns (bytes[] mem
|Name|Type|Description|
|----|----|-----------|
|`results`|`bytes[]`|The results from each of the calls passed in via data|


44 changes: 2 additions & 42 deletions docs/contracts/api/curators/BalancedCurator.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,13 @@ description: "Curator for evenly managing assets in sub-vaults"

# BalancedCurator

[Git Source ↗](https://github.com/stakewise/v3-core/blob/c511cd912cb881f60cf2a32d6c5d5f533e5d04b5/contracts/curators/BalancedCurator.sol)
[Git Source ↗](https://github.com/stakewise/v3-core/blob/fc70cbe1b3d41bc5f78434830d837aa270ca33bc/contracts/curators/BalancedCurator.sol)

**Inherits:** ISubVaultsCurator

Defines the functionality for evenly managing assets in sub-vaults.


## Structs
### Deposit
Struct for storing deposit data


```solidity
struct Deposit {
address vault;
uint256 assets;
}
```

**Properties**

|Name|Type|Description|
|----|----|-----------|
|`vault`|`address`|The address of the vault|
|`assets`|`uint256`|The amount of assets to deposit|

### ExitRequest
Struct for storing exit request data


```solidity
struct ExitRequest {
address vault;
uint256 assets;
}
```

**Properties**

|Name|Type|Description|
|----|----|-----------|
|`vault`|`address`|The address of the vault|
|`assets`|`uint256`|The amount of assets to exit|


## Functions
### getDeposits

Expand All @@ -60,7 +22,7 @@ Function to get the deposits to the sub-vaults
```solidity
function getDeposits(uint256 assetsToDeposit, address[] calldata subVaults, address ejectingVault)
external
pure
view
override
returns (Deposit[] memory deposits);
```
Expand Down Expand Up @@ -106,5 +68,3 @@ function getExitRequests(
|Name|Type|Description|
|----|----|-----------|
|`exitRequests`|`ExitRequest[]`|An array of ExitRequest structs containing the vault addresses and the amounts to exit|


61 changes: 24 additions & 37 deletions docs/contracts/api/curators/CuratorsRegistry.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,65 +6,37 @@ description: "Registry for managing curator addresses for sub-vaults"

# CuratorsRegistry

[Git Source ↗](https://github.com/stakewise/v3-core/blob/c511cd912cb881f60cf2a32d6c5d5f533e5d04b5/contracts/curators/CuratorsRegistry.sol)
[Git Source ↗](https://github.com/stakewise/v3-core/blob/fc70cbe1b3d41bc5f78434830d837aa270ca33bc/contracts/curators/CuratorsRegistry.sol)

**Inherits:** [Ownable2Step ↗](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable2Step.sol), ICuratorsRegistry

Defines the registry functionality that keeps track of Curators for the sub-vaults.


## Events
### CuratorAdded
Emitted when a new curator is added

## State Variables
### isCurator

```solidity
event CuratorAdded(address indexed sender, address indexed curator);
mapping(address curator => bool isCurator) public override isCurator
```

**Parameters**

|Name|Type|Description|
|----|----|-----------|
|`sender`|`address`|The address of the sender|
|`curator`|`address`|The address of the curator|

### CuratorRemoved
Emitted when a curator is removed

### _initialized

```solidity
event CuratorRemoved(address indexed sender, address indexed curator);
bool private _initialized
```

**Parameters**

|Name|Type|Description|
|----|----|-----------|
|`sender`|`address`|The address of the sender|
|`curator`|`address`|The address of the curator|


## Functions
### isCurator
### constructor

Checks if an address is a curator
Constructor


```solidity
function isCurator(address curator) external view returns (bool);
constructor() Ownable(msg.sender);
```
**Parameters**

|Name|Type|Description|
|----|----|-----------|
|`curator`|`address`|The address of the curator|

**Returns**

|Name|Type|Description|
|----|----|-----------|
|`<none>`|`bool`|True if the address is a curator, false otherwise|

### addCurator

Expand Down Expand Up @@ -94,3 +66,18 @@ function removeCurator(address curator) external override onlyOwner;
|Name|Type|Description|
|----|----|-----------|
|`curator`|`address`|The address of the curator to remove|


### initialize

Initializes the CuratorsRegistry


```solidity
function initialize(address _owner) external override onlyOwner;
```
**Parameters**

|Name|Type|Description|
|----|----|-----------|
|`_owner`|`address`|The address of the owner|
3 changes: 2 additions & 1 deletion docs/contracts/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Welcome to the StakeWise Contracts API documentation. This section contains comp
- **Keeper** - Oracle system for updating Vault rewards and approving validator registrations
- **Libraries** - Shared utility libraries used across contracts
- **Misc** - Reward distribution and fee splitting contracts
- **Nodes** - Delegation of validator operations to node operators
- **Tokens** - Over-collateralized staking token (osToken) system and controllers
- **Validators** - Validator lifecycle management, registry interfaces, and deposit data validation
- **Vaults** - Modular staking Vault contracts for Ethereum and Gnosis Chain
- **Vaults** - Modular staking Vault contracts for Ethereum and Gnosis Chain, including MetaVaults and the sub-vaults registry
Loading