feat: LVGA payout bridge + stable-value (stability-vault) variant - #60
feat: LVGA payout bridge + stable-value (stability-vault) variant#60tiero wants to merge 1 commit into
Conversation
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
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Playground PreviewA live preview of this PR's playground is available at:
|
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).checkSigFromStack(mirrored byecrecoveron the pool) and pin an OP_RETURN commitmentprotocolTag ‖ merchantEvmAddr ‖ num2bin(amount, 8); replay bounded byburnNonce.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 commitspayoutCHF. The merchant receives a stable amount regardless of BTC moves; price risk sits with the vault provider, not the bridge. SetlpPk = providerPkfor a single delta-neutral market maker.examples/bridge/lvga_bridge.md— overview doc tying the flow together.Design notes
checkSigFromStackon Arkade andecrecoveron the EVM pool over the same message.payOuttransfer), and the CHF/BTC exposure is isolated in the stability vault's funded provider role — not dumped on the bridge or the user.pubkey/signaturestay strictly insidecheckSigFromStack, so hashed/committed fields concat viaOP_CATand 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 --checkclean; full examples suite green.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ttf3oxgKCxBsYWJrQYfUfE
Generated by Claude Code