-
Couldn't load subscription status.
- Fork 40
Eth instant withdraw #347
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: main
Are you sure you want to change the base?
Eth instant withdraw #347
Conversation
| // 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 <alex_cj96@foxmail.com>
Signed-off-by: GopherJ <alex_cj96@foxmail.com>
Signed-off-by: GopherJ <alex_cj96@foxmail.com>
Signed-off-by: GopherJ <alex_cj96@foxmail.com>
Signed-off-by: GopherJ <alex_cj96@foxmail.com>
Signed-off-by: GopherJ <alex_cj96@foxmail.com>
* chore: validator launch Signed-off-by: GopherJ <alex_cj96@foxmail.com> * fix: typo Signed-off-by: GopherJ <alex_cj96@foxmail.com> * fix: wrong url Signed-off-by: GopherJ <alex_cj96@foxmail.com> * fix: typo Signed-off-by: GopherJ <alex_cj96@foxmail.com> * fix: invalidToken Signed-off-by: GopherJ <alex_cj96@foxmail.com> * fix: chainId Signed-off-by: GopherJ <alex_cj96@foxmail.com> * fix: validator Signed-off-by: GopherJ <alex_cj96@foxmail.com> * chore: add setup/shutdown-validators command Signed-off-by: GopherJ <alex_cj96@foxmail.com> * fix: geth syncing Signed-off-by: GopherJ <alex_cj96@foxmail.com> * chore: generate deposit data Signed-off-by: GopherJ <alex_cj96@foxmail.com> * chore: rename to launch-validators Signed-off-by: GopherJ <alex_cj96@foxmail.com> * feat: add depositContract & register-validators Signed-off-by: GopherJ <alex_cj96@foxmail.com> * chore: rename Signed-off-by: GopherJ <alex_cj96@foxmail.com> * feat: initiate eth withdrawal Signed-off-by: GopherJ <alex_cj96@foxmail.com> * fix: typo Signed-off-by: GopherJ <alex_cj96@foxmail.com> * fix: lint Signed-off-by: GopherJ <alex_cj96@foxmail.com> * fix: address comparison Signed-off-by: GopherJ <alex_cj96@foxmail.com> * feat: use erc1155 instead Signed-off-by: GopherJ <alex_cj96@foxmail.com> * feat: e2e Signed-off-by: GopherJ <alex_cj96@foxmail.com> * chore: adds the present value oracle logic * fix: build Signed-off-by: GopherJ <alex_cj96@foxmail.com> * fix: use old formula until the new one is fully ready Signed-off-by: GopherJ <alex_cj96@foxmail.com> * chore: temporary fix Signed-off-by: GopherJ <alex_cj96@foxmail.com> * chore: support both goerli & zhejiang Signed-off-by: GopherJ <alex_cj96@foxmail.com> * chore: switch to task Signed-off-by: GopherJ <alex_cj96@foxmail.com> * fix: zhejiang launch Signed-off-by: GopherJ <alex_cj96@foxmail.com> * chore: add getter Signed-off-by: GopherJ <alex_cj96@foxmail.com> * chore: updates the present value formula * fix: typo Signed-off-by: GopherJ <alex_cj96@foxmail.com> * chore: adds test function helpers for calculating present value * chore: use shares Signed-off-by: GopherJ <alex_cj96@foxmail.com> * 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 <alex_cj96@foxmail.com> * chore: fix invalid command & make goerli the default Signed-off-by: GopherJ <alex_cj96@foxmail.com> * chore: add missing restart always Signed-off-by: GopherJ <alex_cj96@foxmail.com> * chore: add dummy svg Signed-off-by: GopherJ <alex_cj96@foxmail.com> * feat: add basic svg token uri Signed-off-by: GopherJ <alex_cj96@foxmail.com> --------- Signed-off-by: GopherJ <alex_cj96@foxmail.com> Co-authored-by: 0xwalid <walid.wah@gmail.com>
Signed-off-by: GopherJ <alex_cj96@foxmail.com>
Signed-off-by: GopherJ <alex_cj96@foxmail.com>
Signed-off-by: GopherJ <alex_cj96@foxmail.com>
Signed-off-by: GopherJ <alex_cj96@foxmail.com>
Security Checklist
Make sure to think about each of these exploits in this PR.