From 5a893f23fa8f507541cf8ba12b732800298c8d29 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Mon, 30 Dec 2024 16:31:24 -0500 Subject: [PATCH] lint examples --- .../src/consumer/deploy_aggregator_consumer.cairo | 6 +++--- .../scripts/src/consumer/set_answer.cairo | 4 ++-- .../src/mock_aggregator/deploy_mock_aggregator.cairo | 6 +++--- .../scripts/src/mock_aggregator/set_latest_round.cairo | 2 +- .../aggregator_consumer/src/ocr2/price_consumer.cairo | 4 ++-- .../aggregator_consumer/tests/test_consumer.cairo | 6 +++--- .../tests/test_price_consumer_with_sequencer.cairo | 10 +++++----- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/examples/contracts/aggregator_consumer/scripts/src/consumer/deploy_aggregator_consumer.cairo b/examples/contracts/aggregator_consumer/scripts/src/consumer/deploy_aggregator_consumer.cairo index 4d55a13db..583653189 100644 --- a/examples/contracts/aggregator_consumer/scripts/src/consumer/deploy_aggregator_consumer.cairo +++ b/examples/contracts/aggregator_consumer/scripts/src/consumer/deploy_aggregator_consumer.cairo @@ -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 + contract_name: ByteArray, constructor_calldata: Array, ) -> DeployResult { let mut class_hash: ClassHash = 0x6d1dd0e5fa4e0284dcf341997f1d781bc2fb7d76ada684da7a2a33c38031df5 @@ -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()); diff --git a/examples/contracts/aggregator_consumer/scripts/src/consumer/set_answer.cairo b/examples/contracts/aggregator_consumer/scripts/src/consumer/set_answer.cairo index d53d266a7..e39e386a3 100644 --- a/examples/contracts/aggregator_consumer/scripts/src/consumer/set_answer.cairo +++ b/examples/contracts/aggregator_consumer/scripts/src/consumer/set_answer.cairo @@ -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![]); @@ -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()); diff --git a/examples/contracts/aggregator_consumer/scripts/src/mock_aggregator/deploy_mock_aggregator.cairo b/examples/contracts/aggregator_consumer/scripts/src/mock_aggregator/deploy_mock_aggregator.cairo index e3ab4e9a6..d56e03e1f 100644 --- a/examples/contracts/aggregator_consumer/scripts/src/mock_aggregator/deploy_mock_aggregator.cairo +++ b/examples/contracts/aggregator_consumer/scripts/src/mock_aggregator/deploy_mock_aggregator.cairo @@ -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 + contract_name: ByteArray, constructor_calldata: Array, ) -> DeployResult { let mut class_hash: ClassHash = 0x728d8a221e2204c88df0642b7c6dcee60f7c3d3b3d5c190cac1ceba5baf15e8 @@ -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()); diff --git a/examples/contracts/aggregator_consumer/scripts/src/mock_aggregator/set_latest_round.cairo b/examples/contracts/aggregator_consumer/scripts/src/mock_aggregator/set_latest_round.cairo index 8b853bd43..8b457871c 100644 --- a/examples/contracts/aggregator_consumer/scripts/src/mock_aggregator/set_latest_round.cairo +++ b/examples/contracts/aggregator_consumer/scripts/src/mock_aggregator/set_latest_round.cairo @@ -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() { diff --git a/examples/contracts/aggregator_consumer/src/ocr2/price_consumer.cairo b/examples/contracts/aggregator_consumer/src/ocr2/price_consumer.cairo index 9f2d2e381..d38463ddf 100644 --- a/examples/contracts/aggregator_consumer/src/ocr2/price_consumer.cairo +++ b/examples/contracts/aggregator_consumer/src/ocr2/price_consumer.cairo @@ -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'); @@ -61,7 +61,7 @@ mod AggregatorPriceConsumer { _ => { assert(!report_stale, 'L2 seq down & report stale'); assert(false, 'L2 seq down & report ok'); - } + }, } } } diff --git a/examples/contracts/aggregator_consumer/tests/test_consumer.cairo b/examples/contracts/aggregator_consumer/tests/test_consumer.cairo index 6cd305c8c..ee95950be 100644 --- a/examples/contracts/aggregator_consumer/tests/test_consumer.cairo +++ b/examples/contracts/aggregator_consumer/tests/test_consumer.cairo @@ -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 }; @@ -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 @@ -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'); diff --git a/examples/contracts/aggregator_consumer/tests/test_price_consumer_with_sequencer.cairo b/examples/contracts/aggregator_consumer/tests/test_price_consumer_with_sequencer.cairo index 0b59e0243..d5aa33a72 100644 --- a/examples/contracts/aggregator_consumer/tests/test_price_consumer_with_sequencer.cairo +++ b/examples/contracts/aggregator_consumer/tests/test_price_consumer_with_sequencer.cairo @@ -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 { @@ -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()); @@ -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 @@ -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'); @@ -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');