Skip to content

feat: LVGA payout bridge + stable-value (stability-vault) variant - #60

Draft
tiero wants to merge 1 commit into
masterfrom
claude/lvga-bridge-stability
Draft

feat: LVGA payout bridge + stable-value (stability-vault) variant#60
tiero wants to merge 1 commit into
masterfrom
claude/lvga-bridge-stability

Conversation

@tiero

@tiero tiero commented Jul 25, 2026

Copy link
Copy Markdown
Member

Summary

The LVGA productization layer of the cross-chain bridging work: a merchant-payment bridge-out from Arkade to a SwissLedger (EVM) LVGA liquidity pool, plus a stable-value variant that backs the spending balance with a Bitcoin-collateralized, oracle-marked CHF claim.

Split out from the general bridge research (#56) so this PR is just the LVGA-specific pieces. Depends on nothing from #56 — the contracts use only primitives already on master.

Contracts

  • examples/bridge/wlvga_payout.ark (WlvgaPayout) — the Arkade payout leg, two modes:

    • payOut() (two parties, default) — transfer the BTC-backed wLVGA claim to the LVGA liquidity provider (LP), so the LP is compensated in BTC for the LVGA it releases. LVGA is transfer-restricted / one-way (never redeemed for wLVGA), so the BTC side and the LP can be distinct entities.
    • burnOut() (same party) — burn the wLVGA; only solvent when the LP also received the BTC at mint (integrated market maker).
    • Both authorize the payee with the merchant's secp256k1 key via checkSigFromStack (mirrored by ecrecover on the pool) and pin an OP_RETURN commitment protocolTag ‖ merchantEvmAddr ‖ num2bin(amount, 8); replay bounded by burnNonce.
  • examples/bridge/swissledger_pool.md — spec for the EVM pool contract that auto-releases LVGA (Flavor A: a trusted reporter attests the burn; ecrecover + whitelist + paid[nonce] keep it contained to liveness, not correctness). Includes byte layout, the little-endian / recoverable-ECDSA integration notes, and a reference Solidity sketch.

  • examples/stability/stability_lvga_payout.ark (StabilityPayout) — stable-value variant. seekerPayout() settles a BTC-collateralized, oracle-marked CHF claim directly as a merchant LVGA payment: verifies the CHF/BTC oracle price and the merchant invoice, routes the seeker's BTC entitlement to the LP, and commits payoutCHF. The merchant receives a stable amount regardless of BTC moves; price risk sits with the vault provider, not the bridge. Set lpPk = providerPk for a single delta-neutral market maker.

  • examples/bridge/lvga_bridge.md — overview doc tying the flow together.

Design notes

  • One key, two chains. A single merchant secp256k1 key is verified by checkSigFromStack on Arkade and ecrecover on the EVM pool over the same message.
  • Correct economics for transfer-restricted LVGA. LVGA never round-trips, so the LP's compensation is the BTC-backed claim (payOut transfer), and the CHF/BTC exposure is isolated in the stability vault's funded provider role — not dumped on the bridge or the user.
  • pubkey/signature stay strictly inside checkSigFromStack, so hashed/committed fields concat via OP_CAT and the digest matches off-chain signing and the EVM reconstruction byte-for-byte.

Testing

  • tests/examples/wlvga_payout.rs (5) + tests/examples/stability_lvga_payout.rs (4).
  • cargo fmt --check clean; full examples suite green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ttf3oxgKCxBsYWJrQYfUfE


Generated by Claude Code

Merchant-payment bridge-out from Arkade to a SwissLedger (EVM) LVGA
liquidity pool. Separated from the general bridge research so this PR is
just the LVGA productization.

examples/bridge/wlvga_payout.ark (WlvgaPayout) — two modes:
- payOut() (two parties, default): transfer the BTC-backed wLVGA claim to
  the LVGA liquidity provider so it is compensated in BTC for the LVGA it
  releases (LVGA is transfer-restricted / one-way, never redeemed for wLVGA),
  letting the BTC side and the LP be distinct entities.
- burnOut() (same party): burn the wLVGA; only solvent when the LP also took
  the BTC at mint (integrated market maker).
Both authorize the payee with the merchant's secp256k1 key via
checkSigFromStack (mirrored by ecrecover on the pool) and pin an OP_RETURN
commitment protocolTag || merchantEvmAddr || num2bin(amount, 8); replay
bounded by burnNonce. pubkey/signature stay inside checkSigFromStack so the
committed/hashed fields concat via OP_CAT.

examples/bridge/swissledger_pool.md — spec for the EVM pool contract that
auto-releases LVGA (Flavor A: trusted reporter attests the burn; ecrecover +
whitelist + paid[nonce] contain it to liveness). Byte layout, the LE/ECDSA
integration notes, and a reference Solidity sketch.

examples/stability/stability_lvga_payout.ark (StabilityPayout) — stable-value
variant: a BTC-collateralized, oracle-marked CHF claim settled directly as a
merchant LVGA payment. seekerPayout() verifies the CHF/BTC oracle price and
the merchant invoice, routes the seeker's BTC entitlement to the LP, and
commits payoutCHF. Price risk lives with the vault provider, not the bridge.
Set lpPk = providerPk for a single delta-neutral market maker.

examples/bridge/lvga_bridge.md — overview doc tying the flow together.

Tests: wlvga_payout (5) + stability_lvga_payout (4). cargo fmt clean; full
examples suite green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ttf3oxgKCxBsYWJrQYfUfE
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2b018921-60c7-4c05-8c4b-d15edbeac1c4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/lvga-bridge-stability

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Playground Preview

A live preview of this PR's playground is available at:
https://arkade-os.github.io/compiler/pr-previews/pr-60/

Built from commit 6f726a20f62bae8ea0023cddd686a70212fc9360 · Workflow run

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