-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: import ERC4626 interface * lint: fix issues * feat: resolve base asset * gas: update snapshot
- Loading branch information
Showing
5 changed files
with
140 additions
and
67 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
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,32 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
pragma solidity ^0.8.0; | ||
|
||
contract StubERC4626 { | ||
address public asset; | ||
uint256 private rate; | ||
string revertMsg = "oops"; | ||
bool doRevert; | ||
|
||
constructor(address _asset, uint256 _rate) { | ||
asset = _asset; | ||
rate = _rate; | ||
} | ||
|
||
function setRevert(bool _doRevert) external { | ||
doRevert = _doRevert; | ||
} | ||
|
||
function setRate(uint256 _rate) external { | ||
rate = _rate; | ||
} | ||
|
||
function convertToAssets(uint256 shares) external view returns (uint256) { | ||
if (doRevert) revert(revertMsg); | ||
return shares * rate / 1e18; | ||
} | ||
|
||
function convertToShares(uint256 assets) external view returns (uint256) { | ||
if (doRevert) revert(revertMsg); | ||
return assets * 1e18 / rate; | ||
} | ||
} |
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