Skip to main content

IDepositFacility

Git Source

Title: IDepositFacility

Interface for deposit facilities to coordinate with generic operators (e.g., redemption vaults)

Functions

authorizeOperator

Authorize an operator (e.g., a redemption vault) to handle actions through this facility

function authorizeOperator(address operator_) external;

Parameters

NameTypeDescription
operator_addressThe address of the operator to authorize

deauthorizeOperator

Deauthorize an operator

function deauthorizeOperator(address operator_) external;

Parameters

NameTypeDescription
operator_addressThe address of the operator to deauthorize

isAuthorizedOperator

Check if an operator is authorized

function isAuthorizedOperator(address operator_) external view returns (bool isAuthorized);

Parameters

NameTypeDescription
operator_addressThe address of the operator to check

Returns

NameTypeDescription
isAuthorizedboolTrue if the operator is authorized

getOperators

Get the list of operators authorized to handle actions through this facility

function getOperators() external view returns (address[] memory operators);

Returns

NameTypeDescription
operatorsaddress[]The list of operators

handleCommit

Allows an operator to commit funds. This will ensure that enough funds are available to honour the commitments.

function handleCommit(IERC20 depositToken_, uint8 depositPeriod_, uint256 amount_) external;

Parameters

NameTypeDescription
depositToken_IERC20The deposit token committed
depositPeriod_uint8The deposit period in months
amount_uint256The amount to commit

handleCommitCancel

Allows an operator to cancel committed funds.

function handleCommitCancel(IERC20 depositToken_, uint8 depositPeriod_, uint256 amount_) external;

Parameters

NameTypeDescription
depositToken_IERC20The deposit token committed
depositPeriod_uint8The deposit period in months
amount_uint256The amount to reduce the commitment by

handleCommitWithdraw

Allows an operator to withdraw committed funds. This will withdraw deposit tokens to the recipient.

function handleCommitWithdraw(IERC20 depositToken_, uint8 depositPeriod_, uint256 amount_, address recipient_)
external
returns (uint256 actualAmount);

Parameters

NameTypeDescription
depositToken_IERC20The deposit token to withdraw
depositPeriod_uint8The deposit period in months
amount_uint256The amount to withdraw
recipient_addressThe address to receive the deposit tokens

Returns

NameTypeDescription
actualAmountuint256The amount of tokens transferred

handlePositionRedemption

Allows an operator to handle position-based redemptions by updating the position's remainingDeposit

function handlePositionRedemption(uint256 positionId_, uint256 amount_) external;

Parameters

NameTypeDescription
positionId_uint256The position ID to update
amount_uint256The amount being redeemed from the position

handlePositionCancelRedemption

Allows an operator to handle the cancellation of position-based redemptions by updating the position's remainingDeposit

function handlePositionCancelRedemption(uint256 positionId_, uint256 amount_) external;

Parameters

NameTypeDescription
positionId_uint256The position ID to update
amount_uint256The redemption amount to be cancelled

handleBorrow

Allows an operator to borrow against this facility's committed funds.

function handleBorrow(IERC20 depositToken_, uint8 depositPeriod_, uint256 amount_, address recipient_)
external
returns (uint256 actualAmount);

Parameters

NameTypeDescription
depositToken_IERC20The deposit token to borrow against
depositPeriod_uint8The deposit period in months
amount_uint256The amount to borrow
recipient_addressThe address to receive the borrowed tokens

Returns

NameTypeDescription
actualAmountuint256The amount of tokens borrowed

handleLoanRepay

Allows an operator to repay borrowed funds

function handleLoanRepay(
IERC20 depositToken_,
uint8 depositPeriod_,
uint256 amount_,
uint256 maxAmount_,
address payer_
) external returns (uint256 actualAmount);

Parameters

NameTypeDescription
depositToken_IERC20The deposit token being repaid
depositPeriod_uint8The deposit period in months
amount_uint256The amount of principal being repaid
maxAmount_uint256The maximum amount of principal that can be repaid
payer_addressThe address making the repayment

Returns

NameTypeDescription
actualAmountuint256The amount of tokens repaid

handleLoanDefault

Allows an operator to default on a loan

function handleLoanDefault(IERC20 depositToken_, uint8 depositPeriod_, uint256 amount_, address payer_) external;

Parameters

NameTypeDescription
depositToken_IERC20The deposit token being defaulted
depositPeriod_uint8The deposit period in months
amount_uint256The amount being defaulted
payer_addressThe address making the default

previewReclaim

Preview the amount of deposit token that would be reclaimed

The implementing contract is expected to handle the following:

  • Returning the total amount of deposit tokens that would be reclaimed
function previewReclaim(IERC20 depositToken_, uint8 depositPeriod_, uint256 amount_)
external
view
returns (uint256 reclaimed);

Parameters

