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
2 changes: 1 addition & 1 deletion apps/price_pusher/config.fuel.testnet.sample.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"endpoint": "https://testnet.fuel.network/v1/graphql",
"pyth-contract-address": "0xe31e04946c67fb41923f93d50ee7fc1c6c99d6e07c02860c6bea5f4a13919277",
"pyth-contract-address": "0x25146735b29d4216639f7f8b1d7b921ff87a1d3051de62d6cceaacabeb33b8e7",
"price-service-endpoint": "https://hermes.pyth.network",
"private-key-file": "./mnemonic",
"price-config-file": "./price-config.stable.sample.yaml"
Expand Down
811 changes: 577 additions & 234 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions target_chains/fuel/contracts/Forc.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[[package]]
name = "core"
source = "path+from-root-4BB20845430AF9CF"
source = "path+from-root-8357A6DDC5F39D14"

[[package]]
name = "pyth-contract"
Expand Down Expand Up @@ -32,7 +32,7 @@ dependencies = ["std"]

[[package]]
name = "std"
source = "git+https://github.com/fuellabs/sway?tag=v0.63.5#31a1d6f98395f571cd3674b492d9bf4773c55f65"
source = "git+https://github.com/fuellabs/sway?tag=v0.65.2#66bb430395daf5b8f7205f7b9d8d008e2e812d54"
dependencies = ["core"]

[[package]]
Expand Down
4 changes: 2 additions & 2 deletions target_chains/fuel/contracts/fuel-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
channel = "latest-aarch64-apple-darwin"

