accrueProtocolFee

The admin can call the accrueProtocolFee on the Vault Manager contract, which mints vault tokens to the treasury at the defined rate. Set as InflationPerYearForProtocolFee on the Config.

 /**
   * @notice Accrue the protocol fee from all vaults, restricted to admin
   * @param _vaultAddress the vault address to collect the fee
   */
  function accrueProtocolFee(address _vaultAddress) external onlyAdmin {
    IAlloyxVault vault = IAlloyxVault(_vaultAddress);
    vault.accrueProtocolFee();
  }
  /**
   * @notice Accrue the protocol fee by minting vault tokens to the treasury
   */
  function accrueProtocolFee() external override onlyManager {
    uint256 totalSupply = vaultToken.totalSupply();
    uint256 timeSinceLastFee = block.timestamp.sub(lastProtocolFeeTimestamp);
    uint256 totalTokenToMint = totalSupply.mul(timeSinceLastFee).mul(config.getInflationPerYearForProtocolFee()).div(10000).div(ONE_YEAR_IN_SECONDS);
    vaultToken.mint(totalTokenToMint, config.treasuryAddress());
    lastProtocolFeeTimestamp = block.timestamp;
  }

Last updated