From e918c4a7c4c17fa2c3d4a9986173dee1ec941a70 Mon Sep 17 00:00:00 2001 From: robertocarlous Date: Thu, 18 Jun 2026 09:25:06 +0100 Subject: [PATCH] Add slippage protection parameters to buy and sell functions --- creator-keys/src/lib.rs | 47 +- creator-keys/src/test.rs | 16 +- ...tinct_buyers_and_decrements_on_exit.1.json | 18 +- ...invariant_100_creator_zero_protocol.1.json | 3 +- ...e_split_invariant_50_50_equal_split.1.json | 3 +- ..._split_invariant_90_10_nominal_case.1.json | 3 +- ...variant_across_multiple_fee_configs.1.json | 12 +- ..._split_invariant_across_price_range.1.json | 30 +- ...it_invariant_boundary_odd_price_999.1.json | 3 +- ..._split_invariant_boundary_price_one.1.json | 3 +- ..._split_invariant_boundary_price_two.1.json | 3 +- ..._invariant_deterministic_assertions.1.json | 3 +- ...ll_fee_split_invariant_large_amount.1.json | 3 +- ...t_invariant_max_protocol_50_percent.1.json | 3 +- ...e_split_invariant_zero_net_boundary.1.json | 12 +- ..._net_is_zero_fees_absorb_full_price.1.json | 3 +- ...0_50_price_ten_equal_split_zero_net.1.json | 3 +- ...ice_protocol_takes_first_floor_unit.1.json | 3 +- ...ne_all_creator_no_protocol_rounding.1.json | 3 +- ...favors_creator_on_indivisible_price.1.json | 3 +- ...price_floors_protocol_share_to_zero.1.json | 3 +- ...vent_topic_and_data_order_is_stable.1.json | 3 +- .../test/test_buy_key_success.1.json | 3 +- ..._holder_count_counts_unique_holders.1.json | 9 +- .../test/test_get_sell_quote_success.1.json | 3 +- .../test_balance_after_buys_then_sells.1.json | 21 +- ...ce_after_sequence_of_buys_and_sells.1.json | 18 +- .../test_balance_with_non_zero_initial.1.json | 27 +- ...fee_recipient_balance_by_bps_amount.1.json | 3 +- ...ent_buyer_address_field_is_non_zero.1.json | 3 +- ..._event_buyer_address_matches_caller.1.json | 3 +- ...y_key_event_includes_payment_amount.1.json | 3 +- ...d_fields_are_validated_from_fixture.1.json | 3 +- ..._tracks_new_supply_across_purchases.1.json | 6 +- ...uy_key_event_present_after_purchase.1.json | 3 +- ...nt_topics_include_creator_and_buyer.1.json | 3 +- ...t_buy_key_positive_payment_succeeds.1.json | 3 +- ...buy_key_sufficient_payment_succeeds.1.json | 3 +- ...key_with_large_safe_amount_succeeds.1.json | 3 +- ...key_with_maximum_safe_i128_succeeds.1.json | 3 +- ...istic_across_zero_supply_transition.1.json | 6 +- ...quote_fees_sum_to_total_minus_price.1.json | 11 +- ...ote_monotonic_with_zero_creator_fee.1.json | 3 +- ...te_monotonic_with_zero_protocol_fee.1.json | 3 +- ...e_creators_independent_monotonicity.1.json | 6 +- ...t_buy_quote_price_point_1_is_stable.1.json | 3 +- ...y_quote_price_point_large_is_stable.1.json | 3 +- ..._across_multiple_buyers_small_range.1.json | 30 +- ...ote_price_unchanged_after_five_buys.1.json | 26 +- ...quote_price_unchanged_after_one_buy.1.json | 3 +- ...ecomputed_after_sell_reduces_supply.1.json | 9 +- ...able_across_50_sequential_purchases.1.json | 150 ++- ...e_stable_over_medium_volume_20_buys.1.json | 60 +- ...uote_total_amount_never_below_price.1.json | 51 +- ...dering_is_deterministic_small_range.1.json | 16 +- ...everts_when_price_exceeds_max_price.1.json | 484 +++++++++ ...ds_when_price_at_or_below_max_price.1.json | 842 ++++++++++++++++ ...s_symmetric_price_impact_after_fees.1.json | 6 +- ...ss_five_consecutive_reads_after_buy.1.json | 3 +- ...ts_latest_state_after_buy_then_sell.1.json | 6 +- ...t_creator_details_updates_after_buy.1.json | 3 +- ...est_get_creator_supply_is_read_only.1.json | 3 +- ...eator_supply_returns_current_supply.1.json | 6 +- ...consistent_across_creator_instances.1.json | 375 +++++++ ...key_decimals_matches_token_standard.1.json | 76 ++ ...n_increments_only_on_config_updates.1.json | 3 +- ...uote_zero_amount_returns_noop_quote.1.json | 3 +- ...tal_key_supply_increments_after_buy.1.json | 6 +- ...ount_reflects_mixed_trade_correctly.1.json | 12 +- ...ro_after_last_holder_exit_and_rebuy.1.json | 9 +- ...nchanged_when_holder_still_has_keys.1.json | 9 +- ...ew_consistency_with_get_key_balance.1.json | 9 +- ...er_key_count_view_increments_on_buy.1.json | 6 +- ...der_key_count_view_multiple_holders.1.json | 12 +- ...er_key_count_view_no_state_mutation.1.json | 6 +- ...ew_registered_creator_unseen_wallet.1.json | 6 +- ...der_key_count_view_structure_fields.1.json | 3 +- ...t_view_zero_keys_different_creators.1.json | 6 +- ...cal_fee_configs_apply_independently.1.json | 6 +- ...s_correctly_after_each_partial_sell.1.json | 24 +- .../test_key_balance_increments_on_buy.1.json | 6 +- .../test_key_balance_is_per_buyer.1.json | 9 +- .../test_key_balance_is_per_creator.1.json | 3 +- ...egistered_creator_and_unseen_wallet.1.json | 3 +- ...ator_even_when_other_balances_exist.1.json | 3 +- ...ged_after_rejected_reinitialization.1.json | 230 +++++ ...r_below_minimum_handle_length_fails.1.json | 77 ++ ...eator_minimum_handle_length_success.1.json | 226 +++++ ..._at_is_immutable_after_buy_and_sell.1.json | 6 +- ...o_amount_quote_calls_no_state_drift.1.json | 3 +- ...uy_succeeds_without_underflow_error.1.json | 6 +- ...nt_seller_address_field_is_non_zero.1.json | 6 +- ...event_seller_address_matches_caller.1.json | 6 +- ...cution_applies_updated_protocol_fee.1.json | 6 +- ...tches_quote_after_fee_config_update.1.json | 6 +- ..._full_exit_then_rebuy_updates_state.1.json | 9 +- ...ol_fee_recipient_balance_by_bps_fee.1.json | 6 +- ...l_key_decrements_supply_and_balance.1.json | 9 +- ...d_fields_are_validated_from_fixture.1.json | 9 +- ..._tracks_zero_supply_after_last_sale.1.json | 6 +- ...er_count_when_seller_still_has_keys.1.json | 9 +- ...emoves_holder_when_last_key_is_sold.1.json | 6 +- ...alance_accumulates_across_two_sells.1.json | 12 +- ...eeds_match_execution_at_supply_five.1.json | 18 +- ...ceeds_match_execution_at_supply_one.1.json | 6 +- ...ll_quote_with_large_amount_succeeds.1.json | 3 +- ...mum_safe_amount_50_50_fees_succeeds.1.json | 3 +- ...e_with_maximum_safe_amount_succeeds.1.json | 3 +- ...e_zero_amount_no_state_modification.1.json | 3 +- ...uote_zero_amount_returns_zero_quote.1.json | 3 +- ...sell_underflow_without_state_change.1.json | 383 +++++++ ...hen_seller_has_insufficient_balance.1.json | 6 +- ...g_last_returns_insufficient_balance.1.json | 6 +- ...ts_when_proceeds_below_min_proceeds.1.json | 689 +++++++++++++ ...roceeds_meet_or_exceed_min_proceeds.1.json | 946 ++++++++++++++++++ ...ys_succeeds_without_underflow_error.1.json | 12 +- ...through_preserves_existing_behavior.1.json | 765 ++++++++++++++ ...t_supply_alternating_buys_and_sells.1.json | 12 +- ...ce_decremented_correctly_after_sell.1.json | 9 +- ...upply_buy_then_sell_returns_to_zero.1.json | 6 +- ...y_buy_two_sell_one_conserves_supply.1.json | 9 +- ...r_one_creator_do_not_affect_another.1.json | 9 +- ...ply_mixed_trades_three_participants.1.json | 24 +- ...le_buys_per_holder_sum_equals_total.1.json | 9 +- ...ver_goes_below_zero_after_all_sells.1.json | 18 +- ...upply_three_buyers_sum_equals_total.1.json | 9 +- ...er_failed_sell_insufficient_balance.1.json | 3 +- ...ed_after_failed_sell_not_registered.1.json | 3 +- ...rotocol_fees_across_distinct_buyers.1.json | 9 +- ...ter_failed_buy_unregistered_creator.1.json | 3 +- ...er_failed_sell_insufficient_balance.1.json | 3 +- ...yment_to_creator_after_protocol_fee.1.json | 3 +- ...no_rounding_errors_with_odd_amounts.1.json | 3 +- ...eator_bps_with_partial_protocol_fee.1.json | 3 +- ...rotocol_bps_full_payment_to_creator.1.json | 3 +- .../tests/balance_after_mixed_trades.rs | 28 +- .../buy_creator_fee_recipient_balance.rs | 2 +- creator-keys/tests/buy_event_buyer_address.rs | 4 +- creator-keys/tests/buy_key.rs | 6 +- creator-keys/tests/buy_key_event.rs | 4 +- creator-keys/tests/buy_quote_monotonicity.rs | 20 +- creator-keys/tests/contract_test_env/mod.rs | 2 +- .../tests/creator_detail_read_consistency.rs | 2 +- creator-keys/tests/creator_details_view.rs | 6 +- creator-keys/tests/creator_supply.rs | 6 +- creator-keys/tests/creators_batch.rs | 4 +- creator-keys/tests/events.rs | 4 +- .../tests/holder_count_multiple_buyers.rs | 12 +- creator-keys/tests/holder_key_count_view.rs | 32 +- .../identical_fee_configs_independent.rs | 4 +- creator-keys/tests/key_balance.rs | 16 +- .../key_balance_partial_sells_regression.rs | 8 +- creator-keys/tests/key_supply.rs | 10 +- creator-keys/tests/max_amount_inputs.rs | 6 +- creator-keys/tests/protocol_state_version.rs | 2 +- .../tests/quote_supply_edge_transitions.rs | 10 +- creator-keys/tests/quote_zero_amount.rs | 4 +- .../tests/sell_after_fee_config_mutation.rs | 8 +- .../tests/sell_event_seller_address.rs | 8 +- .../tests/sell_fee_split_invariants.rs | 2 +- creator-keys/tests/sell_key.rs | 38 +- .../sell_protocol_fee_recipient_balance.rs | 12 +- .../tests/sell_quote_matches_execution.rs | 8 +- creator-keys/tests/sell_quote_rounding.rs | 2 +- creator-keys/tests/sell_quote_zero_amount.rs | 4 +- creator-keys/tests/sell_underflow.rs | 28 +- creator-keys/tests/slippage_protection.rs | 137 +++ creator-keys/tests/supply_invariants.rs | 78 +- .../supply_unchanged_after_failed_sell.rs | 8 +- .../tests/buy_after_fee_config_mutation.rs | 4 +- creator-keys/tests/total_supply_overflow.rs | 2 +- .../treasury_accumulation_multi_buyer.rs | 2 +- ...ry_balance_unchanged_after_failed_trade.rs | 10 +- .../tests/zero_creator_fee_regression.rs | 8 +- 174 files changed, 6221 insertions(+), 583 deletions(-) create mode 100644 creator-keys/test_snapshots/test_buy_slippage_reverts_when_price_exceeds_max_price.1.json create mode 100644 creator-keys/test_snapshots/test_buy_slippage_succeeds_when_price_at_or_below_max_price.1.json create mode 100644 creator-keys/test_snapshots/test_get_key_decimals_consistent_across_creator_instances.1.json create mode 100644 creator-keys/test_snapshots/test_get_key_decimals_matches_token_standard.1.json create mode 100644 creator-keys/test_snapshots/test_protocol_config_state_is_unchanged_after_rejected_reinitialization.1.json create mode 100644 creator-keys/test_snapshots/test_register_creator_below_minimum_handle_length_fails.1.json create mode 100644 creator-keys/test_snapshots/test_register_creator_minimum_handle_length_success.1.json create mode 100644 creator-keys/test_snapshots/test_sell_registered_zero_supply_creator_returns_sell_underflow_without_state_change.1.json create mode 100644 creator-keys/test_snapshots/test_sell_slippage_reverts_when_proceeds_below_min_proceeds.1.json create mode 100644 creator-keys/test_snapshots/test_sell_slippage_succeeds_when_proceeds_meet_or_exceed_min_proceeds.1.json create mode 100644 creator-keys/test_snapshots/test_slippage_none_passthrough_preserves_existing_behavior.1.json create mode 100644 creator-keys/tests/slippage_protection.rs diff --git a/creator-keys/src/lib.rs b/creator-keys/src/lib.rs index 126a76c..7a117a0 100644 --- a/creator-keys/src/lib.rs +++ b/creator-keys/src/lib.rs @@ -62,6 +62,7 @@ pub enum ContractError { HandleTooLong = 13, InvalidHandleCharacter = 14, ZeroAddress = 15, + SlippageExceeded = 16, } pub mod fee { @@ -526,6 +527,40 @@ fn credit_protocol_fee_recipient_balance(env: &Env, amount: i128) -> Result<(), Ok(()) } +fn assert_buy_price_slippage(price: i128, max_price: Option) -> Result<(), ContractError> { + if let Some(max) = max_price { + if price > max { + return Err(ContractError::SlippageExceeded); + } + } + Ok(()) +} + +fn compute_sell_proceeds(env: &Env, price: i128) -> Result { + let (creator_fee, protocol_fee) = + CreatorKeysContract::compute_fees_for_payment(env.clone(), price)?; + let fees = fee::checked_fee_sum(creator_fee, protocol_fee).ok_or(ContractError::Overflow)?; + fee::checked_sub_i128(price, fees).ok_or(ContractError::SellUnderflow) +} + +fn assert_sell_proceeds_slippage( + env: &Env, + min_proceeds: Option, +) -> Result<(), ContractError> { + if let Some(min) = min_proceeds { + let price: i128 = env + .storage() + .persistent() + .get(&constants::storage::KEY_PRICE) + .ok_or(ContractError::KeyPriceNotSet)?; + let proceeds = compute_sell_proceeds(env, price)?; + if proceeds < min { + return Err(ContractError::SlippageExceeded); + } + } + Ok(()) +} + fn accrue_sell_protocol_fee(env: &Env) -> Result<(), ContractError> { if env .storage() @@ -695,6 +730,7 @@ impl CreatorKeysContract { creator: Address, buyer: Address, payment: i128, + max_price: Option, ) -> Result { buyer.require_auth(); @@ -708,6 +744,8 @@ impl CreatorKeysContract { .get(&constants::storage::KEY_PRICE) .ok_or(ContractError::KeyPriceNotSet)?; + assert_buy_price_slippage(price, max_price)?; + if payment < price { return Err(ContractError::InsufficientPayment); } @@ -756,7 +794,12 @@ impl CreatorKeysContract { Ok(profile.supply) } - pub fn sell_key(env: Env, creator: Address, seller: Address) -> Result { + pub fn sell_key( + env: Env, + creator: Address, + seller: Address, + min_proceeds: Option, + ) -> Result { seller.require_auth(); let mut profile: CreatorProfile = read_registered_creator_profile(&env, &creator)?; @@ -768,6 +811,8 @@ impl CreatorKeysContract { return Err(ContractError::InsufficientBalance); } + assert_sell_proceeds_slippage(&env, min_proceeds)?; + let new_balance = current_balance .checked_sub(1) .ok_or(ContractError::SellUnderflow)?; diff --git a/creator-keys/src/test.rs b/creator-keys/src/test.rs index 7fdc32e..f6c2307 100644 --- a/creator-keys/src/test.rs +++ b/creator-keys/src/test.rs @@ -208,7 +208,7 @@ fn test_buy_key_fails_if_not_registered() { let creator = Address::generate(&env); let buyer = Address::generate(&env); - let result = client.try_buy_key(&creator, &buyer, &100); + let result = client.try_buy_key(&creator, &buyer, &100, &None); assert_eq!(result, Err(Ok(ContractError::NotRegistered))); assert_no_events(&env); } @@ -228,7 +228,7 @@ fn test_buy_key_success() { client.register_creator(&creator, &handle); let buyer = Address::generate(&env); - let supply = client.buy_key(&creator, &buyer, &100); + let supply = client.buy_key(&creator, &buyer, &100, &None); assert_eq!(supply, 1); let profile = client.get_creator(&creator); @@ -253,9 +253,9 @@ fn test_get_creator_holder_count_counts_unique_holders() { let holder_one = Address::generate(&env); let holder_two = Address::generate(&env); - client.buy_key(&creator, &holder_one, &100); - client.buy_key(&creator, &holder_one, &100); - client.buy_key(&creator, &holder_two, &100); + client.buy_key(&creator, &holder_one, &100, &None); + client.buy_key(&creator, &holder_one, &100, &None); + client.buy_key(&creator, &holder_two, &100, &None); let first_read = client.get_creator_holder_count(&creator); let second_read = client.get_creator_holder_count(&creator); @@ -292,7 +292,7 @@ fn test_buy_key_insufficient_payment() { client.register_creator(&creator, &handle); let buyer = Address::generate(&env); - let result = client.try_buy_key(&creator, &buyer, &99); + let result = client.try_buy_key(&creator, &buyer, &99, &None); assert_eq!(result, Err(Ok(ContractError::InsufficientPayment))); assert_no_events(&env); } @@ -484,7 +484,7 @@ fn test_get_sell_quote_success() { client.register_creator(&creator, &handle); let buyer = Address::generate(&env); - client.buy_key(&creator, &buyer, &1000); + client.buy_key(&creator, &buyer, &1000, &None); let quote = client.get_sell_quote(&creator, &buyer); assert_eq!(quote.price, 1000); @@ -745,7 +745,7 @@ fn test_buy_event_topic_and_data_order_is_stable() { client.register_creator(&creator, &handle); let buyer = Address::generate(&env); - client.buy_key(&creator, &buyer, &500); + client.buy_key(&creator, &buyer, &500, &None); let all_events = env.events().all(); // Each client call is a separate invocation; env.events().all() returns events diff --git a/creator-keys/test_snapshots/holder_count_tracks_distinct_buyers_and_decrements_on_exit.1.json b/creator-keys/test_snapshots/holder_count_tracks_distinct_buyers_and_decrements_on_exit.1.json index 5f201e3..3bf529b 100644 --- a/creator-keys/test_snapshots/holder_count_tracks_distinct_buyers_and_decrements_on_exit.1.json +++ b/creator-keys/test_snapshots/holder_count_tracks_distinct_buyers_and_decrements_on_exit.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -128,7 +130,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -152,7 +155,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, @@ -175,7 +179,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - } + }, + "void" ] } }, @@ -198,7 +203,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/sell_fee_split_invariant_100_creator_zero_protocol.1.json b/creator-keys/test_snapshots/sell_fee_split_invariant_100_creator_zero_protocol.1.json index 46585cd..8ec6dd2 100644 --- a/creator-keys/test_snapshots/sell_fee_split_invariant_100_creator_zero_protocol.1.json +++ b/creator-keys/test_snapshots/sell_fee_split_invariant_100_creator_zero_protocol.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 1000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/sell_fee_split_invariant_50_50_equal_split.1.json b/creator-keys/test_snapshots/sell_fee_split_invariant_50_50_equal_split.1.json index 87850e7..05c6eb1 100644 --- a/creator-keys/test_snapshots/sell_fee_split_invariant_50_50_equal_split.1.json +++ b/creator-keys/test_snapshots/sell_fee_split_invariant_50_50_equal_split.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 200 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/sell_fee_split_invariant_90_10_nominal_case.1.json b/creator-keys/test_snapshots/sell_fee_split_invariant_90_10_nominal_case.1.json index 4485339..8024a55 100644 --- a/creator-keys/test_snapshots/sell_fee_split_invariant_90_10_nominal_case.1.json +++ b/creator-keys/test_snapshots/sell_fee_split_invariant_90_10_nominal_case.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/sell_fee_split_invariant_across_multiple_fee_configs.1.json b/creator-keys/test_snapshots/sell_fee_split_invariant_across_multiple_fee_configs.1.json index 1ae4cb6..0ae6c4f 100644 --- a/creator-keys/test_snapshots/sell_fee_split_invariant_across_multiple_fee_configs.1.json +++ b/creator-keys/test_snapshots/sell_fee_split_invariant_across_multiple_fee_configs.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, @@ -200,7 +201,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, @@ -302,7 +304,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, @@ -404,7 +407,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/sell_fee_split_invariant_across_price_range.1.json b/creator-keys/test_snapshots/sell_fee_split_invariant_across_price_range.1.json index 5b834ec..3b4aca7 100644 --- a/creator-keys/test_snapshots/sell_fee_split_invariant_across_price_range.1.json +++ b/creator-keys/test_snapshots/sell_fee_split_invariant_across_price_range.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 2 } - } + }, + "void" ] } }, @@ -200,7 +201,8 @@ "hi": 0, "lo": 4 } - } + }, + "void" ] } }, @@ -302,7 +304,8 @@ "hi": 0, "lo": 6 } - } + }, + "void" ] } }, @@ -404,7 +407,8 @@ "hi": 0, "lo": 20 } - } + }, + "void" ] } }, @@ -506,7 +510,8 @@ "hi": 0, "lo": 198 } - } + }, + "void" ] } }, @@ -608,7 +613,8 @@ "hi": 0, "lo": 200 } - } + }, + "void" ] } }, @@ -710,7 +716,8 @@ "hi": 0, "lo": 202 } - } + }, + "void" ] } }, @@ -812,7 +819,8 @@ "hi": 0, "lo": 1998 } - } + }, + "void" ] } }, @@ -914,7 +922,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, @@ -1016,7 +1025,8 @@ "hi": 0, "lo": 20000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/sell_fee_split_invariant_boundary_odd_price_999.1.json b/creator-keys/test_snapshots/sell_fee_split_invariant_boundary_odd_price_999.1.json index 9731b51..cf9f22f 100644 --- a/creator-keys/test_snapshots/sell_fee_split_invariant_boundary_odd_price_999.1.json +++ b/creator-keys/test_snapshots/sell_fee_split_invariant_boundary_odd_price_999.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 1998 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/sell_fee_split_invariant_boundary_price_one.1.json b/creator-keys/test_snapshots/sell_fee_split_invariant_boundary_price_one.1.json index 766f404..948e338 100644 --- a/creator-keys/test_snapshots/sell_fee_split_invariant_boundary_price_one.1.json +++ b/creator-keys/test_snapshots/sell_fee_split_invariant_boundary_price_one.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 2 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/sell_fee_split_invariant_boundary_price_two.1.json b/creator-keys/test_snapshots/sell_fee_split_invariant_boundary_price_two.1.json index e75f9f8..97fa354 100644 --- a/creator-keys/test_snapshots/sell_fee_split_invariant_boundary_price_two.1.json +++ b/creator-keys/test_snapshots/sell_fee_split_invariant_boundary_price_two.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 4 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/sell_fee_split_invariant_deterministic_assertions.1.json b/creator-keys/test_snapshots/sell_fee_split_invariant_deterministic_assertions.1.json index 4450e00..9f7c7c7 100644 --- a/creator-keys/test_snapshots/sell_fee_split_invariant_deterministic_assertions.1.json +++ b/creator-keys/test_snapshots/sell_fee_split_invariant_deterministic_assertions.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 246 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/sell_fee_split_invariant_large_amount.1.json b/creator-keys/test_snapshots/sell_fee_split_invariant_large_amount.1.json index 1e93347..90ad6ce 100644 --- a/creator-keys/test_snapshots/sell_fee_split_invariant_large_amount.1.json +++ b/creator-keys/test_snapshots/sell_fee_split_invariant_large_amount.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 2000000000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/sell_fee_split_invariant_max_protocol_50_percent.1.json b/creator-keys/test_snapshots/sell_fee_split_invariant_max_protocol_50_percent.1.json index 3c7b787..bb19bc6 100644 --- a/creator-keys/test_snapshots/sell_fee_split_invariant_max_protocol_50_percent.1.json +++ b/creator-keys/test_snapshots/sell_fee_split_invariant_max_protocol_50_percent.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 400 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/sell_fee_split_invariant_zero_net_boundary.1.json b/creator-keys/test_snapshots/sell_fee_split_invariant_zero_net_boundary.1.json index f700641..59ae461 100644 --- a/creator-keys/test_snapshots/sell_fee_split_invariant_zero_net_boundary.1.json +++ b/creator-keys/test_snapshots/sell_fee_split_invariant_zero_net_boundary.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 2 } - } + }, + "void" ] } }, @@ -201,7 +202,8 @@ "hi": 0, "lo": 4 } - } + }, + "void" ] } }, @@ -304,7 +306,8 @@ "hi": 0, "lo": 6 } - } + }, + "void" ] } }, @@ -407,7 +410,8 @@ "hi": 0, "lo": 20 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/sell_quote_100_percent_creator_seller_net_is_zero_fees_absorb_full_price.1.json b/creator-keys/test_snapshots/sell_quote_100_percent_creator_seller_net_is_zero_fees_absorb_full_price.1.json index 74befeb..a14b5e6 100644 --- a/creator-keys/test_snapshots/sell_quote_100_percent_creator_seller_net_is_zero_fees_absorb_full_price.1.json +++ b/creator-keys/test_snapshots/sell_quote_100_percent_creator_seller_net_is_zero_fees_absorb_full_price.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/sell_quote_50_50_price_ten_equal_split_zero_net.1.json b/creator-keys/test_snapshots/sell_quote_50_50_price_ten_equal_split_zero_net.1.json index f22b939..5ca479c 100644 --- a/creator-keys/test_snapshots/sell_quote_50_50_price_ten_equal_split_zero_net.1.json +++ b/creator-keys/test_snapshots/sell_quote_50_50_price_ten_equal_split_zero_net.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 10 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/sell_quote_50_50_small_price_protocol_takes_first_floor_unit.1.json b/creator-keys/test_snapshots/sell_quote_50_50_small_price_protocol_takes_first_floor_unit.1.json index 83990e0..7caef8c 100644 --- a/creator-keys/test_snapshots/sell_quote_50_50_small_price_protocol_takes_first_floor_unit.1.json +++ b/creator-keys/test_snapshots/sell_quote_50_50_small_price_protocol_takes_first_floor_unit.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 3 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/sell_quote_90_10_dust_price_one_all_creator_no_protocol_rounding.1.json b/creator-keys/test_snapshots/sell_quote_90_10_dust_price_one_all_creator_no_protocol_rounding.1.json index d202598..1c2627d 100644 --- a/creator-keys/test_snapshots/sell_quote_90_10_dust_price_one_all_creator_no_protocol_rounding.1.json +++ b/creator-keys/test_snapshots/sell_quote_90_10_dust_price_one_all_creator_no_protocol_rounding.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 1 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/sell_quote_90_10_remainder_favors_creator_on_indivisible_price.1.json b/creator-keys/test_snapshots/sell_quote_90_10_remainder_favors_creator_on_indivisible_price.1.json index c2e6dd8..9d34913 100644 --- a/creator-keys/test_snapshots/sell_quote_90_10_remainder_favors_creator_on_indivisible_price.1.json +++ b/creator-keys/test_snapshots/sell_quote_90_10_remainder_favors_creator_on_indivisible_price.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 999 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/sell_quote_max_allowed_protocol_bps_50_50_dust_price_floors_protocol_share_to_zero.1.json b/creator-keys/test_snapshots/sell_quote_max_allowed_protocol_bps_50_50_dust_price_floors_protocol_share_to_zero.1.json index 997ee8c..6a2f986 100644 --- a/creator-keys/test_snapshots/sell_quote_max_allowed_protocol_bps_50_50_dust_price_floors_protocol_share_to_zero.1.json +++ b/creator-keys/test_snapshots/sell_quote_max_allowed_protocol_bps_50_50_dust_price_floors_protocol_share_to_zero.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 1 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test/test_buy_event_topic_and_data_order_is_stable.1.json b/creator-keys/test_snapshots/test/test_buy_event_topic_and_data_order_is_stable.1.json index bfa45bf..1b322d9 100644 --- a/creator-keys/test_snapshots/test/test_buy_event_topic_and_data_order_is_stable.1.json +++ b/creator-keys/test_snapshots/test/test_buy_event_topic_and_data_order_is_stable.1.json @@ -97,7 +97,8 @@ "hi": 0, "lo": 500 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test/test_buy_key_success.1.json b/creator-keys/test_snapshots/test/test_buy_key_success.1.json index b94fe4d..bbe252a 100644 --- a/creator-keys/test_snapshots/test/test_buy_key_success.1.json +++ b/creator-keys/test_snapshots/test/test_buy_key_success.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test/test_get_creator_holder_count_counts_unique_holders.1.json b/creator-keys/test_snapshots/test/test_get_creator_holder_count_counts_unique_holders.1.json index 9d5c81d..336d4e0 100644 --- a/creator-keys/test_snapshots/test/test_get_creator_holder_count_counts_unique_holders.1.json +++ b/creator-keys/test_snapshots/test/test_get_creator_holder_count_counts_unique_holders.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -128,7 +130,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test/test_get_sell_quote_success.1.json b/creator-keys/test_snapshots/test/test_get_sell_quote_success.1.json index 7f8ea06..5386503 100644 --- a/creator-keys/test_snapshots/test/test_get_sell_quote_success.1.json +++ b/creator-keys/test_snapshots/test/test_get_sell_quote_success.1.json @@ -97,7 +97,8 @@ "hi": 0, "lo": 1000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_balance_after_buys_then_sells.1.json b/creator-keys/test_snapshots/test_balance_after_buys_then_sells.1.json index 060a7fe..54baa67 100644 --- a/creator-keys/test_snapshots/test_balance_after_buys_then_sells.1.json +++ b/creator-keys/test_snapshots/test_balance_after_buys_then_sells.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -128,7 +130,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -156,7 +159,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -184,7 +188,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -206,7 +211,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, @@ -228,7 +234,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_balance_after_sequence_of_buys_and_sells.1.json b/creator-keys/test_snapshots/test_balance_after_sequence_of_buys_and_sells.1.json index 83fffc4..dff6be8 100644 --- a/creator-keys/test_snapshots/test_balance_after_sequence_of_buys_and_sells.1.json +++ b/creator-keys/test_snapshots/test_balance_after_sequence_of_buys_and_sells.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -122,7 +124,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, @@ -150,7 +153,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -172,7 +176,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, @@ -194,7 +199,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_balance_with_non_zero_initial.1.json b/creator-keys/test_snapshots/test_balance_with_non_zero_initial.1.json index 207b8d7..b1d2682 100644 --- a/creator-keys/test_snapshots/test_balance_with_non_zero_initial.1.json +++ b/creator-keys/test_snapshots/test_balance_with_non_zero_initial.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -128,7 +130,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -156,7 +159,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -184,7 +188,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -206,7 +211,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, @@ -228,7 +234,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, @@ -256,7 +263,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -284,7 +292,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_credits_creator_fee_recipient_balance_by_bps_amount.1.json b/creator-keys/test_snapshots/test_buy_credits_creator_fee_recipient_balance_by_bps_amount.1.json index 1df8640..1edc3e2 100644 --- a/creator-keys/test_snapshots/test_buy_credits_creator_fee_recipient_balance_by_bps_amount.1.json +++ b/creator-keys/test_snapshots/test_buy_credits_creator_fee_recipient_balance_by_bps_amount.1.json @@ -100,7 +100,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_event_buyer_address_field_is_non_zero.1.json b/creator-keys/test_snapshots/test_buy_event_buyer_address_field_is_non_zero.1.json index a5fca9b..d7021a9 100644 --- a/creator-keys/test_snapshots/test_buy_event_buyer_address_field_is_non_zero.1.json +++ b/creator-keys/test_snapshots/test_buy_event_buyer_address_field_is_non_zero.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_event_buyer_address_matches_caller.1.json b/creator-keys/test_snapshots/test_buy_event_buyer_address_matches_caller.1.json index a5fca9b..d7021a9 100644 --- a/creator-keys/test_snapshots/test_buy_event_buyer_address_matches_caller.1.json +++ b/creator-keys/test_snapshots/test_buy_event_buyer_address_matches_caller.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_key_event_includes_payment_amount.1.json b/creator-keys/test_snapshots/test_buy_key_event_includes_payment_amount.1.json index 4e518e6..5beb7d3 100644 --- a/creator-keys/test_snapshots/test_buy_key_event_includes_payment_amount.1.json +++ b/creator-keys/test_snapshots/test_buy_key_event_includes_payment_amount.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 150 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_key_event_payload_fields_are_validated_from_fixture.1.json b/creator-keys/test_snapshots/test_buy_key_event_payload_fields_are_validated_from_fixture.1.json index 4e518e6..5beb7d3 100644 --- a/creator-keys/test_snapshots/test_buy_key_event_payload_fields_are_validated_from_fixture.1.json +++ b/creator-keys/test_snapshots/test_buy_key_event_payload_fields_are_validated_from_fixture.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 150 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_key_event_payload_tracks_new_supply_across_purchases.1.json b/creator-keys/test_snapshots/test_buy_key_event_payload_tracks_new_supply_across_purchases.1.json index 6ea32ac..6184846 100644 --- a/creator-keys/test_snapshots/test_buy_key_event_payload_tracks_new_supply_across_purchases.1.json +++ b/creator-keys/test_snapshots/test_buy_key_event_payload_tracks_new_supply_across_purchases.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_key_event_present_after_purchase.1.json b/creator-keys/test_snapshots/test_buy_key_event_present_after_purchase.1.json index a5fca9b..d7021a9 100644 --- a/creator-keys/test_snapshots/test_buy_key_event_present_after_purchase.1.json +++ b/creator-keys/test_snapshots/test_buy_key_event_present_after_purchase.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_key_event_topics_include_creator_and_buyer.1.json b/creator-keys/test_snapshots/test_buy_key_event_topics_include_creator_and_buyer.1.json index ffbb814..921d881 100644 --- a/creator-keys/test_snapshots/test_buy_key_event_topics_include_creator_and_buyer.1.json +++ b/creator-keys/test_snapshots/test_buy_key_event_topics_include_creator_and_buyer.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 200 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_key_positive_payment_succeeds.1.json b/creator-keys/test_snapshots/test_buy_key_positive_payment_succeeds.1.json index a5fca9b..d7021a9 100644 --- a/creator-keys/test_snapshots/test_buy_key_positive_payment_succeeds.1.json +++ b/creator-keys/test_snapshots/test_buy_key_positive_payment_succeeds.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_key_sufficient_payment_succeeds.1.json b/creator-keys/test_snapshots/test_buy_key_sufficient_payment_succeeds.1.json index b94fe4d..bbe252a 100644 --- a/creator-keys/test_snapshots/test_buy_key_sufficient_payment_succeeds.1.json +++ b/creator-keys/test_snapshots/test_buy_key_sufficient_payment_succeeds.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_key_with_large_safe_amount_succeeds.1.json b/creator-keys/test_snapshots/test_buy_key_with_large_safe_amount_succeeds.1.json index 64dd718..c4259fa 100644 --- a/creator-keys/test_snapshots/test_buy_key_with_large_safe_amount_succeeds.1.json +++ b/creator-keys/test_snapshots/test_buy_key_with_large_safe_amount_succeeds.1.json @@ -48,7 +48,8 @@ "hi": 0, "lo": 1000000000000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_key_with_maximum_safe_i128_succeeds.1.json b/creator-keys/test_snapshots/test_buy_key_with_maximum_safe_i128_succeeds.1.json index 7a18a04..3b75cea 100644 --- a/creator-keys/test_snapshots/test_buy_key_with_maximum_safe_i128_succeeds.1.json +++ b/creator-keys/test_snapshots/test_buy_key_with_maximum_safe_i128_succeeds.1.json @@ -48,7 +48,8 @@ "hi": 0, "lo": 9223372036854775 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_quote_deterministic_across_zero_supply_transition.1.json b/creator-keys/test_snapshots/test_buy_quote_deterministic_across_zero_supply_transition.1.json index 36c88cc..196b6b6 100644 --- a/creator-keys/test_snapshots/test_buy_quote_deterministic_across_zero_supply_transition.1.json +++ b/creator-keys/test_snapshots/test_buy_quote_deterministic_across_zero_supply_transition.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 200 } - } + }, + "void" ] } }, @@ -120,7 +121,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_quote_fees_sum_to_total_minus_price.1.json b/creator-keys/test_snapshots/test_buy_quote_fees_sum_to_total_minus_price.1.json index a401362..37f304e 100644 --- a/creator-keys/test_snapshots/test_buy_quote_fees_sum_to_total_minus_price.1.json +++ b/creator-keys/test_snapshots/test_buy_quote_fees_sum_to_total_minus_price.1.json @@ -97,7 +97,8 @@ "hi": 0, "lo": 1000 } - } + }, + "void" ] } }, @@ -123,9 +124,10 @@ { "i128": { "hi": 0, - "lo": 1000 + "lo": 1001 } - } + }, + "void" ] } }, @@ -133,6 +135,9 @@ } ] ], + [], + [], + [], [] ], "ledger": { diff --git a/creator-keys/test_snapshots/test_buy_quote_monotonic_with_zero_creator_fee.1.json b/creator-keys/test_snapshots/test_buy_quote_monotonic_with_zero_creator_fee.1.json index c2a912e..bba70ce 100644 --- a/creator-keys/test_snapshots/test_buy_quote_monotonic_with_zero_creator_fee.1.json +++ b/creator-keys/test_snapshots/test_buy_quote_monotonic_with_zero_creator_fee.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_quote_monotonic_with_zero_protocol_fee.1.json b/creator-keys/test_snapshots/test_buy_quote_monotonic_with_zero_protocol_fee.1.json index 91ff67d..076d95a 100644 --- a/creator-keys/test_snapshots/test_buy_quote_monotonic_with_zero_protocol_fee.1.json +++ b/creator-keys/test_snapshots/test_buy_quote_monotonic_with_zero_protocol_fee.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 4000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_quote_multiple_creators_independent_monotonicity.1.json b/creator-keys/test_snapshots/test_buy_quote_multiple_creators_independent_monotonicity.1.json index 0220174..5ae46a6 100644 --- a/creator-keys/test_snapshots/test_buy_quote_multiple_creators_independent_monotonicity.1.json +++ b/creator-keys/test_snapshots/test_buy_quote_multiple_creators_independent_monotonicity.1.json @@ -121,7 +121,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, @@ -149,7 +150,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_quote_price_point_1_is_stable.1.json b/creator-keys/test_snapshots/test_buy_quote_price_point_1_is_stable.1.json index e15876b..1459bad 100644 --- a/creator-keys/test_snapshots/test_buy_quote_price_point_1_is_stable.1.json +++ b/creator-keys/test_snapshots/test_buy_quote_price_point_1_is_stable.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 1 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_quote_price_point_large_is_stable.1.json b/creator-keys/test_snapshots/test_buy_quote_price_point_large_is_stable.1.json index 7d650f4..4de0cd7 100644 --- a/creator-keys/test_snapshots/test_buy_quote_price_point_large_is_stable.1.json +++ b/creator-keys/test_snapshots/test_buy_quote_price_point_large_is_stable.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 1000000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_quote_price_unchanged_across_multiple_buyers_small_range.1.json b/creator-keys/test_snapshots/test_buy_quote_price_unchanged_across_multiple_buyers_small_range.1.json index 9653a17..208a649 100644 --- a/creator-keys/test_snapshots/test_buy_quote_price_unchanged_across_multiple_buyers_small_range.1.json +++ b/creator-keys/test_snapshots/test_buy_quote_price_unchanged_across_multiple_buyers_small_range.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 200 } - } + }, + "void" ] } }, @@ -127,7 +128,8 @@ "hi": 0, "lo": 200 } - } + }, + "void" ] } }, @@ -156,7 +158,8 @@ "hi": 0, "lo": 200 } - } + }, + "void" ] } }, @@ -185,7 +188,8 @@ "hi": 0, "lo": 200 } - } + }, + "void" ] } }, @@ -214,7 +218,8 @@ "hi": 0, "lo": 200 } - } + }, + "void" ] } }, @@ -243,7 +248,8 @@ "hi": 0, "lo": 200 } - } + }, + "void" ] } }, @@ -272,7 +278,8 @@ "hi": 0, "lo": 200 } - } + }, + "void" ] } }, @@ -301,7 +308,8 @@ "hi": 0, "lo": 200 } - } + }, + "void" ] } }, @@ -330,7 +338,8 @@ "hi": 0, "lo": 200 } - } + }, + "void" ] } }, @@ -359,7 +368,8 @@ "hi": 0, "lo": 200 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_quote_price_unchanged_after_five_buys.1.json b/creator-keys/test_snapshots/test_buy_quote_price_unchanged_after_five_buys.1.json index a7a42d2..ab5d895 100644 --- a/creator-keys/test_snapshots/test_buy_quote_price_unchanged_after_five_buys.1.json +++ b/creator-keys/test_snapshots/test_buy_quote_price_unchanged_after_five_buys.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 500 } - } + }, + "void" ] } }, @@ -124,9 +125,10 @@ { "i128": { "hi": 0, - "lo": 500 + "lo": 501 } - } + }, + "void" ] } }, @@ -152,9 +154,10 @@ { "i128": { "hi": 0, - "lo": 500 + "lo": 502 } - } + }, + "void" ] } }, @@ -180,9 +183,10 @@ { "i128": { "hi": 0, - "lo": 500 + "lo": 503 } - } + }, + "void" ] } }, @@ -208,9 +212,10 @@ { "i128": { "hi": 0, - "lo": 500 + "lo": 504 } - } + }, + "void" ] } }, @@ -218,6 +223,9 @@ } ] ], + [], + [], + [], [] ], "ledger": { diff --git a/creator-keys/test_snapshots/test_buy_quote_price_unchanged_after_one_buy.1.json b/creator-keys/test_snapshots/test_buy_quote_price_unchanged_after_one_buy.1.json index 30178b1..3ea217a 100644 --- a/creator-keys/test_snapshots/test_buy_quote_price_unchanged_after_one_buy.1.json +++ b/creator-keys/test_snapshots/test_buy_quote_price_unchanged_after_one_buy.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_quote_recomputed_after_sell_reduces_supply.1.json b/creator-keys/test_snapshots/test_buy_quote_recomputed_after_sell_reduces_supply.1.json index f86e52f..da14d3e 100644 --- a/creator-keys/test_snapshots/test_buy_quote_recomputed_after_sell_reduces_supply.1.json +++ b/creator-keys/test_snapshots/test_buy_quote_recomputed_after_sell_reduces_supply.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 500 } - } + }, + "void" ] } }, @@ -126,7 +127,8 @@ "hi": 0, "lo": 500 } - } + }, + "void" ] } }, @@ -150,7 +152,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_quote_stable_across_50_sequential_purchases.1.json b/creator-keys/test_snapshots/test_buy_quote_stable_across_50_sequential_purchases.1.json index 499fd23..ea162e0 100644 --- a/creator-keys/test_snapshots/test_buy_quote_stable_across_50_sequential_purchases.1.json +++ b/creator-keys/test_snapshots/test_buy_quote_stable_across_50_sequential_purchases.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -127,7 +128,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -156,7 +158,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -185,7 +188,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -214,7 +218,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -243,7 +248,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -272,7 +278,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -301,7 +308,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -330,7 +338,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -359,7 +368,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -388,7 +398,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -417,7 +428,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -446,7 +458,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -475,7 +488,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -504,7 +518,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -533,7 +548,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -562,7 +578,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -591,7 +608,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -620,7 +638,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -649,7 +668,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -678,7 +698,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -707,7 +728,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -736,7 +758,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -765,7 +788,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -794,7 +818,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -823,7 +848,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -852,7 +878,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -881,7 +908,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -910,7 +938,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -939,7 +968,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -968,7 +998,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -997,7 +1028,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -1026,7 +1058,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -1055,7 +1088,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -1084,7 +1118,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -1113,7 +1148,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -1142,7 +1178,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -1171,7 +1208,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -1200,7 +1238,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -1229,7 +1268,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -1258,7 +1298,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -1287,7 +1328,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -1316,7 +1358,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -1345,7 +1388,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -1374,7 +1418,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -1403,7 +1448,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -1432,7 +1478,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -1461,7 +1508,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -1490,7 +1538,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, @@ -1519,7 +1568,8 @@ "hi": 0, "lo": 750 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_quote_stable_over_medium_volume_20_buys.1.json b/creator-keys/test_snapshots/test_buy_quote_stable_over_medium_volume_20_buys.1.json index bf684c6..8951e8d 100644 --- a/creator-keys/test_snapshots/test_buy_quote_stable_over_medium_volume_20_buys.1.json +++ b/creator-keys/test_snapshots/test_buy_quote_stable_over_medium_volume_20_buys.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, @@ -127,7 +128,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, @@ -156,7 +158,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, @@ -185,7 +188,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, @@ -214,7 +218,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, @@ -243,7 +248,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, @@ -272,7 +278,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, @@ -301,7 +308,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, @@ -330,7 +338,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, @@ -359,7 +368,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, @@ -388,7 +398,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, @@ -417,7 +428,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, @@ -446,7 +458,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, @@ -475,7 +488,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, @@ -504,7 +518,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, @@ -533,7 +548,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, @@ -562,7 +578,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, @@ -591,7 +608,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, @@ -620,7 +638,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, @@ -649,7 +668,8 @@ "hi": 0, "lo": 5000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_buy_quote_total_amount_never_below_price.1.json b/creator-keys/test_snapshots/test_buy_quote_total_amount_never_below_price.1.json index 3a50c0d..09588f7 100644 --- a/creator-keys/test_snapshots/test_buy_quote_total_amount_never_below_price.1.json +++ b/creator-keys/test_snapshots/test_buy_quote_total_amount_never_below_price.1.json @@ -97,7 +97,8 @@ "hi": 0, "lo": 10000 } - } + }, + "void" ] } }, @@ -123,9 +124,10 @@ { "i128": { "hi": 0, - "lo": 10000 + "lo": 10001 } - } + }, + "void" ] } }, @@ -151,9 +153,10 @@ { "i128": { "hi": 0, - "lo": 10000 + "lo": 10002 } - } + }, + "void" ] } }, @@ -179,9 +182,10 @@ { "i128": { "hi": 0, - "lo": 10000 + "lo": 10003 } - } + }, + "void" ] } }, @@ -207,9 +211,10 @@ { "i128": { "hi": 0, - "lo": 10000 + "lo": 10004 } - } + }, + "void" ] } }, @@ -235,9 +240,10 @@ { "i128": { "hi": 0, - "lo": 10000 + "lo": 10005 } - } + }, + "void" ] } }, @@ -263,9 +269,10 @@ { "i128": { "hi": 0, - "lo": 10000 + "lo": 10006 } - } + }, + "void" ] } }, @@ -291,9 +298,10 @@ { "i128": { "hi": 0, - "lo": 10000 + "lo": 10007 } - } + }, + "void" ] } }, @@ -319,9 +327,10 @@ { "i128": { "hi": 0, - "lo": 10000 + "lo": 10008 } - } + }, + "void" ] } }, @@ -347,9 +356,10 @@ { "i128": { "hi": 0, - "lo": 10000 + "lo": 10009 } - } + }, + "void" ] } }, @@ -357,6 +367,9 @@ } ] ], + [], + [], + [], [] ], "ledger": { diff --git a/creator-keys/test_snapshots/test_buy_quote_total_amount_ordering_is_deterministic_small_range.1.json b/creator-keys/test_snapshots/test_buy_quote_total_amount_ordering_is_deterministic_small_range.1.json index 1d3695c..adc18df 100644 --- a/creator-keys/test_snapshots/test_buy_quote_total_amount_ordering_is_deterministic_small_range.1.json +++ b/creator-keys/test_snapshots/test_buy_quote_total_amount_ordering_is_deterministic_small_range.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 1000 } - } + }, + "void" ] } }, @@ -124,9 +125,10 @@ { "i128": { "hi": 0, - "lo": 1000 + "lo": 1001 } - } + }, + "void" ] } }, @@ -152,9 +154,10 @@ { "i128": { "hi": 0, - "lo": 1000 + "lo": 1002 } - } + }, + "void" ] } }, @@ -162,6 +165,9 @@ } ] ], + [], + [], + [], [] ], "ledger": { diff --git a/creator-keys/test_snapshots/test_buy_slippage_reverts_when_price_exceeds_max_price.1.json b/creator-keys/test_snapshots/test_buy_slippage_reverts_when_price_exceeds_max_price.1.json new file mode 100644 index 0000000..56d4520 --- /dev/null +++ b/creator-keys/test_snapshots/test_buy_slippage_reverts_when_price_exceeds_max_price.1.json @@ -0,0 +1,484 @@ +{ + "generators": { + "address": 4, + "nonce": 0 + }, + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "set_key_price", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "i128": { + "hi": 0, + "lo": 1000 + } + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "set_fee_config", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "u32": 9000 + }, + { + "u32": 1000 + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "register_creator", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "string": "alice" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [], + [], + [], + [], + [], + [] + ], + "ledger": { + "protocol_version": 22, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Creator" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Creator" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "creator" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + }, + { + "key": { + "symbol": "fee_recipient" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + }, + { + "key": { + "symbol": "handle" + }, + "val": { + "string": "alice" + } + }, + { + "key": { + "symbol": "holder_count" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "registered_at" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "supply" + }, + "val": { + "u32": 0 + } + } + ] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "FeeConfig" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "FeeConfig" + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "creator_bps" + }, + "val": { + "u32": 9000 + } + }, + { + "key": { + "symbol": "protocol_bps" + }, + "val": { + "u32": 1000 + } + } + ] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyPrice" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyPrice" + } + ] + }, + "durability": "persistent", + "val": { + "i128": { + "hi": 0, + "lo": 1000 + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolStateVersion" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolStateVersion" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 2 + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": 1033654523790656264 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": 1033654523790656264 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/creator-keys/test_snapshots/test_buy_slippage_succeeds_when_price_at_or_below_max_price.1.json b/creator-keys/test_snapshots/test_buy_slippage_succeeds_when_price_at_or_below_max_price.1.json new file mode 100644 index 0000000..5fe1d85 --- /dev/null +++ b/creator-keys/test_snapshots/test_buy_slippage_succeeds_when_price_at_or_below_max_price.1.json @@ -0,0 +1,842 @@ +{ + "generators": { + "address": 5, + "nonce": 0 + }, + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "set_key_price", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "i128": { + "hi": 0, + "lo": 1000 + } + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "set_fee_config", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "u32": 9000 + }, + { + "u32": 1000 + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "register_creator", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "string": "alice" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "buy_key", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + }, + { + "i128": { + "hi": 0, + "lo": 2000 + } + }, + { + "i128": { + "hi": 0, + "lo": 1000 + } + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "buy_key", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + }, + { + "i128": { + "hi": 0, + "lo": 2000 + } + }, + { + "i128": { + "hi": 0, + "lo": 1001 + } + } + ] + } + }, + "sub_invocations": [] + } + ] + ] + ], + "ledger": { + "protocol_version": 22, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Creator" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Creator" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "creator" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + }, + { + "key": { + "symbol": "fee_recipient" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + }, + { + "key": { + "symbol": "handle" + }, + "val": { + "string": "alice" + } + }, + { + "key": { + "symbol": "holder_count" + }, + "val": { + "u32": 2 + } + }, + { + "key": { + "symbol": "registered_at" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "supply" + }, + "val": { + "u32": 2 + } + } + ] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "CreatorFeeBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "CreatorFeeBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent", + "val": { + "i128": { + "hi": 0, + "lo": 1800 + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "FeeConfig" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "FeeConfig" + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "creator_bps" + }, + "val": { + "u32": 9000 + } + }, + { + "key": { + "symbol": "protocol_bps" + }, + "val": { + "u32": 1000 + } + } + ] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 1 + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 1 + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyPrice" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyPrice" + } + ] + }, + "durability": "persistent", + "val": { + "i128": { + "hi": 0, + "lo": 1000 + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolFeeRecipientBalance" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolFeeRecipientBalance" + } + ] + }, + "durability": "persistent", + "val": { + "i128": { + "hi": 0, + "lo": 200 + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolStateVersion" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolStateVersion" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 2 + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": 1033654523790656264 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": 1033654523790656264 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "key": { + "ledger_key_nonce": { + "nonce": 4837995959683129791 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "key": { + "ledger_key_nonce": { + "nonce": 4837995959683129791 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM", + "key": { + "ledger_key_nonce": { + "nonce": 2032731177588607455 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM", + "key": { + "ledger_key_nonce": { + "nonce": 2032731177588607455 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "buy" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + } + ], + "data": { + "vec": [ + { + "u32": 2 + }, + { + "i128": { + "hi": 0, + "lo": 2000 + } + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/creator-keys/test_snapshots/test_buy_then_sell_has_symmetric_price_impact_after_fees.1.json b/creator-keys/test_snapshots/test_buy_then_sell_has_symmetric_price_impact_after_fees.1.json index d29bcf8..b9c63ca 100644 --- a/creator-keys/test_snapshots/test_buy_then_sell_has_symmetric_price_impact_after_fees.1.json +++ b/creator-keys/test_snapshots/test_buy_then_sell_has_symmetric_price_impact_after_fees.1.json @@ -99,7 +99,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, @@ -123,7 +124,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_creator_details_identical_across_five_consecutive_reads_after_buy.1.json b/creator-keys/test_snapshots/test_creator_details_identical_across_five_consecutive_reads_after_buy.1.json index d981207..439646d 100644 --- a/creator-keys/test_snapshots/test_creator_details_identical_across_five_consecutive_reads_after_buy.1.json +++ b/creator-keys/test_snapshots/test_creator_details_identical_across_five_consecutive_reads_after_buy.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_get_creator_details_reflects_latest_state_after_buy_then_sell.1.json b/creator-keys/test_snapshots/test_get_creator_details_reflects_latest_state_after_buy_then_sell.1.json index 7d85370..c37a867 100644 --- a/creator-keys/test_snapshots/test_get_creator_details_reflects_latest_state_after_buy_then_sell.1.json +++ b/creator-keys/test_snapshots/test_get_creator_details_reflects_latest_state_after_buy_then_sell.1.json @@ -73,7 +73,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -96,7 +97,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_get_creator_details_updates_after_buy.1.json b/creator-keys/test_snapshots/test_get_creator_details_updates_after_buy.1.json index f5c206c..9705f66 100644 --- a/creator-keys/test_snapshots/test_get_creator_details_updates_after_buy.1.json +++ b/creator-keys/test_snapshots/test_get_creator_details_updates_after_buy.1.json @@ -73,7 +73,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_get_creator_supply_is_read_only.1.json b/creator-keys/test_snapshots/test_get_creator_supply_is_read_only.1.json index 1a1d5f7..066bd2a 100644 --- a/creator-keys/test_snapshots/test_get_creator_supply_is_read_only.1.json +++ b/creator-keys/test_snapshots/test_get_creator_supply_is_read_only.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_get_creator_supply_returns_current_supply.1.json b/creator-keys/test_snapshots/test_get_creator_supply_returns_current_supply.1.json index 4d26401..f80f7e6 100644 --- a/creator-keys/test_snapshots/test_get_creator_supply_returns_current_supply.1.json +++ b/creator-keys/test_snapshots/test_get_creator_supply_returns_current_supply.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_get_key_decimals_consistent_across_creator_instances.1.json b/creator-keys/test_snapshots/test_get_key_decimals_consistent_across_creator_instances.1.json new file mode 100644 index 0000000..aa70c3b --- /dev/null +++ b/creator-keys/test_snapshots/test_get_key_decimals_consistent_across_creator_instances.1.json @@ -0,0 +1,375 @@ +{ + "generators": { + "address": 3, + "nonce": 0 + }, + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "register_creator", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "string": "alice" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "register_creator", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "string": "bob" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [] + ], + "ledger": { + "protocol_version": 22, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Creator" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Creator" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "creator" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "fee_recipient" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "handle" + }, + "val": { + "string": "alice" + } + }, + { + "key": { + "symbol": "holder_count" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "registered_at" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "supply" + }, + "val": { + "u32": 0 + } + } + ] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Creator" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Creator" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "creator" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + }, + { + "key": { + "symbol": "fee_recipient" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + }, + { + "key": { + "symbol": "handle" + }, + "val": { + "string": "bob" + } + }, + { + "key": { + "symbol": "holder_count" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "registered_at" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "supply" + }, + "val": { + "u32": 0 + } + } + ] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/creator-keys/test_snapshots/test_get_key_decimals_matches_token_standard.1.json b/creator-keys/test_snapshots/test_get_key_decimals_matches_token_standard.1.json new file mode 100644 index 0000000..a90f00a --- /dev/null +++ b/creator-keys/test_snapshots/test_get_key_decimals_matches_token_standard.1.json @@ -0,0 +1,76 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [], + [] + ], + "ledger": { + "protocol_version": 22, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/creator-keys/test_snapshots/test_get_protocol_state_version_increments_only_on_config_updates.1.json b/creator-keys/test_snapshots/test_get_protocol_state_version_increments_only_on_config_updates.1.json index e9c6a2f..407f461 100644 --- a/creator-keys/test_snapshots/test_get_protocol_state_version_increments_only_on_config_updates.1.json +++ b/creator-keys/test_snapshots/test_get_protocol_state_version_increments_only_on_config_updates.1.json @@ -99,7 +99,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_get_sell_quote_zero_amount_returns_noop_quote.1.json b/creator-keys/test_snapshots/test_get_sell_quote_zero_amount_returns_noop_quote.1.json index 673957e..8212d3a 100644 --- a/creator-keys/test_snapshots/test_get_sell_quote_zero_amount_returns_noop_quote.1.json +++ b/creator-keys/test_snapshots/test_get_sell_quote_zero_amount_returns_noop_quote.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_get_total_key_supply_increments_after_buy.1.json b/creator-keys/test_snapshots/test_get_total_key_supply_increments_after_buy.1.json index 58799a3..e0f9466 100644 --- a/creator-keys/test_snapshots/test_get_total_key_supply_increments_after_buy.1.json +++ b/creator-keys/test_snapshots/test_get_total_key_supply_increments_after_buy.1.json @@ -73,7 +73,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -102,7 +103,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_holder_count_reflects_mixed_trade_correctly.1.json b/creator-keys/test_snapshots/test_holder_count_reflects_mixed_trade_correctly.1.json index 93903ec..d24b0ce 100644 --- a/creator-keys/test_snapshots/test_holder_count_reflects_mixed_trade_correctly.1.json +++ b/creator-keys/test_snapshots/test_holder_count_reflects_mixed_trade_correctly.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -123,7 +125,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, @@ -146,7 +149,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_holder_count_returns_to_zero_after_last_holder_exit_and_rebuy.1.json b/creator-keys/test_snapshots/test_holder_count_returns_to_zero_after_last_holder_exit_and_rebuy.1.json index c178c78..b75be6a 100644 --- a/creator-keys/test_snapshots/test_holder_count_returns_to_zero_after_last_holder_exit_and_rebuy.1.json +++ b/creator-keys/test_snapshots/test_holder_count_returns_to_zero_after_last_holder_exit_and_rebuy.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -95,7 +96,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, @@ -124,7 +126,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_holder_count_unchanged_when_holder_still_has_keys.1.json b/creator-keys/test_snapshots/test_holder_count_unchanged_when_holder_still_has_keys.1.json index de3a6cf..de86394 100644 --- a/creator-keys/test_snapshots/test_holder_count_unchanged_when_holder_still_has_keys.1.json +++ b/creator-keys/test_snapshots/test_holder_count_unchanged_when_holder_still_has_keys.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -122,7 +124,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_holder_key_count_view_consistency_with_get_key_balance.1.json b/creator-keys/test_snapshots/test_holder_key_count_view_consistency_with_get_key_balance.1.json index 99d377a..bb1b82b 100644 --- a/creator-keys/test_snapshots/test_holder_key_count_view_consistency_with_get_key_balance.1.json +++ b/creator-keys/test_snapshots/test_holder_key_count_view_consistency_with_get_key_balance.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -128,7 +130,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_holder_key_count_view_increments_on_buy.1.json b/creator-keys/test_snapshots/test_holder_key_count_view_increments_on_buy.1.json index c418163..fc5b9fb 100644 --- a/creator-keys/test_snapshots/test_holder_key_count_view_increments_on_buy.1.json +++ b/creator-keys/test_snapshots/test_holder_key_count_view_increments_on_buy.1.json @@ -73,7 +73,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -102,7 +103,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_holder_key_count_view_multiple_holders.1.json b/creator-keys/test_snapshots/test_holder_key_count_view_multiple_holders.1.json index 6f7bf03..41d534e 100644 --- a/creator-keys/test_snapshots/test_holder_key_count_view_multiple_holders.1.json +++ b/creator-keys/test_snapshots/test_holder_key_count_view_multiple_holders.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -128,7 +130,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -156,7 +159,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_holder_key_count_view_no_state_mutation.1.json b/creator-keys/test_snapshots/test_holder_key_count_view_no_state_mutation.1.json index d579ae4..78cabf3 100644 --- a/creator-keys/test_snapshots/test_holder_key_count_view_no_state_mutation.1.json +++ b/creator-keys/test_snapshots/test_holder_key_count_view_no_state_mutation.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_holder_key_count_view_registered_creator_unseen_wallet.1.json b/creator-keys/test_snapshots/test_holder_key_count_view_registered_creator_unseen_wallet.1.json index 07a4bb1..7f112dd 100644 --- a/creator-keys/test_snapshots/test_holder_key_count_view_registered_creator_unseen_wallet.1.json +++ b/creator-keys/test_snapshots/test_holder_key_count_view_registered_creator_unseen_wallet.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_holder_key_count_view_structure_fields.1.json b/creator-keys/test_snapshots/test_holder_key_count_view_structure_fields.1.json index ac67044..489bc11 100644 --- a/creator-keys/test_snapshots/test_holder_key_count_view_structure_fields.1.json +++ b/creator-keys/test_snapshots/test_holder_key_count_view_structure_fields.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_holder_key_count_view_zero_keys_different_creators.1.json b/creator-keys/test_snapshots/test_holder_key_count_view_zero_keys_different_creators.1.json index 28a7b3f..1b1c7c0 100644 --- a/creator-keys/test_snapshots/test_holder_key_count_view_zero_keys_different_creators.1.json +++ b/creator-keys/test_snapshots/test_holder_key_count_view_zero_keys_different_creators.1.json @@ -94,7 +94,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -122,7 +123,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_identical_fee_configs_apply_independently.1.json b/creator-keys/test_snapshots/test_identical_fee_configs_apply_independently.1.json index 77d840c..2c2c387 100644 --- a/creator-keys/test_snapshots/test_identical_fee_configs_apply_independently.1.json +++ b/creator-keys/test_snapshots/test_identical_fee_configs_apply_independently.1.json @@ -123,7 +123,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, @@ -151,7 +152,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_key_balance_decrements_correctly_after_each_partial_sell.1.json b/creator-keys/test_snapshots/test_key_balance_decrements_correctly_after_each_partial_sell.1.json index de5b48b..34fe767 100644 --- a/creator-keys/test_snapshots/test_key_balance_decrements_correctly_after_each_partial_sell.1.json +++ b/creator-keys/test_snapshots/test_key_balance_decrements_correctly_after_each_partial_sell.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -128,7 +130,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -156,7 +159,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -184,7 +188,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -207,7 +212,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, @@ -230,7 +236,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, @@ -253,7 +260,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_key_balance_increments_on_buy.1.json b/creator-keys/test_snapshots/test_key_balance_increments_on_buy.1.json index 7b073fe..23d7326 100644 --- a/creator-keys/test_snapshots/test_key_balance_increments_on_buy.1.json +++ b/creator-keys/test_snapshots/test_key_balance_increments_on_buy.1.json @@ -73,7 +73,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -102,7 +103,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_key_balance_is_per_buyer.1.json b/creator-keys/test_snapshots/test_key_balance_is_per_buyer.1.json index 9d5c81d..336d4e0 100644 --- a/creator-keys/test_snapshots/test_key_balance_is_per_buyer.1.json +++ b/creator-keys/test_snapshots/test_key_balance_is_per_buyer.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -128,7 +130,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_key_balance_is_per_creator.1.json b/creator-keys/test_snapshots/test_key_balance_is_per_creator.1.json index ea7cffa..3d9e2b0 100644 --- a/creator-keys/test_snapshots/test_key_balance_is_per_creator.1.json +++ b/creator-keys/test_snapshots/test_key_balance_is_per_creator.1.json @@ -94,7 +94,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_key_balance_zero_for_registered_creator_and_unseen_wallet.1.json b/creator-keys/test_snapshots/test_key_balance_zero_for_registered_creator_and_unseen_wallet.1.json index 33d31b5..e82efc0 100644 --- a/creator-keys/test_snapshots/test_key_balance_zero_for_registered_creator_and_unseen_wallet.1.json +++ b/creator-keys/test_snapshots/test_key_balance_zero_for_registered_creator_and_unseen_wallet.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_key_balance_zero_for_unregistered_creator_even_when_other_balances_exist.1.json b/creator-keys/test_snapshots/test_key_balance_zero_for_unregistered_creator_even_when_other_balances_exist.1.json index c1af06d..9c92322 100644 --- a/creator-keys/test_snapshots/test_key_balance_zero_for_unregistered_creator_even_when_other_balances_exist.1.json +++ b/creator-keys/test_snapshots/test_key_balance_zero_for_unregistered_creator_even_when_other_balances_exist.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_protocol_config_state_is_unchanged_after_rejected_reinitialization.1.json b/creator-keys/test_snapshots/test_protocol_config_state_is_unchanged_after_rejected_reinitialization.1.json new file mode 100644 index 0000000..46d41f8 --- /dev/null +++ b/creator-keys/test_snapshots/test_protocol_config_state_is_unchanged_after_rejected_reinitialization.1.json @@ -0,0 +1,230 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "set_fee_config", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "u32": 9000 + }, + { + "u32": 1000 + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [] + ], + "ledger": { + "protocol_version": 22, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "FeeConfig" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "FeeConfig" + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "creator_bps" + }, + "val": { + "u32": 9000 + } + }, + { + "key": { + "symbol": "protocol_bps" + }, + "val": { + "u32": 1000 + } + } + ] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolStateVersion" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolStateVersion" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 2 + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/creator-keys/test_snapshots/test_register_creator_below_minimum_handle_length_fails.1.json b/creator-keys/test_snapshots/test_register_creator_below_minimum_handle_length_fails.1.json new file mode 100644 index 0000000..64688ee --- /dev/null +++ b/creator-keys/test_snapshots/test_register_creator_below_minimum_handle_length_fails.1.json @@ -0,0 +1,77 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [], + [], + [] + ], + "ledger": { + "protocol_version": 22, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/creator-keys/test_snapshots/test_register_creator_minimum_handle_length_success.1.json b/creator-keys/test_snapshots/test_register_creator_minimum_handle_length_success.1.json new file mode 100644 index 0000000..4f99ba1 --- /dev/null +++ b/creator-keys/test_snapshots/test_register_creator_minimum_handle_length_success.1.json @@ -0,0 +1,226 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "register_creator", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "string": "aaa" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [] + ], + "ledger": { + "protocol_version": 22, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Creator" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Creator" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "creator" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "fee_recipient" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "handle" + }, + "val": { + "string": "aaa" + } + }, + { + "key": { + "symbol": "holder_count" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "registered_at" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "supply" + }, + "val": { + "u32": 0 + } + } + ] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/creator-keys/test_snapshots/test_registered_at_is_immutable_after_buy_and_sell.1.json b/creator-keys/test_snapshots/test_registered_at_is_immutable_after_buy_and_sell.1.json index 6d7482b..ba57786 100644 --- a/creator-keys/test_snapshots/test_registered_at_is_immutable_after_buy_and_sell.1.json +++ b/creator-keys/test_snapshots/test_registered_at_is_immutable_after_buy_and_sell.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 500 } - } + }, + "void" ] } }, @@ -94,7 +95,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_repeated_zero_amount_quote_calls_no_state_drift.1.json b/creator-keys/test_snapshots/test_repeated_zero_amount_quote_calls_no_state_drift.1.json index f7aceff..0a376e0 100644 --- a/creator-keys/test_snapshots/test_repeated_zero_amount_quote_calls_no_state_drift.1.json +++ b/creator-keys/test_snapshots/test_repeated_zero_amount_quote_calls_no_state_drift.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_after_buy_succeeds_without_underflow_error.1.json b/creator-keys/test_snapshots/test_sell_after_buy_succeeds_without_underflow_error.1.json index 8f206b9..59e2d3e 100644 --- a/creator-keys/test_snapshots/test_sell_after_buy_succeeds_without_underflow_error.1.json +++ b/creator-keys/test_snapshots/test_sell_after_buy_succeeds_without_underflow_error.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -94,7 +95,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_event_seller_address_field_is_non_zero.1.json b/creator-keys/test_snapshots/test_sell_event_seller_address_field_is_non_zero.1.json index 8f206b9..59e2d3e 100644 --- a/creator-keys/test_snapshots/test_sell_event_seller_address_field_is_non_zero.1.json +++ b/creator-keys/test_snapshots/test_sell_event_seller_address_field_is_non_zero.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -94,7 +95,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_event_seller_address_matches_caller.1.json b/creator-keys/test_snapshots/test_sell_event_seller_address_matches_caller.1.json index 8f206b9..59e2d3e 100644 --- a/creator-keys/test_snapshots/test_sell_event_seller_address_matches_caller.1.json +++ b/creator-keys/test_snapshots/test_sell_event_seller_address_matches_caller.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -94,7 +95,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_execution_applies_updated_protocol_fee.1.json b/creator-keys/test_snapshots/test_sell_execution_applies_updated_protocol_fee.1.json index 1e64993..af5432c 100644 --- a/creator-keys/test_snapshots/test_sell_execution_applies_updated_protocol_fee.1.json +++ b/creator-keys/test_snapshots/test_sell_execution_applies_updated_protocol_fee.1.json @@ -97,7 +97,8 @@ "hi": 0, "lo": 1000 } - } + }, + "void" ] } }, @@ -145,7 +146,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_execution_fee_matches_quote_after_fee_config_update.1.json b/creator-keys/test_snapshots/test_sell_execution_fee_matches_quote_after_fee_config_update.1.json index a9ac344..fca8011 100644 --- a/creator-keys/test_snapshots/test_sell_execution_fee_matches_quote_after_fee_config_update.1.json +++ b/creator-keys/test_snapshots/test_sell_execution_fee_matches_quote_after_fee_config_update.1.json @@ -97,7 +97,8 @@ "hi": 0, "lo": 500 } - } + }, + "void" ] } }, @@ -146,7 +147,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_full_exit_then_rebuy_updates_state.1.json b/creator-keys/test_snapshots/test_sell_full_exit_then_rebuy_updates_state.1.json index f3168d7..4fa3cb2 100644 --- a/creator-keys/test_snapshots/test_sell_full_exit_then_rebuy_updates_state.1.json +++ b/creator-keys/test_snapshots/test_sell_full_exit_then_rebuy_updates_state.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -97,7 +98,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, @@ -128,7 +130,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_increases_protocol_fee_recipient_balance_by_bps_fee.1.json b/creator-keys/test_snapshots/test_sell_increases_protocol_fee_recipient_balance_by_bps_fee.1.json index 6eeee89..71bc17d 100644 --- a/creator-keys/test_snapshots/test_sell_increases_protocol_fee_recipient_balance_by_bps_fee.1.json +++ b/creator-keys/test_snapshots/test_sell_increases_protocol_fee_recipient_balance_by_bps_fee.1.json @@ -119,7 +119,8 @@ "hi": 0, "lo": 1000 } - } + }, + "void" ] } }, @@ -143,7 +144,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_key_decrements_supply_and_balance.1.json b/creator-keys/test_snapshots/test_sell_key_decrements_supply_and_balance.1.json index de3a6cf..de86394 100644 --- a/creator-keys/test_snapshots/test_sell_key_decrements_supply_and_balance.1.json +++ b/creator-keys/test_snapshots/test_sell_key_decrements_supply_and_balance.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -122,7 +124,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_key_event_payload_fields_are_validated_from_fixture.1.json b/creator-keys/test_snapshots/test_sell_key_event_payload_fields_are_validated_from_fixture.1.json index 9c2081c..99b6da8 100644 --- a/creator-keys/test_snapshots/test_sell_key_event_payload_fields_are_validated_from_fixture.1.json +++ b/creator-keys/test_snapshots/test_sell_key_event_payload_fields_are_validated_from_fixture.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -122,7 +124,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_key_event_payload_tracks_zero_supply_after_last_sale.1.json b/creator-keys/test_snapshots/test_sell_key_event_payload_tracks_zero_supply_after_last_sale.1.json index 8f206b9..59e2d3e 100644 --- a/creator-keys/test_snapshots/test_sell_key_event_payload_tracks_zero_supply_after_last_sale.1.json +++ b/creator-keys/test_snapshots/test_sell_key_event_payload_tracks_zero_supply_after_last_sale.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -94,7 +95,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_key_preserves_holder_count_when_seller_still_has_keys.1.json b/creator-keys/test_snapshots/test_sell_key_preserves_holder_count_when_seller_still_has_keys.1.json index 4a135ce..4fb55d0 100644 --- a/creator-keys/test_snapshots/test_sell_key_preserves_holder_count_when_seller_still_has_keys.1.json +++ b/creator-keys/test_snapshots/test_sell_key_preserves_holder_count_when_seller_still_has_keys.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -123,7 +125,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_key_removes_holder_when_last_key_is_sold.1.json b/creator-keys/test_snapshots/test_sell_key_removes_holder_when_last_key_is_sold.1.json index 5f1c9de..1f41ff4 100644 --- a/creator-keys/test_snapshots/test_sell_key_removes_holder_when_last_key_is_sold.1.json +++ b/creator-keys/test_snapshots/test_sell_key_removes_holder_when_last_key_is_sold.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -95,7 +96,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_protocol_fee_recipient_balance_accumulates_across_two_sells.1.json b/creator-keys/test_snapshots/test_sell_protocol_fee_recipient_balance_accumulates_across_two_sells.1.json index 8e8984d..7ffafcd 100644 --- a/creator-keys/test_snapshots/test_sell_protocol_fee_recipient_balance_accumulates_across_two_sells.1.json +++ b/creator-keys/test_snapshots/test_sell_protocol_fee_recipient_balance_accumulates_across_two_sells.1.json @@ -119,7 +119,8 @@ "hi": 0, "lo": 1000 } - } + }, + "void" ] } }, @@ -147,7 +148,8 @@ "hi": 0, "lo": 1000 } - } + }, + "void" ] } }, @@ -170,7 +172,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - } + }, + "void" ] } }, @@ -193,7 +196,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_quote_proceeds_match_execution_at_supply_five.1.json b/creator-keys/test_snapshots/test_sell_quote_proceeds_match_execution_at_supply_five.1.json index 58f2329..28b05d4 100644 --- a/creator-keys/test_snapshots/test_sell_quote_proceeds_match_execution_at_supply_five.1.json +++ b/creator-keys/test_snapshots/test_sell_quote_proceeds_match_execution_at_supply_five.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, @@ -126,7 +127,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, @@ -154,7 +156,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, @@ -182,7 +185,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, @@ -210,7 +214,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, @@ -236,7 +241,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_quote_proceeds_match_execution_at_supply_one.1.json b/creator-keys/test_snapshots/test_sell_quote_proceeds_match_execution_at_supply_one.1.json index 85c1fe6..95530dc 100644 --- a/creator-keys/test_snapshots/test_sell_quote_proceeds_match_execution_at_supply_one.1.json +++ b/creator-keys/test_snapshots/test_sell_quote_proceeds_match_execution_at_supply_one.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, @@ -124,7 +125,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_quote_with_large_amount_succeeds.1.json b/creator-keys/test_snapshots/test_sell_quote_with_large_amount_succeeds.1.json index a49e528..8e34b34 100644 --- a/creator-keys/test_snapshots/test_sell_quote_with_large_amount_succeeds.1.json +++ b/creator-keys/test_snapshots/test_sell_quote_with_large_amount_succeeds.1.json @@ -74,7 +74,8 @@ "hi": 0, "lo": 500000000000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_quote_with_maximum_safe_amount_50_50_fees_succeeds.1.json b/creator-keys/test_snapshots/test_sell_quote_with_maximum_safe_amount_50_50_fees_succeeds.1.json index a1dddf6..397c3b7 100644 --- a/creator-keys/test_snapshots/test_sell_quote_with_maximum_safe_amount_50_50_fees_succeeds.1.json +++ b/creator-keys/test_snapshots/test_sell_quote_with_maximum_safe_amount_50_50_fees_succeeds.1.json @@ -74,7 +74,8 @@ "hi": 0, "lo": 9223372036854775 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_quote_with_maximum_safe_amount_succeeds.1.json b/creator-keys/test_snapshots/test_sell_quote_with_maximum_safe_amount_succeeds.1.json index 283217e..5c11f69 100644 --- a/creator-keys/test_snapshots/test_sell_quote_with_maximum_safe_amount_succeeds.1.json +++ b/creator-keys/test_snapshots/test_sell_quote_with_maximum_safe_amount_succeeds.1.json @@ -74,7 +74,8 @@ "hi": 0, "lo": 9223372036854775 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_quote_zero_amount_no_state_modification.1.json b/creator-keys/test_snapshots/test_sell_quote_zero_amount_no_state_modification.1.json index 1795723..14992c2 100644 --- a/creator-keys/test_snapshots/test_sell_quote_zero_amount_no_state_modification.1.json +++ b/creator-keys/test_snapshots/test_sell_quote_zero_amount_no_state_modification.1.json @@ -97,7 +97,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_quote_zero_amount_returns_zero_quote.1.json b/creator-keys/test_snapshots/test_sell_quote_zero_amount_returns_zero_quote.1.json index 2e690e4..2d6c837 100644 --- a/creator-keys/test_snapshots/test_sell_quote_zero_amount_returns_zero_quote.1.json +++ b/creator-keys/test_snapshots/test_sell_quote_zero_amount_returns_zero_quote.1.json @@ -97,7 +97,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_registered_zero_supply_creator_returns_sell_underflow_without_state_change.1.json b/creator-keys/test_snapshots/test_sell_registered_zero_supply_creator_returns_sell_underflow_without_state_change.1.json new file mode 100644 index 0000000..250c48f --- /dev/null +++ b/creator-keys/test_snapshots/test_sell_registered_zero_supply_creator_returns_sell_underflow_without_state_change.1.json @@ -0,0 +1,383 @@ +{ + "generators": { + "address": 4, + "nonce": 0 + }, + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "set_key_price", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "i128": { + "hi": 0, + "lo": 100 + } + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "register_creator", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "string": "alice" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [], + [], + [], + [], + [], + [], + [] + ], + "ledger": { + "protocol_version": 22, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Creator" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Creator" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "creator" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + }, + { + "key": { + "symbol": "fee_recipient" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + }, + { + "key": { + "symbol": "handle" + }, + "val": { + "string": "alice" + } + }, + { + "key": { + "symbol": "holder_count" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "registered_at" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "supply" + }, + "val": { + "u32": 0 + } + } + ] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 1 + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyPrice" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyPrice" + } + ] + }, + "durability": "persistent", + "val": { + "i128": { + "hi": 0, + "lo": 100 + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/creator-keys/test_snapshots/test_sell_reverts_when_seller_has_insufficient_balance.1.json b/creator-keys/test_snapshots/test_sell_reverts_when_seller_has_insufficient_balance.1.json index 7891c40..0671b59 100644 --- a/creator-keys/test_snapshots/test_sell_reverts_when_seller_has_insufficient_balance.1.json +++ b/creator-keys/test_snapshots/test_sell_reverts_when_seller_has_insufficient_balance.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -96,7 +97,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_second_key_after_selling_last_returns_insufficient_balance.1.json b/creator-keys/test_snapshots/test_sell_second_key_after_selling_last_returns_insufficient_balance.1.json index 718ad6c..e0ce456 100644 --- a/creator-keys/test_snapshots/test_sell_second_key_after_selling_last_returns_insufficient_balance.1.json +++ b/creator-keys/test_snapshots/test_sell_second_key_after_selling_last_returns_insufficient_balance.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -94,7 +95,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_sell_slippage_reverts_when_proceeds_below_min_proceeds.1.json b/creator-keys/test_snapshots/test_sell_slippage_reverts_when_proceeds_below_min_proceeds.1.json new file mode 100644 index 0000000..6eacde0 --- /dev/null +++ b/creator-keys/test_snapshots/test_sell_slippage_reverts_when_proceeds_below_min_proceeds.1.json @@ -0,0 +1,689 @@ +{ + "generators": { + "address": 4, + "nonce": 0 + }, + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "set_key_price", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "i128": { + "hi": 0, + "lo": 1000 + } + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "set_fee_config", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "u32": 9000 + }, + { + "u32": 1000 + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "register_creator", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "string": "alice" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "buy_key", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + }, + { + "i128": { + "hi": 0, + "lo": 2000 + } + }, + "void" + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [], + [], + [], + [], + [], + [], + [] + ], + "ledger": { + "protocol_version": 22, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Creator" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Creator" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "creator" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + }, + { + "key": { + "symbol": "fee_recipient" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + }, + { + "key": { + "symbol": "handle" + }, + "val": { + "string": "alice" + } + }, + { + "key": { + "symbol": "holder_count" + }, + "val": { + "u32": 1 + } + }, + { + "key": { + "symbol": "registered_at" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "supply" + }, + "val": { + "u32": 1 + } + } + ] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "CreatorFeeBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "CreatorFeeBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent", + "val": { + "i128": { + "hi": 0, + "lo": 900 + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "FeeConfig" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "FeeConfig" + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "creator_bps" + }, + "val": { + "u32": 9000 + } + }, + { + "key": { + "symbol": "protocol_bps" + }, + "val": { + "u32": 1000 + } + } + ] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 1 + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyPrice" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyPrice" + } + ] + }, + "durability": "persistent", + "val": { + "i128": { + "hi": 0, + "lo": 1000 + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolFeeRecipientBalance" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolFeeRecipientBalance" + } + ] + }, + "durability": "persistent", + "val": { + "i128": { + "hi": 0, + "lo": 100 + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolStateVersion" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolStateVersion" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 2 + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": 1033654523790656264 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": 1033654523790656264 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "key": { + "ledger_key_nonce": { + "nonce": 4837995959683129791 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "key": { + "ledger_key_nonce": { + "nonce": 4837995959683129791 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file diff --git a/creator-keys/test_snapshots/test_sell_slippage_succeeds_when_proceeds_meet_or_exceed_min_proceeds.1.json b/creator-keys/test_snapshots/test_sell_slippage_succeeds_when_proceeds_meet_or_exceed_min_proceeds.1.json new file mode 100644 index 0000000..e128412 --- /dev/null +++ b/creator-keys/test_snapshots/test_sell_slippage_succeeds_when_proceeds_meet_or_exceed_min_proceeds.1.json @@ -0,0 +1,946 @@ +{ + "generators": { + "address": 5, + "nonce": 0 + }, + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "set_key_price", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "i128": { + "hi": 0, + "lo": 1000 + } + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "set_fee_config", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "u32": 9000 + }, + { + "u32": 1000 + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "register_creator", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "string": "alice" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "buy_key", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + }, + { + "i128": { + "hi": 0, + "lo": 2000 + } + }, + "void" + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "sell_key", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + }, + { + "i128": { + "hi": 0, + "lo": 0 + } + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "buy_key", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + }, + { + "i128": { + "hi": 0, + "lo": 2000 + } + }, + "void" + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "sell_key", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + }, + { + "i128": { + "hi": -1, + "lo": 18446744073709551615 + } + } + ] + } + }, + "sub_invocations": [] + } + ] + ] + ], + "ledger": { + "protocol_version": 22, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Creator" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Creator" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "creator" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + }, + { + "key": { + "symbol": "fee_recipient" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + }, + { + "key": { + "symbol": "handle" + }, + "val": { + "string": "alice" + } + }, + { + "key": { + "symbol": "holder_count" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "registered_at" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "supply" + }, + "val": { + "u32": 0 + } + } + ] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "CreatorFeeBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "CreatorFeeBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent", + "val": { + "i128": { + "hi": 0, + "lo": 1800 + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "FeeConfig" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "FeeConfig" + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "creator_bps" + }, + "val": { + "u32": 9000 + } + }, + { + "key": { + "symbol": "protocol_bps" + }, + "val": { + "u32": 1000 + } + } + ] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 0 + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 0 + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyPrice" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyPrice" + } + ] + }, + "durability": "persistent", + "val": { + "i128": { + "hi": 0, + "lo": 1000 + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolFeeRecipientBalance" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolFeeRecipientBalance" + } + ] + }, + "durability": "persistent", + "val": { + "i128": { + "hi": 0, + "lo": 200 + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolStateVersion" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolStateVersion" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 2 + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": 1033654523790656264 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": 1033654523790656264 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "key": { + "ledger_key_nonce": { + "nonce": 2032731177588607455 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "key": { + "ledger_key_nonce": { + "nonce": 2032731177588607455 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "key": { + "ledger_key_nonce": { + "nonce": 4837995959683129791 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "key": { + "ledger_key_nonce": { + "nonce": 4837995959683129791 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM", + "key": { + "ledger_key_nonce": { + "nonce": 4270020994084947596 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM", + "key": { + "ledger_key_nonce": { + "nonce": 4270020994084947596 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM", + "key": { + "ledger_key_nonce": { + "nonce": 8370022561469687789 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM", + "key": { + "ledger_key_nonce": { + "nonce": 8370022561469687789 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "sell" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + } + ], + "data": { + "u32": 0 + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/creator-keys/test_snapshots/test_sell_two_keys_succeeds_without_underflow_error.1.json b/creator-keys/test_snapshots/test_sell_two_keys_succeeds_without_underflow_error.1.json index 4636cdb..b868966 100644 --- a/creator-keys/test_snapshots/test_sell_two_keys_succeeds_without_underflow_error.1.json +++ b/creator-keys/test_snapshots/test_sell_two_keys_succeeds_without_underflow_error.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -122,7 +124,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, @@ -144,7 +147,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_slippage_none_passthrough_preserves_existing_behavior.1.json b/creator-keys/test_snapshots/test_slippage_none_passthrough_preserves_existing_behavior.1.json new file mode 100644 index 0000000..50caac6 --- /dev/null +++ b/creator-keys/test_snapshots/test_slippage_none_passthrough_preserves_existing_behavior.1.json @@ -0,0 +1,765 @@ +{ + "generators": { + "address": 4, + "nonce": 0 + }, + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "set_key_price", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "i128": { + "hi": 0, + "lo": 1000 + } + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "set_fee_config", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + { + "u32": 9000 + }, + { + "u32": 1000 + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "register_creator", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "string": "alice" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "buy_key", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + }, + { + "i128": { + "hi": 0, + "lo": 2000 + } + }, + "void" + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "function_name": "sell_key", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + }, + "void" + ] + } + }, + "sub_invocations": [] + } + ] + ] + ], + "ledger": { + "protocol_version": 22, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Creator" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Creator" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "creator" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + }, + { + "key": { + "symbol": "fee_recipient" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + }, + { + "key": { + "symbol": "handle" + }, + "val": { + "string": "alice" + } + }, + { + "key": { + "symbol": "holder_count" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "registered_at" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "supply" + }, + "val": { + "u32": 0 + } + } + ] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "CreatorFeeBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "CreatorFeeBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + }, + "durability": "persistent", + "val": { + "i128": { + "hi": 0, + "lo": 900 + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "FeeConfig" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "FeeConfig" + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "creator_bps" + }, + "val": { + "u32": 9000 + } + }, + { + "key": { + "symbol": "protocol_bps" + }, + "val": { + "u32": 1000 + } + } + ] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyBalance" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 0 + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyPrice" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "KeyPrice" + } + ] + }, + "durability": "persistent", + "val": { + "i128": { + "hi": 0, + "lo": 1000 + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolFeeRecipientBalance" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolFeeRecipientBalance" + } + ] + }, + "durability": "persistent", + "val": { + "i128": { + "hi": 0, + "lo": 100 + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolStateVersion" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "ProtocolStateVersion" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 2 + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": 1033654523790656264 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": 1033654523790656264 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "key": { + "ledger_key_nonce": { + "nonce": 2032731177588607455 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "key": { + "ledger_key_nonce": { + "nonce": 2032731177588607455 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "key": { + "ledger_key_nonce": { + "nonce": 4837995959683129791 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "key": { + "ledger_key_nonce": { + "nonce": 4837995959683129791 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "sell" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + } + ], + "data": { + "u32": 0 + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/creator-keys/test_snapshots/test_supply_alternating_buys_and_sells.1.json b/creator-keys/test_snapshots/test_supply_alternating_buys_and_sells.1.json index 7c12b67..30f4460 100644 --- a/creator-keys/test_snapshots/test_supply_alternating_buys_and_sells.1.json +++ b/creator-keys/test_snapshots/test_supply_alternating_buys_and_sells.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -94,7 +95,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, @@ -122,7 +124,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -144,7 +147,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_supply_and_balance_decremented_correctly_after_sell.1.json b/creator-keys/test_snapshots/test_supply_and_balance_decremented_correctly_after_sell.1.json index de3a6cf..de86394 100644 --- a/creator-keys/test_snapshots/test_supply_and_balance_decremented_correctly_after_sell.1.json +++ b/creator-keys/test_snapshots/test_supply_and_balance_decremented_correctly_after_sell.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -122,7 +124,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_supply_buy_then_sell_returns_to_zero.1.json b/creator-keys/test_snapshots/test_supply_buy_then_sell_returns_to_zero.1.json index be513b2..1f340f8 100644 --- a/creator-keys/test_snapshots/test_supply_buy_then_sell_returns_to_zero.1.json +++ b/creator-keys/test_snapshots/test_supply_buy_then_sell_returns_to_zero.1.json @@ -73,7 +73,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -96,7 +97,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_supply_buy_two_sell_one_conserves_supply.1.json b/creator-keys/test_snapshots/test_supply_buy_two_sell_one_conserves_supply.1.json index baf0111..6f6530a 100644 --- a/creator-keys/test_snapshots/test_supply_buy_two_sell_one_conserves_supply.1.json +++ b/creator-keys/test_snapshots/test_supply_buy_two_sell_one_conserves_supply.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -123,7 +125,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_supply_changes_for_one_creator_do_not_affect_another.1.json b/creator-keys/test_snapshots/test_supply_changes_for_one_creator_do_not_affect_another.1.json index 2182ccb..1dc0a91 100644 --- a/creator-keys/test_snapshots/test_supply_changes_for_one_creator_do_not_affect_another.1.json +++ b/creator-keys/test_snapshots/test_supply_changes_for_one_creator_do_not_affect_another.1.json @@ -94,7 +94,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -122,7 +123,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -144,7 +146,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_supply_mixed_trades_three_participants.1.json b/creator-keys/test_snapshots/test_supply_mixed_trades_three_participants.1.json index 423679c..6d07476 100644 --- a/creator-keys/test_snapshots/test_supply_mixed_trades_three_participants.1.json +++ b/creator-keys/test_snapshots/test_supply_mixed_trades_three_participants.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -128,7 +130,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -156,7 +159,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -184,7 +188,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -207,7 +212,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, @@ -229,7 +235,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4" - } + }, + "void" ] } }, @@ -251,7 +258,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_supply_multiple_buys_per_holder_sum_equals_total.1.json b/creator-keys/test_snapshots/test_supply_multiple_buys_per_holder_sum_equals_total.1.json index d0a1293..f528990 100644 --- a/creator-keys/test_snapshots/test_supply_multiple_buys_per_holder_sum_equals_total.1.json +++ b/creator-keys/test_snapshots/test_supply_multiple_buys_per_holder_sum_equals_total.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -128,7 +130,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_supply_never_goes_below_zero_after_all_sells.1.json b/creator-keys/test_snapshots/test_supply_never_goes_below_zero_after_all_sells.1.json index 73eafd2..62ec2e1 100644 --- a/creator-keys/test_snapshots/test_supply_never_goes_below_zero_after_all_sells.1.json +++ b/creator-keys/test_snapshots/test_supply_never_goes_below_zero_after_all_sells.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -128,7 +130,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -150,7 +153,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, @@ -172,7 +176,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, @@ -194,7 +199,8 @@ }, { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_supply_three_buyers_sum_equals_total.1.json b/creator-keys/test_snapshots/test_supply_three_buyers_sum_equals_total.1.json index 154f8e6..abf68bb 100644 --- a/creator-keys/test_snapshots/test_supply_three_buyers_sum_equals_total.1.json +++ b/creator-keys/test_snapshots/test_supply_three_buyers_sum_equals_total.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -100,7 +101,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, @@ -128,7 +130,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_total_supply_unchanged_after_failed_sell_insufficient_balance.1.json b/creator-keys/test_snapshots/test_total_supply_unchanged_after_failed_sell_insufficient_balance.1.json index 9ae72a8..2e69e5a 100644 --- a/creator-keys/test_snapshots/test_total_supply_unchanged_after_failed_sell_insufficient_balance.1.json +++ b/creator-keys/test_snapshots/test_total_supply_unchanged_after_failed_sell_insufficient_balance.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_total_supply_unchanged_after_failed_sell_not_registered.1.json b/creator-keys/test_snapshots/test_total_supply_unchanged_after_failed_sell_not_registered.1.json index 2e76898..7486da7 100644 --- a/creator-keys/test_snapshots/test_total_supply_unchanged_after_failed_sell_not_registered.1.json +++ b/creator-keys/test_snapshots/test_total_supply_unchanged_after_failed_sell_not_registered.1.json @@ -72,7 +72,8 @@ "hi": 0, "lo": 100 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_treasury_accumulates_protocol_fees_across_distinct_buyers.1.json b/creator-keys/test_snapshots/test_treasury_accumulates_protocol_fees_across_distinct_buyers.1.json index d1d6c0d..c760478 100644 --- a/creator-keys/test_snapshots/test_treasury_accumulates_protocol_fees_across_distinct_buyers.1.json +++ b/creator-keys/test_snapshots/test_treasury_accumulates_protocol_fees_across_distinct_buyers.1.json @@ -121,7 +121,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, @@ -152,7 +153,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, @@ -183,7 +185,8 @@ "hi": 0, "lo": 2000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_treasury_balance_unchanged_after_failed_buy_unregistered_creator.1.json b/creator-keys/test_snapshots/test_treasury_balance_unchanged_after_failed_buy_unregistered_creator.1.json index d345e71..c031a3b 100644 --- a/creator-keys/test_snapshots/test_treasury_balance_unchanged_after_failed_buy_unregistered_creator.1.json +++ b/creator-keys/test_snapshots/test_treasury_balance_unchanged_after_failed_buy_unregistered_creator.1.json @@ -119,7 +119,8 @@ "hi": 0, "lo": 1000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_treasury_balance_unchanged_after_failed_sell_insufficient_balance.1.json b/creator-keys/test_snapshots/test_treasury_balance_unchanged_after_failed_sell_insufficient_balance.1.json index d345e71..c031a3b 100644 --- a/creator-keys/test_snapshots/test_treasury_balance_unchanged_after_failed_sell_insufficient_balance.1.json +++ b/creator-keys/test_snapshots/test_treasury_balance_unchanged_after_failed_sell_insufficient_balance.1.json @@ -119,7 +119,8 @@ "hi": 0, "lo": 1000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_zero_creator_bps_full_payment_to_creator_after_protocol_fee.1.json b/creator-keys/test_snapshots/test_zero_creator_bps_full_payment_to_creator_after_protocol_fee.1.json index 1d67d5b..1b5636f 100644 --- a/creator-keys/test_snapshots/test_zero_creator_bps_full_payment_to_creator_after_protocol_fee.1.json +++ b/creator-keys/test_snapshots/test_zero_creator_bps_full_payment_to_creator_after_protocol_fee.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 1000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_zero_creator_bps_no_rounding_errors_with_odd_amounts.1.json b/creator-keys/test_snapshots/test_zero_creator_bps_no_rounding_errors_with_odd_amounts.1.json index 9cd5f7b..000e15f 100644 --- a/creator-keys/test_snapshots/test_zero_creator_bps_no_rounding_errors_with_odd_amounts.1.json +++ b/creator-keys/test_snapshots/test_zero_creator_bps_no_rounding_errors_with_odd_amounts.1.json @@ -97,7 +97,8 @@ "hi": 0, "lo": 999 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_zero_creator_bps_with_partial_protocol_fee.1.json b/creator-keys/test_snapshots/test_zero_creator_bps_with_partial_protocol_fee.1.json index 4b4042e..2f47c80 100644 --- a/creator-keys/test_snapshots/test_zero_creator_bps_with_partial_protocol_fee.1.json +++ b/creator-keys/test_snapshots/test_zero_creator_bps_with_partial_protocol_fee.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 1000 } - } + }, + "void" ] } }, diff --git a/creator-keys/test_snapshots/test_zero_protocol_bps_full_payment_to_creator.1.json b/creator-keys/test_snapshots/test_zero_protocol_bps_full_payment_to_creator.1.json index 17e474f..c43c2cb 100644 --- a/creator-keys/test_snapshots/test_zero_protocol_bps_full_payment_to_creator.1.json +++ b/creator-keys/test_snapshots/test_zero_protocol_bps_full_payment_to_creator.1.json @@ -98,7 +98,8 @@ "hi": 0, "lo": 1000 } - } + }, + "void" ] } }, diff --git a/creator-keys/tests/balance_after_mixed_trades.rs b/creator-keys/tests/balance_after_mixed_trades.rs index 70b0edc..6fcd4d0 100644 --- a/creator-keys/tests/balance_after_mixed_trades.rs +++ b/creator-keys/tests/balance_after_mixed_trades.rs @@ -35,12 +35,12 @@ fn test_balance_after_sequence_of_buys_and_sells() { assert_eq!(expected, 0); // Execute trades - client.buy_key(&creator, &buyer, &100i128); - client.buy_key(&creator, &buyer, &100i128); - client.sell_key(&creator, &buyer); - client.buy_key(&creator, &buyer, &100i128); - client.sell_key(&creator, &buyer); - client.sell_key(&creator, &buyer); + client.buy_key(&creator, &buyer, &100i128, &None); + client.buy_key(&creator, &buyer, &100i128, &None); + client.sell_key(&creator, &buyer, &None); + client.buy_key(&creator, &buyer, &100i128, &None); + client.sell_key(&creator, &buyer, &None); + client.sell_key(&creator, &buyer, &None); // Verify actual balance matches expected let actual = client.get_key_balance(&creator, &buyer); @@ -70,10 +70,10 @@ fn test_balance_after_buys_then_sells() { assert_eq!(expected, 3); for _ in 0..5 { - client.buy_key(&creator, &buyer, &100i128); + client.buy_key(&creator, &buyer, &100i128, &None); } for _ in 0..2 { - client.sell_key(&creator, &buyer); + client.sell_key(&creator, &buyer, &None); } let actual = client.get_key_balance(&creator, &buyer); @@ -90,7 +90,7 @@ fn test_balance_with_non_zero_initial() { // Buy 4 keys first (initial balance = 4) for _ in 0..4 { - client.buy_key(&creator, &buyer, &100i128); + client.buy_key(&creator, &buyer, &100i128, &None); } // Then apply additional trades: buy, sell, sell, buy, buy @@ -106,11 +106,11 @@ fn test_balance_with_non_zero_initial() { let expected = compute_expected_balance_after_trades(4, &additional_trades); assert_eq!(expected, 5); - client.buy_key(&creator, &buyer, &100i128); - client.sell_key(&creator, &buyer); - client.sell_key(&creator, &buyer); - client.buy_key(&creator, &buyer, &100i128); - client.buy_key(&creator, &buyer, &100i128); + client.buy_key(&creator, &buyer, &100i128, &None); + client.sell_key(&creator, &buyer, &None); + client.sell_key(&creator, &buyer, &None); + client.buy_key(&creator, &buyer, &100i128, &None); + client.buy_key(&creator, &buyer, &100i128, &None); let actual = client.get_key_balance(&creator, &buyer); assert_eq!(actual, expected); diff --git a/creator-keys/tests/buy_creator_fee_recipient_balance.rs b/creator-keys/tests/buy_creator_fee_recipient_balance.rs index 6e1dac7..72ba6b1 100644 --- a/creator-keys/tests/buy_creator_fee_recipient_balance.rs +++ b/creator-keys/tests/buy_creator_fee_recipient_balance.rs @@ -43,7 +43,7 @@ fn test_buy_credits_creator_fee_recipient_balance_by_bps_amount() { let balance_before = client.get_creator_fee_balance(&creator); assert_eq!(balance_before, 0, "recipient balance should start at zero"); - client.buy_key(&creator, &buyer, "e.total_amount); + client.buy_key(&creator, &buyer, "e.total_amount, &None); let balance_after = client.get_creator_fee_balance(&creator); assert_eq!( diff --git a/creator-keys/tests/buy_event_buyer_address.rs b/creator-keys/tests/buy_event_buyer_address.rs index 9d72bca..7316a08 100644 --- a/creator-keys/tests/buy_event_buyer_address.rs +++ b/creator-keys/tests/buy_event_buyer_address.rs @@ -29,7 +29,7 @@ fn test_buy_event_buyer_address_matches_caller() { // Clear any prior events then perform the buy env.events().all(); // clear - client.buy_key(&creator, &buyer, &KEY_PRICE); + client.buy_key(&creator, &buyer, &KEY_PRICE, &None); // Extract and verify the buy event let event_log = env.events().all(); @@ -77,7 +77,7 @@ fn test_buy_event_buyer_address_field_is_non_zero() { // Configure and execute client.set_key_price(&admin, &KEY_PRICE); client.register_creator(&creator, &String::from_str(&env, "alice")); - client.buy_key(&creator, &buyer, &KEY_PRICE); + client.buy_key(&creator, &buyer, &KEY_PRICE, &None); // Verify the buyer address field is present and matches expected let event_log = env.events().all(); diff --git a/creator-keys/tests/buy_key.rs b/creator-keys/tests/buy_key.rs index 0f0b417..f76bca8 100644 --- a/creator-keys/tests/buy_key.rs +++ b/creator-keys/tests/buy_key.rs @@ -19,7 +19,7 @@ fn test_buy_key_unregistered_creator_fails() { let buyer = Address::generate(&env); let expected_price = compute_expected_buy_price(0, base_price); - let result = client.try_buy_key(&creator, &buyer, &expected_price); + let result = client.try_buy_key(&creator, &buyer, &expected_price, &None); assert_eq!(result, Err(Ok(ContractError::NotRegistered))); } @@ -33,7 +33,7 @@ fn test_buy_key_insufficient_payment_fails() { let buyer = Address::generate(&env); let expected_price = compute_expected_buy_price(0, base_price); - let result = client.try_buy_key(&creator, &buyer, &(expected_price - 1)); + let result = client.try_buy_key(&creator, &buyer, &(expected_price - 1), &None); assert_eq!(result, Err(Ok(ContractError::InsufficientPayment))); } @@ -47,7 +47,7 @@ fn test_buy_key_sufficient_payment_succeeds() { let buyer = Address::generate(&env); let expected_price = compute_expected_buy_price(0, base_price); - let supply = client.buy_key(&creator, &buyer, &expected_price); + let supply = client.buy_key(&creator, &buyer, &expected_price, &None); assert_eq!(supply, 1); let profile = client.get_creator(&creator); diff --git a/creator-keys/tests/buy_key_event.rs b/creator-keys/tests/buy_key_event.rs index dc748df..cae8844 100644 --- a/creator-keys/tests/buy_key_event.rs +++ b/creator-keys/tests/buy_key_event.rs @@ -17,7 +17,7 @@ fn test_buy_key_event_includes_payment_amount() { client.set_key_price(&admin, &100i128); client.register_creator(&creator, &String::from_str(&env, "alice")); - let supply = client.buy_key(&creator, &buyer, &150i128); + let supply = client.buy_key(&creator, &buyer, &150i128, &None); assert_eq!(supply, 1); let events = env.events().all(); @@ -43,7 +43,7 @@ fn test_buy_key_event_topics_include_creator_and_buyer() { client.set_key_price(&admin, &100i128); client.register_creator(&creator, &String::from_str(&env, "alice")); - client.buy_key(&creator, &buyer, &200i128); + client.buy_key(&creator, &buyer, &200i128, &None); let events = env.events().all(); let buy_event = events.last().unwrap(); diff --git a/creator-keys/tests/buy_quote_monotonicity.rs b/creator-keys/tests/buy_quote_monotonicity.rs index 2f24488..33ffca6 100644 --- a/creator-keys/tests/buy_quote_monotonicity.rs +++ b/creator-keys/tests/buy_quote_monotonicity.rs @@ -45,7 +45,7 @@ fn test_buy_quote_price_unchanged_after_one_buy() { let buyer = Address::generate(&env); let before = client.get_buy_quote(&creator); - client.buy_key(&creator, &buyer, &100); + client.buy_key(&creator, &buyer, &100, &None); let after = client.get_buy_quote(&creator); assert_eq!(before.price, after.price); @@ -78,7 +78,7 @@ fn test_buy_quote_price_unchanged_across_multiple_buyers_small_range() { for _ in 0..10 { let buyer = Address::generate(&env); - client.buy_key(&creator, &buyer, &price); + client.buy_key(&creator, &buyer, &price, &None); let q = client.get_buy_quote(&creator); assert_eq!( q.price, q0.price, @@ -137,7 +137,7 @@ fn test_buy_quote_stable_over_medium_volume_20_buys() { for i in 0..20_u32 { let buyer = Address::generate(&env); - client.buy_key(&creator, &buyer, &price); + client.buy_key(&creator, &buyer, &price, &None); let q = client.get_buy_quote(&creator); assert_eq!( q.price, @@ -180,7 +180,7 @@ fn test_buy_quote_price_point_1_is_stable() { let q1 = client.get_buy_quote(&creator); let buyer = Address::generate(&env); - client.buy_key(&creator, &buyer, &1); + client.buy_key(&creator, &buyer, &1, &None); let q2 = client.get_buy_quote(&creator); assert_eq!(q1.price, q2.price); @@ -194,7 +194,7 @@ fn test_buy_quote_price_point_large_is_stable() { let q_before = client.get_buy_quote(&creator); let buyer = Address::generate(&env); - client.buy_key(&creator, &buyer, &large_price); + client.buy_key(&creator, &buyer, &large_price, &None); let q_after = client.get_buy_quote(&creator); assert_eq!(q_before.price, q_after.price); @@ -212,7 +212,7 @@ fn test_buy_quote_monotonic_with_zero_creator_fee() { let q1 = client.get_buy_quote(&creator); let buyer = Address::generate(&env); - client.buy_key(&creator, &buyer, &q1.total_amount); + client.buy_key(&creator, &buyer, &q1.total_amount, &None); let q2 = client.get_buy_quote(&creator); assert_eq!(q1.price, q2.price, "price must remain constant"); @@ -238,7 +238,7 @@ fn test_buy_quote_monotonic_with_zero_protocol_fee() { let q1 = client.get_buy_quote(&creator); let buyer = Address::generate(&env); - client.buy_key(&creator, &buyer, &q1.total_amount); + client.buy_key(&creator, &buyer, &q1.total_amount, &None); let q2 = client.get_buy_quote(&creator); assert_eq!(q1.price, q2.price, "price must remain constant"); @@ -260,7 +260,7 @@ fn test_buy_quote_stable_across_50_sequential_purchases() { for i in 0..50_u32 { let buyer = Address::generate(&env); - client.buy_key(&creator, &buyer, &price); + client.buy_key(&creator, &buyer, &price, &None); let current_quote = client.get_buy_quote(&creator); assert_eq!( @@ -321,8 +321,8 @@ fn test_buy_quote_multiple_creators_independent_monotonicity() { let buyer1 = Address::generate(&env); let buyer2 = Address::generate(&env); - client.buy_key(&creator_alice, &buyer1, &q_alice_1.total_amount); - client.buy_key(&creator_bob, &buyer2, &q_bob_1.total_amount); + client.buy_key(&creator_alice, &buyer1, &q_alice_1.total_amount, &None); + client.buy_key(&creator_bob, &buyer2, &q_bob_1.total_amount, &None); // Get quotes after purchases let q_alice_2 = client.get_buy_quote(&creator_alice); diff --git a/creator-keys/tests/contract_test_env/mod.rs b/creator-keys/tests/contract_test_env/mod.rs index ac82658..4bddf44 100644 --- a/creator-keys/tests/contract_test_env/mod.rs +++ b/creator-keys/tests/contract_test_env/mod.rs @@ -191,7 +191,7 @@ pub fn perform_incrementing_buys( ) -> ContractStateSnapshot { for buy_index in 0..count { let payment = starting_amount + i128::from(buy_index) * amount_step; - client.buy_key(creator, buyer, &payment); + client.buy_key(creator, buyer, &payment, &None); } capture_snapshot(client, creator, buyer) diff --git a/creator-keys/tests/creator_detail_read_consistency.rs b/creator-keys/tests/creator_detail_read_consistency.rs index f7f35c1..391b75d 100644 --- a/creator-keys/tests/creator_detail_read_consistency.rs +++ b/creator-keys/tests/creator_detail_read_consistency.rs @@ -86,7 +86,7 @@ fn test_creator_details_identical_across_five_consecutive_reads_after_buy() { // Perform a buy to establish non-zero state contract_test_env::set_key_price_for_tests(&env, &client, 100i128); - client.buy_key(&creator, &buyer, &100i128); + client.buy_key(&creator, &buyer, &100i128, &None); // Perform five consecutive reads with NO state changes between them let read1 = client.get_creator_details(&creator); diff --git a/creator-keys/tests/creator_details_view.rs b/creator-keys/tests/creator_details_view.rs index ebb2e05..9df2c17 100644 --- a/creator-keys/tests/creator_details_view.rs +++ b/creator-keys/tests/creator_details_view.rs @@ -52,7 +52,7 @@ fn test_get_creator_details_updates_after_buy() { assert_eq!(initial_details.supply, 0); contract_test_env::set_key_price_for_tests(&env, &client, 100i128); - client.buy_key(&creator, &buyer, &100i128); + client.buy_key(&creator, &buyer, &100i128, &None); let updated_details = client.get_creator_details(&creator); assert!(updated_details.is_registered); @@ -81,7 +81,7 @@ fn test_get_creator_details_reflects_latest_state_after_buy_then_sell() { // State mutation 1: buy a key — supply must increment contract_test_env::set_key_price_for_tests(&env, &client, 100i128); - client.buy_key(&creator, &buyer, &100i128); + client.buy_key(&creator, &buyer, &100i128, &None); let details_after_buy = client.get_creator_details(&creator); assert_eq!( @@ -92,7 +92,7 @@ fn test_get_creator_details_reflects_latest_state_after_buy_then_sell() { assert_eq!(details_after_buy.handle, String::from_str(&env, "bob")); // State mutation 2: sell the key back — supply must decrement - client.sell_key(&creator, &buyer); + client.sell_key(&creator, &buyer, &None); let details_after_sell = client.get_creator_details(&creator); assert_eq!( diff --git a/creator-keys/tests/creator_supply.rs b/creator-keys/tests/creator_supply.rs index 0be97ac..780a7b4 100644 --- a/creator-keys/tests/creator_supply.rs +++ b/creator-keys/tests/creator_supply.rs @@ -25,8 +25,8 @@ fn test_get_creator_supply_returns_current_supply() { let buyer_one = Address::generate(&env); let buyer_two = Address::generate(&env); - client.buy_key(&creator, &buyer_one, &100_i128); - client.buy_key(&creator, &buyer_two, &100_i128); + client.buy_key(&creator, &buyer_one, &100_i128, &None); + client.buy_key(&creator, &buyer_two, &100_i128, &None); assert_eq!(client.get_creator_supply(&creator), 2); } @@ -38,7 +38,7 @@ fn test_get_creator_supply_is_read_only() { let (client, _admin, creator) = setup(&env); let buyer = Address::generate(&env); - client.buy_key(&creator, &buyer, &100_i128); + client.buy_key(&creator, &buyer, &100_i128, &None); let first_read = client.get_creator_supply(&creator); let second_read = client.get_creator_supply(&creator); diff --git a/creator-keys/tests/creators_batch.rs b/creator-keys/tests/creators_batch.rs index bd7be09..7ec7ebd 100644 --- a/creator-keys/tests/creators_batch.rs +++ b/creator-keys/tests/creators_batch.rs @@ -65,8 +65,8 @@ fn test_registered_at_is_immutable_after_buy_and_sell() { let admin = Address::generate(&env); client.set_key_price(&admin, &500_i128); let buyer = Address::generate(&env); - client.buy_key(&creator, &buyer, &500_i128); - client.sell_key(&creator, &buyer); + client.buy_key(&creator, &buyer, &500_i128, &None); + client.sell_key(&creator, &buyer, &None); // registered_at must still reflect the original registration sequence. let details = client.get_creator_details(&creator); diff --git a/creator-keys/tests/events.rs b/creator-keys/tests/events.rs index e0faa35..458aaa6 100644 --- a/creator-keys/tests/events.rs +++ b/creator-keys/tests/events.rs @@ -46,11 +46,11 @@ impl<'a> EventFixture<'a> { } fn buy_key(&self, buyer: &Address, payment: i128) { - self.client.buy_key(&self.creator, buyer, &payment); + self.client.buy_key(&self.creator, buyer, &payment, &None); } fn sell_key(&self, seller: &Address) { - self.client.sell_key(&self.creator, seller); + self.client.sell_key(&self.creator, seller, &None); } fn last_trade_topics(&self, env: &Env) -> TradeTopics { diff --git a/creator-keys/tests/holder_count_multiple_buyers.rs b/creator-keys/tests/holder_count_multiple_buyers.rs index 6eb8520..d2056c8 100644 --- a/creator-keys/tests/holder_count_multiple_buyers.rs +++ b/creator-keys/tests/holder_count_multiple_buyers.rs @@ -23,22 +23,22 @@ fn holder_count_tracks_distinct_buyers_and_decrements_on_exit() { let buyer_b = Address::generate(&env); let buyer_c = Address::generate(&env); - client.buy_key(&creator, &buyer_a, &100i128); - client.buy_key(&creator, &buyer_b, &100i128); - client.buy_key(&creator, &buyer_c, &100i128); + client.buy_key(&creator, &buyer_a, &100i128, &None); + client.buy_key(&creator, &buyer_b, &100i128, &None); + client.buy_key(&creator, &buyer_c, &100i128, &None); // Three distinct holders, each with one key. assert_eq!(client.get_creator_holder_count(&creator), 3); assert_eq!(client.get_creator_supply(&creator), 3); // Count decrements by one as each buyer fully exits. - client.sell_key(&creator, &buyer_a); + client.sell_key(&creator, &buyer_a, &None); assert_eq!(client.get_creator_holder_count(&creator), 2); - client.sell_key(&creator, &buyer_b); + client.sell_key(&creator, &buyer_b, &None); assert_eq!(client.get_creator_holder_count(&creator), 1); - client.sell_key(&creator, &buyer_c); + client.sell_key(&creator, &buyer_c, &None); assert_eq!(client.get_creator_holder_count(&creator), 0); assert_eq!(client.get_creator_supply(&creator), 0); } diff --git a/creator-keys/tests/holder_key_count_view.rs b/creator-keys/tests/holder_key_count_view.rs index e1387b0..a41da79 100644 --- a/creator-keys/tests/holder_key_count_view.rs +++ b/creator-keys/tests/holder_key_count_view.rs @@ -41,13 +41,13 @@ fn test_holder_key_count_view_increments_on_buy() { assert_eq!(view.key_count, 0); // First purchase - client.buy_key(&creator, &holder, &100i128); + client.buy_key(&creator, &holder, &100i128, &None); let view = client.get_holder_key_count(&creator, &holder); assert_eq!(view.key_count, 1); assert!(view.creator_exists); // Second purchase - client.buy_key(&creator, &holder, &100i128); + client.buy_key(&creator, &holder, &100i128, &None); let view = client.get_holder_key_count(&creator, &holder); assert_eq!(view.key_count, 2); } @@ -62,12 +62,12 @@ fn test_holder_key_count_view_multiple_holders() { let holder_b = Address::generate(&env); // Holder A buys 3 keys - client.buy_key(&creator, &holder_a, &100i128); - client.buy_key(&creator, &holder_a, &100i128); - client.buy_key(&creator, &holder_a, &100i128); + client.buy_key(&creator, &holder_a, &100i128, &None); + client.buy_key(&creator, &holder_a, &100i128, &None); + client.buy_key(&creator, &holder_a, &100i128, &None); // Holder B buys 1 key - client.buy_key(&creator, &holder_b, &100i128); + client.buy_key(&creator, &holder_b, &100i128, &None); // Verify holder A has 3 keys let view_a = client.get_holder_key_count(&creator, &holder_a); @@ -108,8 +108,8 @@ fn test_holder_key_count_view_registered_creator_unseen_wallet() { let unseen_wallet = Address::generate(&env); // Holder with keys buys some keys - client.buy_key(&creator, &holder_with_keys, &100i128); - client.buy_key(&creator, &holder_with_keys, &100i128); + client.buy_key(&creator, &holder_with_keys, &100i128, &None); + client.buy_key(&creator, &holder_with_keys, &100i128, &None); // Unseen wallet should have zero keys let view = client.get_holder_key_count(&creator, &unseen_wallet); @@ -126,9 +126,9 @@ fn test_holder_key_count_view_consistency_with_get_key_balance() { let holder = Address::generate(&env); // Buy some keys - client.buy_key(&creator, &holder, &100i128); - client.buy_key(&creator, &holder, &100i128); - client.buy_key(&creator, &holder, &100i128); + client.buy_key(&creator, &holder, &100i128, &None); + client.buy_key(&creator, &holder, &100i128, &None); + client.buy_key(&creator, &holder, &100i128, &None); // Both methods should return the same key count let view = client.get_holder_key_count(&creator, &holder); @@ -145,8 +145,8 @@ fn test_holder_key_count_view_no_state_mutation() { let holder = Address::generate(&env); // Buy some keys first - client.buy_key(&creator, &holder, &100i128); - client.buy_key(&creator, &holder, &100i128); + client.buy_key(&creator, &holder, &100i128, &None); + client.buy_key(&creator, &holder, &100i128, &None); // Multiple reads should return the same result (no mutation) let view1 = client.get_holder_key_count(&creator, &holder); @@ -176,8 +176,8 @@ fn test_holder_key_count_view_zero_keys_different_creators() { client.register_creator(&creator_b, &String::from_str(&env, "bob")); // Holder buys keys only from creator A - client.buy_key(&creator_a, &holder, &100i128); - client.buy_key(&creator_a, &holder, &100i128); + client.buy_key(&creator_a, &holder, &100i128, &None); + client.buy_key(&creator_a, &holder, &100i128, &None); // Check holder has 0 keys for creator B let view_b = client.get_holder_key_count(&creator_b, &holder); @@ -198,7 +198,7 @@ fn test_holder_key_count_view_structure_fields() { let (client, creator, _admin) = setup_with_creator(&env); let holder = Address::generate(&env); - client.buy_key(&creator, &holder, &100i128); + client.buy_key(&creator, &holder, &100i128, &None); let view = client.get_holder_key_count(&creator, &holder); diff --git a/creator-keys/tests/identical_fee_configs_independent.rs b/creator-keys/tests/identical_fee_configs_independent.rs index 06a0ef5..7aaa664 100644 --- a/creator-keys/tests/identical_fee_configs_independent.rs +++ b/creator-keys/tests/identical_fee_configs_independent.rs @@ -45,8 +45,8 @@ fn test_identical_fee_configs_apply_independently() { assert_eq!(quote1.total_amount, quote2.total_amount); // Execute buys - client.buy_key(&creator1, &buyer1, "e1.total_amount); - client.buy_key(&creator2, &buyer2, "e2.total_amount); + client.buy_key(&creator1, &buyer1, "e1.total_amount, &None); + client.buy_key(&creator2, &buyer2, "e2.total_amount, &None); // Verify fee balances are tracked independently let fee_balance1 = client.get_creator_fee_balance(&creator1); diff --git a/creator-keys/tests/key_balance.rs b/creator-keys/tests/key_balance.rs index 47204ad..14b37e6 100644 --- a/creator-keys/tests/key_balance.rs +++ b/creator-keys/tests/key_balance.rs @@ -34,10 +34,10 @@ fn test_key_balance_increments_on_buy() { assert_eq!(client.get_key_balance(&creator, &buyer), 0); - client.buy_key(&creator, &buyer, &100i128); + client.buy_key(&creator, &buyer, &100i128, &None); assert_eq!(client.get_key_balance(&creator, &buyer), 1); - client.buy_key(&creator, &buyer, &100i128); + client.buy_key(&creator, &buyer, &100i128, &None); assert_eq!(client.get_key_balance(&creator, &buyer), 2); } @@ -57,9 +57,9 @@ fn test_key_balance_is_per_buyer() { client.set_key_price(&admin, &100i128); client.register_creator(&creator, &String::from_str(&env, "alice")); - client.buy_key(&creator, &buyer_a, &100i128); - client.buy_key(&creator, &buyer_a, &100i128); - client.buy_key(&creator, &buyer_b, &100i128); + client.buy_key(&creator, &buyer_a, &100i128, &None); + client.buy_key(&creator, &buyer_a, &100i128, &None); + client.buy_key(&creator, &buyer_b, &100i128, &None); assert_eq!(client.get_key_balance(&creator, &buyer_a), 2); assert_eq!(client.get_key_balance(&creator, &buyer_b), 1); @@ -82,7 +82,7 @@ fn test_key_balance_is_per_creator() { client.register_creator(&creator_a, &String::from_str(&env, "alice")); client.register_creator(&creator_b, &String::from_str(&env, "bob")); - client.buy_key(&creator_a, &buyer, &100i128); + client.buy_key(&creator_a, &buyer, &100i128, &None); assert_eq!(client.get_key_balance(&creator_a, &buyer), 1); assert_eq!(client.get_key_balance(&creator_b, &buyer), 0); @@ -103,7 +103,7 @@ fn test_key_balance_zero_for_unregistered_creator_even_when_other_balances_exist client.set_key_price(&admin, &100i128); client.register_creator(®istered_creator, &String::from_str(&env, "alice")); - client.buy_key(®istered_creator, &buyer, &100i128); + client.buy_key(®istered_creator, &buyer, &100i128, &None); assert_eq!(client.get_key_balance(&unregistered_creator, &buyer), 0); } @@ -123,7 +123,7 @@ fn test_key_balance_zero_for_registered_creator_and_unseen_wallet() { client.set_key_price(&admin, &100i128); client.register_creator(&creator, &String::from_str(&env, "alice")); - client.buy_key(&creator, &buyer_with_balance, &100i128); + client.buy_key(&creator, &buyer_with_balance, &100i128, &None); assert_eq!(client.get_key_balance(&creator, &unseen_wallet), 0); } diff --git a/creator-keys/tests/key_balance_partial_sells_regression.rs b/creator-keys/tests/key_balance_partial_sells_regression.rs index 959d0fc..da38eb0 100644 --- a/creator-keys/tests/key_balance_partial_sells_regression.rs +++ b/creator-keys/tests/key_balance_partial_sells_regression.rs @@ -20,20 +20,20 @@ fn test_key_balance_decrements_correctly_after_each_partial_sell() { // Buy 5 keys to establish the initial balance. for _ in 0..5 { - client.buy_key(&creator, &holder, &100_i128); + client.buy_key(&creator, &holder, &100_i128, &None); } assert_eq!(client.get_key_balance(&creator, &holder), 5); // Partial sell 1: sell 1 key → balance should be 4. - client.sell_key(&creator, &holder); + client.sell_key(&creator, &holder, &None); assert_eq!(client.get_key_balance(&creator, &holder), 4); // Partial sell 2: sell 1 key → balance should be 3. - client.sell_key(&creator, &holder); + client.sell_key(&creator, &holder, &None); assert_eq!(client.get_key_balance(&creator, &holder), 3); // Partial sell 3: sell 1 key → balance should be 2. - client.sell_key(&creator, &holder); + client.sell_key(&creator, &holder, &None); assert_eq!(client.get_key_balance(&creator, &holder), 2); // Final balance: 5 bought − 3 sold = 2. diff --git a/creator-keys/tests/key_supply.rs b/creator-keys/tests/key_supply.rs index 3bad7b0..86c7acf 100644 --- a/creator-keys/tests/key_supply.rs +++ b/creator-keys/tests/key_supply.rs @@ -47,11 +47,11 @@ fn test_get_total_key_supply_increments_after_buy() { assert_eq!(client.get_total_key_supply(&creator), 0); - client.buy_key(&creator, &buyer, &100_i128); + client.buy_key(&creator, &buyer, &100_i128, &None); assert_eq!(client.get_total_key_supply(&creator), 1); let buyer2 = Address::generate(&env); - client.buy_key(&creator, &buyer2, &100_i128); + client.buy_key(&creator, &buyer2, &100_i128, &None); assert_eq!(client.get_total_key_supply(&creator), 2); } @@ -84,7 +84,7 @@ fn test_buy_key_zero_payment_fails() { let buyer = Address::generate(&env); client.register_creator(&creator, &String::from_str(&env, "alice")); - let result = client.try_buy_key(&creator, &buyer, &0_i128); + let result = client.try_buy_key(&creator, &buyer, &0_i128, &None); assert_eq!(result, Err(Ok(ContractError::NotPositiveAmount))); } @@ -98,7 +98,7 @@ fn test_buy_key_negative_payment_fails() { let buyer = Address::generate(&env); client.register_creator(&creator, &String::from_str(&env, "alice")); - let result = client.try_buy_key(&creator, &buyer, &-50_i128); + let result = client.try_buy_key(&creator, &buyer, &-50_i128, &None); assert_eq!(result, Err(Ok(ContractError::NotPositiveAmount))); } @@ -112,7 +112,7 @@ fn test_buy_key_positive_payment_succeeds() { let buyer = Address::generate(&env); client.register_creator(&creator, &String::from_str(&env, "alice")); - let supply = client.buy_key(&creator, &buyer, &100_i128); + let supply = client.buy_key(&creator, &buyer, &100_i128, &None); assert_eq!(supply, 1); } diff --git a/creator-keys/tests/max_amount_inputs.rs b/creator-keys/tests/max_amount_inputs.rs index ae69bac..083d652 100644 --- a/creator-keys/tests/max_amount_inputs.rs +++ b/creator-keys/tests/max_amount_inputs.rs @@ -19,7 +19,7 @@ fn register_holder_with_one_key( ) -> Address { let holder = Address::generate(env); let price = client.get_buy_quote(creator).price; - client.buy_key(creator, &holder, &price); + client.buy_key(creator, &holder, &price, &None); holder } @@ -32,7 +32,7 @@ fn test_buy_key_with_large_safe_amount_succeeds() { let creator = register_test_creator(&env, &client, "creator1"); let buyer = Address::generate(&env); - let supply = client.buy_key(&creator, &buyer, &large_price); + let supply = client.buy_key(&creator, &buyer, &large_price, &None); assert_eq!(supply, 1, "buy should succeed with large amount"); } @@ -45,7 +45,7 @@ fn test_buy_key_with_maximum_safe_i128_succeeds() { let creator = register_test_creator(&env, &client, "creator2"); let buyer = Address::generate(&env); - let supply = client.buy_key(&creator, &buyer, &max_safe_amount); + let supply = client.buy_key(&creator, &buyer, &max_safe_amount, &None); assert_eq!(supply, 1, "buy should succeed at safe maximum"); } diff --git a/creator-keys/tests/protocol_state_version.rs b/creator-keys/tests/protocol_state_version.rs index ee78d50..85cafc0 100644 --- a/creator-keys/tests/protocol_state_version.rs +++ b/creator-keys/tests/protocol_state_version.rs @@ -103,7 +103,7 @@ fn test_get_protocol_state_version_increments_only_on_config_updates() { // Other state changes should not increment version client.set_key_price(&admin, &100i128); client.register_creator(&creator, &String::from_str(&env, "alice")); - client.buy_key(&creator, &buyer, &100i128); + client.buy_key(&creator, &buyer, &100i128, &None); client.set_treasury_address(&admin, &Address::generate(&env)); // Version should still be 2 (only incremented by fee config update) diff --git a/creator-keys/tests/quote_supply_edge_transitions.rs b/creator-keys/tests/quote_supply_edge_transitions.rs index c93f8ae..eb0391c 100644 --- a/creator-keys/tests/quote_supply_edge_transitions.rs +++ b/creator-keys/tests/quote_supply_edge_transitions.rs @@ -22,10 +22,10 @@ fn test_buy_quote_deterministic_across_zero_supply_transition() { q_before.total_amount >= 0, "buy quote total must be bounded" ); - client.buy_key(&creator, &buyer, &q_before.total_amount); + client.buy_key(&creator, &buyer, &q_before.total_amount, &None); // Transition back to zero supply. - client.sell_key(&creator, &buyer); + client.sell_key(&creator, &buyer, &None); assert_eq!(client.get_total_key_supply(&creator), 0); let q_after = client.get_buy_quote(&creator); @@ -61,8 +61,8 @@ fn test_buy_quote_recomputed_after_sell_reduces_supply() { let creator = register_test_creator(&env, &client, "edge3"); let holder = Address::generate(&env); let quote_at_zero = client.get_buy_quote(&creator); - client.buy_key(&creator, &holder, "e_at_zero.total_amount); - client.buy_key(&creator, &holder, "e_at_zero.total_amount); + client.buy_key(&creator, &holder, "e_at_zero.total_amount, &None); + client.buy_key(&creator, &holder, "e_at_zero.total_amount, &None); let supply_before_sell = client.get_total_key_supply(&creator); let quote_before_sell = client.get_buy_quote(&creator); @@ -73,7 +73,7 @@ fn test_buy_quote_recomputed_after_sell_reduces_supply() { "pre-sell quote must match bonding curve helper" ); - client.sell_key(&creator, &holder); + client.sell_key(&creator, &holder, &None); let supply_after_sell = client.get_total_key_supply(&creator); let quote_after_sell = client.get_buy_quote(&creator); diff --git a/creator-keys/tests/quote_zero_amount.rs b/creator-keys/tests/quote_zero_amount.rs index fa9e22b..98ef42e 100644 --- a/creator-keys/tests/quote_zero_amount.rs +++ b/creator-keys/tests/quote_zero_amount.rs @@ -30,7 +30,7 @@ fn test_get_sell_quote_zero_amount_returns_noop_quote() { client.set_key_price(&admin, &100); let creator = register_test_creator(&env, &client, "alice"); - client.buy_key(&creator, &holder, &100); + client.buy_key(&creator, &holder, &100, &None); set_stored_key_price(&env, &contract_id, 0); let quote = client.get_sell_quote(&creator, &holder); @@ -49,7 +49,7 @@ fn test_repeated_zero_amount_quote_calls_no_state_drift() { client.set_key_price(&admin, &100); let creator = register_test_creator(&env, &client, "alice"); - client.buy_key(&creator, &holder, &100); + client.buy_key(&creator, &holder, &100, &None); set_stored_key_price(&env, &contract_id, 0); // Test repeated buy quote calls with zero amount diff --git a/creator-keys/tests/sell_after_fee_config_mutation.rs b/creator-keys/tests/sell_after_fee_config_mutation.rs index 0014feb..ed78fa8 100644 --- a/creator-keys/tests/sell_after_fee_config_mutation.rs +++ b/creator-keys/tests/sell_after_fee_config_mutation.rs @@ -26,7 +26,7 @@ fn test_sell_execution_applies_updated_protocol_fee() { let holder = soroban_sdk::Address::generate(&env); // Holder buys a key at the original fee config - client.buy_key(&creator, &holder, &1000); + client.buy_key(&creator, &holder, &1000, &None); assert_eq!( client.get_key_balance(&creator, &holder), 1, @@ -36,7 +36,7 @@ fn test_sell_execution_applies_updated_protocol_fee() { // Update fee config before executing sell client.set_fee_config(&admin, &8000, &2000); // updated: 80/20 split - let supply = client.sell_key(&creator, &holder); + let supply = client.sell_key(&creator, &holder, &None); assert_eq!(supply, 0, "supply should decrement to 0 after sell"); // Holder balance should be zero after selling @@ -76,7 +76,7 @@ fn test_sell_execution_fee_matches_quote_after_fee_config_update() { let holder = soroban_sdk::Address::generate(&env); // Holder buys a key at the original fee config - client.buy_key(&creator, &holder, &500); + client.buy_key(&creator, &holder, &500, &None); assert_eq!( client.get_key_balance(&creator, &holder), 1, @@ -90,7 +90,7 @@ fn test_sell_execution_fee_matches_quote_after_fee_config_update() { let quote = client.get_sell_quote(&creator, &holder); // Execute the sell - let supply = client.sell_key(&creator, &holder); + let supply = client.sell_key(&creator, &holder, &None); assert_eq!(supply, 0, "supply should be 0 after sell"); assert_eq!( client.get_key_balance(&creator, &holder), diff --git a/creator-keys/tests/sell_event_seller_address.rs b/creator-keys/tests/sell_event_seller_address.rs index e14f651..cdaaac3 100644 --- a/creator-keys/tests/sell_event_seller_address.rs +++ b/creator-keys/tests/sell_event_seller_address.rs @@ -29,11 +29,11 @@ fn test_sell_event_seller_address_matches_caller() { client.register_creator(&creator, &String::from_str(&env, "alice")); // Buyer purchases keys - client.buy_key(&creator, &seller, &KEY_PRICE); + client.buy_key(&creator, &seller, &KEY_PRICE, &None); // Clear event log and then perform the sell env.events().all(); // Clear existing events - client.sell_key(&creator, &seller); + client.sell_key(&creator, &seller, &None); // Extract and verify the sell event let event_log = env.events().all(); @@ -81,8 +81,8 @@ fn test_sell_event_seller_address_field_is_non_zero() { // Configure and execute client.set_key_price(&admin, &KEY_PRICE); client.register_creator(&creator, &String::from_str(&env, "alice")); - client.buy_key(&creator, &seller, &KEY_PRICE); - client.sell_key(&creator, &seller); + client.buy_key(&creator, &seller, &KEY_PRICE, &None); + client.sell_key(&creator, &seller, &None); // Verify the seller address field is present and non-zero let event_log = env.events().all(); diff --git a/creator-keys/tests/sell_fee_split_invariants.rs b/creator-keys/tests/sell_fee_split_invariants.rs index a92b779..7a88845 100644 --- a/creator-keys/tests/sell_fee_split_invariants.rs +++ b/creator-keys/tests/sell_fee_split_invariants.rs @@ -23,7 +23,7 @@ fn setup_holder_with_key( let holder = Address::generate(env); let buy_quote = client.get_buy_quote(creator); assert_eq!(buy_quote.price, key_price); - client.buy_key(creator, &holder, &buy_quote.total_amount); + client.buy_key(creator, &holder, &buy_quote.total_amount, &None); holder } diff --git a/creator-keys/tests/sell_key.rs b/creator-keys/tests/sell_key.rs index f4e6390..ecc0776 100644 --- a/creator-keys/tests/sell_key.rs +++ b/creator-keys/tests/sell_key.rs @@ -22,10 +22,10 @@ fn test_sell_key_decrements_supply_and_balance() { let (client, creator) = setup(&env); let seller = Address::generate(&env); - client.buy_key(&creator, &seller, &100_i128); - client.buy_key(&creator, &seller, &100_i128); + client.buy_key(&creator, &seller, &100_i128, &None); + client.buy_key(&creator, &seller, &100_i128, &None); - let new_supply = client.sell_key(&creator, &seller); + let new_supply = client.sell_key(&creator, &seller, &None); assert_eq!(new_supply, 1); assert_eq!(client.get_total_key_supply(&creator), 1); @@ -38,10 +38,10 @@ fn test_sell_key_removes_holder_when_last_key_is_sold() { let (client, creator) = setup(&env); let seller = Address::generate(&env); - client.buy_key(&creator, &seller, &100_i128); + client.buy_key(&creator, &seller, &100_i128, &None); assert_eq!(client.get_creator_holder_count(&creator), 1); - let new_supply = client.sell_key(&creator, &seller); + let new_supply = client.sell_key(&creator, &seller, &None); assert_eq!(new_supply, 0); assert_eq!(client.get_total_key_supply(&creator), 0); @@ -55,11 +55,11 @@ fn test_sell_key_preserves_holder_count_when_seller_still_has_keys() { let (client, creator) = setup(&env); let seller = Address::generate(&env); - client.buy_key(&creator, &seller, &100_i128); - client.buy_key(&creator, &seller, &100_i128); + client.buy_key(&creator, &seller, &100_i128, &None); + client.buy_key(&creator, &seller, &100_i128, &None); assert_eq!(client.get_creator_holder_count(&creator), 1); - let new_supply = client.sell_key(&creator, &seller); + let new_supply = client.sell_key(&creator, &seller, &None); assert_eq!(new_supply, 1); assert_eq!(client.get_key_balance(&creator, &seller), 1); @@ -74,7 +74,7 @@ fn test_sell_key_fails_for_unregistered_creator() { let creator = Address::generate(&env); let seller = Address::generate(&env); - let result = client.try_sell_key(&creator, &seller); + let result = client.try_sell_key(&creator, &seller, &None); assert_eq!(result, Err(Ok(ContractError::NotRegistered))); } @@ -84,7 +84,7 @@ fn test_sell_key_fails_when_seller_has_no_keys() { let (client, creator) = setup(&env); let seller = Address::generate(&env); - let result = client.try_sell_key(&creator, &seller); + let result = client.try_sell_key(&creator, &seller, &None); assert_eq!(result, Err(Ok(ContractError::InsufficientBalance))); } @@ -95,12 +95,12 @@ fn test_sell_reverts_when_seller_has_insufficient_balance() { let seller = Address::generate(&env); // Seller buys 1 key. - client.buy_key(&creator, &seller, &100_i128); + client.buy_key(&creator, &seller, &100_i128, &None); assert_eq!(client.get_key_balance(&creator, &seller), 1); assert_eq!(client.get_total_key_supply(&creator), 1); // Seller sells their only key — this succeeds. - client.sell_key(&creator, &seller); + client.sell_key(&creator, &seller, &None); assert_eq!(client.get_key_balance(&creator, &seller), 0); assert_eq!(client.get_total_key_supply(&creator), 0); @@ -109,7 +109,7 @@ fn test_sell_reverts_when_seller_has_insufficient_balance() { let supply_before = client.get_total_key_supply(&creator); // Seller attempts to sell again — should revert with InsufficientBalance. - let result = client.try_sell_key(&creator, &seller); + let result = client.try_sell_key(&creator, &seller, &None); assert_eq!(result, Err(Ok(ContractError::InsufficientBalance))); // Holder balance and total supply must be unchanged. @@ -124,17 +124,17 @@ fn test_sell_full_exit_then_rebuy_updates_state() { let (client, creator) = setup(&env); let trader = Address::generate(&env); - client.buy_key(&creator, &trader, &100_i128); + client.buy_key(&creator, &trader, &100_i128, &None); assert_eq!(client.get_total_key_supply(&creator), 1); assert_eq!(client.get_key_balance(&creator, &trader), 1); assert_eq!(client.get_creator_holder_count(&creator), 1); - client.sell_key(&creator, &trader); + client.sell_key(&creator, &trader, &None); assert_eq!(client.get_total_key_supply(&creator), 0); assert_eq!(client.get_key_balance(&creator, &trader), 0); assert_eq!(client.get_creator_holder_count(&creator), 0); - let supply_after_rebuy = client.buy_key(&creator, &trader, &100_i128); + let supply_after_rebuy = client.buy_key(&creator, &trader, &100_i128, &None); assert_eq!(supply_after_rebuy, 1); assert_eq!(client.get_total_key_supply(&creator), 1); @@ -149,13 +149,13 @@ fn test_holder_count_returns_to_zero_after_last_holder_exit_and_rebuy() { let (client, creator) = setup(&env); let trader = Address::generate(&env); - client.buy_key(&creator, &trader, &100_i128); + client.buy_key(&creator, &trader, &100_i128, &None); assert_eq!(client.get_creator_holder_count(&creator), 1); - client.sell_key(&creator, &trader); + client.sell_key(&creator, &trader, &None); assert_eq!(client.get_creator_holder_count(&creator), 0); - let supply_after_rebuy = client.buy_key(&creator, &trader, &100_i128); + let supply_after_rebuy = client.buy_key(&creator, &trader, &100_i128, &None); assert_eq!(supply_after_rebuy, 1); assert_eq!(client.get_creator_holder_count(&creator), 1); } diff --git a/creator-keys/tests/sell_protocol_fee_recipient_balance.rs b/creator-keys/tests/sell_protocol_fee_recipient_balance.rs index 7b02e0d..85d6d3b 100644 --- a/creator-keys/tests/sell_protocol_fee_recipient_balance.rs +++ b/creator-keys/tests/sell_protocol_fee_recipient_balance.rs @@ -28,7 +28,7 @@ fn test_sell_increases_protocol_fee_recipient_balance_by_bps_fee() { let creator = register_test_creator(&env, &client, "alice"); let holder = soroban_sdk::Address::generate(&env); - client.buy_key(&creator, &holder, &KEY_PRICE); + client.buy_key(&creator, &holder, &KEY_PRICE, &None); let balance_before = client.get_protocol_recipient_balance(); let quote = client.get_sell_quote(&creator, &holder); @@ -38,7 +38,7 @@ fn test_sell_increases_protocol_fee_recipient_balance_by_bps_fee() { "sell quote protocol fee should match bps calculation" ); - client.sell_key(&creator, &holder); + client.sell_key(&creator, &holder, &None); let balance_after = client.get_protocol_recipient_balance(); assert_eq!( @@ -65,13 +65,13 @@ fn test_sell_protocol_fee_recipient_balance_accumulates_across_two_sells() { let creator = register_test_creator(&env, &client, "bob"); let holder = soroban_sdk::Address::generate(&env); - client.buy_key(&creator, &holder, &KEY_PRICE); - client.buy_key(&creator, &holder, &KEY_PRICE); + client.buy_key(&creator, &holder, &KEY_PRICE, &None); + client.buy_key(&creator, &holder, &KEY_PRICE, &None); let expected_protocol_fee = compute_expected_protocol_fee(KEY_PRICE, PROTOCOL_BPS); let balance_before = client.get_protocol_recipient_balance(); - client.sell_key(&creator, &holder); + client.sell_key(&creator, &holder, &None); let balance_after_first_sell = client.get_protocol_recipient_balance(); assert_eq!( balance_after_first_sell - balance_before, @@ -79,7 +79,7 @@ fn test_sell_protocol_fee_recipient_balance_accumulates_across_two_sells() { "first sell should credit one protocol fee" ); - client.sell_key(&creator, &holder); + client.sell_key(&creator, &holder, &None); let balance_after_second_sell = client.get_protocol_recipient_balance(); assert_eq!( balance_after_second_sell - balance_after_first_sell, diff --git a/creator-keys/tests/sell_quote_matches_execution.rs b/creator-keys/tests/sell_quote_matches_execution.rs index 9053993..9ac123d 100644 --- a/creator-keys/tests/sell_quote_matches_execution.rs +++ b/creator-keys/tests/sell_quote_matches_execution.rs @@ -55,7 +55,7 @@ fn assert_sell_quote_matches_execution( "difference between quoted and actual proceeds must be zero before sell" ); - let supply_after = client.sell_key(creator, holder); + let supply_after = client.sell_key(creator, holder, &None); assert_eq!( supply_after, supply_before_sell - 1, @@ -83,7 +83,7 @@ fn setup_holder_with_supply( let holder = Address::generate(env); let buy_quote = client.get_buy_quote(creator); for _ in 0..key_count { - client.buy_key(creator, &holder, &buy_quote.total_amount); + client.buy_key(creator, &holder, &buy_quote.total_amount, &None); } holder } @@ -124,7 +124,7 @@ fn test_buy_then_sell_has_symmetric_price_impact_after_fees() { let starting_supply = client.get_total_key_supply(&creator); let initial_buy_quote = client.get_buy_quote(&creator); - client.buy_key(&creator, &trader, &initial_buy_quote.total_amount); + client.buy_key(&creator, &trader, &initial_buy_quote.total_amount, &None); let sell_quote = client.get_sell_quote(&creator, &trader); let supply_after_buy = client.get_total_key_supply(&creator); assert_eq!(supply_after_buy, starting_supply + 1); @@ -137,7 +137,7 @@ fn test_buy_then_sell_has_symmetric_price_impact_after_fees() { assert_eq!(sell_quote.price, expected_sell_price); assert_eq!(sell_quote.total_amount, expected_sell_proceeds); - client.sell_key(&creator, &trader); + client.sell_key(&creator, &trader, &None); let final_buy_quote = client.get_buy_quote(&creator); assert_eq!(client.get_total_key_supply(&creator), starting_supply); assert_eq!(final_buy_quote.price, initial_buy_quote.price); diff --git a/creator-keys/tests/sell_quote_rounding.rs b/creator-keys/tests/sell_quote_rounding.rs index e886276..c7e0e86 100644 --- a/creator-keys/tests/sell_quote_rounding.rs +++ b/creator-keys/tests/sell_quote_rounding.rs @@ -21,7 +21,7 @@ fn register_holder_with_one_key( ) -> Address { let holder = Address::generate(env); let price = client.get_buy_quote(creator).price; - client.buy_key(creator, &holder, &price); + client.buy_key(creator, &holder, &price, &None); holder } diff --git a/creator-keys/tests/sell_quote_zero_amount.rs b/creator-keys/tests/sell_quote_zero_amount.rs index c6d01b4..b485b99 100644 --- a/creator-keys/tests/sell_quote_zero_amount.rs +++ b/creator-keys/tests/sell_quote_zero_amount.rs @@ -30,7 +30,7 @@ fn test_sell_quote_zero_amount_returns_zero_quote() { client.set_key_price(&admin, &100); set_protocol_fee_bps(&env, &client, 9000, 1000); let creator = register_test_creator(&env, &client, "alice"); - client.buy_key(&creator, &holder, &100); + client.buy_key(&creator, &holder, &100, &None); // Zero out the key price — produces a zero sell amount input set_stored_key_price(&env, &contract_id, 0); @@ -97,7 +97,7 @@ fn test_sell_quote_zero_amount_no_state_modification() { client.set_key_price(&admin, &100); set_protocol_fee_bps(&env, &client, 9000, 1000); let creator = register_test_creator(&env, &client, "charlie"); - client.buy_key(&creator, &holder, &100); + client.buy_key(&creator, &holder, &100, &None); // Zero the price and capture state before the read-only calls. set_stored_key_price(&env, &contract_id, 0); diff --git a/creator-keys/tests/sell_underflow.rs b/creator-keys/tests/sell_underflow.rs index 22844dc..9c0ae3c 100644 --- a/creator-keys/tests/sell_underflow.rs +++ b/creator-keys/tests/sell_underflow.rs @@ -51,7 +51,7 @@ fn test_sell_with_no_keys_returns_insufficient_balance() { let seller = Address::generate(&env); // seller never bought — balance is 0 - let result = client.try_sell_key(&creator, &seller); + let result = client.try_sell_key(&creator, &seller, &None); assert_eq!(result, Err(Ok(ContractError::InsufficientBalance))); } @@ -61,11 +61,11 @@ fn test_sell_second_key_after_selling_last_returns_insufficient_balance() { let (client, creator) = setup(&env, 100); let seller = Address::generate(&env); - client.buy_key(&creator, &seller, &100); - client.sell_key(&creator, &seller); + client.buy_key(&creator, &seller, &100, &None); + client.sell_key(&creator, &seller, &None); // No keys left — should be InsufficientBalance, not SellUnderflow - let result = client.try_sell_key(&creator, &seller); + let result = client.try_sell_key(&creator, &seller, &None); assert_eq!(result, Err(Ok(ContractError::InsufficientBalance))); } @@ -91,7 +91,7 @@ fn test_sell_registered_zero_supply_creator_returns_sell_underflow_without_state "setup: seller balance must be nonzero" ); - let result = client.try_sell_key(&creator, &seller); + let result = client.try_sell_key(&creator, &seller, &None); assert_eq!(result, Err(Ok(ContractError::SellUnderflow))); let after = capture_snapshot(&client, &creator, &seller); @@ -104,8 +104,8 @@ fn test_sell_after_buy_succeeds_without_underflow_error() { let (client, creator) = setup(&env, 100); let seller = Address::generate(&env); - client.buy_key(&creator, &seller, &100); - let result = client.try_sell_key(&creator, &seller); + client.buy_key(&creator, &seller, &100, &None); + let result = client.try_sell_key(&creator, &seller, &None); assert!(result.is_ok(), "expected Ok but got {:?}", result); } @@ -116,11 +116,11 @@ fn test_sell_two_keys_succeeds_without_underflow_error() { let (client, creator) = setup(&env, 100); let seller = Address::generate(&env); - client.buy_key(&creator, &seller, &100); - client.buy_key(&creator, &seller, &100); - client.sell_key(&creator, &seller); + client.buy_key(&creator, &seller, &100, &None); + client.buy_key(&creator, &seller, &100, &None); + client.sell_key(&creator, &seller, &None); - let result = client.try_sell_key(&creator, &seller); + let result = client.try_sell_key(&creator, &seller, &None); assert!( result.is_ok(), "second sell should succeed, got {:?}", @@ -136,9 +136,9 @@ fn test_supply_and_balance_decremented_correctly_after_sell() { let (client, creator) = setup(&env, 100); let seller = Address::generate(&env); - client.buy_key(&creator, &seller, &100); - client.buy_key(&creator, &seller, &100); - client.sell_key(&creator, &seller); + client.buy_key(&creator, &seller, &100, &None); + client.buy_key(&creator, &seller, &100, &None); + client.sell_key(&creator, &seller, &None); assert_eq!(client.get_total_key_supply(&creator), 1); assert_eq!(client.get_key_balance(&creator, &seller), 1); diff --git a/creator-keys/tests/slippage_protection.rs b/creator-keys/tests/slippage_protection.rs new file mode 100644 index 0000000..4d26a0a --- /dev/null +++ b/creator-keys/tests/slippage_protection.rs @@ -0,0 +1,137 @@ +//! Slippage protection for `buy_key` (`max_price`) and `sell_key` (`min_proceeds`). + +mod contract_test_env; + +use contract_test_env::{ + capture_snapshot, register_creator_keys, register_test_creator, set_pricing_and_fees, + test_env_with_auths, +}; +use creator_keys::ContractError; +use soroban_sdk::{testutils::Address as _, Address, Env}; + +const KEY_PRICE: i128 = 1_000; + +fn setup_buy( + env: &Env, +) -> ( + creator_keys::CreatorKeysContractClient<'_>, + Address, + Address, + Address, +) { + let (client, contract_id) = register_creator_keys(env); + let _admin = set_pricing_and_fees(env, &client, KEY_PRICE, 9000, 1000); + let creator = register_test_creator(env, &client, "alice"); + let buyer = Address::generate(env); + (client, contract_id, creator, buyer) +} + +fn setup_sell( + env: &Env, +) -> ( + creator_keys::CreatorKeysContractClient<'_>, + Address, + Address, + Address, +) { + let (client, contract_id, creator, holder) = { + let (client, contract_id, creator, buyer) = setup_buy(env); + (client, contract_id, creator, buyer) + }; + let buy_quote = client.get_buy_quote(&creator); + client.buy_key(&creator, &holder, &buy_quote.total_amount, &None); + (client, contract_id, creator, holder) +} + +#[test] +fn test_slippage_exceeded_discriminant_is_16() { + assert_eq!(ContractError::SlippageExceeded as u32, 16); +} + +#[test] +fn test_buy_slippage_reverts_when_price_exceeds_max_price() { + let env = test_env_with_auths(); + let (client, _, creator, buyer) = setup_buy(&env); + + let before = capture_snapshot(&client, &creator, &buyer); + let result = client.try_buy_key(&creator, &buyer, &KEY_PRICE, &Some(KEY_PRICE - 1)); + let after = capture_snapshot(&client, &creator, &buyer); + + assert_eq!(result, Err(Ok(ContractError::SlippageExceeded))); + before.assert_unchanged(&after); +} + +#[test] +fn test_buy_slippage_succeeds_when_price_at_or_below_max_price() { + let env = test_env_with_auths(); + let (client, _, creator, buyer) = setup_buy(&env); + let buy_quote = client.get_buy_quote(&creator); + + let supply_at_limit = + client.buy_key(&creator, &buyer, &buy_quote.total_amount, &Some(KEY_PRICE)); + assert_eq!(supply_at_limit, 1); + assert_eq!(client.get_key_balance(&creator, &buyer), 1); + + let buyer_two = Address::generate(&env); + let supply_below_limit = client.buy_key( + &creator, + &buyer_two, + &buy_quote.total_amount, + &Some(KEY_PRICE + 1), + ); + assert_eq!(supply_below_limit, 2); +} + +#[test] +fn test_sell_slippage_reverts_when_proceeds_below_min_proceeds() { + let env = test_env_with_auths(); + let (client, _, creator, holder) = setup_sell(&env); + let sell_quote = client.get_sell_quote(&creator, &holder); + + let before = capture_snapshot(&client, &creator, &holder); + let result = client.try_sell_key(&creator, &holder, &Some(sell_quote.total_amount + 1)); + let after = capture_snapshot(&client, &creator, &holder); + + assert_eq!(result, Err(Ok(ContractError::SlippageExceeded))); + before.assert_unchanged(&after); +} + +#[test] +fn test_sell_slippage_succeeds_when_proceeds_meet_or_exceed_min_proceeds() { + let env = test_env_with_auths(); + let (client, _, creator, holder) = setup_sell(&env); + let sell_quote = client.get_sell_quote(&creator, &holder); + + let supply_at_limit = client.sell_key(&creator, &holder, &Some(sell_quote.total_amount)); + assert_eq!(supply_at_limit, 0); + + let holder_two = Address::generate(&env); + let buy_quote = client.get_buy_quote(&creator); + client.buy_key(&creator, &holder_two, &buy_quote.total_amount, &None); + let sell_quote_two = client.get_sell_quote(&creator, &holder_two); + + let supply_below_limit = client.sell_key( + &creator, + &holder_two, + &Some(sell_quote_two.total_amount - 1), + ); + assert_eq!(supply_below_limit, 0); +} + +#[test] +fn test_slippage_none_passthrough_preserves_existing_behavior() { + let env = test_env_with_auths(); + let (client, _, creator, buyer) = setup_buy(&env); + let buy_quote = client.get_buy_quote(&creator); + + let supply = client.buy_key(&creator, &buyer, &buy_quote.total_amount, &None); + assert_eq!(supply, 1); + + let sell_quote = client.get_sell_quote(&creator, &buyer); + let supply_after_sell = client.sell_key(&creator, &buyer, &None); + assert_eq!(supply_after_sell, 0); + assert_eq!( + sell_quote.total_amount, + buy_quote.price - buy_quote.creator_fee - buy_quote.protocol_fee + ); +} diff --git a/creator-keys/tests/supply_invariants.rs b/creator-keys/tests/supply_invariants.rs index 75b48eb..91a56cd 100644 --- a/creator-keys/tests/supply_invariants.rs +++ b/creator-keys/tests/supply_invariants.rs @@ -30,9 +30,9 @@ fn test_supply_buy_then_sell_returns_to_zero() { let buyer = Address::generate(&env); assert_eq!(client.get_total_key_supply(&creator), 0); - client.buy_key(&creator, &buyer, &100); + client.buy_key(&creator, &buyer, &100, &None); assert_eq!(client.get_total_key_supply(&creator), 1); - client.sell_key(&creator, &buyer); + client.sell_key(&creator, &buyer, &None); assert_eq!(client.get_total_key_supply(&creator), 0); } @@ -42,11 +42,11 @@ fn test_supply_buy_two_sell_one_conserves_supply() { let (client, creator) = setup(&env, 100); let buyer = Address::generate(&env); - client.buy_key(&creator, &buyer, &100); - client.buy_key(&creator, &buyer, &100); + client.buy_key(&creator, &buyer, &100, &None); + client.buy_key(&creator, &buyer, &100, &None); assert_eq!(client.get_total_key_supply(&creator), 2); - client.sell_key(&creator, &buyer); + client.sell_key(&creator, &buyer, &None); assert_eq!(client.get_total_key_supply(&creator), 1); } @@ -57,10 +57,10 @@ fn test_supply_alternating_buys_and_sells() { let buyer = Address::generate(&env); // buy → sell → buy → sell: supply must be 0 at end - client.buy_key(&creator, &buyer, &100); - client.sell_key(&creator, &buyer); - client.buy_key(&creator, &buyer, &100); - client.sell_key(&creator, &buyer); + client.buy_key(&creator, &buyer, &100, &None); + client.sell_key(&creator, &buyer, &None); + client.buy_key(&creator, &buyer, &100, &None); + client.sell_key(&creator, &buyer, &None); assert_eq!(client.get_total_key_supply(&creator), 0); assert_eq!(client.get_key_balance(&creator, &buyer), 0); @@ -77,9 +77,9 @@ fn test_supply_three_buyers_sum_equals_total() { let b2 = Address::generate(&env); let b3 = Address::generate(&env); - client.buy_key(&creator, &b1, &100); - client.buy_key(&creator, &b2, &100); - client.buy_key(&creator, &b3, &100); + client.buy_key(&creator, &b1, &100, &None); + client.buy_key(&creator, &b2, &100, &None); + client.buy_key(&creator, &b3, &100, &None); let bal1 = client.get_key_balance(&creator, &b1); let bal2 = client.get_key_balance(&creator, &b2); @@ -101,9 +101,9 @@ fn test_supply_multiple_buys_per_holder_sum_equals_total() { let b1 = Address::generate(&env); let b2 = Address::generate(&env); - client.buy_key(&creator, &b1, &100); - client.buy_key(&creator, &b1, &100); - client.buy_key(&creator, &b2, &100); + client.buy_key(&creator, &b1, &100, &None); + client.buy_key(&creator, &b1, &100, &None); + client.buy_key(&creator, &b2, &100, &None); let bal1 = client.get_key_balance(&creator, &b1); let bal2 = client.get_key_balance(&creator, &b2); @@ -128,18 +128,18 @@ fn test_supply_mixed_trades_three_participants() { let carol = Address::generate(&env); // Alice buys 2, Bob buys 1, Carol buys 2 - client.buy_key(&creator, &alice, &100); - client.buy_key(&creator, &alice, &100); - client.buy_key(&creator, &bob, &100); - client.buy_key(&creator, &carol, &100); - client.buy_key(&creator, &carol, &100); + client.buy_key(&creator, &alice, &100, &None); + client.buy_key(&creator, &alice, &100, &None); + client.buy_key(&creator, &bob, &100, &None); + client.buy_key(&creator, &carol, &100, &None); + client.buy_key(&creator, &carol, &100, &None); assert_eq!(client.get_total_key_supply(&creator), 5); // Alice sells 1, Carol sells 2 - client.sell_key(&creator, &alice); - client.sell_key(&creator, &carol); - client.sell_key(&creator, &carol); + client.sell_key(&creator, &alice, &None); + client.sell_key(&creator, &carol, &None); + client.sell_key(&creator, &carol, &None); let bal_alice = client.get_key_balance(&creator, &alice); let bal_bob = client.get_key_balance(&creator, &bob); @@ -159,12 +159,12 @@ fn test_supply_never_goes_below_zero_after_all_sells() { let (client, creator) = setup(&env, 100); let buyer = Address::generate(&env); - client.buy_key(&creator, &buyer, &100); - client.buy_key(&creator, &buyer, &100); - client.buy_key(&creator, &buyer, &100); - client.sell_key(&creator, &buyer); - client.sell_key(&creator, &buyer); - client.sell_key(&creator, &buyer); + client.buy_key(&creator, &buyer, &100, &None); + client.buy_key(&creator, &buyer, &100, &None); + client.buy_key(&creator, &buyer, &100, &None); + client.sell_key(&creator, &buyer, &None); + client.sell_key(&creator, &buyer, &None); + client.sell_key(&creator, &buyer, &None); assert_eq!(client.get_total_key_supply(&creator), 0); } @@ -179,9 +179,9 @@ fn test_supply_changes_for_one_creator_do_not_affect_another() { let buyer = Address::generate(&env); - client.buy_key(&creator_a, &buyer, &100); - client.buy_key(&creator_a, &buyer, &100); - client.sell_key(&creator_a, &buyer); + client.buy_key(&creator_a, &buyer, &100, &None); + client.buy_key(&creator_a, &buyer, &100, &None); + client.sell_key(&creator_a, &buyer, &None); // creator_b supply untouched assert_eq!(client.get_total_key_supply(&creator_b), 0); @@ -198,14 +198,14 @@ fn test_holder_count_reflects_mixed_trade_correctly() { let b1 = Address::generate(&env); let b2 = Address::generate(&env); - client.buy_key(&creator, &b1, &100); - client.buy_key(&creator, &b2, &100); + client.buy_key(&creator, &b1, &100, &None); + client.buy_key(&creator, &b2, &100, &None); assert_eq!(client.get_creator_holder_count(&creator), 2); - client.sell_key(&creator, &b1); + client.sell_key(&creator, &b1, &None); assert_eq!(client.get_creator_holder_count(&creator), 1); - client.sell_key(&creator, &b2); + client.sell_key(&creator, &b2, &None); assert_eq!(client.get_creator_holder_count(&creator), 0); assert_eq!(client.get_total_key_supply(&creator), 0); } @@ -216,9 +216,9 @@ fn test_holder_count_unchanged_when_holder_still_has_keys() { let (client, creator) = setup(&env, 100); let buyer = Address::generate(&env); - client.buy_key(&creator, &buyer, &100); - client.buy_key(&creator, &buyer, &100); - client.sell_key(&creator, &buyer); + client.buy_key(&creator, &buyer, &100, &None); + client.buy_key(&creator, &buyer, &100, &None); + client.sell_key(&creator, &buyer, &None); // Buyer still holds 1 key — holder count must stay at 1 assert_eq!(client.get_creator_holder_count(&creator), 1); diff --git a/creator-keys/tests/supply_unchanged_after_failed_sell.rs b/creator-keys/tests/supply_unchanged_after_failed_sell.rs index 72f9ab4..344dfbf 100644 --- a/creator-keys/tests/supply_unchanged_after_failed_sell.rs +++ b/creator-keys/tests/supply_unchanged_after_failed_sell.rs @@ -23,7 +23,7 @@ fn test_total_supply_unchanged_after_failed_sell_insufficient_balance() { // Buy one key so there is a non-zero supply to observe. let buyer = Address::generate(&env); - client.buy_key(&creator, &buyer, &100_i128); + client.buy_key(&creator, &buyer, &100_i128, &None); // A different address that holds zero keys. let non_holder = Address::generate(&env); @@ -33,7 +33,7 @@ fn test_total_supply_unchanged_after_failed_sell_insufficient_balance() { assert_eq!(supply_before, 1, "setup: supply should be 1 after one buy"); // Attempt to sell — should fail because non_holder has no keys. - let result = client.try_sell_key(&creator, &non_holder); + let result = client.try_sell_key(&creator, &non_holder, &None); assert_eq!( result, Err(Ok(ContractError::InsufficientBalance)), @@ -59,13 +59,13 @@ fn test_total_supply_unchanged_after_failed_sell_not_registered() { // Register one creator and buy a key so there is observable state. let creator = register_test_creator(&env, &client, "bob"); let buyer = Address::generate(&env); - client.buy_key(&creator, &buyer, &100_i128); + client.buy_key(&creator, &buyer, &100_i128, &None); let supply_before = client.get_total_key_supply(&creator); // A completely different unregistered creator address. let unregistered = Address::generate(&env); - let result = client.try_sell_key(&unregistered, &buyer); + let result = client.try_sell_key(&unregistered, &buyer, &None); assert_eq!( result, Err(Ok(ContractError::NotRegistered)), diff --git a/creator-keys/tests/tests/buy_after_fee_config_mutation.rs b/creator-keys/tests/tests/buy_after_fee_config_mutation.rs index 78ddcd8..230fd40 100644 --- a/creator-keys/tests/tests/buy_after_fee_config_mutation.rs +++ b/creator-keys/tests/tests/buy_after_fee_config_mutation.rs @@ -29,7 +29,7 @@ fn test_buy_execution_applies_updated_protocol_fee() { // Update fee config before executing buy client.set_fee_config(&admin, &8000, &2000); // updated: 80/20 split - let supply = client.buy_key(&creator, &buyer, &1000); + let supply = client.buy_key(&creator, &buyer, &1000, &None); assert_eq!(supply, 1, "supply should increment to 1 after buy"); // Buyer receives the correct key balance @@ -75,7 +75,7 @@ fn test_buy_execution_fee_matches_quote_after_fee_config_update() { let quote = client.get_buy_quote(&creator); // Execute the buy - let supply = client.buy_key(&creator, &buyer, &500); + let supply = client.buy_key(&creator, &buyer, &500, &None); assert_eq!(supply, 1, "supply should be 1 after buy"); assert_eq!( client.get_key_balance(&creator, &buyer), diff --git a/creator-keys/tests/total_supply_overflow.rs b/creator-keys/tests/total_supply_overflow.rs index fa1d5e7..0214fb5 100644 --- a/creator-keys/tests/total_supply_overflow.rs +++ b/creator-keys/tests/total_supply_overflow.rs @@ -30,7 +30,7 @@ fn buy_at_max_supply_is_rejected_with_overflow_and_no_state_corruption() { }); let buyer = Address::generate(&env); - let result = client.try_buy_key(&creator, &buyer, &100i128); + let result = client.try_buy_key(&creator, &buyer, &100i128, &None); // The buy that would push supply past the ceiling is rejected with Overflow. assert!(matches!(result, Err(Ok(ContractError::Overflow)))); diff --git a/creator-keys/tests/treasury_accumulation_multi_buyer.rs b/creator-keys/tests/treasury_accumulation_multi_buyer.rs index bf46661..58837c6 100644 --- a/creator-keys/tests/treasury_accumulation_multi_buyer.rs +++ b/creator-keys/tests/treasury_accumulation_multi_buyer.rs @@ -46,7 +46,7 @@ fn test_treasury_accumulates_protocol_fees_across_distinct_buyers() { let treasury_before = client.get_protocol_recipient_balance(); - client.buy_key(&creator, buyer, "e.total_amount); + client.buy_key(&creator, buyer, "e.total_amount, &None); let treasury_after = client.get_protocol_recipient_balance(); assert_eq!( diff --git a/creator-keys/tests/treasury_balance_unchanged_after_failed_trade.rs b/creator-keys/tests/treasury_balance_unchanged_after_failed_trade.rs index e9d926c..3a23f8c 100644 --- a/creator-keys/tests/treasury_balance_unchanged_after_failed_trade.rs +++ b/creator-keys/tests/treasury_balance_unchanged_after_failed_trade.rs @@ -37,7 +37,7 @@ fn test_treasury_balance_unchanged_after_failed_buy_insufficient_payment() { let treasury_before = client.get_protocol_recipient_balance(); // Pay one stroop below the key price — should fail with InsufficientPayment. - let result = client.try_buy_key(&creator, &buyer, &(KEY_PRICE - 1)); + let result = client.try_buy_key(&creator, &buyer, &(KEY_PRICE - 1), &None); assert_eq!( result, Err(Ok(ContractError::InsufficientPayment)), @@ -67,7 +67,7 @@ fn test_treasury_balance_unchanged_after_failed_buy_unregistered_creator() { // assertion proves the balance is held steady rather than merely staying 0. let registered = register_test_creator(&env, &client, "alice"); let buyer = Address::generate(&env); - client.buy_key(®istered, &buyer, &KEY_PRICE); + client.buy_key(®istered, &buyer, &KEY_PRICE, &None); let treasury_before = client.get_protocol_recipient_balance(); assert!( @@ -77,7 +77,7 @@ fn test_treasury_balance_unchanged_after_failed_buy_unregistered_creator() { // Buying keys for a creator that was never registered must fail. let unregistered = Address::generate(&env); - let result = client.try_buy_key(&unregistered, &buyer, &KEY_PRICE); + let result = client.try_buy_key(&unregistered, &buyer, &KEY_PRICE, &None); assert_eq!( result, Err(Ok(ContractError::NotRegistered)), @@ -105,7 +105,7 @@ fn test_treasury_balance_unchanged_after_failed_sell_insufficient_balance() { // Seed a non-zero treasury balance with one successful buy. let creator = register_test_creator(&env, &client, "alice"); let buyer = Address::generate(&env); - client.buy_key(&creator, &buyer, &KEY_PRICE); + client.buy_key(&creator, &buyer, &KEY_PRICE, &None); let treasury_before = client.get_protocol_recipient_balance(); assert!( @@ -115,7 +115,7 @@ fn test_treasury_balance_unchanged_after_failed_sell_insufficient_balance() { // A different address holding zero keys cannot sell. let non_holder = Address::generate(&env); - let result = client.try_sell_key(&creator, &non_holder); + let result = client.try_sell_key(&creator, &non_holder, &None); assert_eq!( result, Err(Ok(ContractError::InsufficientBalance)), diff --git a/creator-keys/tests/zero_creator_fee_regression.rs b/creator-keys/tests/zero_creator_fee_regression.rs index 31e024e..7ae764c 100644 --- a/creator-keys/tests/zero_creator_fee_regression.rs +++ b/creator-keys/tests/zero_creator_fee_regression.rs @@ -42,7 +42,7 @@ fn test_zero_creator_bps_full_payment_to_creator_after_protocol_fee() { // Perform a buy with payment of 1000 let payment_amount = 1000i128; - let supply = client.buy_key(&creator, &buyer, &payment_amount); + let supply = client.buy_key(&creator, &buyer, &payment_amount, &None); assert_eq!(supply, 1, "Supply should increment to 1"); // Compute expected fees @@ -89,7 +89,7 @@ fn test_zero_creator_bps_with_partial_protocol_fee() { // Perform a buy let payment_amount = 1000i128; - client.buy_key(&creator, &buyer, &payment_amount); + client.buy_key(&creator, &buyer, &payment_amount, &None); // Compute fees let (creator_fee, protocol_fee) = client.compute_fees_for_payment(&payment_amount); @@ -131,7 +131,7 @@ fn test_zero_protocol_bps_full_payment_to_creator() { // Perform a buy let payment_amount = 1000i128; - client.buy_key(&creator, &buyer, &payment_amount); + client.buy_key(&creator, &buyer, &payment_amount, &None); // Compute fees let (creator_fee, protocol_fee) = client.compute_fees_for_payment(&payment_amount); @@ -168,7 +168,7 @@ fn test_zero_creator_bps_no_rounding_errors_with_odd_amounts() { // Perform a buy with an odd payment amount let payment_amount = 999i128; - client.buy_key(&creator, &buyer, &payment_amount); + client.buy_key(&creator, &buyer, &payment_amount, &None); // Compute fees let (creator_fee, protocol_fee) = client.compute_fees_for_payment(&payment_amount);