forked from apy-finance/apy-core-public
-
Notifications
You must be signed in to change notification settings - Fork 1
[WIP] Remove mAPT dependence from Index Token #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
chanhosuh
wants to merge
16
commits into
develop
Choose a base branch
from
remove-mapt
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
fc16ad7
Replace call to mAPT with one to oracle adapter
chanhosuh 558dcdb
Replace mAPT with lpAccountFunder address
chanhosuh d96f4c9
Update unit tests
chanhosuh a03f552
Start int test cleanup
chanhosuh 4cb702f
Fix deployed value tests
chanhosuh 3389a57
Add check to retain old functionality
chanhosuh 1ccffef
Fix redeem unlock test
chanhosuh ea0a7d7
Rename pool to vault
chanhosuh 11956f6
Update tests
chanhosuh e2ef2b8
Fix unit tests from earlier change
chanhosuh 82e3c4d
Use direct imports
chanhosuh 80d8867
Remove mapt naming
chanhosuh 19e2039
Remove address registry dependency; use setters
chanhosuh 48f47d3
Validate contract addresses
chanhosuh 98a2ac4
Update unit tests
chanhosuh 80e5254
Test new storage vars set
chanhosuh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,39 @@ | ||
// SPDX-License-Identifier: BUSDL-1.1 | ||
pragma solidity 0.6.11; | ||
|
||
/** | ||
* @notice For vaults that keep a separate reserve of tokens | ||
*/ | ||
interface IReserveVault { | ||
/** | ||
* @notice Log when the percent held in reserve is changed | ||
* @param reservePercentage The new percent held in reserve | ||
*/ | ||
event ReservePercentageChanged(uint256 reservePercentage); | ||
|
||
/** | ||
* @notice Set a new percent of tokens to hold in reserve | ||
* @param reservePercentage_ The new percent | ||
*/ | ||
function setReservePercentage(uint256 reservePercentage_) external; | ||
|
||
/** | ||
* @notice Transfer an amount of tokens to the LP Account | ||
* @dev This should only be callable by the `LpAccountFunder` | ||
* @param amount The amount of tokens | ||
*/ | ||
function transferToLpAccount(uint256 amount) external; | ||
|
||
/** | ||
* @notice Get the amount of tokens missing from the reserve | ||
* @dev A negative amount indicates extra tokens not needed for the reserve | ||
* @return The amount of missing tokens | ||
*/ | ||
function getReserveTopUpValue() external view returns (int256); | ||
|
||
/** | ||
* @notice Get the current percentage of tokens held in reserve | ||
* @return The percent | ||
*/ | ||
function reservePercentage() external view returns (uint256); | ||
} |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's come up with a new name for this while we have the opportunity. It may make sense to switch the sign and make it a
uint256
as well, because it will only be used to determine excess tokens, never tokens that should be returned.Maybe we should overall avoid the reference to the LP Account, even with
transferToLpAccount
. All the vault fundamentally cares about is that there is something it can transfer to, that has permission to initiate the transfer, and that it can only transfer the excess tokens.One way we could think of this is as a 0% interest loan to another contract. Might be the wrong approach, but let's see how that might look:
Could also keep it simpler and stay with the transfer terminology:
In both cases I think it makes sense to drop the sign and invert the calculation so excess tokens is a positive number. Should simplify the rest of any calculations.