NameTypeDescription
depositToken_IERC20The address of the deposit token
depositPeriod_uint8The period of the deposit in months
amount_uint256The amount of deposit tokens to reclaim

Returns

NameTypeDescription
reclaimeduint256The amount of deposit token returned to the caller

reclaim

Reclaims deposit tokens, after applying a discount Deposit tokens can be reclaimed at any time. The caller is not required to have a position in the facility.

The implementing contract is expected to handle the following:

  • Burning the receipt tokens
  • Transferring the deposit token to recipient_
  • Emitting an event
function reclaim(IERC20 depositToken_, uint8 depositPeriod_, uint256 amount_) external returns (uint256 reclaimed);

Parameters

NameTypeDescription
depositToken_IERC20The address of the deposit token
depositPeriod_uint8The period of the deposit in months
amount_uint256The amount of deposit tokens to reclaim

Returns

NameTypeDescription
reclaimeduint256The amount of deposit token returned to the caller

setAssetPeriodReclaimRate

Sets the reclaim rate for an asset period

function setAssetPeriodReclaimRate(IERC20 asset_, uint8 depositPeriod_, uint16 reclaimRate_) external;

Parameters

NameTypeDescription
asset_IERC20The address of the underlying asset
depositPeriod_uint8The deposit period, in months
reclaimRate_uint16The reclaim rate to set (in basis points, where 100e2 = 100%)

getAssetPeriodReclaimRate

Returns the reclaim rate for an asset period

function getAssetPeriodReclaimRate(IERC20 asset_, uint8 depositPeriod_) external view returns (uint16 reclaimRate);

Parameters

NameTypeDescription
asset_IERC20The address of the underlying asset
depositPeriod_uint8The deposit period, in months

Returns

NameTypeDescription
reclaimRateuint16The reclaim rate for the asset period

split

Splits the specified amount of the position into a new position

function split(uint256 positionId_, uint256 amount_, address to_, bool wrap_)
external
returns (uint256 newPositionId);

Parameters

NameTypeDescription
positionId_uint256The ID of the position to split
amount_uint256The amount to split from the position
to_addressThe address to receive the new position
wrap_boolWhether to wrap the new position

Returns

NameTypeDescription
newPositionIduint256The ID of the newly created position

getAvailableDeposits

Get the available deposit balance for a specific token. This excludes any committed funds.

function getAvailableDeposits(IERC20 depositToken_) external view returns (uint256 balance);

Parameters

NameTypeDescription
depositToken_IERC20The deposit token to query

Returns

NameTypeDescription
balanceuint256The available deposit balance

getCommittedDeposits

Get the committed deposits for a specific token. The committed deposits value represents the amount of the deposit token that this contract ensures will be available for all operators to use.

function getCommittedDeposits(IERC20 depositToken_) external view returns (uint256 committed);

Parameters

NameTypeDescription
depositToken_IERC20The deposit token to query

Returns

NameTypeDescription
committeduint256The total committed deposits

getCommittedDeposits

Get the committed deposits for a specific token and operator. The committed deposits value represents the amount of the deposit token that this contract ensures will be available for the specific operator to use.

function getCommittedDeposits(IERC20 depositToken_, address operator_) external view returns (uint256 committed);

Parameters

NameTypeDescription
depositToken_IERC20The deposit token to query
operator_addressThe operator

Returns

NameTypeDescription
committeduint256The committed deposits for the operator

Events

OperatorAuthorized

event OperatorAuthorized(address indexed operator);

OperatorDeauthorized

event OperatorDeauthorized(address indexed operator);

AssetCommitted

event AssetCommitted(address indexed asset, address indexed operator, uint256 amount);

AssetCommitCancelled

event AssetCommitCancelled(address indexed asset, address indexed operator, uint256 amount);

AssetCommitWithdrawn

event AssetCommitWithdrawn(address indexed asset, address indexed operator, uint256 amount);

Reclaimed

event Reclaimed(
address indexed user,
address indexed depositToken,
uint8 depositPeriod,
uint256 reclaimedAmount,
uint256 forfeitedAmount
);

AssetPeriodReclaimRateSet

event AssetPeriodReclaimRateSet(address indexed asset, uint8 depositPeriod, uint16 reclaimRate);

Errors

DepositFacility_ZeroAmount

error DepositFacility_ZeroAmount();

DepositFacility_InvalidAddress

error DepositFacility_InvalidAddress(address operator);

DepositFacility_UnauthorizedOperator

error DepositFacility_UnauthorizedOperator(address operator);

DepositFacility_InsufficientDeposits

error DepositFacility_InsufficientDeposits(uint256 requested, uint256 available);

DepositFacility_InsufficientCommitment

error DepositFacility_InsufficientCommitment(address operator, uint256 requested, uint256 available);

DepositFacility_InvalidReclaimRate

error DepositFacility_InvalidReclaimRate(uint16 reclaimRate, uint16 maxReclaimRate);