File tree Expand file tree Collapse file tree 3 files changed +44
-0
lines changed
target_chains/sui/contracts/sources Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -74,4 +74,12 @@ module pyth::data_source {
74
74
public fun emitter_address (data_source: &DataSource ): ExternalAddress {
75
75
data_source.emitter_address
76
76
}
77
+
78
+ #[test_only]
79
+ public fun new_data_source_for_test (emitter_chain: u64 , emitter_address: ExternalAddress ): DataSource {
80
+ DataSource {
81
+ emitter_chain,
82
+ emitter_address,
83
+ }
84
+ }
77
85
}
Original file line number Diff line number Diff line change @@ -175,6 +175,17 @@ module pyth::price_info {
175
175
object::delete (id);
176
176
}
177
177
178
+ #[test_only]
179
+ public fun new_price_info_object_for_test (
180
+ price_info: PriceInfo ,
181
+ ctx: &mut TxContext
182
+ ): PriceInfoObject {
183
+ PriceInfoObject {
184
+ id: object::new (ctx),
185
+ price_info
186
+ }
187
+ }
188
+
178
189
public fun uid_to_inner (price_info: &PriceInfoObject ): ID {
179
190
object::uid_to_inner (&price_info.id)
180
191
}
Original file line number Diff line number Diff line change @@ -365,6 +365,31 @@ module pyth::state {
365
365
sui::dynamic_field ::add (&mut self.id, CurrentDigest {}, bytes32::from_bytes (b"new build "));
366
366
}
367
367
368
+ #[test_only]
369
+ public fun register_price_info_object_for_test (self: &mut State , price_identifier: PriceIdentifier , id: ID ) {
370
+ price_info::add (&mut self.id, price_identifier, id);
371
+ }
372
+
373
+ #[test_only]
374
+ public fun new_state_for_test (
375
+ upgrade_cap: UpgradeCap ,
376
+ governance_data_source: DataSource ,
377
+ stale_price_threshold: u64 ,
378
+ base_update_fee: u64 ,
379
+ ctx: &mut TxContext
380
+ ): State {
381
+ State {
382
+ id: object::new (ctx),
383
+ upgrade_cap,
384
+ governance_data_source,
385
+ stale_price_threshold,
386
+ base_update_fee,
387
+ fee_recipient_address: tx_context::sender (ctx),
388
+ last_executed_governance_sequence: 0 ,
389
+ consumed_vaas: consumed_vaas::new (ctx),
390
+ }
391
+ }
392
+
368
393
////////////////////////////////////////////////////////////////////////////
369
394
//
370
395
// Deprecated
You can’t perform that action at this time.
0 commit comments