Skip to content

feat: Resolve contract issues 578, 579, 542, 543 - #699

Merged
abayomicornelius merged 5 commits into
SO4-Markets:mainfrom
infimum90:main
Sep 1, 2026
Merged

feat: Resolve contract issues 578, 579, 542, 543#699
abayomicornelius merged 5 commits into
SO4-Markets:mainfrom
infimum90:main

Conversation

@infimum90

Copy link
Copy Markdown
Contributor

Closes #579 contracts/liquidation_handler/src/lib.rs:28 / contracts/adl_handler/src/lib.rs:42 — added update_oracle(env, caller, new_oracle) admin-gated, rejecting current_contract_address and any other stored instance address (Admin/RoleStore/DataStore/OrderHandler), emitting orcl_set with old/new, mirroring deposit_handler/src/lib.rs:189, order_handler/src/lib.rs:387, withdrawal_handler/src/lib.rs:183. Added Error::InvalidOracle (liquidation 8, adl 10, fixed duplicate InvalidMarket/MarketPaused discriminant in liquidation).

Closes #578 — removed dead variants: order_handler/src/lib.rs:89 PriceTooHigh=7, order_handler/src/lib.rs:96 UnauthorizedPositionManager=11, oracle/src/lib.rs:48 NoKeepers=8, reader/src/lib.rs:63 Unauthorized=3 (explicit repr preserved).

Closes #542 contracts/deposit_vault/src/lib.rs:73 / contracts/withdrawal_vault/src/lib.rs:59 — record_transfer_in now fn(env, caller, token) with caller.require_auth() + require_controller, mirroring transfer_out. Updated deposit_handler/src/lib.rs:129 client trait and deposit_handler/src/lib.rs:319,327,337 call sites to pass handler as caller.

Closes #543 contracts/data_store/src/lib.rs:177 — added lazy TTL renewal (extend_ttl(&dk, MIN_BUMP_THRESHOLD, PERSISTENT_BUMP_TARGET)) to all scalar accessors: get_u128/get_u128_batch/set_u128/set_u128_config/get_u128_cached/apply_delta_to_u128/increment_u128/decrement_u128/get_i128/set_i128/apply_delta_to_i128/get_address/set_address/get_bool/set_bool/get_bytes32/set_bytes32, closing archival gap for market definition keys.

…rkets#579)

Admin-gated setter to repoint stored oracle address, mirroring
deposit_handler/order_handler/withdrawal_handler. Rejects no-op and
copy-paste mistakes (current contract or other instance addresses) and
emits orcl_set event for audit trail.
Remove PriceTooHigh and UnauthorizedPositionManager from order_handler,
NoKeepers from oracle, and Unauthorized from reader. Variants were
declared but never raised, polluting ABI; either wire or remove per
suggested fix.
Require caller auth and CONTROLLER role for deposit_vault and
withdrawal_vault record_transfer_in, mirroring transfer_out. Update
deposit_handler call sites to pass handler address as caller. Prevents
front-running that strands deposits by zeroing delta before
create_deposit.
Apply lazy TTL renewal (extend_ttl with MIN_BUMP_THRESHOLD /
PERSISTENT_BUMP_TARGET) on every read/write for u128/i128/address/
bool/bytes32 accessors and their delta/increment variants. Prevents
archival of market config keys written once at create_market and
silently consumed on every operation.
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@infimum90 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@abayomicornelius
abayomicornelius merged commit 46c5773 into SO4-Markets:main Sep 1, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment