Skip to content

Commit d6b1d03

Browse files
natspec
1 parent 0637b6f commit d6b1d03

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/EulerSwapFactory.sol

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ contract EulerSwapFactory is IEulerSwapFactory, EVCUtil {
114114
return allPools.length;
115115
}
116116

117+
/// @inheritdoc IEulerSwapFactory
117118
function getEulerAccountState(address eulerAccount) external view returns (address, uint48, uint48) {
118119
return (
119120
eulerAccountState[eulerAccount].pool,
@@ -184,19 +185,36 @@ contract EulerSwapFactory is IEulerSwapFactory, EVCUtil {
184185
}
185186
}
186187

188+
/// @notice Updates an element at a specific index in an array
189+
/// @dev Directly modifies the array element at the given index with a new value
190+
/// @param arr The storage array to update
191+
/// @param index The index of the element to update
192+
/// @param _newValue The new value to set at the specified index
187193
function _updateInArray(address[] storage arr, uint256 index, address _newValue) internal {
188194
arr[index] = _newValue;
189195
}
190196

197+
/// @notice Adds a new element to the end of an array
198+
/// @dev Uses the push operation to append a new value to the array
199+
/// @param arr The storage array to append to
200+
/// @param _newValue The new value to append to the array
191201
function _pushInArray(address[] storage arr, address _newValue) internal {
192202
arr.push(_newValue);
193203
}
194204

205+
/// @notice Removes an element from an array at a specific index
206+
/// @dev Uses the swap-and-pop pattern to remove an element while maintaining array order
207+
/// @param arr The storage array to remove from
208+
/// @param index The index of the element to remove
195209
function _removeFromArray(address[] storage arr, uint256 index) internal {
196210
arr[index] = arr[arr.length - 1];
197211
arr.pop();
198212
}
199213

214+
/// @notice Retrieves the asset addresses for a given pool
215+
/// @dev Calls the pool contract to get its asset0 and asset1 addresses
216+
/// @param pool The address of the pool to query
217+
/// @return The addresses of asset0 and asset1 in the pool
200218
function _getAssets(address pool) internal view returns (address, address) {
201219
return (EulerSwap(pool).asset0(), EulerSwap(pool).asset1());
202220
}

src/interfaces/IEulerSwapFactory.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@ interface IEulerSwapFactory {
2222
external
2323
returns (address);
2424

25+
/// @notice Retrieves the state information for a given Euler account
26+
/// @dev Returns the current pool address, index in allPools array, and index in poolMap array
27+
/// for the specified Euler account
28+
/// @param eulerAccount The address of the Euler account to query
29+
/// @return pool The address of the current pool associated with the Euler account
30+
/// @return allPoolsIndex The index of the pool in the allPools array
31+
/// @return poolMapIndex The index of the pool in the poolMap array for its asset pair
2532
function getEulerAccountState(address eulerAccount) external view returns (address, uint48, uint48);
33+
2634
/// @notice Compute the address of a new EulerSwap pool with the given parameters
2735
/// @dev The pool address is deterministically generated using CREATE2 with a salt derived from
2836
/// the euler account address and provided salt parameter. This allows the pool address to be

0 commit comments

Comments
 (0)