-
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
base: develop
Are you sure you want to change the base?
Conversation
Having `_getDeployedValue` return 0 when zero supply botches some of the calc unit tests, which used to mock out mAPT.
* @dev A negative amount indicates extra tokens not needed for the reserve | ||
* @return The amount of missing tokens | ||
*/ | ||
function getReserveTopUpValue() external view returns (int256); |
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:
function lendUnderlyer(uint256 amount) external;
function getMaxUnderlyerLoan() external view returns (uint256);
Could also keep it simpler and stay with the transfer terminology:
function transferUnderlyer(uint256 amount) external;
function getTransferUnderlyerMaxAmount() external view returns (uint256);
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.
* @dev Tokens from the vault are typically borrowed by the LP Account | ||
* @return The USD value. USD prices have 8 decimals. | ||
*/ | ||
function _getDeployedValue() internal view returns (uint256) { |
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.
If we go with the lending terminology mentioned above, this could become _getLoanedUsdValue
Address Registry dependence has been removed. Dependencies are all contracts, not EOAs, so their respective setters all validate the passed address is a contract address. Unit tests have been updated but the tests in |
No description provided.