Skip to content

Instantly share code, notes, and snippets.

@mempirate
Created June 15, 2022 13:18
Show Gist options
  • Save mempirate/3f0dde4c5fd44bbcbcf0bd4417348601 to your computer and use it in GitHub Desktop.
Save mempirate/3f0dde4c5fd44bbcbcf0bd4417348601 to your computer and use it in GitHub Desktop.
abstract contract IERC4626 is ERC20 {
// Emitted every time someone deposits
event Deposit(address indexed sender, address indexed receiver, uint256 assets, uint256 shares);
// Emitted every time someone withdraws
event Withdraw(address indexed sender, address indexed receiver, uint256 assets, uint256 shares);
// Returns the address of the underlying token
function asset() external view virtual returns (address asset);
// Returns the amount of assets managed by the vault
function totalAssets() external view virtual returns (uint256 totalAssets);
// Mints `shares` vault tokens by depositing exactly `assets` underlying assets
function deposit(uint256 assets, address receiver) external virtual returns (uint256 shares);
// Mints exactly `shares` vault tokens by depositing `assets` underlying assets
function mint(uint256 shares, address receiver) external virtual returns (uint256 assets);
// Redeems `shares` from `assets`
function withdraw(
uint256 assets,
address receiver,
address owner
) external virtual returns (uint256 shares);
// Redeems `shares` from `assets`
function redeem(
uint256 shares,
address receiver,
address owner
) external virtual returns (uint256 assets);
// Other view functions omitted
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment