CoveYFI

Git Source

Inherits: ERC20Permit, Rescuable, AccessControlEnumerable

CoveYFI is a tokenized version of veYFI, commonly referred to as a liquid locker.

Extends the ERC-20 standard with permit, pausable, ownable, and rescuable functionality.

State Variables

_YFI

Address of the mainnet Yearn YFI token.

address private constant _YFI = 0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e;

_YEARN_STAKING_DELEGATE

Address of the YearnStakingDelegate contract, set at deployment and immutable thereafter.

address private immutable _YEARN_STAKING_DELEGATE;

Functions

constructor

constructor(
    address _yearnStakingDelegate,
    address admin
)
    payable
    ERC20("Cove YFI", "coveYFI")
    ERC20Permit("Cove YFI");

Parameters

NameTypeDescription
_yearnStakingDelegateaddressThe address of the YearnStakingDelegate contract.
adminaddressThe address of the contract admin for rescuing tokens.

deposit

Deposits YFI tokens into the YearnStakingDelegate contract and mints coveYFI tokens to the sender.

Mints coveYFI tokens equivalent to the amount of YFI deposited. The deposited YFI is then staked. Reverts with Errors.ZeroAmount if the deposit amount is zero. Emits a Transfer event from the zero address to the sender, indicating minting of coveYFI tokens.

function deposit(uint256 balance) external returns (uint256);

Parameters

NameTypeDescription
balanceuint256The amount of YFI tokens to deposit and stake. Must be greater than zero to succeed.

Returns

NameTypeDescription
<none>uint256The amount of coveYFI tokens minted to the sender.

deposit

Deposits YFI tokens into the YearnStakingDelegate contract and mints coveYFI tokens to the receiver.

function deposit(uint256 balance, address receiver) external returns (uint256);

Parameters

NameTypeDescription
balanceuint256The amount of YFI tokens to deposit and stake.
receiveraddressThe address to mint the coveYFI tokens to.

Returns

NameTypeDescription
<none>uint256The amount of coveYFI tokens minted to the receiver.

rescue

Allows the owner to rescue tokens mistakenly sent to the contract.

Can only be called by the contract owner. This function is intended for use in case of accidental token transfers into the contract.

function rescue(IERC20 token, address to, uint256 balance) external onlyRole(DEFAULT_ADMIN_ROLE);

Parameters

NameTypeDescription
tokenIERC20The ERC20 token to rescue, or 0x0 for ETH.
toaddressThe recipient address of the rescued tokens.
balanceuint256The amount of tokens to rescue.

yearnStakingDelegate

Returns the address of the YearnStakingDelegate contract.

Provides a way to access the YearnStakingDelegate address used by the contract.

function yearnStakingDelegate() external view returns (address);

Returns

NameTypeDescription
<none>addressThe address of the YearnStakingDelegate contract.

yfi

Returns the address of the YFI token contract.

Provides a way to access the YFI token address used by the contract.

function yfi() external pure returns (address);

Returns

NameTypeDescription
<none>addressThe address of the YFI token contract.

asset

Returns the address of asset required to deposit into this contract, which is YFI.

This is provided for the compatibility with the 4626 Router.

function asset() external pure returns (address);

Returns

NameTypeDescription
<none>addressThe address of the YFI token contract.

_deposit

function _deposit(uint256 balance, address receiver) internal returns (uint256);