@@ -95,13 +95,12 @@ Pyth also provides a javascript SDK to construct transaction blocks that update
95
95
96
96
The code snippet below provides a general template for what your contract code should look like:
97
97
98
- ` ` ` rust {20 } copy
98
+ ` ` ` rust {18 } copy
99
99
module pyth_example::main {
100
100
use sui::clock::Clock;
101
101
use pyth::price_info;
102
102
use pyth::price_identifier;
103
103
use pyth::price;
104
- use pyth::state::{State as PythState};
105
104
use pyth::pyth;
106
105
use pyth::price_info::PriceInfoObject;
107
106
@@ -110,12 +109,11 @@ module pyth_example::main {
110
109
public fun use_pyth_price(
111
110
// Other arguments
112
111
clock: & Clock,
113
- pyth_state: & PythState,
114
112
price_info_object: & PriceInfoObject,
115
113
){
116
114
let max_age = 60;
117
115
// Make sure the price is not older than max_age seconds
118
- let price_struct = pyth::get_price(pyth_state, price_info_object, clock);
116
+ let price_struct = pyth::get_price_no_older_than( price_info_object,clock, max_age );
119
117
120
118
// Check the price feed ID
121
119
let price_info = price_info::get_price_info_from_price_info_object(price_info_object);
@@ -168,7 +166,6 @@ tx.moveCall({
168
166
target: ` pyth_example::main::use_pyth_price ` ,
169
167
arguments: [
170
168
... , // other arguments needed for your contract
171
- tx .object (pythStateId ),
172
169
tx .object (priceInfoObjectIds [0 ]),
173
170
],
174
171
});
0 commit comments