YieldDistributor
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
| Name | Type | Description |
|---|---|---|
_asset | address | Address of the apxUSD token contract |
_authority | address | Address of the AccessManager contract |
_vesting | address | Address of the Vesting contract |
_signingDelegate | address | Address of the signature delegate |
availableBalance
Returns the available balance of apxUSD tokens
function availableBalance() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Amount 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
| Name | Type | Description |
|---|---|---|
newVesting | address | New vesting contract address |
setSigningDelegate
Sets the signature delegate
Only callable through AccessManager with ADMIN_ROLE
function setSigningDelegate(address newSigningDelegate) external restricted;
Parameters
| Name | Type | Description |
|---|---|---|
newSigningDelegate | address | New 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
| Name | Type | Description |
|---|---|---|
amount | uint256 | Amount 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
| Name | Type | Description |
|---|---|---|
amount | uint256 | Amount of yield to withdraw |
receiver | address | Address 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
| Name | Type | Description |
|---|---|---|
withdrawAsset | address | Address of the asset to withdraw |
amount | uint256 | Amount of the asset to withdraw |
receiver | address | Address to receive the asset |