Skip to content

Commit 421b780

Browse files
committed
formatted
1 parent c783efa commit 421b780

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

target_chains/stylus/contracts/pyth-receiver/src/governance_structs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ pub fn parse_instruction(payload: Vec<u8>) -> Result<GovernanceInstruction, Pyth
349349
if payload.len() < cursor + 28 {
350350
return Err(PythReceiverError::InvalidGovernanceMessage);
351351
}
352-
352+
353353
let mut target_address_bytes = [0u8; 20];
354354
target_address_bytes.copy_from_slice(&payload[cursor..cursor + 20]);
355355
cursor += 20;

target_chains/stylus/contracts/pyth-receiver/src/lib.rs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -572,10 +572,10 @@ impl PythReceiver {
572572
}
573573
GovernancePayload::SetTransactionFee(payload) => {
574574
self.set_transaction_fee(payload.value, payload.expo);
575-
},
575+
}
576576
GovernancePayload::WithdrawFee(payload) => {
577577
self.withdraw_fee(payload.value, payload.expo, payload.target_address)?;
578-
},
578+
}
579579
}
580580

581581
Ok(())
@@ -610,17 +610,14 @@ impl PythReceiver {
610610

611611
self.single_update_fee_in_wei.set(new_fee);
612612

613-
evm::log(FeeSet {
614-
old_fee,
615-
new_fee,
616-
});
613+
evm::log(FeeSet { old_fee, new_fee });
617614
}
618615

619616
fn set_valid_period(&mut self, valid_time_period_seconds: u64) {
620617
let old_valid_period = self.valid_time_period_seconds.get();
621618
let new_valid_period = U256::from(valid_time_period_seconds);
622619
self.valid_time_period_seconds.set(new_valid_period);
623-
620+
624621
evm::log(ValidPeriodSet {
625622
old_valid_period,
626623
new_valid_period,
@@ -744,22 +741,24 @@ impl PythReceiver {
744741

745742
self.transaction_fee_in_wei.set(new_fee);
746743

747-
evm::log(TransactionFeeSet {
748-
old_fee,
749-
new_fee,
750-
});
744+
evm::log(TransactionFeeSet { old_fee, new_fee });
751745
}
752746

753-
fn withdraw_fee(&mut self, value: u64, expo: u64, target_address: Address) -> Result<(), PythReceiverError> {
747+
fn withdraw_fee(
748+
&mut self,
749+
value: u64,
750+
expo: u64,
751+
target_address: Address,
752+
) -> Result<(), PythReceiverError> {
754753
let fee_to_withdraw = U256::from(value) * U256::from(10).pow(U256::from(expo));
755754
let current_balance = self.vm().balance(self.vm().contract_address());
756-
757755

758756
if current_balance < fee_to_withdraw {
759757
return Err(PythReceiverError::InsufficientFee);
760758
}
761759

762-
self.vm().transfer_eth(target_address, fee_to_withdraw)
760+
self.vm()
761+
.transfer_eth(target_address, fee_to_withdraw)
763762
.map_err(|_| PythReceiverError::InsufficientFee)?;
764763

765764
evm::log(FeeWithdrawn {
@@ -820,9 +819,9 @@ fn set_data_sources(receiver: &mut PythReceiver, data_sources: Vec<DataSource>)
820819
receiver.is_valid_data_source.setter(data_source).set(false);
821820
}
822821
}
823-
822+
824823
receiver.valid_data_sources.erase();
825-
824+
826825
let mut new_data_sources = Vec::new();
827826
for data_source in data_sources {
828827
let mut storage_data_source = receiver.valid_data_sources.grow();

0 commit comments

Comments
 (0)