Skip to content

Commit 3aad8ca

Browse files
authored
perf: dont use reserve data extended (#57)
1 parent 105baaf commit 3aad8ca

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/periphery/contracts/static-a-token/ERC4626StataTokenUpgradeable.sol

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,18 +139,19 @@ abstract contract ERC4626StataTokenUpgradeable is ERC4626Upgradeable, IERC4626St
139139

140140
///@inheritdoc IERC4626
141141
function maxRedeem(address owner) public view override returns (uint256) {
142-
DataTypes.ReserveData memory reserveData = POOL.getReserveDataExtended(asset());
142+
DataTypes.ReserveConfigurationMap memory reserveConfiguration = POOL.getConfiguration(asset());
143143

144144
// if paused or inactive users cannot withdraw underlying
145145
if (
146-
!ReserveConfiguration.getActive(reserveData.configuration) ||
147-
ReserveConfiguration.getPaused(reserveData.configuration)
146+
!ReserveConfiguration.getActive(reserveConfiguration) ||
147+
ReserveConfiguration.getPaused(reserveConfiguration)
148148
) {
149149
return 0;
150150
}
151151

152152
// otherwise users can withdraw up to the available amount
153-
uint256 underlyingTokenBalanceInShares = convertToShares(reserveData.virtualUnderlyingBalance);
153+
uint128 virtualUnderlyingBalance = POOL.getVirtualUnderlyingBalance(asset());
154+
uint256 underlyingTokenBalanceInShares = convertToShares(virtualUnderlyingBalance);
154155
uint256 cachedUserBalance = balanceOf(owner);
155156
return
156157
underlyingTokenBalanceInShares >= cachedUserBalance

0 commit comments

Comments
 (0)