Description:
Decentralized Finance (DeFi) protocol contract providing Factory functionality.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
interface IEulerSwapFactory {
/// @notice Returns all deployed pools
/// @dev Returns the complete array of all pool addresses
/// @return An array containing all pool addresses
function pools() external view returns (address[] memory);
}
interface IEulerSwap {
/// @dev Immutable pool parameters. Passed to the instance via proxy trailing data.
struct Params {
// Entities
address vault0;
address vault1;
address eulerAccount;
// Curve
uint112 equilibriumReserve0;
uint112 equilibriumReserve1;
uint256 priceX;
uint256 priceY;
uint256 concentrationX;
uint256 concentrationY;
// Fees
uint256 fee;
uint256 protocolFee;
address protocolFeeRecipient;
}
/// @notice Retrieves the pool's immutable parameters.
function getParams() external view returns (Params memory);
/// @notice Retrieves the underlying assets supported by this pool.
function getAssets() external view returns (address asset0, address asset1);
}
contract QueryEuler {
address public immutable EULER_SWAP_FACTORY;
constructor(address _eulerSwapFactory) {
EULER_SWAP_FACTORY = _eulerSwapFactory;
}
function queryPoolAssets(uint256 startIndex, uint256 length) public view returns (uint256 poolLength, bytes memory data) {
address[] memory pools = IEulerSwapFactory(EULER_SWAP_FACTORY).pools();
poolLength = pools.length;
require(startIndex < poolLength, "startIndex out of bounds");
uint256 endIndex = startIndex + length;
for (uint256 i = startIndex; i < endIndex && i < poolLength; i++) {
address pool = pools[i];
IEulerSwap.Params memory params = IEulerSwap(pool).getParams();
(address asset0, address asset1) = IEulerSwap(pool).getAssets();
data = bytes.concat(data, abi.encodePacked(pool, params.vault0, params.vault1, asset0, asset1));
}
}
}
Submitted on: 2025-09-18 13:40:07
Comments
Log in to comment.
No comments yet.