WCurveGauge

This is the technical documentation for the WCurveGauge Solidity contract. The WCurveGauge contract is a wrapped Curve Gauge position that leverages LP tokens to be held in the BlueberryBank and does not generate yields. LP tokens are identified by tokenIds encoded from the LP token address.

Imports

The contract imports several OpenZeppelin contracts and other utility contracts and interfaces.

import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

import "../utils/BlueBerryErrors.sol" as Errors;
import "../utils/EnsureApprove.sol";
import "../interfaces/IERC20Wrapper.sol";
import "../interfaces/IWCurveGauge.sol";
import "../interfaces/curve/ILiquidityGauge.sol";

Contract Inheritance

The WCurveGauge contract inherits from the following contracts:

  • ERC1155Upgradeable

  • ReentrancyGuardUpgradeable

  • OwnableUpgradeable

  • EnsureApprove

  • IERC20Wrapper

  • IWCurveGauge

State Variables

The contract maintains the following state variables:

  • registry: Address of Curve Registry

  • gaugeController: Address of Curve Gauge Controller

  • CRV: Address of CRV token

  • accCrvPerShares: Mapping from gauge id to accCrvPerShare

Functions

initialize

This function initializes the contract with the addresses of the CRV token, Curve Registry, and Curve Gauge Controller.

encodeId

This function encodes the given pool id and CRV amount per share to an ERC1155 token id.

decodeId

This function decodes the given ERC1155 token id to a pool id and CRV amount per share.

getUnderlyingToken

This function returns the underlying ERC20 token of the given ERC1155 token id.

getLpFromGaugeId

This function returns the LP token address from the given gauge id.

pendingRewards

This function returns the pending rewards from the farming pool.

mint

This function mints an ERC1155 token for the given LP token.

_mintCrv

This internal function mints CRV rewards for the Curve gauge.

Last updated