Skip to content

Commit 35886d8

Browse files
chore: format
1 parent 187ada8 commit 35886d8

File tree

6 files changed

+30
-23
lines changed

6 files changed

+30
-23
lines changed

target_chains/ethereum/sdk/stylus/benches/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async fn deploy(
4747
let sol_path = args.as_ref().map(|_| {
4848
manifest_dir
4949
.join("examples")
50-
.join( format!("{}-example",contract_name))
50+
.join(format!("{}-example", contract_name))
5151
.join("src")
5252
.join("constructor.sol")
5353
});

target_chains/ethereum/sdk/stylus/contracts/src/pyth/mock.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,23 @@ use crate::{
1111
use alloc::vec::Vec;
1212
use alloy_primitives::{Bytes, B256, U256};
1313
use alloy_sol_types::{sol_data::Uint as SolUInt, SolType, SolValue};
14-
use stylus_sdk::storage::{StorageUint, StorageMap};
15-
use stylus_sdk::{abi::Bytes as AbiBytes, evm, msg, prelude::{storage, public}};
14+
use stylus_sdk::storage::{StorageMap, StorageUint};
15+
use stylus_sdk::{
16+
abi::Bytes as AbiBytes,
17+
evm, msg,
18+
prelude::{public, storage},
19+
};
1620

1721
/// Decode data type PriceFeed and uint64
1822
pub type DecodeDataType = (PriceFeed, SolUInt<64>);
1923

20-
2124
#[storage]
2225
pub struct MockPythContract {
23-
single_update_fee_in_wei : StorageUint<256, 4>,
24-
valid_time_period: StorageUint<256,4>,
25-
price_feeds: StorageMap<B256, StoragePriceFeed> ,
26+
single_update_fee_in_wei: StorageUint<256, 4>,
27+
valid_time_period: StorageUint<256, 4>,
28+
price_feeds: StorageMap<B256, StoragePriceFeed>,
2629
}
2730

28-
2931
#[public]
3032
impl MockPythContract {
3133
fn initialize(

target_chains/ethereum/sdk/stylus/contracts/src/pyth/pyth_contract.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ pub use crate::pyth::functions::{
66
use alloc::vec::Vec;
77
use alloy_primitives::{Bytes, B256, U256};
88
use alloy_sol_types::SolValue;
9-
use stylus_sdk::{abi::Bytes as AbiBytes, prelude::*, storage::{StorageAddress, TopLevelStorage}};
9+
use stylus_sdk::{
10+
abi::Bytes as AbiBytes,
11+
prelude::*,
12+
storage::{StorageAddress, TopLevelStorage},
13+
};
1014
/// `IPyth` is a trait that defines methods for interacting with the Pyth contract.
1115
pub trait IPyth {
1216
/// The Error Type for the Pyth Contract.
@@ -131,10 +135,9 @@ pub trait IPyth {
131135
) -> Result<Vec<u8>, Self::Error>;
132136
}
133137

134-
135138
#[storage]
136139
pub struct PythContract {
137-
pub _ipyth : StorageAddress,
140+
pub _ipyth: StorageAddress,
138141
}
139142

140143
unsafe impl TopLevelStorage for PythContract {}
@@ -162,7 +165,7 @@ impl IPyth for PythContract {
162165
}
163166

164167
fn get_ema_price_no_older_than(&mut self, id: B256, age: U256) -> Result<Vec<u8>, Self::Error> {
165-
let price = get_ema_price_no_older_than(self,self._ipyth.get(), id, age)?;
168+
let price = get_ema_price_no_older_than(self, self._ipyth.get(), id, age)?;
166169
let data = price.abi_encode();
167170
Ok(data)
168171
}

target_chains/ethereum/sdk/stylus/examples/extend-pyth-example/tests/extend-pyth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ use std::assert_eq;
44

55
use abi::ExtendPyth;
66
use alloy::{primitives::U256, sol};
7-
use stylus_sdk::alloy_primitives::{Address, FixedBytes};
87
use alloy_sol_types::SolValue;
98
use e2e::{env, Account, ReceiptExt};
9+
use stylus_sdk::alloy_primitives::{Address, FixedBytes};
1010

1111
use crate::ExtendPythExample::constructorCall;
1212
use eyre::Result;

target_chains/ethereum/sdk/stylus/examples/function-example/src/lib.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,20 @@ use pyth_stylus::pyth::{
1212
get_price_unsafe, get_update_fee, get_valid_time_period, update_price_feeds,
1313
},
1414
mock::create_price_feed_update_data_list,
15-
types::StoragePrice
15+
types::StoragePrice,
1616
};
1717
use stylus_sdk::{
18-
prelude::{entrypoint, public, storage},
19-
storage::{StorageAddress, StorageB256},
20-
stylus_proc::SolidityError
18+
prelude::{entrypoint, public, storage},
19+
storage::{StorageAddress, StorageB256},
20+
stylus_proc::SolidityError,
2121
};
2222

23-
2423
#[entrypoint]
2524
#[storage]
2625
struct FunctionCallsExample {
2726
pyth_address: StorageAddress,
2827
price_id: StorageB256,
29-
price: StoragePrice
28+
price: StoragePrice,
3029
}
3130

3231
sol! {

target_chains/ethereum/sdk/stylus/examples/pyth-example/src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ use pyth_stylus::pyth::{
88
types::Price,
99
};
1010
use stylus_sdk::{
11-
abi::Bytes, alloy_primitives::U256, msg,
12-
storage::StorageB256, stylus_proc::SolidityError,
11+
abi::Bytes,
12+
alloy_primitives::U256,
13+
msg,
1314
prelude::{entrypoint, public, storage},
15+
storage::StorageB256,
16+
stylus_proc::SolidityError,
1417
};
1518

1619
pub use sol::*;
@@ -35,8 +38,8 @@ pub enum Error {
3538
#[storage]
3639
struct PythExample {
3740
#[borrow]
38-
pyth:PythContract,
39-
eth_usd_price_id : StorageB256,
41+
pyth: PythContract,
42+
eth_usd_price_id: StorageB256,
4043
}
4144

4245
#[public]

0 commit comments

Comments
 (0)