Skip to content

fix(alex-monitor): set min-alex-out before every live execution attempt - #99

Open
mattglory wants to merge 1 commit into
mainfrom
fix-alex-monitor-min-alex-out
Open

mattglory wants to merge 1 commit into
mainfrom
fix-alex-monitor-min-alex-out

Conversation

@mattglory

Copy link
Copy Markdown
Owner

Summary

`alex-arb-receiver-v5` requires `min-alex-out` set fresh before every call — it auto-resets to 0 after every successful execution, specifically to force re-calibration rather than silently reusing a stale slippage value. `monitor-alex-arb.mjs`'s `executeAlexArb` never called `set-min-alex-out` at all.

Checked the live on-chain state before fixing, not assumed: `min-alex-out` is currently `6,890,524,177,442`, a leftover value from some earlier setup with no relation to this script's current 10 STX test loan (which quotes ~697 ALEX, ~69.7 billion raw units — two orders of magnitude below the stale threshold). Flipping `EXECUTE=true` as the script stood would not have reverted cleanly at the `ERR-MIN-ALEX-UNSET` guard as expected — the stale nonzero value would pass that check, then Leg 1's own swap would fail its slippage floor against the real quote, burning the ~0.3 STX gas estimate on a guaranteed-to-fail transaction every time a profitable opportunity was actually detected.

Fix

Computes `min-alex-out` as 1% below the same quote the scan already fetched, and broadcasts it as a separate transaction immediately before the flash-loan call, both signed by the same wallet — confirmed live to be `alex-arb-receiver-v5`'s actual `contract-owner` (`SPR9PQAN...`), so it has permission to call this.

Not included

Restarted the background monitor with the fix; still dry-run by default. No live execution happened or was recommended without this fix landing first.

🤖 Generated with Claude Code

alex-arb-receiver-v5 requires min-alex-out set fresh before each call --
it auto-resets to 0 after every successful execution, specifically to
force re-calibration rather than silently reusing a stale slippage
value. monitor-alex-arb.mjs's executeAlexArb never called
set-min-alex-out at all.

Checked the live on-chain state before fixing, not assumed: min-alex-out
is currently 6,890,524,177,442, a leftover value from some earlier setup
with no relation to this script's current 10 STX test loan (which quotes
~697 ALEX, ~69.7 billion raw units -- two orders of magnitude below the
stale threshold). Flipping EXECUTE=true as the script stood would not
have reverted cleanly at the ERR-MIN-ALEX-UNSET guard as expected --
the stale nonzero value would pass that check, then Leg 1's own swap
would fail its slippage floor against the real quote, burning the ~0.3
STX gas estimate on a guaranteed-to-fail transaction every time a
profitable opportunity was detected.

Fix computes min-alex-out as 1% below the same quote the scan already
fetched, and broadcasts it as a separate transaction immediately before
the flash-loan call, both signed by the same wallet -- confirmed live
to be alex-arb-receiver-v5's actual contract-owner (SPR9PQAN...), so it
has permission to call this.

Restarted the background monitor with the fix; still dry-run by default,
no live execution without an explicit EXECUTE=true decision.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
web Ready Ready Preview Oct 10, 2026 10:32am UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview — 99f16a63 Deployed Oct 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant