@@ -44,38 +44,35 @@ abstract contract PythGovernance is PythGetters, PythSetters, PythGovernanceInst
4444
4545 if (gi.action == GovernanceAction.UpgradeContract) {
4646 require (gi.targetChainId != 0 , "upgrade with chain id 0 is not possible " );
47- upgradeContract (gi.payload);
47+ upgradeContract (parseUpgradeContractPayload ( gi.payload) );
4848 } else if (gi.action == GovernanceAction.AuthorizeGovernanceDataSourceTransfer) {
49- AuthorizeGovernanceDataSourceTransfer (gi.payload);
49+ AuthorizeGovernanceDataSourceTransfer (parseAuthorizeGovernanceDataSourceTransferPayload ( gi.payload) );
5050 } else if (gi.action == GovernanceAction.SetDataSources) {
51- setDataSources (gi.payload);
51+ setDataSources (parseSetDataSourcesPayload ( gi.payload) );
5252 } else if (gi.action == GovernanceAction.SetFee) {
53- setFee (gi.payload);
53+ setFee (parseSetFeePayload ( gi.payload) );
5454 } else if (gi.action == GovernanceAction.SetValidPeriod) {
55- setValidPeriod (gi.payload);
55+ setValidPeriod (parseSetValidPeriodPayload ( gi.payload) );
5656 } else if (gi.action == GovernanceAction.RequestGovernanceDataSourceTransfer) {
5757 revert ("RequestGovernanceDataSourceTransfer can be only part of AuthorizeGovernanceDataSourceTransfer message " );
5858 } else {
5959 revert ("invalid governance action " );
6060 }
6161 }
6262
63- function upgradeContract (bytes memory encodedPayload ) internal {
64- UpgradeContractPayload memory payload = parseUpgradeContractPayload (encodedPayload);
65- // This contract does not have enough access to execute this, it should be executed on the
66- // upgradable
63+ function upgradeContract (UpgradeContractPayload memory payload ) internal {
64+ // This method on this contract does not have enough access to execute this, it should be executed on the
65+ // upgradable contract.
6766 upgradeUpgradableContract (payload);
6867 }
6968
7069 function upgradeUpgradableContract (UpgradeContractPayload memory payload ) virtual internal ;
7170
7271 // Transfer the governance data source to a new value with sanity checks
7372 // to ensure the new governance data source can manage the contract.
74- function AuthorizeGovernanceDataSourceTransfer (bytes memory encodedPayload ) internal {
73+ function AuthorizeGovernanceDataSourceTransfer (AuthorizeGovernanceDataSourceTransferPayload memory payload ) internal {
7574 PythInternalStructs.DataSource memory oldGovernanceDatSource = governanceDataSource ();
7675
77- AuthorizeGovernanceDataSourceTransferPayload memory payload = parseAuthorizeGovernanceDataSourceTransferPayload (encodedPayload);
78-
7976 // Make sure the claimVaa is a valid VAA with RequestGovernanceDataSourceTransfer governance message
8077 // If it's valid then its emitter can take over the governance from the current emitter.
8178 // The VAA is checked here to ensure that the new governance data source is valid and can send message
@@ -106,9 +103,7 @@ abstract contract PythGovernance is PythGetters, PythSetters, PythGovernanceInst
106103 emit GovernanceDataSourceSet (oldGovernanceDatSource, governanceDataSource (), lastExecutedGovernanceSequence ());
107104 }
108105
109- function setDataSources (bytes memory encodedPayload ) internal {
110- SetDataSourcesPayload memory payload = parseSetDataSourcesPayload (encodedPayload);
111-
106+ function setDataSources (SetDataSourcesPayload memory payload ) internal {
112107 PythInternalStructs.DataSource[] memory oldDataSources = validDataSources ();
113108
114109 for (uint i = 0 ; i < oldDataSources.length ; i += 1 ) {
@@ -124,18 +119,14 @@ abstract contract PythGovernance is PythGetters, PythSetters, PythGovernanceInst
124119 emit DataSourcesSet (oldDataSources, validDataSources ());
125120 }
126121
127- function setFee (bytes memory encodedPayload ) internal {
128- SetFeePayload memory payload = parseSetFeePayload (encodedPayload);
129-
122+ function setFee (SetFeePayload memory payload ) internal {
130123 uint oldFee = singleUpdateFeeInWei ();
131124 setSingleUpdateFeeInWei (payload.newFee);
132125
133126 emit FeeSet (oldFee, singleUpdateFeeInWei ());
134127 }
135128
136- function setValidPeriod (bytes memory encodedPayload ) internal {
137- SetValidPeriodPayload memory payload = parseSetValidPeriodPayload (encodedPayload);
138-
129+ function setValidPeriod (SetValidPeriodPayload memory payload ) internal {
139130 uint oldValidPeriod = validTimePeriodSeconds ();
140131 setValidTimePeriodSeconds (payload.newValidPeriod);
141132
0 commit comments