mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-06-02 15:20:01 +00:00
30 lines
855 B
Rust
30 lines
855 B
Rust
|
|
pub use nssa_core::program::PdaSeed;
|
||
|
|
use nssa_core::{account::AccountId, program::ProgramId};
|
||
|
|
use serde::{Deserialize, Serialize};
|
||
|
|
|
||
|
|
const BRIDGE_SEED_DOMAIN_SEPARATOR: [u8; 32] = *b"/LEZ/v0.3/BridgeSeed/0000000000/";
|
||
|
|
|
||
|
|
#[derive(Serialize, Deserialize)]
|
||
|
|
pub enum Instruction {
|
||
|
|
/// Transfers native tokens from the bridge PDA account to a recipient vault.
|
||
|
|
///
|
||
|
|
/// Required accounts (2):
|
||
|
|
/// - Bridge PDA account
|
||
|
|
/// - Recipient vault PDA account
|
||
|
|
Deposit {
|
||
|
|
vault_program_id: ProgramId,
|
||
|
|
recipient_id: AccountId,
|
||
|
|
amount: u128,
|
||
|
|
},
|
||
|
|
}
|
||
|
|
|
||
|
|
#[must_use]
|
||
|
|
pub const fn compute_bridge_seed() -> PdaSeed {
|
||
|
|
PdaSeed::new(BRIDGE_SEED_DOMAIN_SEPARATOR)
|
||
|
|
}
|
||
|
|
|
||
|
|
#[must_use]
|
||
|
|
pub fn compute_bridge_account_id(bridge_program_id: ProgramId) -> AccountId {
|
||
|
|
AccountId::for_public_pda(&bridge_program_id, &compute_bridge_seed())
|
||
|
|
}
|