Skip to content

RewardVaultFactory

0x94Ad6Ac84f6C6FbA8b8CCbD71d9f4f101def52a8 | ABI JSON

Git Source

Factory contract for creating RewardVaults and keeping track of them.

Inherits: IRewardVaultFactory, AccessControlUpgradeable, UUPSUpgradeable

Constants

VAULT_MANAGER_ROLE

The VAULT MANAGER role.

solidity
bytes32 public constant VAULT_MANAGER_ROLE = keccak256("VAULT_MANAGER_ROLE");

VAULT_PAUSER_ROLE

The VAULT PAUSER role.

solidity
bytes32 public constant VAULT_PAUSER_ROLE = keccak256("VAULT_PAUSER_ROLE");

State Variables

allVaults

Array of all vaults that have been created.

solidity
address[] public allVaults;

beacon

The beacon address.

solidity
address public beacon;

beaconDepositContract

The BeaconDeposit contract address.

solidity
address public beaconDepositContract;

bgt

The BGT token address.

solidity
address public bgt;

bgtIncentiveDistributor

The address of the BGTIncentiveDistributor contract to receive the BGT booster share of the incentive tokens.

solidity
address public bgtIncentiveDistributor;

bgtIncentiveFeeCollector

The address of the BGTIncentiveFeeCollector contract to receive fees.

solidity
address public bgtIncentiveFeeCollector;

bgtIncentiveFeeRate

Fee rate on incentives in basis points (e.g., 100 = 1%).

solidity
uint256 public bgtIncentiveFeeRate;

distributor

The distributor address.

solidity
address public distributor;

getVault

Mapping of staking token to vault address.

solidity
mapping(address stakingToken => address vault) public getVault;

View Functions

allVaultsLength

Gets the number of vaults that have been created.

solidity
function allVaultsLength() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The number of vaults

bgtIncentiveDistributor

Gets the address of the BGTIncentiveDistributor contract.

solidity
function bgtIncentiveDistributor() external view returns (address);

Returns

NameTypeDescription
<none>addressThe address of the BGTIncentiveDistributor contract

bgtIncentiveFeeCollector

Gets the address of the incentive fee collector.

solidity
function bgtIncentiveFeeCollector() external view returns (address);

Returns

NameTypeDescription
<none>addressThe address of the BGTIncentiveFeeCollector contract

bgtIncentiveFeeRate

Gets the value of the incentive fee rate.

solidity
function bgtIncentiveFeeRate() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The rate (in basis points)

getIncentiveFeeAmount

Applies the fee percentage on the incentive amount.

solidity
function getIncentiveFeeAmount(uint256 incentiveAmount) external view returns (uint256);

Parameters

NameTypeDescription
incentiveAmountuint256The amount of incentive tokens

Returns

NameTypeDescription
<none>uint256The fee amount

getVault

Gets the vault for the given staking token.

solidity
function getVault(address stakingToken) external view returns (address);

Parameters

NameTypeDescription
stakingTokenaddressThe address of the staking token

Returns

NameTypeDescription
<none>addressThe address of the vault

predictRewardVaultAddress

Predicts the address of the reward vault for the given staking token.

solidity
function predictRewardVaultAddress(address stakingToken) external view returns (address);

Parameters

NameTypeDescription
stakingTokenaddressThe address of the staking token

Returns

NameTypeDescription
<none>addressThe address of the reward vault

Functions

createRewardVault

Creates a new reward vault for the given staking token.

Reverts if the staking token is not a contract.

Emits:

solidity
function createRewardVault(address stakingToken) external returns (address);

Parameters

NameTypeDescription
stakingTokenaddressThe address of the staking token

Returns

NameTypeDescription
<none>addressThe address of the new vault

initialize

Initializes the RewardVaultFactory contract.

solidity
function initialize(
    address _bgt,
    address _distributor,
    address _beaconDepositContract,
    address _governance,
    address _vaultImpl
) external initializer;

Parameters

NameTypeDescription
_bgtaddressThe BGT token address
_distributoraddressThe distributor address
_beaconDepositContractaddressThe BeaconDeposit contract address
_governanceaddressThe governance address
_vaultImpladdressThe vault implementation address

setBGTIncentiveDistributor

Sets the BGTIncentiveDistributor contract.

Only callable by the admin.

Emits:

solidity
function setBGTIncentiveDistributor(address _bgtIncentiveDistributor) external onlyRole(DEFAULT_ADMIN_ROLE);

Parameters

NameTypeDescription
_bgtIncentiveDistributoraddressThe address of the new BGTIncentiveDistributor contract

setBGTIncentiveFeeCollector

Sets the BGTIncentiveFeeCollector contract.

Only callable by the admin.

Emits:

solidity
function setBGTIncentiveFeeCollector(address _bgtIncentiveFeeCollector) external onlyRole(DEFAULT_ADMIN_ROLE);

Parameters

NameTypeDescription
_bgtIncentiveFeeCollectoraddressThe address of the new BGTIncentiveFeeCollector contract

setBGTIncentiveFeeRate

Sets the incentives fee rate.

Only callable by the admin.

Emits:

solidity
function setBGTIncentiveFeeRate(uint256 _bgtIncentiveFeeRate) external onlyRole(DEFAULT_ADMIN_ROLE);

Parameters

NameTypeDescription
_bgtIncentiveFeeRateuint256The new value for the rate (in basis points)

Events

BGTIncentiveDistributorSet

Emitted when the BGTIncentiveDistributor contract is set.

solidity
event BGTIncentiveDistributorSet(address indexed newBGTIncentiveDistributor, address indexed oldBGTIncentiveDistributor);

Parameters

NameTypeDescription
newBGTIncentiveDistributoraddressThe address of the new BGTIncentiveDistributor contract
oldBGTIncentiveDistributoraddressThe address of the old BGTIncentiveDistributor contract

IncentiveFeeCollectorUpdated

Emitted when the incentive fee collector address is updated.

solidity
event IncentiveFeeCollectorUpdated(address newAddress, address oldAddress);

Parameters

NameTypeDescription
newAddressaddressThe new address for incentive fees
oldAddressaddressThe old address for incentive fees

IncentiveFeeRateUpdated

Emitted when the incentive fee percentage is updated.

solidity
event IncentiveFeeRateUpdated(uint256 newValue, uint256 oldValue);

Parameters

NameTypeDescription
newValueuint256The new rate (in basis points)
oldValueuint256The old rate (in basis points)

VaultCreated

Emitted when a new vault is created.

solidity
event VaultCreated(address indexed stakingToken, address indexed vault);

Parameters

NameTypeDescription
stakingTokenaddressThe address of the staking token
vaultaddressThe address of the vault

Errors

InvalidIncentiveFeeRate

Thrown when the incentive fee rate exceeds the maximum allowed value.

solidity
error InvalidIncentiveFeeRate();

NotAContract

Thrown when the provided address is not a contract.

solidity
error NotAContract();

ZeroAddress

Thrown when a zero address is provided where a valid address is required.

solidity
error ZeroAddress();