Skip to main content

dlp_api/
consts.rs

1use pinocchio::Address;
2use solana_program::{pubkey, pubkey::Pubkey};
3
4/// The delegation session fees (extracted in percentage from the delegation PDAs rent on closure).
5pub const RENT_FEES_PERCENTAGE: u8 = 10;
6
7/// The fees extracted from the validator earnings (extracted in percentage from the validator fees claims).
8pub const PROTOCOL_FEES_PERCENTAGE: u8 = 10;
9
10/// Fixed fee per commit (charged for each commit after the first).
11pub const COMMIT_FEE_LAMPORTS: u64 = 100_000;
12
13/// Fixed fee per delegation session (0.0003 SOL).
14pub const SESSION_FEE_LAMPORTS: u64 = 300_000;
15
16/// The discriminator for the external undelegate instruction.
17pub const EXTERNAL_UNDELEGATE_DISCRIMINATOR: [u8; 8] =
18    [196, 28, 41, 206, 48, 37, 51, 167];
19
20/// The program ID of the delegation program.
21pub const DELEGATION_PROGRAM_ID: Pubkey = crate::id();
22
23/// Default validator identity (used when none is provided during delegation).
24#[cfg(not(feature = "unit_test_config"))]
25pub const DEFAULT_VALIDATOR_IDENTITY: Pubkey =
26    pubkey!("MAS1Dt9qreoRMQ14YQuhg8UTZMMzDdKhmkZMECCzk57");
27
28#[cfg(feature = "unit_test_config")]
29pub const DEFAULT_VALIDATOR_IDENTITY: Pubkey =
30    pubkey!("tEsT3eV6RFCWs1BZ7AXTzasHqTtMnMLCB2tjQ42TDXD");
31
32/// The broadcast identity marks an account as undelegatable.
33/// Validators treat it as always delegatable, which is safe since such accounts
34/// cannot be committed or delegated
35pub const BROADCAST_IDENTITY: Pubkey =
36    pubkey!("Broadcast1111111111111111111111111111111111");
37
38pub const BPF_LOADER_UPGRADEABLE_ID: Address =
39    Address::new_from_array(const_crypto::bs58::decode_pubkey(
40        "BPFLoaderUpgradeab1e11111111111111111111111",
41    ));
42
43pub const DELEGATION_PROGRAM_DATA_ID: Address = Address::new_from_array(
44    const_crypto::ed25519::derive_program_address(
45        &[crate::fast::ID.as_array()],
46        BPF_LOADER_UPGRADEABLE_ID.as_array(),
47    )
48    .0,
49);
50
51pub const RENT_EXCEPTION_ZERO_BYTES_LAMPORTS: u64 = 890880;