Skip to content

Latest commit

 

History

History
34 lines (27 loc) · 1.6 KB

File metadata and controls

34 lines (27 loc) · 1.6 KB

^ back to docs

LI.FI Solana Program 1

This program is used by LI.FI primarily to track on-chain transactions generated using the LI.FI backend/API.

Building

To build the program via cargo: cargo build-sbf --manifest-path=./program/Cargo.toml --sbf-out-dir=./program/target/so

To build the program via https://github.com/Ellipsis-Labs/solana-verifiable-build?tab=readme-ov-file#solana-verify-cli: solana-verify build ./program

Testing

To run the program tests: cargo test --manifest-path=./program/Cargo.toml


Instructions

The program supports the following instructions:

TrackV1 - Track a transaction on-chain

Source Code: src/instructions/track_v1.rs

  • Inputs:
    • Accounts:
      1. sysvar_clock_account - The clock sysvar account on Solana.
      2. instruction_track_account - The program derived account (PDA) corresponding to the current or previous epoch. (used to bundle transactions by epoch to facilitate tracking)
    • Data:
      1. transaction_id : Uint8Array (8 bytes) - The unique identifier used to track the transaction, generated by the LI.FI backend/API.
  • Logic:
    1. Check account inputs for validity
      1. Check if the first account's public key is readonly and matches the clock sysvar account
      2. Check if the second account's public key is readonly and matches the PDA of either the current or previous epoch
    2. Hex-encode the transaction_id into a string and log it to stdout, using solana_program::log::sol_log, in the format "LI.FI TX: 0xabcd1234"