Skip to content

Commit

Permalink
Add cancelation interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
hieronx committed Mar 4, 2024
1 parent c41ebcd commit f7d7e77
Showing 1 changed file with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions src/interfaces/IERC7540.sol
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,98 @@ interface IERC7540Redeem {
function claimableRedeemRequest(uint256 requestId, address owner) external view returns (uint256 claimableShares);
}

interface IERC7540CancelDeposit {
event CancelDepositRequest(
address indexed owner, uint256 indexed requestId, address sender
);

/**
* @dev Submits a Request for cancelling the pending deposit Request
* - owner MUST be msg.sender unless some unspecified explicit approval is given by the caller,
* approval of ERC-20 tokens from owner to sender is NOT enough.
* - MUST set pendingCancelDepositRequest to `true` for the returned requestId after request
* - MUST increase claimableCancelDepositRequest for the returned requestId after fulfillment
* - SHOULD be claimable using `claimCancelDepositRequest`
* Note: while `pendingCancelDepositRequest` is `true`, `requestDeposit` cannot be called
*/
function cancelDepositRequest(uint256 requestId, address owner) external;

/**
* @dev Returns whether the deposit Request is pending cancelation
*
* - MUST NOT show any variations depending on the caller.
*/
function pendingCancelDepositRequest(uint256 requestId, address owner) external view returns (bool isPending);

/**
* @dev Returns the amount of assets that were canceled from a deposit Request, and can now be claimed.
*
* - MUST NOT show any variations depending on the caller.
*/
function claimableCancelDepositRequest(uint256 requestId, address owner)
external
view
returns (uint256 claimableAssets);

/**
* @dev Claims the canceled deposit assets, and removes the pending cancelation Request
* - owner MUST be msg.sender unless some unspecified explicit approval is given by the caller,
* approval of ERC-20 tokens from owner to sender is NOT enough.
* - MUST set pendingCancelDepositRequest to `false` for the returned requestId after request
* - MUST set claimableCancelDepositRequest to 0 for the returned requestId after fulfillment
*/
function claimCancelDepositRequest(uint256 requestId, address owner) external;
}

interface IERC7540CancelRedeem {
event CancelRedeemRequest(
address indexed owner, uint256 indexed requestId, address sender
);

/**
* @dev Submits a Request for cancelling the pending redeem Request
* - owner MUST be msg.sender unless some unspecified explicit approval is given by the caller,
* approval of ERC-20 tokens from owner to sender is NOT enough.
* - MUST set pendingCancelRedeemRequest to `true` for the returned requestId after request
* - MUST increase claimableCancelRedeemRequest for the returned requestId after fulfillment
* - SHOULD be claimable using `claimCancelRedeemRequest`
* Note: while `pendingCancelRedeemRequest` is `true`, `requestRedeem` cannot be called
*/
function cancelRedeemRequest(uint256 requestId, address owner) external;

/**
* @dev Returns whether the redeem Request is pending cancelation
*
* - MUST NOT show any variations depending on the caller.
*/
function pendingCancelRedeemRequest(uint256 requestId, address owner) external view returns (bool isPending);

/**
* @dev Returns the amount of shares that were canceled from a redeem Request, and can now be claimed.
*
* - MUST NOT show any variations depending on the caller.
*/
function claimableCancelRedeemRequest(uint256 requestId, address owner)
external
view
returns (uint256 claimableShares);

/**
* @dev Claims the canceled redeem shares, and removes the pending cancelation Request
* - owner MUST be msg.sender unless some unspecified explicit approval is given by the caller,
* approval of ERC-20 tokens from owner to sender is NOT enough.
* - MUST set pendingCancelRedeemRequest to `false` for the returned requestId after request
* - MUST set claimableCancelRedeemRequest to 0 for the returned requestId after fulfillment
*/
function claimCancelRedeemRequest(uint256 requestId, address owner) external;
}

/**
* @title IERC7540
* @dev Interface of the ERC7540 "Asynchronous Tokenized Vault Standard", as defined in
Expand Down

0 comments on commit f7d7e77

Please sign in to comment.