Skip to content

Commit 7f64863

Browse files
committed
style: enhance comment formatting and organization in AnypayLifiModifierWrapper contract for improved readability
1 parent 9070e9c commit 7f64863

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

src/AnypayLifiModifierWrapper.sol

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ pragma solidity ^0.8.17;
1414
* Success of internal calls is NOT a guarantee that the correct offset was used or modification occurred.
1515
*/
1616
contract AnypayLifiModifierWrapper {
17-
// --- Immutables ---
17+
// -------------------------------------------------------------------------
18+
// Immutables
19+
// -------------------------------------------------------------------------
1820

1921
/// @notice The target LiFi Diamond contract address.
2022
address public immutable TARGET_LIFI_DIAMOND;
2123

22-
// --- Constants ---
24+
// -------------------------------------------------------------------------
25+
// Constants
26+
// -------------------------------------------------------------------------
2327

2428
/// @notice Assumed offset for func(BridgeData memory, Param2 calldata)
2529
uint256 internal constant RECEIVER_OFFSET_ASSUMED_2_ARGS = 228;
@@ -29,10 +33,17 @@ contract AnypayLifiModifierWrapper {
2933
/// @notice Hardcoded receiver
3034
address internal constant SENTINEL_RECEIVER = 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF;
3135

32-
// --- Events ---
36+
// -------------------------------------------------------------------------
37+
// Events
38+
// -------------------------------------------------------------------------
39+
3340
event ForwardAttempt(uint256 indexed offset, bytes4 selector, address sender, bool modificationMade);
3441
event ForwardResult(bool success, uint256 indexed usedOffset);
3542

43+
// -------------------------------------------------------------------------
44+
// Constructor + functions
45+
// -------------------------------------------------------------------------
46+
3647
constructor(address _lifiDiamondAddress) {
3748
require(_lifiDiamondAddress != address(0), "Wrapper: Zero address");
3849
TARGET_LIFI_DIAMOND = _lifiDiamondAddress;
@@ -57,7 +68,7 @@ contract AnypayLifiModifierWrapper {
5768
calldatacopy(add(originalDataCopy, 0x20), 0, dataSize)
5869
}
5970

60-
// --- Attempt 1: Offset 228 (Assumed 2 Args w/ 1st as ILiFi.BridgeData) ---
71+
// Attempt 1: Offset 228 (Assumed 2 Args w/ 1st as ILiFi.BridgeData)
6172
bool attempt1Possible = dataSize >= RECEIVER_OFFSET_ASSUMED_2_ARGS + 32;
6273
if (attempt1Possible) {
6374
bytes memory attempt1Data = _cloneBytes(originalDataCopy);
@@ -75,7 +86,7 @@ contract AnypayLifiModifierWrapper {
7586
}
7687
}
7788

78-
// --- Attempt 2: Offset 260 (Assumed 3 Args w/ 1st as ILiFi.BridgeData) ---
89+
// Attempt 2: Offset 260 (Assumed 3 Args w/ 1st as ILiFi.BridgeData)
7990
bool attempt2Possible = dataSize >= RECEIVER_OFFSET_ASSUMED_3_ARGS + 32;
8091
if (attempt2Possible) {
8192
bytes memory attempt2Data = _cloneBytes(originalDataCopy);
@@ -96,7 +107,7 @@ contract AnypayLifiModifierWrapper {
96107
}
97108
}
98109

99-
// --- Final Attempt: Unmodified ---
110+
// Final Attempt: Unmodified
100111
string memory reason;
101112
if (!attempt1Possible && !attempt2Possible) {
102113
reason = "Calldata too short for modification attempts";
@@ -161,6 +172,10 @@ contract AnypayLifiModifierWrapper {
161172
}
162173
}
163174

175+
// -------------------------------------------------------------------------
176+
// Receive
177+
// -------------------------------------------------------------------------
178+
164179
/**
165180
* @dev Needed to receive plain Ether transfers.
166181
*/

0 commit comments

Comments
 (0)