generated from transmissions11/foundry-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
92 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# ERC-4626 Reference Implementations • [![CI](https://github.com/transmissions11/foundry-template/actions/workflows/tests.yml/badge.svg)](https://github.com/transmissions11/foundry-template/actions/workflows/tests.yml) | ||
# ERC-7540 Reference Implementations • [![CI](https://github.com/transmissions11/foundry-template/actions/workflows/tests.yml/badge.svg)](https://github.com/transmissions11/foundry-template/actions/workflows/tests.yml) | ||
|
||
Includes sample reference implementations for [ERC-7540](https://ethereum-magicians.org/t/eip-7540-asynchronous-erc-4626-tokenized-vaults/16153) async deposit and withdraw for different use cases. | ||
Includes sample reference implementations for [ERC-7540](https://ethereum-magicians.org/t/eip-7540-asynchronous-erc-4626-tokenized-vaults/16153) async deposit and redeem for different use cases. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.15; | ||
|
||
/** | ||
* @dev Interface of the ERC165 standard, as defined in the | ||
* https://eips.ethereum.org/EIPS/eip-165[EIP]. | ||
* | ||
* Implementers can declare support of contract interfaces, which can then be | ||
* queried by others. | ||
*/ | ||
interface IERC165 { | ||
/** | ||
* @dev Returns true if this contract implements the interface defined by | ||
* `interfaceId`. See the corresponding | ||
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] | ||
* to learn more about how these ids are created. | ||
* | ||
* This function call must use less than 30 000 gas. | ||
*/ | ||
function supportsInterface(bytes4 interfaceId) external view returns (bool); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.15; | ||
|
||
import {IERC165} from "./IERC165.sol"; | ||
|
||
interface IERC7540Deposit is IERC165 { | ||
event DepositRequest(address indexed sender, address indexed operator, uint256 assets); | ||
|
||
/** | ||
* @dev Transfers assets from msg.sender into the Vault and submits a Request for asynchronous deposit/mint. | ||
* | ||
* - MUST support ERC-20 approve / transferFrom on asset as a deposit Request flow. | ||
* - MUST revert if all of assets cannot be requested for deposit/mint. | ||
* | ||
* NOTE: most implementations will require pre-approval of the Vault with the Vault's underlying asset token. | ||
*/ | ||
function requestDeposit(uint256 assets, address operator) external; | ||
|
||
/** | ||
* @dev Returns the amount of requested assets in Pending state for the operator to deposit or mint. | ||
* | ||
* - MUST NOT include any assets in Claimable state for deposit or mint. | ||
* - MUST NOT show any variations depending on the caller. | ||
* - MUST NOT revert unless due to integer overflow caused by an unreasonably large input. | ||
*/ | ||
function pendingDepositRequest(address operator) external view returns (uint256 assets); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.15; | ||
|
||
import {IERC165} from "./IERC165.sol"; | ||
|
||
interface IERC7540Redeem is IERC165 { | ||
event RedeemRequest(address indexed sender, address indexed operator, address indexed owner, uint256 shares); | ||
|
||
/** | ||
* @dev Assumes control of shares from owner and submits a Request for asynchronous redeem/withdraw. | ||
* | ||
* - MUST support a redeem Request flow where the control of shares is taken from owner directly | ||
* where msg.sender has ERC-20 approval over the shares of owner. | ||
* - MUST revert if all of shares cannot be requested for redeem / withdraw. | ||
*/ | ||
function requestRedeem(uint256 shares, address operator, address owner) external; | ||
|
||
/** | ||
* @dev Returns the amount of requested shares in Pending state for the operator to redeem or withdraw. | ||
* | ||
* - MUST NOT include any shares in Claimable state for redeem or withdraw. | ||
* - MUST NOT show any variations depending on the caller. | ||
* - MUST NOT revert unless due to integer overflow caused by an unreasonably large input. | ||
*/ | ||
function pendingRedeemRequest(address operator) external view returns (uint256 shares); | ||
} |