5 Commits
Author SHA1 Message Date
zeekay 687b9086a3 feat(swap): native-LUX HTLC locks are live (no gate, no mint)
The precompile previously gated native (asset == address(0)) behind
ErrNativeUnsupported, claiming it could not read msg.value. That was wrong:
the EVM moves msg.value into the precompile address BEFORE Run, so native is
handled by the exact observed-balance idiom dex/settle_custody.go already
uses. Native is now a first-class asset, fully symmetric to ERC-20:

- lock: delivered = GetBalance(swapAddr) - reserve[native]; require == amount
  exactly (rejects value==0, short, and over-delivery — the native analog of
  the ERC-20 transferFrom-delta in pullExact). Never mints; the value was
  moved by the caller's frame.
- claim/refund: real SubBalance(swapAddr)/AddBalance(to) via the single payOut
  dispatcher, underflow-guarded (SubBalance is uint256-modular from a
  precompile). Conservation balanceOf(swapAddr) == reserve[asset] holds for
  native exactly as for ERC-20.

No interface change, no new capability — uses contract.StateDB's existing
GetBalance/Add/SubBalance. ErrNativeUnsupported removed. LXSwapHTLC.sol doc
corrected (both legs custody native symmetrically). go test -race ./swap/...
green (21 tests incl. native lock/claim/refund + conservation).
2026-06-26 04:38:52 +00:00
zeekay 81bbd139f2 feat(swap): EVM counterparty HTLC contract (LXSwapHTLC.sol)
The off-Lux mirror of the LP-90A0 swap precompile, deployable on any EVM
chain that is not Lux (Ethereum, an L2). Bound to the precompile leg ONLY
by a shared SHA-256 hashlock: one 32-byte preimage claims both legs, so
revealing it on one chain exposes it for the counterparty on the other.

Mirrors the precompile bit-for-bit — SHA-256 hashlock, 32-byte preimage,
exact-delta ERC-20 pull (rejects fee-on-transfer), disjoint claim/refund
windows, effects-before-interaction under a non-reentrant guard, no owner /
pause / mint / upgrade selector (non-custody is structural). Adds native-ETH
custody via msg.value, the precompile's gated case (ErrNativeUnsupported).

Compiles clean under solc 0.8.24 (zero warnings).
2026-06-26 04:08:12 +00:00
zeekay 43e545450a chore: use Lux-native naming for the DEX core/EVM-adapter model
Rename the mock external perps venue in the integration test to a neutral
name and reword NatSpec/docs to Lux's own terms (native HFT surface,
single-entrypoint execute() dispatch, robust index methodology).
Behavior-preserving: integration test passes; no ABI changes.
2026-06-22 16:07:29 -07:00
zeekay 1b219d33bc chore: update deps, fix node/vms to vm/vms imports, remove stub files 2026-01-09 08:48:29 +00:00
zeekay 128f9ab66d feat: add DEX precompile Solidity interfaces
IPoolManager, IHooks, IERC20Minimal, Types for Uniswap v4-style DEX
2025-12-25 16:57:33 +00:00