Skip to main content

VaultGnoStaking

Git Source ↗

Inherits: Initializable ↗, VaultAdmin, VaultState, VaultValidators, VaultEnterExit, IVaultGnoStaking

Defines the Gnosis staking functionality for the Vault

State Variables

_securityDeposit

uint256 private constant _securityDeposit = 1e9

_gnoToken

IERC20 internal immutable _gnoToken

_tokensConverterFactory

ITokensConverterFactory private immutable _tokensConverterFactory

_tokensConverter

IGnoTokensConverter internal _tokensConverter

__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

uint256[49] 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

constructor(address gnoToken, address tokensConverterFactory) ;

Parameters

NameTypeDescription
gnoTokenaddressThe address of the GNO token
tokensConverterFactoryaddressThe address of the tokens converter factory

deposit

Deposit GNO to the Vault

function deposit(uint256 assets, address receiver, address referrer)
public
virtual
override
returns (uint256 shares);

Parameters

NameTypeDescription
assetsuint256The amount of GNO to deposit
receiveraddressThe address that will receive Vault's shares
referreraddressThe address of the referrer. Set to zero address if not used.

Returns

NameTypeDescription
sharesuint256The number of shares minted

donateAssets

Donate assets to the Vault. Must approve GNO transfer before the call.

function donateAssets(uint256 amount) external override;

Parameters

NameTypeDescription
amountuint256The amount of GNO to donate

receive

Function for receiving xDAI and forwarding it to the tokens converter

receive() external payable;

_registerValidators

Internal function for registering validators

function _registerValidators(ValidatorUtils.ValidatorDeposit[] memory deposits) internal virtual override;

Parameters

NameTypeDescription
depositsValidatorUtils.ValidatorDeposit[]The validators registration data

_vaultAssets

Internal function for retrieving the total assets stored in the Vault. NB! Assets can be forcibly sent to the vault, the returned value must be used with caution

function _vaultAssets() internal view virtual override returns (uint256);

Returns

NameTypeDescription
<none>uint256The total amount of assets stored in the Vault

_transferVaultAssets

Internal function for transferring assets from the Vault to the receiver

function _transferVaultAssets(address receiver, uint256 assets) internal virtual override nonReentrant;

Parameters

NameTypeDescription
receiveraddressThe address that will receive the assets
assetsuint256The number of assets to transfer

_pullWithdrawals

Pulls assets from withdrawal contract

function _pullWithdrawals() internal virtual;

__VaultGnoStaking_upgrade

Upgrades the VaultGnoStaking contract

function __VaultGnoStaking_upgrade() internal onlyInitializing;

__VaultGnoStaking_init

Initializes the VaultGnoStaking contract

function __VaultGnoStaking_init() internal onlyInitializing;

__VaultGnoStaking_init_common

Common initialization for gas optimization

function __VaultGnoStaking_init_common() private;