[components]
forc = "0.63.5"
fuel-core = "0.35.0"
forc = "0.65.2"
fuel-core = "0.37.1"
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,6 @@
"name": "FeesCanOnlyBePaidInTheBaseAsset",
"typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d"
},
{
"name": "FuturePriceNotAllowed",
"typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d"
},
{
"name": "GuardianSetNotFound",
"typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d"
Expand Down Expand Up @@ -1535,7 +1531,7 @@
{
"name": "DEPLOYER",
"concreteTypeId": "ab7cd04e05be58e3fc15d424c2c4a57f824a2a2d97d67252440a3925ebdc1335",
"offset": 132984
"offset": 133088
}
]
}
Binary file not shown.
11 changes: 7 additions & 4 deletions target_chains/fuel/contracts/pyth-contract/src/main.sw
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,13 @@ fn ema_price_unsafe(price_feed_id: PriceFeedId) -> Price {
fn price_no_older_than(time_period: u64, price_feed_id: PriceFeedId) -> Price {
let price = price_unsafe(price_feed_id);
let current_time = timestamp();
require(
current_time - price.publish_time <= time_period,
PythError::OutdatedPrice,
);
// Mimicking saturating subtraction to avoid underflow
let time_difference = if current_time > price.publish_time {
current_time - price.publish_time
} else {
0
};
require(time_difference <= time_period, PythError::OutdatedPrice);

price
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,6 @@ impl PriceFeed {
//convert publish_time from UNIX to TAI64
publish_time += TAI64_DIFFERENCE;

require(
publish_time <= timestamp(),
PythError::FuturePriceNotAllowed,
);

PriceFeed::new(
Price::new(ema_confidence, exponent, ema_price, publish_time),
price_feed_id,
Expand Down
1 change: 0 additions & 1 deletion target_chains/fuel/contracts/pyth-interface/src/errors.sw
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ library;

pub enum PythError {
FeesCanOnlyBePaidInTheBaseAsset: (),
FuturePriceNotAllowed: (),
GuardianSetNotFound: (),
IncorrectMessageType: (),
InsufficientFee: (),
Expand Down
4 changes: 2 additions & 2 deletions target_chains/fuel/sdk/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pythnetwork/pyth-fuel-js",
"version": "1.0.6",
"version": "1.0.7",
"description": "Pyth Network Fuel Utils in JS",
"homepage": "https://pyth.network",
"author": {
Expand Down Expand Up @@ -45,6 +45,6 @@
"typescript": "^5.4.5"
},
"dependencies": {
"fuels": "^0.94.5"
"fuels": "^0.96.1"
}
}
6 changes: 1 addition & 5 deletions target_chains/fuel/sdk/js/src/abi/pyth-contract-abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,6 @@
"name": "FeesCanOnlyBePaidInTheBaseAsset",
"typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d"
},
{
"name": "FuturePriceNotAllowed",
"typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d"
},
{
"name": "GuardianSetNotFound",
"typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d"
Expand Down Expand Up @@ -1535,7 +1531,7 @@
{
"name": "DEPLOYER",
"concreteTypeId": "ab7cd04e05be58e3fc15d424c2c4a57f824a2a2d97d67252440a3925ebdc1335",
"offset": 132984
"offset": 133088
}
]
}
6 changes: 5 additions & 1 deletion target_chains/fuel/sdk/js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import PYTH_CONTRACT_ABI from "./abi/pyth-contract-abi.json";

/** Address of the Pyth contract on Fuel Sepolia (testnet). */
export const PYTH_CONTRACT_ADDRESS_SEPOLIA =
"0xe31e04946c67fb41923f93d50ee7fc1c6c99d6e07c02860c6bea5f4a13919277";
"0x25146735b29d4216639f7f8b1d7b921ff87a1d3051de62d6cceaacabeb33b8e7";

/** Address of the Pyth contract on Fuel Mainnet. */
export const PYTH_CONTRACT_ADDRESS_MAINNET =
"0x1c86fdd9e0e7bc0d2ae1bf6817ef4834ffa7247655701ee1b031b52a24c523da";

/** Asset ID of ETH on Fuel. */
export const FUEL_ETH_ASSET_ID =
Expand Down
12 changes: 3 additions & 9 deletions target_chains/fuel/sdk/js/src/types/PythContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* eslint-disable @typescript-eslint/consistent-type-imports */

/*
Fuels version: 0.94.5
Fuels version: 0.96.1
*/

import { Contract, Interface } from "fuels";
Expand Down Expand Up @@ -78,7 +78,6 @@ export enum InitializationErrorOutput {
}
export enum PythErrorInput {
FeesCanOnlyBePaidInTheBaseAsset = "FeesCanOnlyBePaidInTheBaseAsset",
FuturePriceNotAllowed = "FuturePriceNotAllowed",
GuardianSetNotFound = "GuardianSetNotFound",
IncorrectMessageType = "IncorrectMessageType",
InsufficientFee = "InsufficientFee",
Expand Down Expand Up @@ -115,7 +114,6 @@ export enum PythErrorInput {
}
export enum PythErrorOutput {
FeesCanOnlyBePaidInTheBaseAsset = "FeesCanOnlyBePaidInTheBaseAsset",
FuturePriceNotAllowed = "FuturePriceNotAllowed",
GuardianSetNotFound = "GuardianSetNotFound",
IncorrectMessageType = "IncorrectMessageType",
InsufficientFee = "InsufficientFee",
Expand Down Expand Up @@ -673,11 +671,6 @@ const abi = {
typeId:
"2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d",
},
{
name: "FuturePriceNotAllowed",
typeId:
"2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d",
},
{
name: "GuardianSetNotFound",
typeId:
Expand Down Expand Up @@ -2123,7 +2116,7 @@ const abi = {
name: "DEPLOYER",
concreteTypeId:
"ab7cd04e05be58e3fc15d424c2c4a57f824a2a2d97d67252440a3925ebdc1335",
offset: 132984,
offset: 133088,
},
],
};
Expand Down Expand Up @@ -2178,6 +2171,7 @@ const storageSlots: StorageSlot[] = [
value: "0000000000000000000000000000000000000000000000000000000000000000",
},
];

export class PythContractInterface extends Interface {
constructor() {
super(abi);
Expand Down
21 changes: 13 additions & 8 deletions target_chains/fuel/sdk/js/src/types/PythContractFactory.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion target_chains/fuel/sdk/js/src/types/common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* eslint-disable @typescript-eslint/consistent-type-imports */

/*
Fuels version: 0.94.5
Fuels version: 0.96.1
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion target_chains/fuel/sdk/js/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* eslint-disable @typescript-eslint/consistent-type-imports */

/*
Fuels version: 0.94.5
Fuels version: 0.96.1
*/

export { PythContract } from "./PythContract";
Expand Down
Loading