Developers
Cross-chain with LayerZero V2
How EVM Locks reach the Solana ledger and back.
simETH vault · PositionVaultsimHYPE vault · PositionVaultOAppGemas · Advances · Matches · BackingsLocks stay on their home chains while Gemas, Advances, Matches and Backings live on Solana, so four messages cross chains. They travel over LayerZero V2, which reaches all three chains with managed relaying, rather than a relayer run by Tesoro.
The four messages
| # | Message | Direction | Effect |
|---|---|---|---|
| 1 | PositionLocked | EVM vault to Solana | A Lock (the on-chain Position) now exists: owner, LST, locked amount, length. The bridge applies it to tesoro_core. |
| 2 | YieldAccrued(cumulative) | EVM vault to Solana | Cumulative yield. tesoro_core pays back the Advance first; the rest is free yield. Applied once per sequence. |
| 3 | Unlock | Solana to EVM vault | Nothing is left to pay back and the owner unlocked: the vault releases the locked amount to the owner. |
| 4 | PayYield(to, amount) | Solana to EVM vault | A holder redeemed Gemas from this Lock: the vault pays that amount in LST shares, never more than accrued yield. |
Wire format (identical in Solidity and Rust, abi.encodePacked, big-endian): header msgType u8 | sourceChain u32 (eid) | positionId bytes32 | seq u64 (45 bytes), then the body. The positionId is the vault address (20 bytes), the vault's Lock id (u64) and 4 zero bytes, so two vaults on one chain never collide and a vault can speak only for its own Locks. Every handler is idempotent per sequence number.
Pieces
| Piece | Role |
|---|---|
PositionVaultOApp | A PositionVault that is a LayerZero OApp. openPosition sends PositionLocked, reportYield sends YieldAccrued (cumulative yield and the vault Treasury's cumulative credits, 77 bytes), and _lzReceive feeds Unlock, PayYield and PayInstant to the vault. The vault reports and pays the whole yield; Solana works out the Yield Fee for each cash-out and names the split in the PayYield message. |
tesoro_bridge | Solana OApp: an inbox for inbound facts, permissionless CPIs into tesoro_core, permissionless outbound sends. |
SourceAuthority | A tesoro_core PDA per source chain naming the signer allowed to report PositionLocked and YieldAccrued. The bridge authority PDA is registered for Ethereum and HyperEVM, so an Ethereum authority cannot touch a HyperEVM Lock. |
Flow and who pays
- Link, once. The Account's Solana wallet calls
tesoro_bridge::link_evmwith an EIP-191 signature from the EVM wallet overTesoro: link EVM address to Account <TesoroAccount PDA>. The bridge recovers the signer on chain withsecp256k1_recover, so nobody can claim someone else's address. - Inbox record. Anyone creates the record with
init_position(eid, positionId)before the message (about 0.003 SOL), because the default executors cap the native drop to Solana at 0 and rent cannot be paid insidelz_receive. - openPosition(lstAmount, months). The caller pays the LayerZero fee in the chain's native coin (the app reads
quotePositionLocked()and adds about 20%; the excess is refunded). - apply_locked. Permissionless: the bridge CPIs
open_position_from_source, signed by its PDA.PeerConfigper vault supplies decimals and rate. The locked amount must fitu64, so up to about 18 ETH; the vault refuses larger deposits. - Advance. The oracle path in tesoro_core: the owner and the oracle co-sign, the oracle supplies the issuance price.
- reportYield, then apply_yield, only when an action needs it. Nothing reports in the background. Redeem, Redeem now and Unlock first ask the vault for a report (the app does it for the Player; anyone may), wait until
apply_yieldhas applied it on Solana, then continue. The vault computes its Accrued Yield on the spot, so the figure includes everything earned up to that block. - Redeem. The holder calls
tesoro_bridge::redeem_to_evm, which CPIsredeem_from_sourceand records the units in aClaim. Anyone then callssend_pay_yield, which advancesunits_sentin the same transaction so a unit is paid once. Plainredeemrefuses EVM-sourced Sources. - Redeem now. The holder calls
tesoro_bridge::instant_redeem_to_evm, which moves their won Gemas to Tesoro's Treasury Account and pays 60% of their value (after the Yield Fee and the Instant Redeem Fee). The bridge keeps a mirror of each vault's Treasury (VaultTreasury) and refuses a payout the vault has not reported funds for (the vault's balance at its latest report, less payouts recorded since). Anyone then callssend_pay_instant(message type 12), and the vault pays from its Treasury. To refill, the Treasury Account redeems the Gemas it bought as the yield lands (redeem_treasury_to_evm) and aPayYieldto the vault's own address books the proceeds into its Treasury. - Unlock. After
tesoro_core::unlock, anyone callssend_unlock. Yield still owed to redeemers stays in the vault. Unlock and every Redeem to ETH or HYPE pay a flat Delivery Fee, in the asset the Player receives, for the cross-chain send;DeliveryTermsholds it and the vault never takes more than a tenth of a payout.
lz_receive deliberately only records the fact: its account list is derived from the message alone and cannot include the Account, the open Source or rent-funded accounts. Applying is a second, permissionless transaction.
Endpoints and latency
| Chain | Chain id | LayerZero eid | Observed delivery |
|---|---|---|---|
| Solana | n/a | 40168 | Solana to Ethereum about 4 to 5 minutes |
| Ethereum | 560048 | 40449 | Ethereum to Solana about 2 minutes |
| HyperEVM | 998 | 40362 | Both directions delivered in roughly 40 to 80 seconds |
The default pathway configuration uses LayerZero Labs as the single required DVN. Fees seen: about 0.0001 ETH per Ethereum send, about 0.0074 HYPE per HyperEVM send (so a wallet needs roughly 0.02 HYPE to open a Lock), and about 0.0003 SOL per Solana send.
Failure behaviour
- Vaults record each sequence as handled, so messages can arrive in any order without stranding an Unlock or PayYield.
- A PayYield larger than the vault's accrued yield reverts, and a reverted receive rolls back its handled mark, so LayerZero can retry it once yield catches up.
- The vault always caps a payout at its own accrued yield, so a lying DVN could report false yield but could not drain the locked amount through PayYield.