AsyncRedeemer
Inherits: ERC721Upgradeable, ReentrancyGuard, MachinePeriphery, SanctionsList, Whitelist, IAsyncRedeemer
Constants
AsyncRedeemerStorageLocation
bytes32 private constant AsyncRedeemerStorageLocation =
0x187c268ec5d498b5b6e4945b27f62abf37217cdbd80e6429181b3e4c2c378900;Functions
_getAsyncRedeemerStorage
function _getAsyncRedeemerStorage() private pure returns (AsyncRedeemerStorage storage $);Returns
| Name | Type | Description |
|---|---|---|
| $ | AsyncRedeemerStorage |
constructor
constructor(address _registry, address _sanctionsOracle)
MachinePeriphery(_registry)
SanctionsList(_sanctionsOracle);Parameters
| Name | Type | Description |
|---|---|---|
| _registry | address | |
| _sanctionsOracle | address |
initialize
Initializer of the contract.
function initialize(bytes calldata data) external virtual override initializer;Parameters
| Name | Type | Description |
|---|---|---|
| data | bytes | The initialization data, if any. |
__AsyncRedeemer_init
function __AsyncRedeemer_init(
uint256 _finalizationDelay,
uint256 _minRedeemAmount,
bool _whitelistStatus,
bool _sanctionsCheckStatus
) internal onlyInitializing;Parameters
| Name | Type | Description |
|---|---|---|
| _finalizationDelay | uint256 | |
| _minRedeemAmount | uint256 | |
| _whitelistStatus | bool | |
| _sanctionsCheckStatus | bool |
nextRequestId
ID of the next redeem request to be created.
function nextRequestId() external view override returns (uint256);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
lastFinalizedRequestId
ID of the last finalized redeem request.
function lastFinalizedRequestId() external view override returns (uint256);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
finalizationDelay
Minimum time (in seconds) that must elapse between request submission and finalization.
function finalizationDelay() external view override returns (uint256);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
minRedeemAmount
Minimum amount of shares required to create a redeem request.
function minRedeemAmount() external view override returns (uint256);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
getShares
Request ID => Shares
function getShares(uint256 requestId) external view override returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| requestId | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
getClaimableAssets
Request ID => Claimable Assets
Reverts if the request is not finalized.
function getClaimableAssets(uint256 requestId) public view override returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| requestId | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
previewFinalizeRequests
Returns the total shares and current expected assets for a batch of unfinalized requests up to the given request ID.
function previewFinalizeRequests(uint256 upToRequestId) public view override returns (uint256, uint256);Parameters
| Name | Type | Description |
|---|---|---|
| upToRequestId | uint256 | The request ID up to which to calculate the total shares and assets. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 | totalShares The total shares for the batch of requests. |
| <none> | uint256 | totalAssets 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, uint256 minAssets)
public
virtual
override
nonReentrant
sanctionsCheck
whitelistCheck
returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| shares | uint256 | The amount of shares to redeem. |
| receiver | address | The receiver of the receipt NFT. |
| minAssets | uint256 | The minimum amount of assets for the request's entry price. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 | requestId 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
override
onlyMechanic
nonReentrant
returns (uint256, uint256);Parameters
| Name | Type | Description |
|---|---|---|
| upToRequestId | uint256 | The request ID up to which to finalize requests. |
| minAssets | uint256 | The minimum amount of assets that must be available for the requests to be finalized. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 | |
| <none> | uint256 |
claimAssets
Claims the assets associated with a finalized redeem request and burns the associated NFT.
function claimAssets(uint256 requestId)
external
override
nonReentrant
sanctionsCheck
whitelistCheck
returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| requestId | uint256 | The ID of the redeem request and associated NFT. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
setFinalizationDelay
Sets the finalization delay for redeem requests.
function setFinalizationDelay(uint256 newDelay) external override onlyRiskManagerTimelock;Parameters
| Name | Type | Description |
|---|---|---|
| newDelay | uint256 | The new finalization delay in seconds. |
setMinRedeemAmount
Sets the minimum redeem amount.
function setMinRedeemAmount(uint256 newMinRedeemAmount) external override onlyRiskManagerTimelock;Parameters
| Name | Type | Description |
|---|---|---|
| newMinRedeemAmount | uint256 | The new minimum redeem amount. |
setWhitelistStatus
Enables or disables the whitelist.
function setWhitelistStatus(bool enabled) external override onlyRiskManager;Parameters
| Name | Type | Description |
|---|---|---|
| enabled | bool | True to enable the whitelist, false to disable. |
setWhitelistedUsers
Whitelists or unwhitelists a list of users.
function setWhitelistedUsers(address[] calldata users, bool whitelisted) external override onlyRiskManager;Parameters
| Name | Type | Description |
|---|---|---|
| users | address[] | The addresses of the users to update. |
| whitelisted | bool | True to whitelist the users, false to unwhitelist. |
setSanctionsCheckStatus
Enables or disables sanctions screening.
function setSanctionsCheckStatus(bool enabled) external override onlyRiskManager;Parameters
| Name | Type | Description |
|---|---|---|
| enabled | bool | True to enable screening, false to disable. |
_validateFinalizedRequest
Checks that the request exists, is finalized, and has not yet been claimed.
function _validateFinalizedRequest(uint256 requestId) internal view;Parameters
| Name | Type | Description |
|---|---|---|
| requestId | uint256 |
_validateFinalizableRequest
Checks that the request exists and is eligible for finalization.
function _validateFinalizableRequest(uint256 requestId) internal view;Parameters
| Name | Type | Description |
|---|---|---|
| requestId | uint256 |
_previewRedeem
Returns the amount of assets that can be obtained against a given amount of shares, under current market conditions.
function _previewRedeem(uint256 shares) internal view virtual returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| shares | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
Structs
AsyncRedeemerStorage
Note:
- storage-location: erc7201:makina.storage.AsyncRedeemer
struct AsyncRedeemerStorage {
uint256 _nextRequestId;
uint256 _lastFinalizedRequestId;
uint256 _finalizationDelay;
mapping(uint256 requestId => IAsyncRedeemer.RedeemRequest request) _requests;
uint256 _minRedeemAmount;
}Properties
| Name | Type | Description |
|---|---|---|
| _nextRequestId | uint256 | |
| _lastFinalizedRequestId | uint256 | |
| _finalizationDelay | uint256 | |
| _requests | mapping(uint256 requestId => IAsyncRedeemer.RedeemRequest request) | |
| _minRedeemAmount | uint256 |