Skip to content

Commit

Permalink
lint examples
Browse files Browse the repository at this point in the history
  • Loading branch information
augustbleeds committed Dec 30, 2024
1 parent dfc1e6b commit 5a893f2
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use sncast_std::{
declare, deploy, DeclareResult, DeployResult, get_nonce, DisplayContractAddress,
DisplayClassHash
DisplayClassHash,
};

use starknet::{ContractAddress, ClassHash};

fn declare_and_deploy(
contract_name: ByteArray, constructor_calldata: Array<felt252>
contract_name: ByteArray, constructor_calldata: Array<felt252>,
) -> DeployResult {
let mut class_hash: ClassHash =
0x6d1dd0e5fa4e0284dcf341997f1d781bc2fb7d76ada684da7a2a33c38031df5
Expand All @@ -31,7 +31,7 @@ fn declare_and_deploy(
Option::Some(salt),
true,
Option::None,
Option::Some(nonce)
Option::Some(nonce),
);
if deploy_result.is_err() {
println!("{:?}", deploy_result.unwrap_err());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn main() {
// Queries the aggregator for the latest round data
let mut read_ocr_address_data = read_ocr_address.unwrap().data.span();
let aggregator_address = Serde::<
starknet::ContractAddress
starknet::ContractAddress,
>::deserialize(ref read_ocr_address_data)
.unwrap();
let latest_round = call(aggregator_address, selector!("latest_round_data"), array![]);
Expand All @@ -41,7 +41,7 @@ fn main() {
selector!("set_answer"),
array![round.answer.into()],
Option::None,
Option::Some(get_nonce('pending'))
Option::Some(get_nonce('pending')),
);
if result.is_err() {
println!("{:?}", result.unwrap_err());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use sncast_std::{
declare, deploy, DeclareResult, DeployResult, get_nonce, DisplayContractAddress,
DisplayClassHash
DisplayClassHash,
};

use starknet::{ContractAddress, ClassHash};

fn declare_and_deploy(
contract_name: ByteArray, constructor_calldata: Array<felt252>
contract_name: ByteArray, constructor_calldata: Array<felt252>,
) -> DeployResult {
let mut class_hash: ClassHash =
0x728d8a221e2204c88df0642b7c6dcee60f7c3d3b3d5c190cac1ceba5baf15e8
Expand All @@ -31,7 +31,7 @@ fn declare_and_deploy(
Option::Some(salt),
true,
Option::None,
Option::Some(nonce)
Option::Some(nonce),
);
if deploy_result.is_err() {
println!("{:?}", deploy_result.unwrap_err());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn main() {
selector!("set_latest_round_data"),
array![answer, block_num, observation_timestamp, transmission_timestamp],
Option::None,
Option::Some(get_nonce('pending'))
Option::Some(get_nonce('pending')),
);

if result.is_err() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ mod AggregatorPriceConsumer {
fn constructor(
ref self: ContractState,
uptime_feed_address: ContractAddress,
aggregator_address: ContractAddress
aggregator_address: ContractAddress,
) {
assert(!uptime_feed_address.is_zero(), 'uptime feed is 0');
assert(!aggregator_address.is_zero(), 'aggregator is 0');
Expand Down Expand Up @@ -61,7 +61,7 @@ mod AggregatorPriceConsumer {
_ => {
assert(!report_stale, 'L2 seq down & report stale');
assert(false, 'L2 seq down & report ok');
}
},
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn test_set_and_read_latest_round() {
// Deploys the mock aggregator
let mock_aggregator_address = deploy_mock_aggregator(16);
let mock_aggregator_dispatcher = IMockAggregatorDispatcher {
contract_address: mock_aggregator_address
contract_address: mock_aggregator_address,
};
let aggregator_dispatcher = IAggregatorDispatcher { contract_address: mock_aggregator_address };

Expand Down Expand Up @@ -82,7 +82,7 @@ fn test_set_and_read_answer() {
// Deploys the mock aggregator
let mock_aggregator_address = deploy_mock_aggregator(16);
let mock_aggregator_dispatcher = IMockAggregatorDispatcher {
contract_address: mock_aggregator_address
contract_address: mock_aggregator_address,
};

// Deploys the consumer
Expand All @@ -91,7 +91,7 @@ fn test_set_and_read_answer() {

// Let's make sure the AggregatorConsumer was initialized correctly
assert(
consumer_dispatcher.read_ocr_address() == mock_aggregator_address, 'Invalid OCR address'
consumer_dispatcher.read_ocr_address() == mock_aggregator_address, 'Invalid OCR address',
);
assert(consumer_dispatcher.read_answer() == 0, 'Invalid initial answer');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use starknet::ContractAddress;

use snforge_std::{
declare, ContractClassTrait, start_cheat_caller_address_global,
stop_cheat_caller_address_global, DeclareResultTrait
stop_cheat_caller_address_global, DeclareResultTrait,
};

fn deploy_mock_aggregator(decimals: u8) -> ContractAddress {
Expand All @@ -41,7 +41,7 @@ fn deploy_uptime_feed(initial_status: u128, owner_address: ContractAddress) -> C
}

fn deploy_price_consumer(
uptime_feed_address: ContractAddress, aggregator_address: ContractAddress
uptime_feed_address: ContractAddress, aggregator_address: ContractAddress,
) -> ContractAddress {
let mut calldata = ArrayTrait::new();
calldata.append(uptime_feed_address.into());
Expand All @@ -65,7 +65,7 @@ fn test_get_latest_price() {
let mock_aggregator_address = deploy_mock_aggregator(decimals);
let uptime_feed_address = deploy_uptime_feed(init_status, owner);
let price_consumer_address = deploy_price_consumer(
uptime_feed_address, mock_aggregator_address
uptime_feed_address, mock_aggregator_address,
);

// Adds the price consumer contract to the sequencer uptime feed access control list
Expand All @@ -84,7 +84,7 @@ fn test_get_latest_price() {
start_cheat_caller_address_global(price_consumer_address);
// start_prank(CheatTarget::All, price_consumer_address);
let latest_price = IAggregatorPriceConsumerDispatcher {
contract_address: price_consumer_address
contract_address: price_consumer_address,
}
.get_latest_price();
assert(latest_price == init_status, 'latest price is incorrect');
Expand All @@ -101,7 +101,7 @@ fn test_get_latest_price() {
// This should now return the updated answer
start_cheat_caller_address_global(price_consumer_address);
let updated_latest_price = IAggregatorPriceConsumerDispatcher {
contract_address: price_consumer_address
contract_address: price_consumer_address,
}
.get_latest_price();
assert(updated_latest_price == answer, 'updated price is incorrect');
Expand Down

0 comments on commit 5a893f2

Please sign in to comment.