-
Notifications
You must be signed in to change notification settings - Fork 96
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
Add public getMarginRequired() #400
Merged
haythemsellami
merged 2 commits into
feature/v2.0.0
from
chore/public-_getMarginRequired
May 6, 2021
Merged
Add public getMarginRequired() #400
haythemsellami
merged 2 commits into
feature/v2.0.0
from
chore/public-_getMarginRequired
May 6, 2021
Conversation
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
antoncoding
reviewed
May 5, 2021
antoncoding
suggested changes
May 6, 2021
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.
I've been giving some thoughts, I think it make more sense to not asking the user to put in VaultDetails
as an argument, as the _getVaultDetails
function is not public.
In this external function, we should simply get detail first, and that call the internal function.
haythemsellami
pushed a commit
that referenced
this pull request
May 7, 2021
* Controller modifications for partial collateralization (#368) * update OpenVaultArgs; set vault type; add vaultLatestUpdate * fix build * fix tests * fix integration tests * add vault type to event * increase tests coverage * update comment Co-authored-by: aparnakr <aparnalocked@gmail.com> Co-authored-by: aparnakr <aparnalocked@gmail.com> * Update chainlink interface to V3 (#369) * update chainlink interface to V3 * add decimals() scaling * Chainlink historical price (#370) * update OpenVaultArgs; set vault type; add vaultLatestUpdate * fix build * fix tests * fix integration tests * add vault type to event * increase tests coverage * update chainlink interface to V3 * add historical price function * fix integration tests * add tests * add more tests * typo Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * add decimals() scaling Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * fix the controller harness (#373) * Partial collateralization margin check (#371) * update OpenVaultArgs; set vault type; add vaultLatestUpdate * fix build * fix tests * fix integration tests * add vault type to event * increase tests coverage * update chainlink interface to V3 * add historical price function * fix integration tests * add tests * add more tests * add sync function * just checking that vault is not under water at settling, and boom encountered stack tooo deep :p * change variables scope * add vault type to getVault() * fix tests to work with the getVault() modification * update getVault() to return latestUpdateTimestamp; add test for sync() * add owner functions * fix typo * set oracle deviation value * fix build * add vaultType to getExcessCollateral * check margin if naked vault and not expired yet * fix tests * add _findUpperBoundValue() * add getter functions * add test coverage * improve coverage * typo Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * add decimals() scaling * re-order functions; increase coverage * _getNakedMarginRequired() * _getNakedMarginRequired() test * re-run CI * update package-lock.json * lint contracts * lint test files * improve coverage * more margin required tests * more margin required tests * fix bug * call tests * improve comment * add view function to get required margin for specific product * add backward compatibility for openVault action * more tests * refactor _getProductHash * refactor * test settling undercollateralized vault * tests for removing collateral from expired positions * updated harness * remove console.log() * clean Co-authored-by: Anton Cheng <antonassocareer@gmail.com> Co-authored-by: Shelly Grossman <shellygr151@gmail.com> * Opyn liquidation (#378) * update OpenVaultArgs; set vault type; add vaultLatestUpdate * fix build * fix tests * fix integration tests * add vault type to event * increase tests coverage * update chainlink interface to V3 * add historical price function * fix integration tests * add tests * add more tests * add sync function * just checking that vault is not under water at settling, and boom encountered stack tooo deep :p * change variables scope * add vault type to getVault() * fix tests to work with the getVault() modification * update getVault() to return latestUpdateTimestamp; add test for sync() * add owner functions * fix typo * set oracle deviation value * fix build * add vaultType to getExcessCollateral * check margin if naked vault and not expired yet * fix tests * add _findUpperBoundValue() * add getter functions * add test coverage * improve coverage * typo Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * add decimals() scaling * re-order functions; increase coverage * _getNakedMarginRequired() * _getNakedMarginRequired() test * re-run CI * update package-lock.json * lint contracts * lint test files * improve coverage * more margin required tests * more margin required tests * fix bug * call tests * improve comment * add view function to get required margin for specific product * add backward compatibility for openVault action * more tests * refactor _getProductHash * refactor * test settling undercollateralized vault * add liquidate action args * liquidate action args tests * get liquidation price; check if vault is liquidatable * add comments * init tests * liquidate * fix tests * more tests * add comments * liquidation price testing * more tests * change AUCTION_TIME scaling * tests * tests * fix calculation; more tests * fix collateral to sell calculation * full liquidation tests * partially liquidation test * add function description * clear Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * clear Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * clear Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * clear Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * clear Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * clear Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * rename var; refactor util function * natspec comments * clean tests * require dust amount is greater than zero * set bignumber config * fix coverage * update circleci config * fix tests * clean code * clean Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * clean * fix build * add requirement for spot shock value * fix typo * cap liquidation price * fix capping * fix tests * add tests for call position * add natspec comment * fix timestamp check * fix tests * fix tests Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * Gamma partial collateralization: integration tests (#381) * update OpenVaultArgs; set vault type; add vaultLatestUpdate * fix build * fix tests * fix integration tests * add vault type to event * increase tests coverage * update chainlink interface to V3 * add historical price function * fix integration tests * add tests * add more tests * add sync function * just checking that vault is not under water at settling, and boom encountered stack tooo deep :p * change variables scope * add vault type to getVault() * fix tests to work with the getVault() modification * update getVault() to return latestUpdateTimestamp; add test for sync() * add owner functions * fix typo * set oracle deviation value * fix build * add vaultType to getExcessCollateral * check margin if naked vault and not expired yet * fix tests * add _findUpperBoundValue() * add getter functions * add test coverage * improve coverage * typo Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * add decimals() scaling * re-order functions; increase coverage * _getNakedMarginRequired() * _getNakedMarginRequired() test * re-run CI * update package-lock.json * lint contracts * lint test files * improve coverage * more margin required tests * more margin required tests * fix bug * call tests * improve comment * add view function to get required margin for specific product * add backward compatibility for openVault action * more tests * refactor _getProductHash * refactor * test settling undercollateralized vault * add liquidate action args * liquidate action args tests * get liquidation price; check if vault is liquidatable * add comments * init tests * liquidate * fix tests * more tests * add comments * liquidation price testing * more tests * change AUCTION_TIME scaling * tests * tests * fix calculation; more tests * fix collateral to sell calculation * full liquidation tests * partially liquidation test * add function description * clear Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * clear Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * clear Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * clear Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * clear Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * clear Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * rename var; refactor util function * natspec comments * clean tests * require dust amount is greater than zero * set bignumber config * fix coverage * update circleci config * fix tests * clean code * clean Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * clean * fix build * add requirement for spot shock value * fix typo * cap liquidation price * fix capping * fix tests * add tests for call position * clean * add natspec comment * add natspec comment * init integration tests * more tests * fix timestamp check * more tests * fix tests * fix tests * more tests * init call integration tests * more tests * fix tests * more tests * add more tests for put and call naked margin positions * chore: undo vault type changes * fix tests * fix unit tests * fix integration tests for call Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * Merge setProductTimeToExpiry() & setTimeToExpiryValue() into setUpperBoundValues() (#385) * add setUpperBoundValues() * update tests * fix unit tests * fix integration tests * integration-tests:fix collateral check after liquidation * assert liquidation price is greater than zero when testing liquidation scenarios * clean * unit tests:setUpperBoundValues() * improve margin calculator coverage * fix integration tests * updateUpperBoundValue() * improve updateUpperBoundValue() coverage * Improve comments in Calculator & Controller (#389) * improve comments * Improve comment in Controller * fix build failing * remove unused code * remove LiquidationStatus struct (#390) * improve comments * Improve comment in Controller * fix build failing * remove LiquidationStatus struct * revert package.json change * Fix wrong sign * improve comments * Improve comment in Controller * fix build failing * remove unused code * remove LiquidationStatus struct * revert package.json change * Fix wrong sign Co-authored-by: Haythem Sellami <sellamihaythem96@gmail.com> * Fix tests (#396) * fix tests * update error delta * Refactor marginVault to reduce # of SLOAD (#380) * refactor marginVault to reduce # of SLOAD * Apply change to addCollateral and removeCollateral * Simplify remove logic * keep the old if block * remove duplicated logic in _getCashValue and _getExpiredCashValue (#394) * update _isMarginableLong() verification order (#398) * Add donate feature (#399) * add donate() * add tests * fix tests * add function comment * rm BigNumber rounding mode config in MarginCalculator liquidation unit test * rm BigNumber config settings * Disable withdrawing collateral after expiry (#397) * undo _withdrawCollateral() changes and update revert messages * update error messages * update tests: * Update error code Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * Add public getMarginRequired() (#400) * add external _getMarginRequired() * update getMarginRequired() * rename variables (#401) * chore: update comment * chore:clean & update comments * Update yearn pricer (#402) * fix yearn pricer to work with the new OpynPricerInterface * update revert message Co-authored-by: Anton Cheng <antonassocareer@gmail.com> Co-authored-by: Anton Cheng <antonassocareer@gmail.com> * Refactor: Rename state variables, events, & external functions (#403) * refactor: productToTimeToExpiry -> timesToExpiryForProduct * refactor: ProductTimeToExpiryAdded -> TimeToExpiryAdded * refactor: getProductTimeToExpiry -> getTimesToExpiry * refactor: timeToExpiryToMaxPrice -> maxPriceAtTimeToExpiry * refactor: TimeToExpiryValueAdded -> MaxPriceAdded * refactor: getTimeToExpiryValue -> getMaxPrice * docs: misc spotShock mapping comment update * fix compiler warnings & move to core folder * Fix certora contracts path (#404) * fix: contracts path * fix harness contracts path Co-authored-by: aparnakr <aparnalocked@gmail.com> Co-authored-by: Anton Cheng <antonassocareer@gmail.com> Co-authored-by: Shelly Grossman <shellygr151@gmail.com> Co-authored-by: CruzMolina <7537712+CruzMolina@users.noreply.github.com> Co-authored-by: Cruz Molina <cruz.adam.molina@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Task: Add public getMarginRequired()
High Level Description
Add external getMarginRequired() function.
Code
Documentation