|
@@ -34,7 +34,8 @@ contract PythGovernanceInstructions {
|
|
|
SetFee, // 3
|
|
SetFee, // 3
|
|
|
SetValidPeriod, // 4
|
|
SetValidPeriod, // 4
|
|
|
RequestGovernanceDataSourceTransfer, // 5
|
|
RequestGovernanceDataSourceTransfer, // 5
|
|
|
- SetWormholeAddress // 6
|
|
|
|
|
|
|
+ SetWormholeAddress, // 6
|
|
|
|
|
+ SetTransactionFee // 7
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
struct GovernanceInstruction {
|
|
struct GovernanceInstruction {
|
|
@@ -77,6 +78,10 @@ contract PythGovernanceInstructions {
|
|
|
address newWormholeAddress;
|
|
address newWormholeAddress;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ struct SetTransactionFeePayload {
|
|
|
|
|
+ uint newFee;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// @dev Parse a GovernanceInstruction
|
|
/// @dev Parse a GovernanceInstruction
|
|
|
function parseGovernanceInstruction(
|
|
function parseGovernanceInstruction(
|
|
|
bytes memory encodedInstruction
|
|
bytes memory encodedInstruction
|
|
@@ -220,4 +225,22 @@ contract PythGovernanceInstructions {
|
|
|
if (encodedPayload.length != index)
|
|
if (encodedPayload.length != index)
|
|
|
revert PythErrors.InvalidGovernanceMessage();
|
|
revert PythErrors.InvalidGovernanceMessage();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /// @dev Parse a SetTransactionFeePayload (action 7) with minimal validation
|
|
|
|
|
+ function parseSetTransactionFeePayload(
|
|
|
|
|
+ bytes memory encodedPayload
|
|
|
|
|
+ ) public pure returns (SetTransactionFeePayload memory stf) {
|
|
|
|
|
+ uint index = 0;
|
|
|
|
|
+
|
|
|
|
|
+ uint64 val = encodedPayload.toUint64(index);
|
|
|
|
|
+ index += 8;
|
|
|
|
|
+
|
|
|
|
|
+ uint64 expo = encodedPayload.toUint64(index);
|
|
|
|
|
+ index += 8;
|
|
|
|
|
+
|
|
|
|
|
+ stf.newFee = uint256(val) * uint256(10) ** uint256(expo);
|
|
|
|
|
+
|
|
|
|
|
+ if (encodedPayload.length != index)
|
|
|
|
|
+ revert PythErrors.InvalidGovernanceMessage();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|