Skip to main content

IAsyncRedeemer

Git Source

Inherits: IMachinePeriphery

Functions

nextRequestId

ID of the next redeem request to be created.

function nextRequestId() external view returns (uint256);

lastFinalizedRequestId

ID of the last finalized redeem request.

function lastFinalizedRequestId() external view returns (uint256);

finalizationDelay

Minimum time (in seconds) to be elapsed between request submission and finalization.

function finalizationDelay() external view returns (uint256);

getShares

Request ID => Shares

function getShares(uint256 requestId) external view returns (uint256);

getClaimableAssets

Request ID => Claimable Assets

Reverts if the request is not finalized.

function getClaimableAssets(uint256 requestId) external view returns (uint256);

previewFinalizeRequests

Returns the total shares and curreent expected assets for a batch of unfinalized requests up to given request ID.

function previewFinalizeRequests(uint256 upToRequestId) external view returns (uint256, uint256);

Parameters

NameTypeDescription
upToRequestIduint256The request ID up to which to calculate the total shares and assets.

Returns

NameTypeDescription
<none>uint256totalShares The total shares for the batch of requests.
<none>uint256totalAssets The current total assets for the batch of requests.

requestRedeem

Creates a redeem request and issues an associated NFT to the receiver.

function requestRedeem(uint256 shares, address receiver) external returns (uint256);

Parameters

NameTypeDescription
sharesuint256The amount of shares to redeem.
receiveraddressThe receiver of the receipt NFT.

Returns

NameTypeDescription
<none>uint256requestId The ID of the redeem request.

finalizeRequests

Finalizes redeem requests up to a given request ID.

Can only be called by the operator of the associated machine.

function finalizeRequests(uint256 upToRequestId, uint256 minAssets) external returns (uint256, uint256);

Parameters

NameTypeDescription
upToRequestIduint256The request ID up to which to finalize requests.
minAssetsuint256The minimum amount of assets that must be available for the requests to be finalized.

claimAssets

Claims the assets associated with a finalized redeem request and burns the associated NFT.

function claimAssets(uint256 requestId) external returns (uint256);

Parameters

NameTypeDescription
requestIduint256the ID of the redeem request and associated NFT.

setFinalizationDelay

Sets the finalization delay for redeem requests.

function setFinalizationDelay(uint256 newDelay) external;

Parameters

NameTypeDescription
newDelayuint256The new finalization delay in seconds.

Events

FinalizationDelayChanged

event FinalizationDelayChanged(uint256 indexed oldDelay, uint256 indexed newDelay);

RedeemRequestCreated

event RedeemRequestCreated(uint256 indexed requestId, uint256 shares, address indexed receiver);

RedeemRequestClaimed

event RedeemRequestClaimed(uint256 indexed requestId, uint256 shares, uint256 assets, address indexed receiver);

RedeemRequestsFinalized

event RedeemRequestsFinalized(
uint256 indexed fromRequestId, uint256 indexed toRequestId, uint256 totalShares, uint256 totalAssets
);

Structs

RedeemRequest

struct RedeemRequest {
uint256 shares;
uint256 assets;
uint256 requestTime;
}