Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions target_chains/sui/contracts/sources/data_source.move
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,12 @@ module pyth::data_source {
public fun emitter_address(data_source: &DataSource): ExternalAddress{
data_source.emitter_address
}

#[test_only]
public fun new_data_source_for_test(emitter_chain: u64, emitter_address: ExternalAddress): DataSource {
DataSource {
emitter_chain,
emitter_address,
}
}
}
11 changes: 11 additions & 0 deletions target_chains/sui/contracts/sources/price_info.move
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,17 @@ module pyth::price_info {
object::delete(id);
}

#[test_only]
public fun new_price_info_object_for_test(
price_info: PriceInfo,
ctx: &mut TxContext
): PriceInfoObject {
PriceInfoObject {
id: object::new(ctx),
price_info
}
}

public fun uid_to_inner(price_info: &PriceInfoObject): ID {
object::uid_to_inner(&price_info.id)
}
Expand Down
25 changes: 25 additions & 0 deletions target_chains/sui/contracts/sources/state.move
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,31 @@ module pyth::state {
sui::dynamic_field::add(&mut self.id, CurrentDigest {}, bytes32::from_bytes(b"new build"));
}

#[test_only]
public fun register_price_info_object_for_test(self: &mut State, price_identifier: PriceIdentifier, id: ID) {
price_info::add(&mut self.id, price_identifier, id);
}

#[test_only]
public fun new_state_for_test(
upgrade_cap: UpgradeCap,
governance_data_source: DataSource,
stale_price_threshold: u64,
base_update_fee: u64,
ctx: &mut TxContext
): State {
State {
id: object::new(ctx),
upgrade_cap,
governance_data_source,
stale_price_threshold,
base_update_fee,
fee_recipient_address: tx_context::sender(ctx),
last_executed_governance_sequence: 0,
consumed_vaas: consumed_vaas::new(ctx),
}
}

////////////////////////////////////////////////////////////////////////////
//
// Deprecated
Expand Down
Loading