Skip to content

Feature/hk stx bitflow receiver v1 - #23

Merged
mattglory merged 1 commit into
mattglory:mainfrom
unixwhisperer:feature/hk-stx-bitflow-receiver-v1
Aug 25, 2026
Merged

Feature/hk stx bitflow receiver v1#23
mattglory merged 1 commit into
mattglory:mainfrom
unixwhisperer:feature/hk-stx-bitflow-receiver-v1

Conversation

@unixwhisperer

Copy link
Copy Markdown
Contributor

Description

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • 🧪 Test addition or improvement
  • 🔧 Refactoring (no functional changes)
  • 🎨 Style/formatting changes
  • ⚡ Performance improvement

Related Issues

Fixes #
Related to #

Changes Made

Testing Performed

Manual Testing

  • Tested locally with clarinet check
  • Tested in clarinet console
  • Tested specific edge cases

Automated Testing

  • All existing tests pass
  • Added new tests for changes
  • Tests cover edge cases

Test Commands Run

# List the commands you ran to test
clarinet check
clarinet console3

Test Results

# Paste test output here

Checklist

Code Quality

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Documentation

  • I have updated the documentation accordingly
  • I have updated the README.md (if needed)
  • I have added/updated code comments
  • I have updated the CHANGELOG.md

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested edge cases
  • I have tested error conditions

Security & Safety

  • My changes don't introduce security vulnerabilities
  • I haven't committed any secrets or sensitive data
  • I've considered the impact on existing users
  • I've followed Clarity best practices

Screenshots (if applicable)

Additional Context

Deployment Considerations

  • Requires contract deployment
  • Requires data migration
  • Requires configuration changes
  • Backward compatible

@vercel

vercel Bot commented Jun 5, 2026

Copy link
Copy Markdown

@unixwhisperer is attempting to deploy a commit to the matt glory's projects Team on Vercel.

A member of the Team first needs to authorize it.

@mattglory mattglory left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Hillary — contract and docs review both approved. Two requests before merge: (1) please remove the .beads/ directory — it's your personal tooling and doesn't belong in the main repo. (2) The session handoff files under project-docs/session-handoffs/ are your internal working docs — happy to keep if you want them on record, but flag if you'd prefer they stay off main. Once cleaned up this is ready to merge. The docs-feedback-report findings are exactly what the protocol needs.

mattglory added a commit that referenced this pull request Jul 28, 2026
External-integrator feedback (PR #23) surfaced 4 real DX bugs; fixed all:
- Sugar trap: warn that in-repo examples use .flashstack-stx-core sugar
  (resolves to deployer address) — external deploys must use absolute principals
- Seed requirement: new 'Do You Need a Seed?' section — a 0-balance receiver
  can't cover the fee+slippage on a break-even strategy
- Read-only gotcha: show how to write estimate-repayment; a define-constant
  core principal is rejected inside define-read-only (must inline the literal)
- clarinet check coverage: clarify it only type-checks contracts in Clarinet.toml,
  not script-deployed receivers

Also strips the false 'first flash loan protocol' claim (Zest predates on Stacks)
from INTEGRATION_GUIDE, package.json, CONTRIBUTING; scopes CHANGELOG 'first' to
FlashStack's own milestones.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mattglory

Copy link
Copy Markdown
Owner

Update: the 4 findings in your docs-feedback-report.md are now fixed on main (c9139b9) — thank you, these were spot on:

  • The .flashstack-stx-core sugar trap is now called out in BUILD_A_RECEIVER.md (rule 5) + INTEGRATION_GUIDE.md — external deploys are told to use absolute principals.
  • New "Do You Need a Seed?" section documents that a 0-balance receiver can't cover fee + slippage.
  • Step 3 now shows how to write the estimate-repayment read-only, including the define-constant-inside-define-read-only rejection and the inline-literal fix.
  • README + BUILD_A_RECEIVER now clarify clarinet check only covers contracts in Clarinet.toml.

To land this PR (recapping + a couple additions):

  1. Remove .beads/ — personal tooling (config, git hooks, metadata) and the two .beads/ lines it added to .gitignore. AGENTS.md is in the same bucket.
  2. project-docs/session-handoffs/ — your call: fine to keep on record, or drop if you'd rather they stay off main.

Two optional, non-blocking suggestions for the contract itself:

  1. Make it CI-checkable: add hk-stx-bitflow-receiver-v1 to Clarinet.toml (declaring the mainnet contracts it calls as [[project.requirements]]) + a small negative test asserting execute-stx-flash reverts u403 when contract-caller != core. Then clarinet check actually validates it — closing the exact coverage gap you flagged.
  2. Protect your own seed: the receiver uses u1 min-outs with no arm/TTL guard, so once whitelisted, anyone can trigger the round-trip and sandwich-bleed the seed (no protocol risk — just your funds). Consider the owner-armed, one-shot, real-min-out pattern from deepstack-rebalance-receiver if you'll run it unattended.

Great work — real integrator feedback that made the protocol better.

… receiver

External-developer flash-loan receiver that borrows STX from
flashstack-stx-core, executes a real STX->stSTX->STX round-trip on the
Bitflow stableswap pool, and repays principal + fee atomically.

Combines the contract-caller gate from hk-stx-real-receiver-v2 with the
Bitflow round-trip logic from bitflow-arb-receiver-v4. Deployed under an
external wallet, so all cross-contract references use absolute mainnet
principals.
@unixwhisperer
unixwhisperer force-pushed the feature/hk-stx-bitflow-receiver-v1 branch from 1003bb9 to 42a9f6a Compare August 25, 2026 17:19
@mattglory
mattglory merged commit a68f548 into mattglory:main Aug 25, 2026
5 of 6 checks passed
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.

2 participants