@@ -45,33 +45,33 @@ abi UpdatePrice {
45
45
}
46
46
47
47
const PYTH_MAINNET_CONTRACT_ID = 0x1c86fdd9e0e7bc0d2ae1bf6817ef4834ffa7247655701ee1b031b52a24c523da; // Mainnet Contract
48
- const PYTH_CONTRACT_ID = 0x25146735b29d4216639f7f8b1d7b921ff87a1d3051de62d6cceaacabeb33b8e7; // Testnet Contract
48
+ const PYTH_TESTNET_CONTRACT_ID = 0x25146735b29d4216639f7f8b1d7b921ff87a1d3051de62d6cceaacabeb33b8e7; // Testnet Contract
49
49
const FUEL_ETH_BASE_ASSET_ID = 0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07;
50
50
51
51
impl UpdatePrice for Contract {
52
52
fn valid_time_period() -> u64 {
53
- let pyth_contract = abi(PythCore, PYTH_CONTRACT_ID );
53
+ let pyth_contract = abi(PythCore, PYTH_MAINNET_CONTRACT_ID );
54
54
let period = pyth_contract.valid_time_period();
55
55
period
56
56
}
57
57
fn get_price(price_feed_id: PriceFeedId) -> Price {
58
- let pyth_contract = abi(PythCore, PYTH_CONTRACT_ID );
58
+ let pyth_contract = abi(PythCore, PYTH_MAINNET_CONTRACT_ID );
59
59
let price = pyth_contract.price(price_feed_id);
60
60
price
61
61
}
62
62
fn get_price_unsafe(price_feed_id: PriceFeedId) -> Price {
63
- let pyth_contract = abi(PythCore, PYTH_CONTRACT_ID );
63
+ let pyth_contract = abi(PythCore, PYTH_MAINNET_CONTRACT_ID );
64
64
let price = pyth_contract.price_unsafe(price_feed_id);
65
65
price
66
66
}
67
67
fn update_fee(update_data: Vec<Bytes>) -> u64 {
68
- let pyth_contract = abi(PythCore, PYTH_CONTRACT_ID );
68
+ let pyth_contract = abi(PythCore, PYTH_MAINNET_CONTRACT_ID );
69
69
let fee = pyth_contract.update_fee(update_data);
70
70
fee
71
71
}
72
72
#[payable]
73
73
fn update_price_feeds(update_fee: u64, update_data: Vec<Bytes>) {
74
- let pyth_contract = abi(PythCore, PYTH_CONTRACT_ID );
74
+ let pyth_contract = abi(PythCore, PYTH_MAINNET_CONTRACT_ID );
75
75
pyth_contract
76
76
.update_price_feeds {
77
77
asset_id: FUEL_ETH_BASE_ASSET_ID,
@@ -102,7 +102,7 @@ The code snippet above does the following things:
102
102
- ` update_fee(update_data) ` : Calculates the fee required to update the price feeds.
103
103
- ` update_price_feeds(update_fee, update_data) ` : Updates the price feeds with the provided data and fee.
104
104
105
- 3 . Uses the ` PYTH_CONTRACT_ID ` constant to interact with the Pyth contract on testnet.
105
+ 3 . Uses the ` PYTH_MAINNET_CONTRACT_ID ` constant to interact with the Pyth contract on testnet.
106
106
4 . Uses the ` FUEL_ETH_BASE_ASSET_ID ` constant as the asset ID for paying update fees.
107
107
108
108
To use this contract, you would typically:
0 commit comments