RewardVaultFactory
Factory contract for creating RewardVaults and keeping track of them.
Inherits: IRewardVaultFactory, AccessControlUpgradeable, UUPSUpgradeable
Constants
VAULT_MANAGER_ROLE
The VAULT MANAGER role.
bytes32 public constant VAULT_MANAGER_ROLE = keccak256("VAULT_MANAGER_ROLE");
VAULT_PAUSER_ROLE
The VAULT PAUSER role.
bytes32 public constant VAULT_PAUSER_ROLE = keccak256("VAULT_PAUSER_ROLE");
State Variables
allVaults
Array of all vaults that have been created.
address[] public allVaults;
beacon
The beacon address.
address public beacon;
beaconDepositContract
The BeaconDeposit contract address.
address public beaconDepositContract;
bgt
The BGT token address.
address public bgt;
bgtIncentiveDistributor
The address of the BGTIncentiveDistributor contract to receive the BGT booster share of the incentive tokens.
address public bgtIncentiveDistributor;
bgtIncentiveFeeCollector
The address of the BGTIncentiveFeeCollector contract to receive fees.
address public bgtIncentiveFeeCollector;
bgtIncentiveFeeRate
Fee rate on incentives in basis points (e.g., 100 = 1%).
uint256 public bgtIncentiveFeeRate;
distributor
The distributor address.
address public distributor;
getVault
Mapping of staking token to vault address.
mapping(address stakingToken => address vault) public getVault;
View Functions
allVaultsLength
Gets the number of vaults that have been created.
function allVaultsLength() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The number of vaults |
bgtIncentiveDistributor
Gets the address of the BGTIncentiveDistributor contract.
function bgtIncentiveDistributor() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | The address of the BGTIncentiveDistributor contract |
bgtIncentiveFeeCollector
Gets the address of the incentive fee collector.
function bgtIncentiveFeeCollector() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | The address of the BGTIncentiveFeeCollector contract |
bgtIncentiveFeeRate
Gets the value of the incentive fee rate.
function bgtIncentiveFeeRate() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The rate (in basis points) |
getIncentiveFeeAmount
Applies the fee percentage on the incentive amount.
function getIncentiveFeeAmount(uint256 incentiveAmount) external view returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
incentiveAmount | uint256 | The amount of incentive tokens |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The fee amount |
getVault
Gets the vault for the given staking token.
function getVault(address stakingToken) external view returns (address);
Parameters
Name | Type | Description |
---|---|---|
stakingToken | address | The address of the staking token |
Returns
Name | Type | Description |
---|---|---|
<none> | address | The address of the vault |
predictRewardVaultAddress
Predicts the address of the reward vault for the given staking token.
function predictRewardVaultAddress(address stakingToken) external view returns (address);
Parameters
Name | Type | Description |
---|---|---|
stakingToken | address | The address of the staking token |
Returns
Name | Type | Description |
---|---|---|
<none> | address | The 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:
function createRewardVault(address stakingToken) external returns (address);
Parameters
Name | Type | Description |
---|---|---|
stakingToken | address | The address of the staking token |
Returns
Name | Type | Description |
---|---|---|
<none> | address | The address of the new vault |
initialize
Initializes the RewardVaultFactory contract.
function initialize(
address _bgt,
address _distributor,
address _beaconDepositContract,
address _governance,
address _vaultImpl
) external initializer;
Parameters
Name | Type | Description |
---|---|---|
_bgt | address | The BGT token address |
_distributor | address | The distributor address |
_beaconDepositContract | address | The BeaconDeposit contract address |
_governance | address | The governance address |
_vaultImpl | address | The vault implementation address |
setBGTIncentiveDistributor
Sets the BGTIncentiveDistributor contract.
Only callable by the admin.
Emits:
function setBGTIncentiveDistributor(address _bgtIncentiveDistributor) external onlyRole(DEFAULT_ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
_bgtIncentiveDistributor | address | The address of the new BGTIncentiveDistributor contract |
setBGTIncentiveFeeCollector
Sets the BGTIncentiveFeeCollector contract.
Only callable by the admin.
Emits:
function setBGTIncentiveFeeCollector(address _bgtIncentiveFeeCollector) external onlyRole(DEFAULT_ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
_bgtIncentiveFeeCollector | address | The address of the new BGTIncentiveFeeCollector contract |
setBGTIncentiveFeeRate
Sets the incentives fee rate.
Only callable by the admin.
Emits:
function setBGTIncentiveFeeRate(uint256 _bgtIncentiveFeeRate) external onlyRole(DEFAULT_ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
_bgtIncentiveFeeRate | uint256 | The new value for the rate (in basis points) |
Events
BGTIncentiveDistributorSet
Emitted when the BGTIncentiveDistributor contract is set.
event BGTIncentiveDistributorSet(address indexed newBGTIncentiveDistributor, address indexed oldBGTIncentiveDistributor);
Parameters
Name | Type | Description |
---|---|---|
newBGTIncentiveDistributor | address | The address of the new BGTIncentiveDistributor contract |
oldBGTIncentiveDistributor | address | The address of the old BGTIncentiveDistributor contract |
IncentiveFeeCollectorUpdated
Emitted when the incentive fee collector address is updated.
event IncentiveFeeCollectorUpdated(address newAddress, address oldAddress);
Parameters
Name | Type | Description |
---|---|---|
newAddress | address | The new address for incentive fees |
oldAddress | address | The old address for incentive fees |
IncentiveFeeRateUpdated
Emitted when the incentive fee percentage is updated.
event IncentiveFeeRateUpdated(uint256 newValue, uint256 oldValue);
Parameters
Name | Type | Description |
---|---|---|
newValue | uint256 | The new rate (in basis points) |
oldValue | uint256 | The old rate (in basis points) |
VaultCreated
Emitted when a new vault is created.
event VaultCreated(address indexed stakingToken, address indexed vault);
Parameters
Name | Type | Description |
---|---|---|
stakingToken | address | The address of the staking token |
vault | address | The address of the vault |
Errors
InvalidIncentiveFeeRate
Thrown when the incentive fee rate exceeds the maximum allowed value.
error InvalidIncentiveFeeRate();
NotAContract
Thrown when the provided address is not a contract.
error NotAContract();
ZeroAddress
Thrown when a zero address is provided where a valid address is required.
error ZeroAddress();