diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb61624a..5d3cc97e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,8 +3,8 @@ name: Origami CI on: [push, pull_request] env: - DOJO_VERSION: v0.5.0 - SCARB_VERSION: v2.4.0 + DOJO_VERSION: v0.6.0-alpha.0 + SCARB_VERSION: v2.5.4 jobs: check: diff --git a/Scarb.lock b/Scarb.lock index c8f8a8b2..4b2025c2 100644 --- a/Scarb.lock +++ b/Scarb.lock @@ -11,12 +11,12 @@ dependencies = [ [[package]] name = "cubit" version = "1.3.0" -source = "git+https://github.com/influenceth/cubit.git#62756082bf2555d7ab25c69d9c7bc30574ff1ce8" +source = "git+https://github.com/notV4l/cubit.git?rev=5aa99005#5aa99005475012a04421e85c8fa3dc77f53c8ca3" [[package]] name = "dojo" version = "0.5.1" -source = "git+https://github.com/dojoengine/dojo?tag=v0.5.1#4a6cad5f21d8da71714ae6ff48c9cc6ecaae642a" +source = "git+https://github.com/dojoengine/dojo?tag=v0.6.0-alpha.0#afa4e93688d3c75de0cf2469d226b06ca85dbdd4" dependencies = [ "dojo_plugin", ] @@ -45,7 +45,7 @@ dependencies = [ [[package]] name = "origami" -version = "0.5.1" +version = "0.6.0-alpha.0" dependencies = [ "cubit", "dojo", diff --git a/Scarb.toml b/Scarb.toml index 4a67776f..a6f19d50 100644 --- a/Scarb.toml +++ b/Scarb.toml @@ -2,13 +2,14 @@ members = ["crates", "examples/*", "token"] [workspace.package] -version = "0.5.1" +version = "0.6.0-alpha.0" description = "Community-maintained libraries for Cairo" homepage = "https://github.com/dojoengine/origami" authors = ["bal7hazar@proton.me"] [workspace.dependencies] -cubit = { git = "https://github.com/influenceth/cubit.git" } -dojo = { git = "https://github.com/dojoengine/dojo", tag = "v0.5.1" } +# cubit = { git = "https://github.com/influenceth/cubit.git" } +cubit = { git = "https://github.com/notV4l/cubit.git", rev = "5aa99005" } +dojo = { git = "https://github.com/dojoengine/dojo", tag = "v0.6.0-alpha.0" } origami = { path = "crates" } token = { path = "token" } diff --git a/crates/src/algebra/matrix.cairo b/crates/src/algebra/matrix.cairo index 5ed219d9..7dc37339 100644 --- a/crates/src/algebra/matrix.cairo +++ b/crates/src/algebra/matrix.cairo @@ -292,7 +292,6 @@ mod tests { } #[test] - #[available_gas(1_000_000)] fn test_matrix_get() { let rows: u8 = 3; let cols: u8 = 4; @@ -303,7 +302,6 @@ mod tests { } #[test] - #[available_gas(1_000_000)] fn test_matrix_transpose() { let rows: u8 = 2; let cols: u8 = 3; @@ -315,7 +313,6 @@ mod tests { } #[test] - #[available_gas(1_000_000)] fn test_matrix_addition() { let rows: u8 = 2; let cols: u8 = 3; @@ -328,7 +325,6 @@ mod tests { } #[test] - #[available_gas(1_000_000)] fn test_matrix_subtraction() { let rows: u8 = 2; let cols: u8 = 3; @@ -342,7 +338,6 @@ mod tests { } #[test] - #[available_gas(10_000_000)] fn test_matrix_square_multiplication() { let size: u8 = 2; let values: Array = array![1, 2, 3, 4]; @@ -356,7 +351,6 @@ mod tests { } #[test] - #[available_gas(10_000_000)] fn test_matrix_rectangle_multiplication() { let values: Array = array![1, 2, 3, 4, 5, 6]; let mut matrix1 = MatrixTrait::new(values.span(), 2, 3); @@ -369,7 +363,6 @@ mod tests { } #[test] - #[available_gas(5_000_000)] fn test_matrix_determinant_2x2() { let values: Array = array![4, 3, 1, 2]; let mut matrix = MatrixTrait::new(values.span(), 2, 2); @@ -377,7 +370,6 @@ mod tests { } #[test] - #[available_gas(10_000_000)] fn test_matrix_determinant_3x3() { let values: Array = array![6, 1, 1, 4, -2, 5, 2, 8, 7]; let mut matrix = MatrixTrait::new(values.span(), 3, 3); @@ -385,7 +377,6 @@ mod tests { } #[test] - #[available_gas(10_000_000)] fn test_matrix_inverse_2x2() { let values: Array = array![1, 2, 0, 1]; let mut matrix = MatrixTrait::new(values.span(), 2, 2); @@ -397,7 +388,6 @@ mod tests { } #[test] - #[available_gas(10_000_000)] fn test_matrix_inverse_3x3() { let values: Array = array![1, 1, 0, 0, 1, 0, 0, 1, 1]; let mut matrix = MatrixTrait::new(values.span(), 3, 3); diff --git a/crates/src/algebra/vec2.cairo b/crates/src/algebra/vec2.cairo index 6bee5980..e4553cd0 100644 --- a/crates/src/algebra/vec2.cairo +++ b/crates/src/algebra/vec2.cairo @@ -105,7 +105,6 @@ mod tests { use super::{FixedTrait, ONE_u128, Vec2Trait}; #[test] - #[available_gas(2000000)] fn test_new() { let var1_pos = FixedTrait::new(ONE_u128, false); let var2_neg = FixedTrait::new(2 * ONE_u128, true); @@ -124,7 +123,6 @@ mod tests { } #[test] - #[available_gas(2000000)] fn test_splat() { let var = FixedTrait::new(ONE_u128, false); @@ -142,7 +140,6 @@ mod tests { } #[test] - #[available_gas(2000000)] fn test_select() { let var1_pos = FixedTrait::new(ONE_u128, false); let var2_neg = FixedTrait::new(2 * ONE_u128, true); @@ -168,7 +165,6 @@ mod tests { } #[test] - #[available_gas(2000000)] fn test_dot() { let var1_pos = FixedTrait::new(ONE_u128, false); let var2_neg = FixedTrait::new(2 * ONE_u128, true); @@ -188,7 +184,6 @@ mod tests { } #[test] - #[available_gas(2000000)] fn test_dot_into_vec() { let var1_pos = FixedTrait::new(ONE_u128, false); let var2_neg = FixedTrait::new(2 * ONE_u128, true); @@ -212,7 +207,6 @@ mod tests { } #[test] - #[available_gas(2000000)] fn test_xx() { let var1_pos = FixedTrait::new(ONE_u128, false); let var2_neg = FixedTrait::new(2 * ONE_u128, true); @@ -226,7 +220,6 @@ mod tests { } #[test] - #[available_gas(2000000)] fn test_xy() { let var1_pos = FixedTrait::new(ONE_u128, false); let var2_neg = FixedTrait::new(2 * ONE_u128, true); @@ -240,7 +233,6 @@ mod tests { } #[test] - #[available_gas(2000000)] fn test_yx() { let var1_pos = FixedTrait::new(ONE_u128, false); let var2_neg = FixedTrait::new(2 * ONE_u128, true); @@ -254,7 +246,6 @@ mod tests { } #[test] - #[available_gas(2000000)] fn test_yy() { let var1_pos = FixedTrait::new(ONE_u128, false); let var2_neg = FixedTrait::new(2 * ONE_u128, true); diff --git a/crates/src/algebra/vector.cairo b/crates/src/algebra/vector.cairo index 9bff622f..a240ea28 100644 --- a/crates/src/algebra/vector.cairo +++ b/crates/src/algebra/vector.cairo @@ -35,7 +35,6 @@ impl VectorImpl, +AddEq, +Zeroable, +Copy, +Drop,> of Vec // [Check] Dimesions are compatible assert(self.size() == vector.size(), errors::INVALID_SIZE); // [Compute] Dot product in a loop - let mut index = 0; let mut value = Zeroable::zero(); loop { match self.data.pop_front() { @@ -112,7 +111,6 @@ mod tests { } #[test] - #[available_gas(1_000_000)] fn test_vector_get() { let mut vector: Vector = VectorTrait::new(array![1, 2, 3, 4].span()); assert(vector.get(0) == 1, 'Vector: get failed'); @@ -120,7 +118,6 @@ mod tests { } #[test] - #[available_gas(1_000_000)] fn test_vector_dot_product() { let vector1: Vector = VectorTrait::new(array![1, 2, 3].span()); let vector2: Vector = VectorTrait::new(array![4, 5, 6].span()); diff --git a/crates/src/defi/auction/gda.cairo b/crates/src/defi/auction/gda.cairo index 374d6685..4d771490 100644 --- a/crates/src/defi/auction/gda.cairo +++ b/crates/src/defi/auction/gda.cairo @@ -93,7 +93,6 @@ mod tests { // ipynb with calculations at https://colab.research.google.com/drive/14elIFRXdG3_gyiI43tP47lUC_aClDHfB?usp=sharing #[test] - #[available_gas(2000000)] fn test_price_1() { let auction = ContinuousGDA { initial_price: FixedTrait::new_unscaled(1000, false), @@ -110,7 +109,6 @@ mod tests { #[test] - #[available_gas(2000000)] fn test_price_2() { let auction = ContinuousGDA { initial_price: FixedTrait::new_unscaled(1000, false), @@ -126,7 +124,6 @@ mod tests { } #[test] - #[available_gas(2000000)] fn test_price_3() { let auction = ContinuousGDA { initial_price: FixedTrait::new_unscaled(1000, false), @@ -142,7 +139,6 @@ mod tests { } #[test] - #[available_gas(2000000)] fn test_price_4() { let auction = ContinuousGDA { initial_price: FixedTrait::new_unscaled(1000, false), @@ -166,7 +162,6 @@ mod tests { use super::super::{DiscreteGDA, DiscreteGDATrait}; #[test] - #[available_gas(2000000)] fn test_initial_price() { let auction = DiscreteGDA { sold: FixedTrait::new_unscaled(0, false), @@ -182,7 +177,6 @@ mod tests { // ipynb with calculations at https://colab.research.google.com/drive/14elIFRXdG3_gyiI43tP47lUC_aClDHfB?usp=sharing #[test] - #[available_gas(2000000)] fn test_price_1() { let auction = DiscreteGDA { sold: FixedTrait::new_unscaled(1, false), @@ -201,7 +195,6 @@ mod tests { } #[test] - #[available_gas(2000000)] fn test_price_2() { let auction = DiscreteGDA { sold: FixedTrait::new_unscaled(2, false), @@ -219,7 +212,6 @@ mod tests { } #[test] - #[available_gas(2000000)] fn test_price_3() { let auction = DiscreteGDA { sold: FixedTrait::new_unscaled(4, false), @@ -238,7 +230,6 @@ mod tests { } #[test] - #[available_gas(2000000)] fn test_price_4() { let auction = DiscreteGDA { sold: FixedTrait::new_unscaled(20, false), diff --git a/crates/src/defi/auction/helpers.cairo b/crates/src/defi/auction/helpers.cairo index dec1ec70..fe50eb1e 100644 --- a/crates/src/defi/auction/helpers.cairo +++ b/crates/src/defi/auction/helpers.cairo @@ -25,7 +25,6 @@ mod tests { const TOLERANCE: u128 = 18446744073709550; // 0.001 #[test] - #[available_gas(20000000)] fn test_days_convertions() { let days = FixedTrait::new(2, false); let actual = to_days_fp(from_days_fp(days)); diff --git a/crates/src/defi/auction/vrgda.cairo b/crates/src/defi/auction/vrgda.cairo index 15fed4fc..96bc3f82 100644 --- a/crates/src/defi/auction/vrgda.cairo +++ b/crates/src/defi/auction/vrgda.cairo @@ -168,7 +168,6 @@ mod tests { const DELTA: u128 = 184467440737095; #[test] - #[available_gas(2000000)] fn test_target_price() { let auction = LinearVRGDA { target_price: FixedTrait::new(_69_42, false), @@ -182,7 +181,6 @@ mod tests { } #[test] - #[available_gas(20000000)] fn test_pricing_basic() { let auction = LinearVRGDA { target_price: FixedTrait::new(_69_42, false), @@ -196,7 +194,6 @@ mod tests { } #[test] - #[available_gas(20000000)] fn test_pricing_basic_reverse() { let auction = LinearVRGDA { target_price: FixedTrait::new(_69_42, false), @@ -228,7 +225,6 @@ mod tests { const _0_0023: u128 = 42427511369531970; #[test] - #[available_gas(200000000)] fn test_target_price() { let auction = LogisticVRGDA { target_price: FixedTrait::new(_69_42, false), @@ -244,7 +240,6 @@ mod tests { } #[test] - #[available_gas(200000000)] fn test_pricing_basic() { let auction = LogisticVRGDA { target_price: FixedTrait::new(_69_42, false), @@ -260,7 +255,6 @@ mod tests { } #[test] - #[available_gas(200000000)] fn test_pricing_basic_reverse() { let auction = LogisticVRGDA { target_price: FixedTrait::new(_69_42, false), diff --git a/crates/src/map/hex/hex.cairo b/crates/src/map/hex/hex.cairo index 5a1106ab..6e74f543 100644 --- a/crates/src/map/hex/hex.cairo +++ b/crates/src/map/hex/hex.cairo @@ -136,7 +136,6 @@ impl ImplHexTile of IHexTile { mod tests { use super::{IHexTile, ImplHexTile, Direction, HexTile}; #[test] - #[available_gas(500000)] fn test_row_col() { let mut hex_tile = ImplHexTile::new(5, 5); @@ -146,7 +145,6 @@ mod tests { #[test] - #[available_gas(500000)] fn test_hex_tile_neighbors() { let mut hex_tile = ImplHexTile::new(5, 5); @@ -182,7 +180,6 @@ mod tests { } #[test] - #[available_gas(501230000)] fn test_is_neighbor() { let mut hex_tile = ImplHexTile::new(5, 5); @@ -209,7 +206,6 @@ mod tests { } #[test] - #[available_gas(5012300000000000000)] fn test_tiles_within_range() { let mut hex_tile = ImplHexTile::new(5, 5); diff --git a/crates/src/random/deck.cairo b/crates/src/random/deck.cairo index 845172c3..717d8fda 100644 --- a/crates/src/random/deck.cairo +++ b/crates/src/random/deck.cairo @@ -168,7 +168,6 @@ mod tests { const DECK_SEED: felt252 = 'SEED'; #[test] - #[available_gas(500_000)] fn test_deck_new_draw() { let mut deck = DeckTrait::new(DECK_SEED, DECK_CARDS_NUMBER); assert(deck.remaining == DECK_CARDS_NUMBER, 'Wrong remaining'); @@ -181,7 +180,6 @@ mod tests { } #[test] - #[available_gas(1_000_000)] fn test_deck_from_bitmap() { let bitmap: u128 = 0 * 0x10 + 0 * 0x8 + 1 * 0x4 + 0 * 0x2 + 0 * 0x1; let mut deck = DeckTrait::from_bitmap(DECK_SEED, DECK_CARDS_NUMBER, bitmap); @@ -194,7 +192,6 @@ mod tests { } #[test] - #[available_gas(500_000)] fn test_deck_new_withdraw() { let mut deck = DeckTrait::new(DECK_SEED, DECK_CARDS_NUMBER); deck.withdraw(0x2); @@ -206,7 +203,6 @@ mod tests { } #[test] - #[available_gas(100_000)] #[should_panic(expected: ('Deck: no cards left',))] fn test_deck_new_draw_revert_no_card_left() { let mut deck = DeckTrait::new(DECK_SEED, DECK_CARDS_NUMBER); @@ -215,7 +211,6 @@ mod tests { } #[test] - #[available_gas(600_000)] fn test_deck_new_discard() { let mut deck = DeckTrait::new(DECK_SEED, DECK_CARDS_NUMBER); loop { @@ -230,7 +225,6 @@ mod tests { } #[test] - #[available_gas(400_000)] fn test_deck_new_remove() { let mut deck = DeckTrait::new(DECK_SEED, DECK_CARDS_NUMBER); let mut cards: Array = array![]; diff --git a/crates/src/random/dice.cairo b/crates/src/random/dice.cairo index bc2f8eb4..2c5dab31 100644 --- a/crates/src/random/dice.cairo +++ b/crates/src/random/dice.cairo @@ -65,7 +65,6 @@ mod tests { const DICE_SEED: felt252 = 'SEED'; #[test] - #[available_gas(2000000)] fn test_dice_new_roll() { let mut dice = DiceTrait::new(DICE_FACE_COUNT, DICE_SEED); assert(dice.roll() == 1, 'Wrong dice value'); @@ -77,7 +76,6 @@ mod tests { } #[test] - #[available_gas(2000000)] fn test_dice_new_roll_overflow() { let mut dice = DiceTrait::new(DICE_FACE_COUNT, DICE_SEED); dice.nonce = 0x800000000000011000000000000000000000000000000000000000000000000; // PRIME - 1 diff --git a/crates/src/security/commitment.cairo b/crates/src/security/commitment.cairo index 765f1020..134d17ae 100644 --- a/crates/src/security/commitment.cairo +++ b/crates/src/security/commitment.cairo @@ -46,7 +46,6 @@ mod tests { use super::{Commitment, CommitmentTrait}; #[test] - #[available_gas(30_000)] fn test_security_commit_reveal() { let mut commitment = CommitmentTrait::new(); let value = array!['ohayo'].span(); @@ -57,12 +56,9 @@ mod tests { } #[test] - #[available_gas(15_000)] #[should_panic(expected: ('Commitment: can not commit zero',))] fn test_security_commit_revert_zero() { let mut commitment = CommitmentTrait::new(); - let value = array!['ohayo'].span(); - let hash = poseidon_hash_span(value); commitment.commit(0); } } diff --git a/examples/chess/src/tests/integration.cairo b/examples/chess/src/tests/integration.cairo index d004aa8c..e56abeb3 100644 --- a/examples/chess/src/tests/integration.cairo +++ b/examples/chess/src/tests/integration.cairo @@ -7,7 +7,6 @@ mod tests { use chess::models::player::{Color}; #[test] - #[available_gas(3000000000000000)] fn integration() { let white = starknet::contract_address_const::<0x01>(); let black = starknet::contract_address_const::<0x02>(); diff --git a/examples/chess/src/tests/units.cairo b/examples/chess/src/tests/units.cairo index 03f90993..fb625c34 100644 --- a/examples/chess/src/tests/units.cairo +++ b/examples/chess/src/tests/units.cairo @@ -28,7 +28,6 @@ mod tests { (world, actions_system) } #[test] - #[available_gas(3000000000000000)] fn test_spawn() { let white = starknet::contract_address_const::<0x01>(); let black = starknet::contract_address_const::<0x02>(); @@ -52,7 +51,6 @@ mod tests { assert(a1.piece_type != PieceType::None, 'should have piece'); } #[test] - #[available_gas(3000000000000000)] fn test_move() { let white = starknet::contract_address_const::<0x01>(); let black = starknet::contract_address_const::<0x02>(); diff --git a/examples/hex_map/src/actions.cairo b/examples/hex_map/src/actions.cairo index 0bc86343..49d6d179 100644 --- a/examples/hex_map/src/actions.cairo +++ b/examples/hex_map/src/actions.cairo @@ -116,7 +116,6 @@ mod tests { } #[test] - #[available_gas(30000000)] fn test_east() { // caller let caller = starknet::contract_address_const::<0x0>(); @@ -142,25 +141,17 @@ mod tests { #[test] #[should_panic(expected: ('Cannot walk on water', 'ENTRYPOINT_FAILED'))] - #[available_gas(30000000)] fn test_south_east() { - // caller - let caller = starknet::contract_address_const::<0x0>(); - - let (world, actions_system) = setup_world(); + let (_world, actions_system) = setup_world(); // call spawn() actions_system.spawn(); // call move with direction right actions_system.move(Direction::SouthEast(())); - - // get new_position - let new_position = get!(world, caller, Position); } #[test] - #[available_gas(30000000)] fn test_south() { // caller let caller = starknet::contract_address_const::<0x0>(); @@ -184,25 +175,17 @@ mod tests { } #[test] #[should_panic(expected: ('Cannot walk on water', 'ENTRYPOINT_FAILED'))] - #[available_gas(30000000)] fn test_north() { - // caller - let caller = starknet::contract_address_const::<0x0>(); - - let (world, actions_system) = setup_world(); + let (_world, actions_system) = setup_world(); // call spawn() actions_system.spawn(); // call move with direction right actions_system.move(Direction::West(())); - - // get new_position - let new_position = get!(world, caller, Position); } #[test] - #[available_gas(30000000)] fn test_north_west() { // caller let caller = starknet::contract_address_const::<0x0>(); @@ -227,21 +210,14 @@ mod tests { #[test] #[should_panic(expected: ('Cannot walk on water', 'ENTRYPOINT_FAILED'))] - #[available_gas(30000000)] fn test_north_east() { - // caller - let caller = starknet::contract_address_const::<0x0>(); - - let (world, actions_system) = setup_world(); + let (_world, actions_system) = setup_world(); // call spawn() actions_system.spawn(); // call move with direction right actions_system.move(Direction::NorthEast(())); - - // get new_position - let new_position = get!(world, caller, Position); } } diff --git a/examples/hex_map/src/models.cairo b/examples/hex_map/src/models.cairo index 64256048..cc549b15 100644 --- a/examples/hex_map/src/models.cairo +++ b/examples/hex_map/src/models.cairo @@ -36,13 +36,11 @@ impl Vec2Impl of Vec2Trait { // use super::{Position, Vec2, Vec2Trait}; // #[test] -// #[available_gas(100000)] // fn test_vec_is_zero() { // assert(Vec2Trait::is_zero(Vec2 { x: 0, y: 0 }), 'not zero'); // } // #[test] -// #[available_gas(100000)] // fn test_vec_is_equal() { // let position = Vec2 { x: 420, y: 0 }; // assert(position.is_equal(Vec2 { x: 420, y: 0 }), 'not equal'); diff --git a/examples/hex_map/src/noise.cairo b/examples/hex_map/src/noise.cairo index dcebe720..91a7d671 100644 --- a/examples/hex_map/src/noise.cairo +++ b/examples/hex_map/src/noise.cairo @@ -56,9 +56,11 @@ mod tests { use debug::PrintTrait; use super::{Direction, HexTile, ImplHexTile, ITile}; + #[test] - #[available_gas(500000000)] fn test_gradient() { + // seems inconsistent + let mut i = 5; let mut tile = ImplHexTile::new(7, 5); @@ -70,7 +72,7 @@ mod tests { if (j >= neighbors.len()) { break; } - let n = *neighbors.at(j); + let _n = *neighbors.at(j); j += 1; }; diff --git a/examples/market/src/models/market.cairo b/examples/market/src/models/market.cairo index 50369e11..4db5fc98 100644 --- a/examples/market/src/models/market.cairo +++ b/examples/market/src/models/market.cairo @@ -245,11 +245,10 @@ mod tests { let market = Market { item_id: 1, cash_amount: SCALING_FACTOR * 1, item_quantity: 1 }; // pool 1:1 - let cost = market.buy(10); + let _cost = market.buy(10); } #[test] - #[available_gas(100000)] fn test_market_buy() { let market = Market { item_id: 1, cash_amount: SCALING_FACTOR * 1, item_quantity: 10 @@ -259,7 +258,6 @@ mod tests { } #[test] - #[available_gas(100000)] fn test_market_sell() { let market = Market { item_id: 1, cash_amount: SCALING_FACTOR * 1, item_quantity: 10 @@ -269,7 +267,6 @@ mod tests { } #[test] - #[available_gas(500000)] fn test_market_add_liquidity_no_initial() { // Without initial liquidity let market = Market { item_id: 1, cash_amount: 0, item_quantity: 0 }; @@ -291,7 +288,6 @@ mod tests { } #[test] - #[available_gas(600000)] fn test_market_add_liquidity_optimal() { // With initial liquidity let market = Market { @@ -319,7 +315,6 @@ mod tests { } #[test] - #[available_gas(1000000)] fn test_market_add_liquidity_not_optimal() { // With initial liquidity let market = Market { @@ -344,9 +339,9 @@ mod tests { let expected_quantity = FixedTrait::new_unscaled(expected_quantity, false); // Get expecteed liquidity - let expected_liquidity = FixedTrait::sqrt(expected_amount * expected_quantity); + let _expected_liquidity = FixedTrait::sqrt(expected_amount * expected_quantity); - let final_liquidity = initial_liquidity + liquidity_add; + let _final_liquidity = initial_liquidity + liquidity_add; // assert_precise(expected_liquidity, final_liquidity.into(), 'wrong liquidity', Option::None(())); } @@ -358,12 +353,11 @@ mod tests { }; // pool 1:10 // Adding 20 items requires (SCALING_FACTOR * 2) cash amount to maintain the ratio // Therefore this should fail - let (amount_add, quantity_add, liquidity_add) = market + let (_amount_add, _quantity_add, _liquidity_add) = market .add_liquidity(SCALING_FACTOR * 1, 20); } #[test] - #[available_gas(1000000)] fn test_market_remove_liquidity() { // With initial liquidity let market = Market { @@ -387,9 +381,9 @@ mod tests { let expected_quantity = FixedTrait::new_unscaled(expected_quantity, false); // Get expecteed liquidity - let expected_liquidity = FixedTrait::sqrt(expected_amount * expected_quantity); + let _expected_liquidity = FixedTrait::sqrt(expected_amount * expected_quantity); - let final_liquidity = initial_liquidity - liquidity_remove; + let _final_liquidity = initial_liquidity - liquidity_remove; // assert_precise(expected_liquidity, final_liquidity.into(), 'wrong liquidity', Option::None(())); } @@ -402,7 +396,7 @@ mod tests { // Remove liquidity let one = FixedTrait::new_unscaled(1, false); - let (amount_remove, quantity_remove) = market.remove_liquidity(one); + let (_amount_remove, _quantity_remove) = market.remove_liquidity(one); } #[test] @@ -418,6 +412,6 @@ mod tests { let two = FixedTrait::new_unscaled(2, false); let liquidity_remove = initial_liquidity * two; - let (amount_remove, quantity_remove) = market.remove_liquidity(liquidity_remove); + let (_amount_remove, _quantity_remove) = market.remove_liquidity(liquidity_remove); } } diff --git a/examples/market/src/systems/liquidity.cairo b/examples/market/src/systems/liquidity.cairo index 6684519c..6a9ee495 100644 --- a/examples/market/src/systems/liquidity.cairo +++ b/examples/market/src/systems/liquidity.cairo @@ -6,6 +6,7 @@ use dojo::world::IWorldDispatcher; use cubit::f128::types::fixed::Fixed; +#[starknet::interface] trait ILiquidity { fn add( self: @TContractState, world: IWorldDispatcher, item_id: u32, amount: u128, quantity: u128 diff --git a/examples/market/src/systems/trade.cairo b/examples/market/src/systems/trade.cairo index 7b944011..6c4efde4 100644 --- a/examples/market/src/systems/trade.cairo +++ b/examples/market/src/systems/trade.cairo @@ -2,6 +2,7 @@ use dojo::world::IWorldDispatcher; +#[starknet::interface] trait ITrade { fn buy(self: @TContractState, world: IWorldDispatcher, item_id: u32, quantity: u128); fn sell(self: @TContractState, world: IWorldDispatcher, item_id: u32, quantity: u128); diff --git a/examples/market/src/tests/trade.cairo b/examples/market/src/tests/trade.cairo index 873117c5..4ae8ae8d 100644 --- a/examples/market/src/tests/trade.cairo +++ b/examples/market/src/tests/trade.cairo @@ -15,8 +15,7 @@ use market::models::market::{Market, MarketTrait}; use market::tests::{setup, setup::Systems}; #[test] -#[available_gas(1_000_000_000)] fn test_market_spawn() { // [Setup] - let (world, systems) = setup::spawn_market(); + let (_world, _systems) = setup::spawn_market(); } diff --git a/examples/projectile/src/lib.cairo b/examples/projectile/src/lib.cairo index b6ff75d9..5ae37de5 100644 --- a/examples/projectile/src/lib.cairo +++ b/examples/projectile/src/lib.cairo @@ -142,7 +142,6 @@ mod tests { use super::{deg_to_rad, fill_position_s, vec2_from_mag_theta, calc_x, calc_y}; use super::{Vec2Trait, Fixed, FixedTrait, ONE_u128}; #[test] - #[available_gas(2000000)] fn test_deg_to_rad() { let sixty = FixedTrait::new(60 * ONE_u128, false); let theta = deg_to_rad(sixty); @@ -156,7 +155,6 @@ mod tests { } #[test] - #[available_gas(20000000)] fn test_vec2_from_mag_theta() { let mag = FixedTrait::new(100 * ONE_u128, false); let sixty = FixedTrait::new(60 * ONE_u128, false); @@ -183,7 +181,6 @@ mod tests { } #[test] - #[available_gas(20000000)] fn test_fill_position_s() { let v_0_mag = FixedTrait::from_unscaled_felt(100); let theta_0_deg = FixedTrait::from_unscaled_felt(65); @@ -232,7 +229,6 @@ mod tests { } #[test] - #[available_gas(2000000)] fn test_calc_x() { let x_0 = FixedTrait::new(100 * ONE_u128, false); let v_0x = FixedTrait::new(50 * ONE_u128, false); @@ -243,7 +239,6 @@ mod tests { } #[test] - #[available_gas(2000000)] fn test_calc_y() { let y_0 = FixedTrait::new(100 * ONE_u128, false); let v_0y = FixedTrait::new(50 * ONE_u128, false); diff --git a/token/src/components/tests/introspection/test_src5.cairo b/token/src/components/tests/introspection/test_src5.cairo index b10154ea..57344ef2 100644 --- a/token/src/components/tests/introspection/test_src5.cairo +++ b/token/src/components/tests/introspection/test_src5.cairo @@ -20,34 +20,30 @@ fn STATE() -> (IWorldDispatcher, SRC5Mock::ContractState) { #[test] -#[available_gas(2000000)] fn test_src5_default_behavior() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); let supports_default_interface = state.supports_interface(ISRC5_ID); assert(supports_default_interface, 'Should support base interface'); } #[test] -#[available_gas(3000000)] fn test_src5_not_registered_interface() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); let supports_unregistered_interface = state.supports_interface(OTHER_ID); assert(!supports_unregistered_interface, 'Should not support unregistered'); } #[test] -#[available_gas(3000000)] fn test_src5_register_interface() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); state.src5.register_interface(OTHER_ID); let supports_new_interface = state.supports_interface(OTHER_ID); assert(supports_new_interface, 'Should support new interface'); } #[test] -#[available_gas(3000000)] fn test_src5_deregister_interface() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); state.src5.register_interface(OTHER_ID); state.src5.deregister_interface(OTHER_ID); let supports_old_interface = state.supports_interface(OTHER_ID); @@ -55,9 +51,8 @@ fn test_src5_deregister_interface() { } #[test] -#[available_gas(3000000)] #[should_panic(expected: ('SRC5: invalid id',))] fn test_src5_deregister_default_interface() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); state.src5.deregister_interface(ISRC5_ID); } diff --git a/token/src/components/tests/mocks/erc20/erc20_balance_mock.cairo b/token/src/components/tests/mocks/erc20/erc20_balance_mock.cairo index 5d9e692d..593a1ca3 100644 --- a/token/src/components/tests/mocks/erc20/erc20_balance_mock.cairo +++ b/token/src/components/tests/mocks/erc20/erc20_balance_mock.cairo @@ -26,6 +26,10 @@ trait IERC20BalanceMock { fn initializer(ref self: TState, initial_supply: u256, recipient: ContractAddress,); } +#[starknet::interface] +trait IERC20BalanceMockInit { + fn initializer(ref self: TState, initial_supply: u256, recipient: ContractAddress,); +} #[dojo::contract] mod erc20_balance_mock { @@ -69,8 +73,7 @@ mod erc20_balance_mock { } #[abi(embed_v0)] - #[generate_trait] - impl InitializerImpl of InitializerTrait { + impl InitializerImpl of super::IERC20BalanceMockInit { fn initializer(ref self: ContractState, initial_supply: u256, recipient: ContractAddress,) { // set balance for recipient self.erc20_balance.update_balance(recipient, 0, initial_supply); diff --git a/token/src/components/tests/mocks/erc20/erc20_bridgeable_mock.cairo b/token/src/components/tests/mocks/erc20/erc20_bridgeable_mock.cairo index fd8259c7..c01455da 100644 --- a/token/src/components/tests/mocks/erc20/erc20_bridgeable_mock.cairo +++ b/token/src/components/tests/mocks/erc20/erc20_bridgeable_mock.cairo @@ -1,3 +1,17 @@ +use starknet::ContractAddress; + +#[starknet::interface] +trait IERC20BridgeableMockInit { + fn initializer( + ref self: TState, + name: felt252, + symbol: felt252, + initial_supply: u256, + recipient: ContractAddress, + l2_bridge_address: ContractAddress, + ); +} + #[dojo::contract] mod erc20_bridgeable_mock { use starknet::ContractAddress; @@ -91,8 +105,7 @@ mod erc20_bridgeable_mock { // #[abi(embed_v0)] - #[generate_trait] - impl ERC20InitializerImpl of ERC20InitializerTrait { + impl ERC20InitializerImpl of super::IERC20BridgeableMockInit { fn initializer( ref self: ContractState, name: felt252, diff --git a/token/src/components/tests/security/test_initializable.cairo b/token/src/components/tests/security/test_initializable.cairo index 262e4b43..b8c875e4 100644 --- a/token/src/components/tests/security/test_initializable.cairo +++ b/token/src/components/tests/security/test_initializable.cairo @@ -19,19 +19,17 @@ fn STATE() -> (IWorldDispatcher, InitializableMock::ContractState) { } #[test] -#[available_gas(5000000)] fn test_initializable_initialize() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); assert(!state.initializable.is_initialized(), 'Should not be initialized'); state.initializable.initialize(); assert(state.initializable.is_initialized(), 'Should be initialized'); } #[test] -#[available_gas(5000000)] #[should_panic(expected: ('Initializable: is initialized',))] fn test_initializable_initialize_when_initialized() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); state.initializable.initialize(); state.initializable.initialize(); } diff --git a/token/src/components/tests/token/erc20/test_erc20_allowance.cairo b/token/src/components/tests/token/erc20/test_erc20_allowance.cairo index ffe0c424..fee4e9c3 100644 --- a/token/src/components/tests/token/erc20/test_erc20_allowance.cairo +++ b/token/src/components/tests/token/erc20/test_erc20_allowance.cairo @@ -59,9 +59,8 @@ fn STATE() -> (IWorldDispatcher, erc20_allowance_mock::ContractState) { // #[test] -#[available_gas(100000000)] fn test_erc20_allowance_approve() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); testing::set_caller_address(OWNER()); @@ -72,20 +71,18 @@ fn test_erc20_allowance_approve() { } #[test] -#[available_gas(100000000)] #[should_panic(expected: ('ERC20: approve from 0',))] fn test_erc20_allowance_approve_from_zero() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); testing::set_caller_address(ZERO()); state.erc20_allowance.approve(SPENDER(), VALUE); } #[test] -#[available_gas(100000000)] #[should_panic(expected: ('ERC20: approve to 0',))] fn test_erc20_allowance_approve_to_zero() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); testing::set_caller_address(OWNER()); state.erc20_allowance.approve(ZERO(), VALUE); @@ -96,9 +93,8 @@ fn test_erc20_allowance_approve_to_zero() { // #[test] -#[available_gas(100000000)] fn test_erc20_allowance_spend_allowance() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); testing::set_caller_address(OWNER()); diff --git a/token/src/components/tests/token/erc20/test_erc20_balance.cairo b/token/src/components/tests/token/erc20/test_erc20_balance.cairo index 4d8fe446..b3f86396 100644 --- a/token/src/components/tests/token/erc20/test_erc20_balance.cairo +++ b/token/src/components/tests/token/erc20/test_erc20_balance.cairo @@ -64,9 +64,8 @@ fn STATE() -> (IWorldDispatcher, erc20_balance_mock::ContractState) { } #[test] -#[available_gas(100000000)] fn test_erc20_balance_initialize() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); assert(state.erc20_balance.balance_of(ADMIN()) == 0, 'Should be 0'); assert(state.erc20_balance.balance_of(OWNER()) == 0, 'Should be 0'); @@ -82,9 +81,8 @@ fn test_erc20_balance_initialize() { // #[test] -#[available_gas(100000000)] fn test_erc20_balance_update_balance() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); state.erc20_balance.update_balance(ZERO(), 0, 420); assert(state.erc20_balance.balance_of(ZERO()) == 420, 'Should be 420'); @@ -97,19 +95,17 @@ fn test_erc20_balance_update_balance() { } #[test] -#[available_gas(10000000)] #[should_panic(expected: ('u256_sub Overflow',))] fn test_erc20_balance_update_balance_sub_overflow() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); state.erc20_balance.update_balance(ZERO(), 1, 0); } #[test] -#[available_gas(10000000)] #[should_panic(expected: ('u256_add Overflow',))] fn test_erc20_balance_update_balance_add_overflow() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); state.erc20_balance.update_balance(ZERO(), 0, BoundedInt::max()); state.erc20_balance.update_balance(ZERO(), 0, 1); @@ -120,9 +116,8 @@ fn test_erc20_balance_update_balance_add_overflow() { // #[test] -#[available_gas(100000000)] fn test_erc20_balance_transfer_internal() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); state.erc20_balance.update_balance(ADMIN(), 0, 420); state.erc20_balance.update_balance(OTHER(), 0, 1000); @@ -139,19 +134,17 @@ fn test_erc20_balance_transfer_internal() { } #[test] -#[available_gas(100000000)] #[should_panic(expected: ('ERC20: transfer from 0',))] fn test_erc20_balance_transfer_internal_from_zero() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); state.erc20_balance.transfer_internal(ZERO(), ADMIN(), 420); } #[test] -#[available_gas(100000000)] #[should_panic(expected: ('ERC20: transfer to 0',))] fn test_erc20_balance_transfer_internal_to_zero() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); state.erc20_balance.transfer_internal(ADMIN(), ZERO(), 420); } @@ -192,7 +185,6 @@ fn setup() -> (IWorldDispatcher, IERC20BalanceMockDispatcher) { // #[test] -#[available_gas(40000000)] fn test_transfer_from() { let (world, mut erc20_balance_mock) = setup(); @@ -223,10 +215,9 @@ fn test_transfer_from() { } #[test] -#[available_gas(25000000)] #[should_panic(expected: ('u256_sub Overflow', 'ENTRYPOINT_FAILED'))] fn test_transfer_from_greater_than_allowance() { - let (world, mut erc20_balance_mock) = setup(); + let (_world, mut erc20_balance_mock) = setup(); utils::impersonate(OWNER()); erc20_balance_mock.approve(SPENDER(), VALUE); @@ -238,10 +229,9 @@ fn test_transfer_from_greater_than_allowance() { } #[test] -#[available_gas(25000000)] #[should_panic(expected: ('ERC20: transfer to 0', 'ENTRYPOINT_FAILED'))] fn test_transfer_from_to_zero_address() { - let (world, mut erc20_balance_mock) = setup(); + let (_world, mut erc20_balance_mock) = setup(); utils::impersonate(OWNER()); erc20_balance_mock.approve(SPENDER(), VALUE); @@ -251,10 +241,9 @@ fn test_transfer_from_to_zero_address() { } #[test] -#[available_gas(25000000)] #[should_panic(expected: ('u256_sub Overflow', 'ENTRYPOINT_FAILED'))] fn test_transfer_from_from_zero_address() { - let (world, mut erc20_balance_mock) = setup(); + let (_world, mut erc20_balance_mock) = setup(); erc20_balance_mock.transfer_from(ZERO(), RECIPIENT(), VALUE); } @@ -265,7 +254,6 @@ fn test_transfer_from_from_zero_address() { // #[test] -#[available_gas(40000000)] fn test_transferFrom() { let (world, mut erc20_balance_mock) = setup(); diff --git a/token/src/components/tests/token/erc20/test_erc20_bridgeable.cairo b/token/src/components/tests/token/erc20/test_erc20_bridgeable.cairo index 1fc41c50..0ad9e0c2 100644 --- a/token/src/components/tests/token/erc20/test_erc20_bridgeable.cairo +++ b/token/src/components/tests/token/erc20/test_erc20_bridgeable.cairo @@ -52,7 +52,7 @@ fn STATE() -> (IWorldDispatcher, erc20_bridgeable_mock::ContractState) { fn setup() -> erc20_bridgeable_mock::ContractState { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); state.initializer(NAME, SYMBOL, SUPPLY, OWNER(), BRIDGE()); state } @@ -62,9 +62,8 @@ fn setup() -> erc20_bridgeable_mock::ContractState { // #[test] -#[available_gas(25000000)] fn test_erc20_bridgeable_initializer() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); state.initializer(NAME, SYMBOL, SUPPLY, OWNER(), BRIDGE()); assert(state.l2_bridge_address() == BRIDGE(), 'should be BRIDGE'); @@ -75,7 +74,6 @@ fn test_erc20_bridgeable_initializer() { // #[test] -#[available_gas(30000000)] fn test_erc20_bridgeable_bridge_can_mint() { let mut state = setup(); @@ -86,7 +84,6 @@ fn test_erc20_bridgeable_bridge_can_mint() { } #[test] -#[available_gas(30000000)] #[should_panic(expected: ('ERC20: caller not bridge',))] fn test_erc20_bridgeable_bridge_only_can_mint() { let mut state = setup(); @@ -96,7 +93,6 @@ fn test_erc20_bridgeable_bridge_only_can_mint() { } #[test] -#[available_gas(30000000)] fn test_erc20_bridgeable_bridge_can_burn() { let mut state = setup(); @@ -108,7 +104,6 @@ fn test_erc20_bridgeable_bridge_can_burn() { } #[test] -#[available_gas(30000000)] #[should_panic(expected: ('ERC20: caller not bridge',))] fn test_erc20_bridgeable_bridge_only_can_burn() { let mut state = setup(); diff --git a/token/src/components/tests/token/erc20/test_erc20_metadata.cairo b/token/src/components/tests/token/erc20/test_erc20_metadata.cairo index 82f4b125..5b166727 100644 --- a/token/src/components/tests/token/erc20/test_erc20_metadata.cairo +++ b/token/src/components/tests/token/erc20/test_erc20_metadata.cairo @@ -21,9 +21,8 @@ fn STATE() -> (IWorldDispatcher, erc20_metadata_mock::ContractState) { } #[test] -#[available_gas(100000000)] fn test_erc20_metadata_initialize() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); state.erc20_metadata.initialize(NAME, SYMBOL, DECIMALS); @@ -35,9 +34,8 @@ fn test_erc20_metadata_initialize() { } #[test] -#[available_gas(100000000)] fn test_erc20_metadata_update_total_supply() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); state.erc20_metadata.update_total_supply(0, 420); assert(state.erc20_metadata.total_supply() == 420, 'Should be 420'); @@ -51,20 +49,18 @@ fn test_erc20_metadata_update_total_supply() { #[test] -#[available_gas(10000000)] #[should_panic(expected: ('u256_sub Overflow',))] fn test_erc20_metadata_update_total_supply_sub_overflow() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); state.erc20_metadata.update_total_supply(1, 0); } #[test] -#[available_gas(10000000)] #[should_panic(expected: ('u256_add Overflow',))] fn test_erc20_metadata_update_total_supply_add_overflow() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); state.erc20_metadata.update_total_supply(0, BoundedInt::max()); state.erc20_metadata.update_total_supply(0, 1); diff --git a/token/src/components/tests/token/erc20/test_erc20_mintable_burnable.cairo b/token/src/components/tests/token/erc20/test_erc20_mintable_burnable.cairo index 3bd60727..167065ff 100644 --- a/token/src/components/tests/token/erc20/test_erc20_mintable_burnable.cairo +++ b/token/src/components/tests/token/erc20/test_erc20_mintable_burnable.cairo @@ -32,9 +32,8 @@ fn STATE() -> (IWorldDispatcher, erc20_mintable_burnable_mock::ContractState) { } #[test] -#[available_gas(100000000)] fn test_erc20_mintable_mint() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); let total_supply = state.total_supply(); state.erc20_mintable.mint(RECIPIENT(), VALUE); @@ -45,18 +44,16 @@ fn test_erc20_mintable_mint() { } #[test] -#[available_gas(100000000)] #[should_panic(expected: ('ERC20: mint to 0',))] fn test_erc20_mintable_mint_to_zero() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); state.erc20_mintable.mint(ZERO(), VALUE); } #[test] -#[available_gas(100000000)] fn test_erc20_burnable_burn() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); let total_supply = state.total_supply(); state.erc20_mintable.mint(RECIPIENT(), VALUE); @@ -72,10 +69,9 @@ fn test_erc20_burnable_burn() { #[test] -#[available_gas(100000000)] #[should_panic(expected: ('ERC20: burn from 0',))] fn test_erc20_burnable_burn_from_zero() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); state.erc20_burnable.burn(ZERO(), VALUE); } diff --git a/token/src/erc1155/tests.cairo b/token/src/erc1155/tests.cairo index 3447581b..2821445e 100644 --- a/token/src/erc1155/tests.cairo +++ b/token/src/erc1155/tests.cairo @@ -61,7 +61,6 @@ fn setup() -> ERC1155::ContractState { // #[test] -#[available_gas(20000000)] fn test_constructor() { let (world, mut state) = STATE(); ERC1155::constructor(ref state, world.contract_address, NAME, SYMBOL, URI); @@ -83,9 +82,8 @@ fn test_constructor() { } #[test] -#[available_gas(20000000)] fn test_initializer() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); InternalImpl::initializer(ref state, NAME, SYMBOL, URI); assert(ERC1155MetadataImpl::name(@state) == NAME, 'Name should be NAME'); @@ -107,7 +105,6 @@ fn test_initializer() { // #[test] -#[available_gas(20000000)] fn test_balance_of() { let mut state = setup(); @@ -117,7 +114,6 @@ fn test_balance_of() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: invalid account',))] fn test_balance_of_zero() { let state = setup(); @@ -126,7 +122,6 @@ fn test_balance_of_zero() { #[test] -#[available_gas(20000000)] fn test_balance_of_batch() { let mut state = setup(); @@ -141,7 +136,6 @@ fn test_balance_of_batch() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: invalid account',))] fn test_balance_of_batch_zero() { let state = setup(); @@ -154,9 +148,8 @@ fn test_balance_of_batch_zero() { // #[test] -#[available_gas(20000000)] fn test_set_approval_for_all() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); testing::set_caller_address(OWNER()); assert(!ERC1155Impl::is_approved_for_all(@state, OWNER(), OPERATOR()), 'Invalid default value'); @@ -179,27 +172,24 @@ fn test_set_approval_for_all() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: self approval',))] fn test_set_approval_for_all_owner_equal_operator_true() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); testing::set_caller_address(OWNER()); ERC1155Impl::set_approval_for_all(ref state, OWNER(), true); } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: self approval',))] fn test_set_approval_for_all_owner_equal_operator_false() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); testing::set_caller_address(OWNER()); ERC1155Impl::set_approval_for_all(ref state, OWNER(), false); } #[test] -#[available_gas(20000000)] fn test__set_approval_for_all() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); assert(!ERC1155Impl::is_approved_for_all(@state, OWNER(), OPERATOR()), 'Invalid default value'); InternalImpl::_set_approval_for_all(ref state, OWNER(), OPERATOR(), true); @@ -220,18 +210,16 @@ fn test__set_approval_for_all() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: self approval',))] fn test__set_approval_for_all_owner_equal_operator_true() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); InternalImpl::_set_approval_for_all(ref state, OWNER(), OWNER(), true); } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: self approval',))] fn test__set_approval_for_all_owner_equal_operator_false() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); InternalImpl::_set_approval_for_all(ref state, OWNER(), OWNER(), false); } @@ -241,7 +229,6 @@ fn test__set_approval_for_all_owner_equal_operator_false() { // #[test] -#[available_gas(50000000)] fn test_safe_transfer_from_owner() { let mut state = setup(); let id = TOKEN_ID; @@ -259,7 +246,6 @@ fn test_safe_transfer_from_owner() { } #[test] -#[available_gas(50000000)] fn test_transferFrom_owner() { let mut state = setup(); let id = TOKEN_ID; @@ -277,27 +263,24 @@ fn test_transferFrom_owner() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: wrong sender',))] fn test_safe_transfer_from_zero() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); ERC1155Impl::safe_transfer_from( ref state, ZERO(), RECIPIENT(), TOKEN_ID, TOKEN_AMOUNT, array![] ); } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: wrong sender',))] fn test_safeTransferFrom_zero() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); ERC1155CamelOnlyImpl::safeTransferFrom( ref state, ZERO(), RECIPIENT(), TOKEN_ID, TOKEN_AMOUNT, array![] ); } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: invalid receiver',))] fn test_safe_transfer_from_to_zero() { let mut state = setup(); @@ -306,7 +289,6 @@ fn test_safe_transfer_from_to_zero() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: invalid receiver',))] fn test_safeTransferFrom_to_zero() { let mut state = setup(); @@ -317,7 +299,6 @@ fn test_safeTransferFrom_to_zero() { } #[test] -#[available_gas(50000000)] fn test_safe_transfer_from_to_owner() { let mut state = setup(); @@ -336,7 +317,6 @@ fn test_safe_transfer_from_to_owner() { } #[test] -#[available_gas(50000000)] fn test_safeTransferFrom_to_owner() { let mut state = setup(); @@ -357,7 +337,6 @@ fn test_safeTransferFrom_to_owner() { } #[test] -#[available_gas(50000000)] fn test_transfer_from_approved_for_all() { let mut state = setup(); let id = TOKEN_ID; @@ -379,7 +358,6 @@ fn test_transfer_from_approved_for_all() { } #[test] -#[available_gas(50000000)] fn test_safeTransferFrom_approved_for_all() { let mut state = setup(); let id = TOKEN_ID; @@ -401,7 +379,6 @@ fn test_safeTransferFrom_approved_for_all() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: unauthorized caller',))] fn test_safe_transfer_from_unauthorized() { let mut state = setup(); @@ -412,7 +389,6 @@ fn test_safe_transfer_from_unauthorized() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: unauthorized caller',))] fn test_safeTransferFrom_unauthorized() { let mut state = setup(); @@ -428,7 +404,6 @@ fn test_safeTransferFrom_unauthorized() { // #[test] -#[available_gas(50000000)] fn test_safe_batch_transfer_from_owner() { let mut state = setup(); let owner = OWNER(); @@ -449,7 +424,6 @@ fn test_safe_batch_transfer_from_owner() { } #[test] -#[available_gas(50000000)] fn test_safeBatchTransferFrom_owner() { let mut state = setup(); let owner = OWNER(); @@ -470,10 +444,9 @@ fn test_safeBatchTransferFrom_owner() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: wrong sender',))] fn test_safe_batch_transfer_from_zero() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); let ids = array![TOKEN_ID, TOKEN_ID_2]; let amounts = array![TOKEN_AMOUNT, TOKEN_AMOUNT_2]; @@ -482,10 +455,9 @@ fn test_safe_batch_transfer_from_zero() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: wrong sender',))] fn test_safeBatchTransferFrom_zero() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); let ids = array![TOKEN_ID, TOKEN_ID_2]; let amounts = array![TOKEN_AMOUNT, TOKEN_AMOUNT_2]; @@ -496,10 +468,9 @@ fn test_safeBatchTransferFrom_zero() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: invalid receiver',))] fn test_safe_batch_transfer_from_to_zero() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); let ids = array![TOKEN_ID, TOKEN_ID_2]; let amounts = array![TOKEN_AMOUNT, TOKEN_AMOUNT_2]; @@ -508,10 +479,9 @@ fn test_safe_batch_transfer_from_to_zero() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: invalid receiver',))] fn test_safeBatchTransferFrom_to_zero() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); let ids = array![TOKEN_ID, TOKEN_ID_2]; let amounts = array![TOKEN_AMOUNT, TOKEN_AMOUNT_2]; @@ -520,7 +490,6 @@ fn test_safeBatchTransferFrom_to_zero() { } #[test] -#[available_gas(50000000)] fn test_safe_batch_transfer_from_to_owner() { let mut state = setup(); @@ -553,7 +522,6 @@ fn test_safe_batch_transfer_from_to_owner() { } #[test] -#[available_gas(50000000)] fn test_safeBatchTransferFrom_to_owner() { let mut state = setup(); @@ -586,7 +554,6 @@ fn test_safeBatchTransferFrom_to_owner() { } #[test] -#[available_gas(50000000)] fn test_batch_transfer_from_approved_for_all() { let mut state = setup(); let owner = OWNER(); @@ -611,7 +578,6 @@ fn test_batch_transfer_from_approved_for_all() { } #[test] -#[available_gas(50000000)] fn test_safeBatchTransferFrom_approved_for_all() { let mut state = setup(); let owner = OWNER(); @@ -636,7 +602,6 @@ fn test_safeBatchTransferFrom_approved_for_all() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: unauthorized caller',))] fn test_safe_batch_transfer_from_unauthorized() { let mut state = setup(); @@ -648,7 +613,6 @@ fn test_safe_batch_transfer_from_unauthorized() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: unauthorized caller',))] fn test_safeBatchTransferFrom_unauthorized() { let mut state = setup(); @@ -666,9 +630,8 @@ fn test_safeBatchTransferFrom_unauthorized() { // #[test] -#[available_gas(20000000)] fn test__mint() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); let recipient = RECIPIENT(); assert( @@ -685,10 +648,9 @@ fn test__mint() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: invalid receiver',))] fn test__mint_to_zero() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); InternalImpl::_mint(ref state, ZERO(), TOKEN_ID, TOKEN_AMOUNT); } @@ -698,7 +660,6 @@ fn test__mint_to_zero() { // #[test] -#[available_gas(20000000)] fn test__burn() { let mut state = setup(); @@ -718,7 +679,6 @@ fn test__burn() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC1155: insufficient balance',))] fn test__burn_more_than_balance() { let mut state = setup(); diff --git a/token/src/erc20/tests.cairo b/token/src/erc20/tests.cairo index a98f582b..4ac8ff10 100644 --- a/token/src/erc20/tests.cairo +++ b/token/src/erc20/tests.cairo @@ -53,9 +53,8 @@ fn setup() -> ERC20::ContractState { // #[test] -#[available_gas(25000000)] fn test_initializer() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); InternalImpl::initializer(ref state, NAME, SYMBOL); assert(ERC20MetadataImpl::name(@state) == NAME, 'Name should be NAME'); @@ -66,7 +65,6 @@ fn test_initializer() { #[test] -#[available_gas(25000000)] fn test_constructor() { let (world, mut state) = STATE(); ERC20::constructor(ref state, world.contract_address, NAME, SYMBOL, SUPPLY, OWNER()); @@ -85,24 +83,21 @@ fn test_constructor() { // #[test] -#[available_gas(25000000)] fn test_total_supply() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); InternalImpl::_mint(ref state, OWNER(), SUPPLY); assert(ERC20Impl::total_supply(@state) == SUPPLY, 'Should eq SUPPLY'); } #[test] -#[available_gas(25000000)] fn test_balance_of() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); InternalImpl::_mint(ref state, OWNER(), SUPPLY); assert(ERC20Impl::balance_of(@state, OWNER()) == SUPPLY, 'Should eq SUPPLY'); } #[test] -#[available_gas(25000000)] fn test_allowance() { let mut state = setup(); testing::set_caller_address(OWNER()); @@ -116,7 +111,6 @@ fn test_allowance() { // #[test] -#[available_gas(25000000)] fn test_approve() { let mut state = setup(); testing::set_caller_address(OWNER()); @@ -129,7 +123,6 @@ fn test_approve() { } #[test] -#[available_gas(25000000)] #[should_panic(expected: ('ERC20: approve from 0',))] fn test_approve_from_zero() { let mut state = setup(); @@ -137,7 +130,6 @@ fn test_approve_from_zero() { } #[test] -#[available_gas(25000000)] #[should_panic(expected: ('ERC20: approve to 0',))] fn test_approve_to_zero() { let mut state = setup(); @@ -146,7 +138,6 @@ fn test_approve_to_zero() { } #[test] -#[available_gas(25000000)] fn test__approve() { let mut state = setup(); testing::set_caller_address(OWNER()); @@ -159,7 +150,6 @@ fn test__approve() { } #[test] -#[available_gas(25000000)] #[should_panic(expected: ('ERC20: approve from 0',))] fn test__approve_from_zero() { let mut state = setup(); @@ -167,7 +157,6 @@ fn test__approve_from_zero() { } #[test] -#[available_gas(25000000)] #[should_panic(expected: ('ERC20: approve to 0',))] fn test__approve_to_zero() { let mut state = setup(); @@ -180,7 +169,6 @@ fn test__approve_to_zero() { // #[test] -#[available_gas(25000000)] fn test_transfer() { let mut state = setup(); testing::set_caller_address(OWNER()); @@ -193,7 +181,6 @@ fn test_transfer() { } #[test] -#[available_gas(25000000)] fn test__transfer() { let mut state = setup(); @@ -206,7 +193,6 @@ fn test__transfer() { } #[test] -#[available_gas(25000000)] #[should_panic(expected: ('u256_sub Overflow',))] fn test__transfer_not_enough_balance() { let mut state = setup(); @@ -217,7 +203,6 @@ fn test__transfer_not_enough_balance() { } #[test] -#[available_gas(25000000)] #[should_panic(expected: ('ERC20: transfer from 0',))] fn test__transfer_from_zero() { let mut state = setup(); @@ -225,7 +210,6 @@ fn test__transfer_from_zero() { } #[test] -#[available_gas(25000000)] #[should_panic(expected: ('ERC20: transfer to 0',))] fn test__transfer_to_zero() { let mut state = setup(); @@ -237,7 +221,6 @@ fn test__transfer_to_zero() { // #[test] -#[available_gas(30000000)] fn test_transfer_from() { let mut state = setup(); testing::set_caller_address(OWNER()); @@ -257,7 +240,6 @@ fn test_transfer_from() { } #[test] -#[available_gas(25000000)] #[should_panic(expected: ('u256_sub Overflow',))] fn test_transfer_from_greater_than_allowance() { let mut state = setup(); @@ -270,7 +252,6 @@ fn test_transfer_from_greater_than_allowance() { } #[test] -#[available_gas(25000000)] #[should_panic(expected: ('ERC20: transfer to 0',))] fn test_transfer_from_to_zero_address() { let mut state = setup(); @@ -282,7 +263,6 @@ fn test_transfer_from_to_zero_address() { } #[test] -#[available_gas(25000000)] #[should_panic(expected: ('u256_sub Overflow',))] fn test_transfer_from_from_zero_address() { let mut state = setup(); @@ -294,7 +274,6 @@ fn test_transfer_from_from_zero_address() { // #[test] -#[available_gas(25000000)] fn test__spend_allowance_not_unlimited() { let mut state = setup(); @@ -315,9 +294,8 @@ fn test__spend_allowance_not_unlimited() { // #[test] -#[available_gas(25000000)] fn test__mint() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); InternalImpl::_mint(ref state, OWNER(), VALUE); assert_only_event_transfer(ZERO(), OWNER(), VALUE); assert(ERC20Impl::balance_of(@state, OWNER()) == VALUE, 'Should eq amount'); @@ -325,10 +303,9 @@ fn test__mint() { } #[test] -#[available_gas(25000000)] #[should_panic(expected: ('ERC20: mint to 0',))] fn test__mint_to_zero() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); InternalImpl::_mint(ref state, Zeroable::zero(), VALUE); } @@ -337,7 +314,6 @@ fn test__mint_to_zero() { // #[test] -#[available_gas(25000000)] fn test__burn() { let mut state = setup(); InternalImpl::_burn(ref state, OWNER(), VALUE); @@ -348,7 +324,6 @@ fn test__burn() { } #[test] -#[available_gas(25000000)] #[should_panic(expected: ('ERC20: burn from 0',))] fn test__burn_from_zero() { let mut state = setup(); diff --git a/token/src/erc721/tests.cairo b/token/src/erc721/tests.cairo index 646daaa2..d8c3a4a2 100644 --- a/token/src/erc721/tests.cairo +++ b/token/src/erc721/tests.cairo @@ -86,7 +86,6 @@ fn setup() -> ERC721::ContractState { // #[test] -#[available_gas(20000000)] fn test_constructor() { let (world, mut state) = STATE(); ERC721::constructor(ref state, world.contract_address, NAME, SYMBOL, URI, OWNER(), TOKEN_ID); @@ -109,9 +108,8 @@ fn test_constructor() { } #[test] -#[available_gas(10000000)] fn test_initializer() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); InternalImpl::initializer(ref state, NAME, SYMBOL, URI); assert(ERC721MetadataImpl::name(@state) == NAME, 'Name should be NAME'); @@ -137,14 +135,12 @@ fn test_initializer() { // #[test] -#[available_gas(20000000)] fn test_balance_of() { let state = setup(); assert(ERC721Impl::balance_of(@state, OWNER()) == 1, 'Should return balance'); } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: invalid account',))] fn test_balance_of_zero() { let state = setup(); @@ -152,14 +148,12 @@ fn test_balance_of_zero() { } #[test] -#[available_gas(20000000)] fn test_owner_of() { let state = setup(); assert(ERC721Impl::owner_of(@state, TOKEN_ID) == OWNER(), 'Should return owner'); } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: invalid token ID',))] fn test_owner_of_non_minted() { let state = setup(); @@ -167,7 +161,6 @@ fn test_owner_of_non_minted() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: invalid token ID',))] fn test_token_uri_non_minted() { let state = setup(); @@ -175,7 +168,6 @@ fn test_token_uri_non_minted() { } #[test] -#[available_gas(20000000)] fn test_get_approved() { let mut state = setup(); let spender = SPENDER(); @@ -187,7 +179,6 @@ fn test_get_approved() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: invalid token ID',))] fn test_get_approved_nonexistent() { let mut state = setup(); @@ -195,9 +186,8 @@ fn test_get_approved_nonexistent() { } #[test] -#[available_gas(20000000)] fn test__exists() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); let token_id = TOKEN_ID; assert(!InternalImpl::_exists(@state, token_id), 'Token should not exist'); @@ -227,7 +217,6 @@ fn test__exists() { // #[test] -#[available_gas(20000000)] fn test_approve_from_owner() { let mut state = setup(); @@ -241,7 +230,6 @@ fn test_approve_from_owner() { } #[test] -#[available_gas(20000000)] fn test_approve_from_operator() { let mut state = setup(); @@ -259,7 +247,6 @@ fn test_approve_from_operator() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: unauthorized caller',))] fn test_approve_from_unauthorized() { let mut state = setup(); @@ -269,7 +256,6 @@ fn test_approve_from_unauthorized() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: approval to owner',))] fn test_approve_to_owner() { let mut state = setup(); @@ -279,16 +265,14 @@ fn test_approve_to_owner() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: invalid token ID',))] fn test_approve_nonexistent() { // let mut state = STATE(); - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); ERC721Impl::approve(ref state, SPENDER(), TOKEN_ID); } #[test] -#[available_gas(20000000)] fn test__approve() { let mut state = setup(); InternalImpl::_approve(ref state, SPENDER(), TOKEN_ID); @@ -300,7 +284,6 @@ fn test__approve() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: approval to owner',))] fn test__approve_to_owner() { let mut state = setup(); @@ -308,11 +291,10 @@ fn test__approve_to_owner() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: invalid token ID',))] fn test__approve_nonexistent() { //let mut state = STATE(); - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); InternalImpl::_approve(ref state, SPENDER(), TOKEN_ID); } @@ -321,10 +303,9 @@ fn test__approve_nonexistent() { // #[test] -#[available_gas(20000000)] fn test_set_approval_for_all() { //let mut state = STATE(); - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); testing::set_caller_address(OWNER()); assert(!ERC721Impl::is_approved_for_all(@state, OWNER(), OPERATOR()), 'Invalid default value'); @@ -347,30 +328,27 @@ fn test_set_approval_for_all() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: self approval',))] fn test_set_approval_for_all_owner_equal_operator_true() { //let mut state = STATE(); - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); testing::set_caller_address(OWNER()); ERC721Impl::set_approval_for_all(ref state, OWNER(), true); } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: self approval',))] fn test_set_approval_for_all_owner_equal_operator_false() { //let mut state = STATE(); - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); testing::set_caller_address(OWNER()); ERC721Impl::set_approval_for_all(ref state, OWNER(), false); } #[test] -#[available_gas(20000000)] fn test__set_approval_for_all() { //let mut state = STATE(); - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); assert(!ERC721Impl::is_approved_for_all(@state, OWNER(), OPERATOR()), 'Invalid default value'); InternalImpl::_set_approval_for_all(ref state, OWNER(), OPERATOR(), true); @@ -391,20 +369,18 @@ fn test__set_approval_for_all() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: self approval',))] fn test__set_approval_for_all_owner_equal_operator_true() { //let mut state = STATE(); - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); InternalImpl::_set_approval_for_all(ref state, OWNER(), OWNER(), true); } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: self approval',))] fn test__set_approval_for_all_owner_equal_operator_false() { // let mut state = STATE(); - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); InternalImpl::_set_approval_for_all(ref state, OWNER(), OWNER(), false); } @@ -414,7 +390,6 @@ fn test__set_approval_for_all_owner_equal_operator_false() { // #[test] -#[available_gas(60000000)] fn test_transfer_from_owner() { let mut state = setup(); let token_id = TOKEN_ID; @@ -435,7 +410,6 @@ fn test_transfer_from_owner() { } #[test] -#[available_gas(50000000)] fn test_transferFrom_owner() { let mut state = setup(); let token_id = TOKEN_ID; @@ -456,25 +430,22 @@ fn test_transferFrom_owner() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: invalid token ID',))] fn test_transfer_from_nonexistent() { //let mut state = STATE(); - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); ERC721Impl::transfer_from(ref state, ZERO(), RECIPIENT(), TOKEN_ID); } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: invalid token ID',))] fn test_transferFrom_nonexistent() { //let mut state = STATE(); - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); ERC721CamelOnlyImpl::transferFrom(ref state, ZERO(), RECIPIENT(), TOKEN_ID); } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: invalid receiver',))] fn test_transfer_from_to_zero() { let mut state = setup(); @@ -483,7 +454,6 @@ fn test_transfer_from_to_zero() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: invalid receiver',))] fn test_transferFrom_to_zero() { let mut state = setup(); @@ -493,7 +463,6 @@ fn test_transferFrom_to_zero() { } #[test] -#[available_gas(50000000)] fn test_transfer_from_to_owner() { let mut state = setup(); @@ -509,7 +478,6 @@ fn test_transfer_from_to_owner() { } #[test] -#[available_gas(50000000)] fn test_transferFrom_to_owner() { let mut state = setup(); @@ -525,7 +493,6 @@ fn test_transferFrom_to_owner() { } #[test] -#[available_gas(50000000)] fn test_transfer_from_approved() { let mut state = setup(); let token_id = TOKEN_ID; @@ -545,7 +512,6 @@ fn test_transfer_from_approved() { } #[test] -#[available_gas(50000000)] fn test_transferFrom_approved() { let mut state = setup(); let token_id = TOKEN_ID; @@ -565,7 +531,6 @@ fn test_transferFrom_approved() { } #[test] -#[available_gas(50000000)] fn test_transfer_from_approved_for_all() { let mut state = setup(); let token_id = TOKEN_ID; @@ -586,7 +551,6 @@ fn test_transfer_from_approved_for_all() { } #[test] -#[available_gas(50000000)] fn test_transferFrom_approved_for_all() { let mut state = setup(); let token_id = TOKEN_ID; @@ -607,7 +571,6 @@ fn test_transferFrom_approved_for_all() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: unauthorized caller',))] fn test_transfer_from_unauthorized() { let mut state = setup(); @@ -616,7 +579,6 @@ fn test_transfer_from_unauthorized() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: unauthorized caller',))] fn test_transferFrom_unauthorized() { let mut state = setup(); @@ -629,7 +591,6 @@ fn test_transferFrom_unauthorized() { // // // #[test] -// #[available_gas(20000000)] // fn test_safe_transfer_from_to_account() { // let mut state = setup(); // let account = setup_account(); @@ -646,7 +607,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // fn test_safeTransferFrom_to_account() { // let mut state = setup(); // let account = setup_account(); @@ -663,7 +623,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // fn test_safe_transfer_from_to_account_camel() { // let mut state = setup(); // let account = setup_camel_account(); @@ -680,7 +639,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // fn test_safeTransferFrom_to_account_camel() { // let mut state = setup(); // let account = setup_camel_account(); @@ -697,7 +655,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // fn test_safe_transfer_from_to_receiver() { // let mut state = setup(); // let receiver = setup_receiver(); @@ -714,7 +671,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // fn test_safeTransferFrom_to_receiver() { // let mut state = setup(); // let receiver = setup_receiver(); @@ -731,7 +687,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // fn test_safe_transfer_from_to_receiver_camel() { // let mut state = setup(); // let receiver = setup_camel_receiver(); @@ -748,7 +703,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // fn test_safeTransferFrom_to_receiver_camel() { // let mut state = setup(); // let receiver = setup_camel_receiver(); @@ -765,7 +719,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // #[should_panic(expected: ('ERC721: safe transfer failed',))] // fn test_safe_transfer_from_to_receiver_failure() { // let mut state = setup(); @@ -778,7 +731,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // #[should_panic(expected: ('ERC721: safe transfer failed',))] // fn test_safeTransferFrom_to_receiver_failure() { // let mut state = setup(); @@ -791,7 +743,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // #[should_panic(expected: ('ERC721: safe transfer failed',))] // fn test_safe_transfer_from_to_receiver_failure_camel() { // let mut state = setup(); @@ -804,7 +755,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // #[should_panic(expected: ('ERC721: safe transfer failed',))] // fn test_safeTransferFrom_to_receiver_failure_camel() { // let mut state = setup(); @@ -817,7 +767,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // #[should_panic(expected: ('ENTRYPOINT_NOT_FOUND',))] // fn test_safe_transfer_from_to_non_receiver() { // let mut state = setup(); @@ -830,7 +779,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // #[should_panic(expected: ('ENTRYPOINT_NOT_FOUND',))] // fn test_safeTransferFrom_to_non_receiver() { // let mut state = setup(); @@ -843,7 +791,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // #[should_panic(expected: ('ERC721: invalid token ID',))] // fn test_safe_transfer_from_nonexistent() { // let mut state = STATE(); @@ -851,7 +798,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // #[should_panic(expected: ('ERC721: invalid token ID',))] // fn test_safeTransferFrom_nonexistent() { // let mut state = STATE(); @@ -859,7 +805,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // #[should_panic(expected: ('ERC721: invalid receiver',))] // fn test_safe_transfer_from_to_zero() { // let mut state = setup(); @@ -868,7 +813,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // #[should_panic(expected: ('ERC721: invalid receiver',))] // fn test_safeTransferFrom_to_zero() { // let mut state = setup(); @@ -877,7 +821,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // fn test_safe_transfer_from_to_owner() { // let mut state = STATE(); // let token_id = TOKEN_ID; @@ -898,7 +841,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // fn test_safeTransferFrom_to_owner() { // let mut state = STATE(); // let token_id = TOKEN_ID; @@ -919,7 +861,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // fn test_safe_transfer_from_to_owner_camel() { // let mut state = STATE(); // let token_id = TOKEN_ID; @@ -940,7 +881,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // fn test_safeTransferFrom_to_owner_camel() { // let mut state = STATE(); // let token_id = TOKEN_ID; @@ -961,7 +901,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // fn test_safe_transfer_from_approved() { // let mut state = setup(); // let receiver = setup_receiver(); @@ -982,7 +921,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // fn test_safeTransferFrom_approved() { // let mut state = setup(); // let receiver = setup_receiver(); @@ -1003,7 +941,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // fn test_safe_transfer_from_approved_camel() { // let mut state = setup(); // let receiver = setup_camel_receiver(); @@ -1024,7 +961,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // fn test_safeTransferFrom_approved_camel() { // let mut state = setup(); // let receiver = setup_camel_receiver(); @@ -1045,7 +981,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // fn test_safe_transfer_from_approved_for_all() { // let mut state = setup(); // let receiver = setup_receiver(); @@ -1066,7 +1001,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // fn test_safeTransferFrom_approved_for_all() { // let mut state = setup(); // let receiver = setup_receiver(); @@ -1087,7 +1021,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // fn test_safe_transfer_from_approved_for_all_camel() { // let mut state = setup(); // let receiver = setup_camel_receiver(); @@ -1108,7 +1041,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // fn test_safeTransferFrom_approved_for_all_camel() { // let mut state = setup(); // let receiver = setup_camel_receiver(); @@ -1129,7 +1061,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // #[should_panic(expected: ('ERC721: unauthorized caller',))] // fn test_safe_transfer_from_unauthorized() { // let mut state = setup(); @@ -1138,7 +1069,6 @@ fn test_transferFrom_unauthorized() { // } // #[test] -// #[available_gas(20000000)] // #[should_panic(expected: ('ERC721: unauthorized caller',))] // fn test_safeTransferFrom_unauthorized() { // let mut state = setup(); @@ -1151,7 +1081,6 @@ fn test_transferFrom_unauthorized() { // #[test] -#[available_gas(50000000)] fn test__transfer() { let mut state = setup(); let token_id = TOKEN_ID; @@ -1167,15 +1096,13 @@ fn test__transfer() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: invalid token ID',))] fn test__transfer_nonexistent() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); InternalImpl::_transfer(ref state, ZERO(), RECIPIENT(), TOKEN_ID); } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: invalid receiver',))] fn test__transfer_to_zero() { let mut state = setup(); @@ -1183,7 +1110,6 @@ fn test__transfer_to_zero() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: wrong sender',))] fn test__transfer_from_invalid_owner() { let mut state = setup(); @@ -1195,9 +1121,8 @@ fn test__transfer_from_invalid_owner() { // #[test] -#[available_gas(20000000)] fn test__mint() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); let recipient = RECIPIENT(); let token_id = TOKEN_ID; @@ -1209,15 +1134,13 @@ fn test__mint() { } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: invalid receiver',))] fn test__mint_to_zero() { - let (world, mut state) = STATE(); + let (_world, mut state) = STATE(); InternalImpl::_mint(ref state, ZERO(), TOKEN_ID); } #[test] -#[available_gas(20000000)] #[should_panic(expected: ('ERC721: token already minted',))] fn test__mint_already_exist() { let mut state = setup(); @@ -1229,7 +1152,6 @@ fn test__mint_already_exist() { // // // #[test] -// #[available_gas(20000000)] // fn test__safe_mint_to_receiver() { // let mut state = STATE(); // let recipient = setup_receiver(); @@ -1243,7 +1165,6 @@ fn test__mint_already_exist() { // } // #[test] -// #[available_gas(20000000)] // fn test__safe_mint_to_receiver_camel() { // let mut state = STATE(); // let recipient = setup_camel_receiver(); @@ -1257,7 +1178,6 @@ fn test__mint_already_exist() { // } // #[test] -// #[available_gas(20000000)] // fn test__safe_mint_to_account() { // let mut state = STATE(); // let account = setup_account(); @@ -1271,7 +1191,6 @@ fn test__mint_already_exist() { // } // #[test] -// #[available_gas(20000000)] // fn test__safe_mint_to_account_camel() { // let mut state = STATE(); // let account = setup_camel_account(); @@ -1285,7 +1204,6 @@ fn test__mint_already_exist() { // } // #[test] -// #[available_gas(20000000)] // #[should_panic(expected: ('ENTRYPOINT_NOT_FOUND',))] // fn test__safe_mint_to_non_receiver() { // let mut state = STATE(); @@ -1298,7 +1216,6 @@ fn test__mint_already_exist() { // } // #[test] -// #[available_gas(20000000)] // #[should_panic(expected: ('ERC721: safe mint failed',))] // fn test__safe_mint_to_receiver_failure() { // let mut state = STATE(); @@ -1311,7 +1228,6 @@ fn test__mint_already_exist() { // } // #[test] -// #[available_gas(20000000)] // #[should_panic(expected: ('ERC721: safe mint failed',))] // fn test__safe_mint_to_receiver_failure_camel() { // let mut state = STATE(); @@ -1324,7 +1240,6 @@ fn test__mint_already_exist() { // } // #[test] -// #[available_gas(20000000)] // #[should_panic(expected: ('ERC721: invalid receiver',))] // fn test__safe_mint_to_zero() { // let mut state = STATE(); @@ -1332,7 +1247,6 @@ fn test__mint_already_exist() { // } // #[test] -// #[available_gas(20000000)] // #[should_panic(expected: ('ERC721: token already minted',))] // fn test__safe_mint_already_exist() { // let mut state = setup(); @@ -1344,7 +1258,6 @@ fn test__mint_already_exist() { // #[test] -#[available_gas(25000000)] fn test__burn() { let mut state = setup(); @@ -1369,10 +1282,9 @@ fn test__burn() { } #[test] -#[available_gas(30000000)] #[should_panic(expected: ('ERC721: invalid token ID',))] fn test__burn_nonexistent() { - let (mut world, mut state) = STATE(); + let (mut _world, mut state) = STATE(); InternalImpl::_burn(ref state, TOKEN_ID); } @@ -1381,7 +1293,6 @@ fn test__burn_nonexistent() { // // #[test] -// #[available_gas(20000000)] // fn test__set_token_uri() { // let mut state = setup(); @@ -1391,7 +1302,6 @@ fn test__burn_nonexistent() { // } // #[test] -// #[available_gas(20000000)] // #[should_panic(expected: ('ERC721: invalid token ID',))] // fn test__set_token_uri_nonexistent() { // let mut state = STATE(); diff --git a/token/src/presets/erc20/bridgeable.cairo b/token/src/presets/erc20/bridgeable.cairo index ce647d46..ed432631 100644 --- a/token/src/presets/erc20/bridgeable.cairo +++ b/token/src/presets/erc20/bridgeable.cairo @@ -55,6 +55,22 @@ trait IERC20BridgeablePreset { } +/// +/// Interface required to remove compiler warnings and future +/// deprecation. +/// +#[starknet::interface] +trait IERC20BridgeableInitializer { + fn initializer( + ref self: TState, + name: felt252, + symbol: felt252, + initial_supply: u256, + recipient: ContractAddress, + l2_bridge_address: ContractAddress + ); +} + #[dojo::contract] mod ERC20Bridgeable { use token::erc20::interface; @@ -168,8 +184,7 @@ mod ERC20Bridgeable { // #[abi(embed_v0)] - #[generate_trait] - impl ERC20InitializerImpl of ERC20InitializerTrait { + impl ERC20InitializerImpl of super::IERC20BridgeableInitializer { fn initializer( ref self: ContractState, name: felt252, diff --git a/token/src/presets/erc20/tests_bridgeable.cairo b/token/src/presets/erc20/tests_bridgeable.cairo index 2ac4b3c6..f61da081 100644 --- a/token/src/presets/erc20/tests_bridgeable.cairo +++ b/token/src/presets/erc20/tests_bridgeable.cairo @@ -95,9 +95,8 @@ fn setup() -> (IWorldDispatcher, IERC20BridgeablePresetDispatcher) { // #[test] -#[available_gas(30000000)] fn test_initializer() { - let (world, mut erc20_bridgeable) = setup(); + let (_world, mut erc20_bridgeable) = setup(); assert(erc20_bridgeable.balance_of(OWNER()) == SUPPLY, 'Should eq inital_supply'); assert(erc20_bridgeable.total_supply() == SUPPLY, 'Should eq inital_supply'); @@ -113,7 +112,6 @@ fn test_initializer() { // #[test] -#[available_gas(25000000)] fn test_approve() { let (world, mut erc20_bridgeable) = setup(); @@ -137,7 +135,6 @@ fn test_approve() { // #[test] -#[available_gas(30000000)] fn test_transfer() { let (world, mut erc20_bridgeable) = setup(); @@ -163,7 +160,6 @@ fn test_transfer() { // #[test] -#[available_gas(40000000)] fn test_transfer_from() { let (world, mut erc20_bridgeable) = setup(); @@ -199,7 +195,6 @@ fn test_transfer_from() { // #[test] -#[available_gas(30000000)] fn test_bridge_can_mint() { let (world, mut erc20_bridgeable) = setup(); @@ -218,17 +213,15 @@ fn test_bridge_can_mint() { } #[test] -#[available_gas(30000000)] #[should_panic(expected: ('ERC20: caller not bridge', 'ENTRYPOINT_FAILED'))] fn test_bridge_only_can_mint() { - let (world, mut erc20_bridgeable) = setup(); + let (_world, mut erc20_bridgeable) = setup(); utils::impersonate(RECIPIENT()); erc20_bridgeable.mint(RECIPIENT(), VALUE); } #[test] -#[available_gas(30000000)] fn test_bridge_can_burn() { let (world, mut erc20_bridgeable) = setup(); @@ -252,10 +245,9 @@ fn test_bridge_can_burn() { } #[test] -#[available_gas(30000000)] #[should_panic(expected: ('ERC20: caller not bridge', 'ENTRYPOINT_FAILED'))] fn test_bridge_only_can_burn() { - let (world, mut erc20_bridgeable) = setup(); + let (_world, mut erc20_bridgeable) = setup(); utils::impersonate(BRIDGE()); erc20_bridgeable.mint(RECIPIENT(), VALUE); diff --git a/token/src/tests/utils.cairo b/token/src/tests/utils.cairo index 0495ab5d..6ed7019d 100644 --- a/token/src/tests/utils.cairo +++ b/token/src/tests/utils.cairo @@ -33,7 +33,10 @@ fn assert_no_events_left(address: ContractAddress) { } fn drop_event(address: ContractAddress) { - testing::pop_log_raw(address); + match testing::pop_log_raw(address) { + option::Option::Some(_) => {}, + option::Option::None => {}, + }; } fn drop_all_events(address: ContractAddress) {