SwapAndLock

Git Source

Inherits: ISwapAndLock, AccessControlEnumerable

This contract is designed to swap dYFI tokens to YFI and lock them in the YearnStakingDelegate. It inherits from ISwapAndLock and AccessControlEnumerable to leverage swapping functionality and role-based access control.

State Variables

_YFI

Address of the mainnet Yearn YFI token.

address private constant _YFI = 0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e;

_D_YFI

Address of the mainnet Yearn D_YFI token.

address private constant _D_YFI = 0x41252E8691e964f7DE35156B68493bAb6797a275;

_YEARN_STAKING_DELEGATE

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

address private immutable _YEARN_STAKING_DELEGATE;

_COVE_YFI

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

address private immutable _COVE_YFI;

_dYfiRedeemer

Address of the DYfiRedeemer contract.

address private _dYfiRedeemer;

Functions

constructor

Constructs the SwapAndLock contract.

constructor(address yearnStakingDelegate_, address coveYfi_, address admin) payable;

Parameters

NameTypeDescription
yearnStakingDelegate_addressAddress of the YearnStakingDelegate contract.
coveYfi_addressAddress of the CoveYFI contract.
adminaddressAddress of the contract admin for rescuing tokens.

convertToCoveYfi

Converts any YFI held by this contract to CoveYFI, minting CoveYFI to the treasury. YFI will be locked as veYFI under YearnStakingDelegate's ownership.

function convertToCoveYfi() external returns (uint256);

Returns

NameTypeDescription
<none>uint256The amount of coveYFI minted.

setDYfiRedeemer

Sets the address of the DYfiRedeemer contract and approves it to spend dYFI. If the redeemer was already set, the approval is removed from the old redeemer.

function setDYfiRedeemer(address newDYfiRedeemer) external onlyRole(DEFAULT_ADMIN_ROLE);

Parameters

NameTypeDescription
newDYfiRedeemeraddressAddress of the new DYFIRedeemer contract.

dYfiRedeemer

Get the address of the dYFI redeemer contract.

function dYfiRedeemer() external view returns (address);

Returns

NameTypeDescription
<none>addressThe address of the dYFI redeemer contract.

Events

DYfiRedeemerSet

Emitted when the address of the DYfiRedeemer contract is updated.

event DYfiRedeemerSet(address oldRedeemer, address newRedeemer);

Parameters

NameTypeDescription
oldRedeemeraddressThe address of the previous DYfiRedeemer contract.
newRedeemeraddressThe address of the new DYfiRedeemer contract.