Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

YieldDistributor

Git Source

Inherits: AccessManaged, ERC1271Delegated, IYieldDistributor, ReentrancyGuardTransient

Title: YieldDistributor

Contract that receives yield from MinterV0 minting operations and deposits it to the Vesting contract

Acts as an intermediary between MinterV0 and Vesting. When minting operations have YieldDistributor as the beneficiary, it receives apxUSD tokens. Operators can then trigger deposits of these tokens to the Vesting contract for vesting. This decouples the Minting and Vesting contracts while allowing for yield distribution to be automated. Features:

  • Receives apxUSD tokens from MinterV0 minting operations
  • Operator-controlled yield deposits to Vesting. This can be an automated service.
  • Admin-controlled vesting contract configuration
  • Access control via AccessManager

State Variables

asset

The apxUSD token contract

IERC20 public immutable asset

vesting

The vesting contract address

IVesting public vesting

Functions

constructor

Initializes the YieldDistributor contract

constructor(address _asset, address _authority, address _vesting, address _signingDelegate)
    AccessManaged(_authority)
    ERC1271Delegated(_signingDelegate);

Parameters

NameTypeDescription
_assetaddressAddress of the apxUSD token contract
_authorityaddressAddress of the AccessManager contract
_vestingaddressAddress of the Vesting contract
_signingDelegateaddressAddress of the signature delegate

availableBalance

Returns the available balance of apxUSD tokens

function availableBalance() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256Amount of apxUSD tokens available for deposit

setVesting

Sets the vesting contract address

Only callable through AccessManager with ADMIN_ROLE

function setVesting(address newVesting) external restricted;

Parameters

NameTypeDescription
newVestingaddressNew vesting contract address

setSigningDelegate

Sets the signature delegate

Only callable through AccessManager with ADMIN_ROLE

function setSigningDelegate(address newSigningDelegate) external restricted;

Parameters

NameTypeDescription
newSigningDelegateaddressNew signature delegate address

depositYield

Deposits yield to the vesting contract

Only callable through AccessManager with ROLE_YIELD_OPERATOR Approves vesting contract and calls depositYield() which pulls tokens

function depositYield(uint256 amount) external restricted;

Parameters

NameTypeDescription
amountuint256Amount of yield to deposit

withdraw

Withdraws yield from the vesting contract

Only callable through AccessManager with ADMIN_ROLE

function withdraw(uint256 amount, address receiver) external override restricted;

Parameters

NameTypeDescription
amountuint256Amount of yield to withdraw
receiveraddressAddress to receive the yield

withdrawTokens

Withdraws tokens from the YieldDistributor

Only callable through AccessManager with ADMIN_ROLE

function withdrawTokens(address withdrawAsset, uint256 amount, address receiver)
    public
    override
    restricted
    nonReentrant;

Parameters

NameTypeDescription
withdrawAssetaddressAddress of the asset to withdraw
amountuint256Amount of the asset to withdraw
receiveraddressAddress to receive the asset