-
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
Blur Integration #371
base: main
Are you sure you want to change the base?
Blur Integration #371
Conversation
@@ -361,4 +380,53 @@ contract PoolParameters is | |||
); | |||
userConfig.auctionValidityTime = block.timestamp; | |||
} | |||
|
|||
/// @inheritdoc IPoolParameters | |||
function enableBlurExchange() external onlyPoolAdmin { |
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 suggest using different names for these. as we are not really enabling the actual exchange
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.
enableBlurIntegration?
request.borrowAmount, | ||
timeLockParams | ||
); | ||
IWETH(weth).withdraw(request.borrowAmount); |
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't we transfer weth directly? might save us one transfer
// currency token. address(0) means ETH | ||
address paymentToken; | ||
// cash amount from user wallet | ||
uint256 listingPrice; |
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.
is cash amount ? or listing price?
Errors.INVALID_REQUEST_STATUS | ||
); | ||
|
||
address keeper = ps._blurExchangeKeeper; |
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.
could we not to check “msg.sender == keeper” to save some gas.
address nTokenAddress = nftReserve.xTokenAddress; | ||
// no time lock needed here | ||
DataTypes.TimeLockParams memory timeLockParams; | ||
(, uint64 collateralizedBalance) = INToken(nTokenAddress).burn( |
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 the nToken is in auction , will revert.
.getParams(); | ||
// ensure user can't borrow/withdraw with the new mint nToken | ||
require( | ||
request.listingPrice >= floorPrice.percentMul(liquidationThreshold), |
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.
- user init buy from blur which have high boost token id (set require.listingprice = nToken floor price * LS)
- user get more borrow limit : nToken floor price * boost *LTV - nToken floor price * LS
- user can borrow more money.
|
||
//mint debt token | ||
if (totalBorrow > 0) { | ||
BorrowLogic.executeBorrow( |
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.
should we do transferUnderlyingTo before executeBorrow ? since the borrow use rate is not correct in updateInterestRates now.
borrow use rate = total debt / (balance (pToken contract) + total debt)
balance (pToken contract) should subtract the totalBorrow
request.tokenId | ||
); | ||
|
||
return request.listingPrice + requestFee - request.borrowAmount; |
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 save some gas if calculate needCashETH first and sent into validateInitiateBlurExchangeRequest ?
* chore: basic implementation for BLUR sell * chore: fix typo * chore: check ape pair staking and gas optimization * chore: check owner and fix interest rate issue * chore: keeper fulfill request with ETH * chore: fix updating wrong status * chore: forbid initiate request for uniswapV3 and stakeFish
Security Checklist
Make sure to think about each of these exploits in this PR.