Skip to content

Commit fe8db0c

Browse files
committed
refactor: rename amount to fee in fee withdrawal logic and related events
1 parent 2a45ef9 commit fe8db0c

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

target_chains/ethereum/contracts/contracts/pyth/PythGovernance.sol

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ abstract contract PythGovernance is
3939
address newWormholeAddress
4040
);
4141
event TransactionFeeSet(uint oldFee, uint newFee);
42-
event FeeWithdrawn(address targetAddress, uint amount);
42+
event FeeWithdrawn(address targetAddress, uint fee);
4343

4444
function verifyGovernanceVM(
4545
bytes memory encodedVM
@@ -260,14 +260,12 @@ abstract contract PythGovernance is
260260
}
261261

262262
function withdrawFee(WithdrawFeePayload memory payload) internal {
263-
if (payload.amount > address(this).balance)
263+
if (payload.fee > address(this).balance)
264264
revert PythErrors.InsufficientFee();
265265

266-
(bool success, ) = payload.targetAddress.call{value: payload.amount}(
267-
""
268-
);
266+
(bool success, ) = payload.targetAddress.call{value: payload.fee}("");
269267
require(success, "Failed to withdraw fees");
270268

271-
emit FeeWithdrawn(payload.targetAddress, payload.amount);
269+
emit FeeWithdrawn(payload.targetAddress, payload.fee);
272270
}
273271
}

target_chains/ethereum/contracts/contracts/pyth/PythGovernanceInstructions.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ contract PythGovernanceInstructions {
8585

8686
struct WithdrawFeePayload {
8787
address targetAddress;
88-
// Amount in wei, matching the native uint256 type used for address.balance in EVM
89-
uint256 amount;
88+
// Fee in wei, matching the native uint256 type used for address.balance in EVM
89+
uint256 fee;
9090
}
9191

9292
/// @dev Parse a GovernanceInstruction
@@ -266,7 +266,7 @@ contract PythGovernanceInstructions {
266266
uint64 expo = encodedPayload.toUint64(index);
267267
index += 8;
268268

269-
wf.amount = uint256(val) * uint256(10) ** uint256(expo);
269+
wf.fee = uint256(val) * uint256(10) ** uint256(expo);
270270

271271
if (encodedPayload.length != index)
272272
revert PythErrors.InvalidGovernanceMessage();

target_chains/ethereum/contracts/forge-test/PythGovernance.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,5 +705,5 @@ contract PythGovernanceTest is
705705
address newWormholeAddress
706706
);
707707
event TransactionFeeSet(uint oldFee, uint newFee);
708-
event FeeWithdrawn(address recipient, uint256 amount);
708+
event FeeWithdrawn(address recipient, uint256 fee);
709709
}

0 commit comments

Comments
 (0)