-
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
Layer2 AA Migration #406
Layer2 AA Migration #406
Conversation
.cache(); | ||
currentReserve.updateState(reserveCache); | ||
vars.xTokenAddresses[j] = reserveCache.xTokenAddress; | ||
vars.reserveConfigurations[j] = reserveCache |
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.
suggest change vars.reserveConfigurations to vars.reserveAssetType, to avoid call getAssetType() each time.
* @notice Defines the basic interface for an ParaSpace Pool. | ||
**/ | ||
interface IPoolAAPositionMover { | ||
function positionMoveToAA(uint256 salt) external returns (address); |
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 define also events here so that typescript can generate correct typings
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.0; | ||
|
||
import {ParaVersionedInitializable} from "../libraries/paraspace-upgradeability/ParaVersionedInitializable.sol"; |
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 cannot we reuse PoolPositionMover?
bool isCollateral = nToken.isUsedAsCollateral(tokenId); | ||
nToken.transferOnLiquidation(user, aaAccount, tokenId); | ||
if (isCollateral) { | ||
nToken.setIsUsedAsCollateral( |
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 move this out of the loop and use batchSetIsUsedAsCollateral?
scripts/deployments/steps/06_pool.ts
Outdated
@@ -119,6 +122,31 @@ export const step_06 = async (verify = false) => { | |||
); | |||
} | |||
|
|||
const accountFactory = | |||
(await getContractAddressInDb(eContractid.AccountFactory)) || | |||
(await deployAccountFactory(zeroAddress())); |
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 assume that AccountFactory is already deployed then we can use getAccountFactory instead
|
||
DataTypes.ReserveCache memory reserveCache = currentReserve | ||
.cache(); | ||
currentReserve.updateState(reserveCache); |
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.
updateState is not necessary , since rate is not changed.
IPToken pToken = IPToken(vars.xTokenAddresses[j]); | ||
uint256 balance = pToken.balanceOf(user); | ||
if (balance > 0) { | ||
DataTypes.TimeLockParams memory timeLockParams; |
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.
we should move timeLockParams out of loop
uint256 balance = pToken.balanceOf(user); | ||
if (balance > 0) { | ||
DataTypes.TimeLockParams memory timeLockParams; | ||
pToken.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.
sAPE will revert
for (uint256 k = 0; k < balance; k++) { | ||
uint256 tokenId = nToken.tokenOfOwnerByIndex(user, k); | ||
bool isCollateral = nToken.isUsedAsCollateral(tokenId); | ||
nToken.transferOnLiquidation(user, aaAccount, tokenId); |
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 user have staking NFT in current account , user may use positionMoveToAA to keep all staking amount of $Ape in current account , move others token to AA.
|
||
DataTypes.ReserveCache memory reserveCache = currentReserve | ||
.cache(); | ||
_calculateLiquidityAndDebtIndex(reserveCache); |
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 assetType is NFT should skip the _calculateLiquidityAndDebtIndex(reserveCache)
} | ||
|
||
if (vars.xTokenAddresses[j] == address(0)) { | ||
DataTypes.ReserveData storage currentReserve = ps._reserves[ |
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.
suggest move "address currentReserveAddress = ps._reservesList[j];"to here
Security Checklist
Make sure to think about each of these exploits in this PR.