Cached Data & Gas Efficiency
Cache System
Total Assets Cache
uint256 public cacheTotalAssets; // Total value of all assets
function _updateTotalAssets() internal {
uint256 assets = IERC20(asset).balanceOf(address(this));
for (uint256 i = 0; i < components.length; i++) {
address component = components[i];
address router = componentAllocations[component].router;
assets += IRouter(router).getComponentAssets(component);
}
cacheTotalAssets = assets;
}Cache Validity
Redemption Tracking
Available Reserve Calculation
Last updated