-
Notifications
You must be signed in to change notification settings - Fork 39
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
Eth instant withdraw #347
base: main
Are you sure you want to change the base?
Eth instant withdraw #347
Conversation
@@ -386,6 +448,20 @@ library DataTypes { | |||
uint16 _apeCompoundFee; | |||
// Map of user's ape compound strategies | |||
mapping(address => ApeCompoundStrategy) _apeCompoundStrategies; | |||
// Reserve storage for ape staking | |||
uint256[20] __apeStakingReserve; |
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.
shall we rename it to be __apeStakingGap
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.
Reserve 有预留的意思,感觉比gap好点吧
); | ||
uint256 availableLiquidityPlusDebt = availableLiquidity + totalDebt; | ||
uint256 usageRatio = totalDebt.rayDiv(availableLiquidityPlusDebt); | ||
require(usageRatio <= 0.8e27, Errors.USAGE_RATIO_TOO_HIGH); |
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.
can we make this a constant?
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.
这个主要是不确定需求上是不是个constant
VAULT_CONTRACT, | ||
VAULT_CONTRACT, | ||
borrowAmount, | ||
discountRate |
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.
why it's not reserve.currentStableBorrowRate?
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.
Current requirement is using discountRate as borrow rate.
); | ||
|
||
uint256 presentValue = IInstantNFTOracle(WITHDRAW_ORACLE) | ||
.getPresentValueByDiscountRate( |
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.
this will return static value but the loan collateral's present value should be dynamic right.
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.
Walid 实现不对吧。presentValue肯定与Duration有关,不能只与discountRate有关。
borrower: msg.sender, | ||
collateralAsset: collateralAsset, | ||
collateralTokenId: collateralTokenId.toUint64(), | ||
collateralAmount: collateralAmount.toUint64(), |
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.
collateralAmount 使用 uint64不太够吧,NFT合约那边 这个amount 有可能是 32e18 这种数据
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.
这个不同于erc20的amount,不会很大,之前讨论的是1万 或是 100万
5a4499c
to
6994559
Compare
6994559
to
3bb1016
Compare
Signed-off-by: GopherJ <[email protected]>
Signed-off-by: GopherJ <[email protected]>
Signed-off-by: GopherJ <[email protected]>
Signed-off-by: GopherJ <[email protected]>
Signed-off-by: GopherJ <[email protected]>
Signed-off-by: GopherJ <[email protected]>
* chore: validator launch Signed-off-by: GopherJ <[email protected]> * fix: typo Signed-off-by: GopherJ <[email protected]> * fix: wrong url Signed-off-by: GopherJ <[email protected]> * fix: typo Signed-off-by: GopherJ <[email protected]> * fix: invalidToken Signed-off-by: GopherJ <[email protected]> * fix: chainId Signed-off-by: GopherJ <[email protected]> * fix: validator Signed-off-by: GopherJ <[email protected]> * chore: add setup/shutdown-validators command Signed-off-by: GopherJ <[email protected]> * fix: geth syncing Signed-off-by: GopherJ <[email protected]> * chore: generate deposit data Signed-off-by: GopherJ <[email protected]> * chore: rename to launch-validators Signed-off-by: GopherJ <[email protected]> * feat: add depositContract & register-validators Signed-off-by: GopherJ <[email protected]> * chore: rename Signed-off-by: GopherJ <[email protected]> * feat: initiate eth withdrawal Signed-off-by: GopherJ <[email protected]> * fix: typo Signed-off-by: GopherJ <[email protected]> * fix: lint Signed-off-by: GopherJ <[email protected]> * fix: address comparison Signed-off-by: GopherJ <[email protected]> * feat: use erc1155 instead Signed-off-by: GopherJ <[email protected]> * feat: e2e Signed-off-by: GopherJ <[email protected]> * chore: adds the present value oracle logic * fix: build Signed-off-by: GopherJ <[email protected]> * fix: use old formula until the new one is fully ready Signed-off-by: GopherJ <[email protected]> * chore: temporary fix Signed-off-by: GopherJ <[email protected]> * chore: support both goerli & zhejiang Signed-off-by: GopherJ <[email protected]> * chore: switch to task Signed-off-by: GopherJ <[email protected]> * fix: zhejiang launch Signed-off-by: GopherJ <[email protected]> * chore: add getter Signed-off-by: GopherJ <[email protected]> * chore: updates the present value formula * fix: typo Signed-off-by: GopherJ <[email protected]> * chore: adds test function helpers for calculating present value * chore: use shares Signed-off-by: GopherJ <[email protected]> * chore: typo fix * chore: typo fix * chore: typo fix * chore: adds more test cases for present value logic * chore: removes unused vars * chore: fixes tests numbers * fix: use shares instead Signed-off-by: GopherJ <[email protected]> * chore: fix invalid command & make goerli the default Signed-off-by: GopherJ <[email protected]> * chore: add missing restart always Signed-off-by: GopherJ <[email protected]> * chore: add dummy svg Signed-off-by: GopherJ <[email protected]> * feat: add basic svg token uri Signed-off-by: GopherJ <[email protected]> --------- Signed-off-by: GopherJ <[email protected]> Co-authored-by: 0xwalid <[email protected]>
Signed-off-by: GopherJ <[email protected]>
Signed-off-by: GopherJ <[email protected]>
Signed-off-by: GopherJ <[email protected]>
Signed-off-by: GopherJ <[email protected]>
Signed-off-by: GopherJ <[email protected]>
Security Checklist
Make sure to think about each of these exploits in this PR.