Skip to content

Commit 31df2e2

Browse files
committed
doc: add documentation for all processors
1 parent c9a0047 commit 31df2e2

34 files changed

+519
-222
lines changed

e-token/src/processor/allocate_transfer_queue.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,21 @@ use crate::assert_owner;
88

99
pub const MAX_ITEMS_PER_REALLOC: usize = 10_240 / item_len();
1010

11+
///
12+
/// Executes on:
13+
///
14+
/// Accounts:
15+
///
16+
/// 0: [writable] - PDA : Transfer queue account (PDA derived from [QUEUE_SEED, mint, validator]).
17+
/// 1: [] - Builtin : System program.
18+
///
19+
/// Instruction Data: None
20+
///
1121
#[inline(always)]
1222
pub fn process_allocate_transfer_queue(
1323
accounts: &[AccountView],
1424
_instruction_data: &[u8],
1525
) -> ProgramResult {
16-
// Expected accounts:
17-
// 1. [writable] Transfer queue account (PDA derived from [QUEUE_SEED, mint, validator])
18-
// 2. [] System program
19-
2026
let [queue_info, _system_program_info, ..] = accounts else {
2127
return Err(ProgramError::NotEnoughAccountKeys);
2228
};

e-token/src/processor/close_ephemeral_ata.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,22 @@ use pinocchio::{address::address_eq, error::ProgramError, AccountView, ProgramRe
33

44
use crate::{assert_owner, assert_signer};
55

6+
///
7+
/// Executes on:
8+
///
9+
/// Accounts:
10+
///
11+
/// 0: [signer] - Any : Owner of the ephemeral ATA.
12+
/// 1: [writable] - PDA : Ephemeral ATA account (PDA derived from [owner, mint]).
13+
/// 2: [writable] - Any : Recipient account for rent refund.
14+
///
15+
/// Instruction Data: None
16+
///
617
#[inline(always)]
718
pub fn process_close_ephemeral_ata(
819
accounts: &[AccountView],
920
_instruction_data: &[u8],
1021
) -> ProgramResult {
11-
// Expected accounts:
12-
// 0. [signer] Owner of the ephemeral ATA
13-
// 1. [writable] Ephemeral ATA account (PDA [owner, mint])
14-
// 2. [writable] Recipient account for rent refund
1522
let [owner_info, ephemeral_ata_info, recipient_info, ..] = accounts else {
1623
return Err(ProgramError::NotEnoughAccountKeys);
1724
};

e-token/src/processor/close_lamports_pda_intent.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@ use crate::{
99

1010
const DLP_EPHEMERAL_BALANCE_TAG: &[u8] = b"balance";
1111

12+
///
13+
/// Executes on:
14+
///
15+
/// Accounts:
16+
///
17+
/// 0: [writable] - PDA : Rent PDA account.
18+
/// 1: [writable] - PDA : Lamports PDA account.
19+
/// 2: [] - Any : Payer / original authority used in PDA derivation.
20+
/// 3: [] - Any : Destination account.
21+
/// 4: [] - Any : Escrow authority.
22+
/// 5: [signer] - PDA : Escrow signer PDA.
23+
///
24+
/// Instruction Data: escrow_index (u8) + salt ([u8; 32])
25+
///
1226
#[inline(never)]
1327
pub fn process_close_lamports_pda_intent(
1428
accounts: &[AccountView],

e-token/src/processor/close_shuttle_ata_intent.rs

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,26 @@ use pinocchio::{error::ProgramError, AccountView, ProgramResult};
1212
use pinocchio_token_2022::instructions::CloseAccount;
1313
const DLP_EPHEMERAL_BALANCE_TAG: &[u8] = b"balance";
1414

15-
/// Post-undelegate handler that first withdraws any remaining shuttle EATA
16-
/// balance through the shared vault flow, then closes shuttle wallet ATA,
17-
/// shuttle EATA, and shuttle metadata, refunding rent to the stored payer.
1815
///
19-
/// Expected accounts:
20-
/// 0. [writable] Shuttle rent reimbursement account (must equal `ShuttleMetadata.payer`)
21-
/// 1. [writable] Shuttle metadata account
22-
/// 2. [writable] Shuttle EATA account (PDA [shuttle_metadata, mint])
23-
/// 3. [writable] Shuttle wallet ATA account
24-
/// 4. [writable] Destination token account
25-
/// 5. [] Mint account
26-
/// 6. [] Global Vault account
27-
/// 7. [writable] Vault source token account
28-
/// 8. [] Token program account
29-
/// 9. [] Source program (must equal this program)
30-
/// 10. [] Escrow authority
31-
/// 11. [signer] Escrow signer PDA
16+
/// Executes on:
17+
///
18+
/// Accounts:
19+
///
20+
/// 0: [writable] - Any : Shuttle rent reimbursement account (must equal `ShuttleMetadata.payer`).
21+
/// 1: [writable] - PDA : Shuttle metadata account.
22+
/// 2: [writable] - PDA : Shuttle EATA account (PDA derived from [shuttle_metadata, mint]).
23+
/// 3: [writable] - SPL : Shuttle wallet ATA account.
24+
/// 4: [writable] - SPL : Destination token account.
25+
/// 5: [] - SPL : Mint account.
26+
/// 6: [] - PDA : Global vault account.
27+
/// 7: [writable] - SPL : Vault source token account.
28+
/// 8: [] - SPL : Token program account.
29+
/// 9: [] - Program : Source program (must equal this program).
30+
/// 10: [] - Any : Escrow authority.
31+
/// 11: [signer] - PDA : Escrow signer PDA.
32+
///
33+
/// Instruction Data: escrow_index (u8)
34+
///
3235
pub fn process_close_shuttle_ata_intent(
3336
accounts: &[AccountView],
3437
instruction_data: &[u8],

e-token/src/processor/create_ephemeral_ata_permission.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,24 @@ use pinocchio::{address::address_eq, error::ProgramError, AccountView, ProgramRe
1010

1111
use crate::assert_signer;
1212

13+
///
14+
/// Executes on:
15+
///
16+
/// Accounts:
17+
///
18+
/// 0: [writable] - PDA : Ephemeral ATA account (PDA derived from [owner, mint]).
19+
/// 1: [writable] - PDA : Permission PDA (derived from ["permission:", ephemeral_ata]).
20+
/// 2: [signer] - Keypair : Payer (must match the Ephemeral ATA owner).
21+
/// 3: [] - Builtin : System program.
22+
/// 4: [] - Program : Permission program (ACL).
23+
///
24+
/// Instruction Data: CreateEphemeralAtaPermission
25+
///
1326
#[inline(always)]
1427
pub fn process_create_ephemeral_ata_permission(
1528
accounts: &[AccountView],
1629
instruction_data: &[u8],
1730
) -> ProgramResult {
18-
// Expected accounts:
19-
// 0. [writable] Ephemeral ATA account (PDA derived from [owner, mint]) - signer via seeds
20-
// 1. [writable] Permission PDA (derived from ["permission:", ephemeral_ata])
21-
// 2. [signer] Payer (must match Ephemeral ATA owner)
22-
// 3. [] System program
23-
// 4. [] Permission program (ACL)
24-
25-
// Instruction data:
26-
// [0] MemberFlags bitfield encoded via MemberFlags::to_acl_flag_byte.
2731
let args = CreateEphemeralAtaPermission::try_from_bytes(instruction_data)?;
2832

2933
let [ephemeral_ata_info, permission_info, payer_info, system_program, permission_program, ..] =

e-token/src/processor/delegate_ephemeral_ata.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,26 @@ use ephemeral_rollups_pinocchio::types::DelegateConfig;
33
use ephemeral_spl_api::state::{ephemeral_ata::EphemeralAta, load_initialized};
44
use pinocchio::{error::ProgramError, AccountView, Address, ProgramResult};
55

6+
///
7+
/// Executes on:
8+
///
9+
/// Accounts:
10+
///
11+
/// 0: [signer] - Keypair : Payer (seed used to derive the Ephemeral ATA PDA).
12+
/// 1: [writable] - PDA : Ephemeral ATA account (PDA derived from [payer, mint]).
13+
/// 2: [] - Program : Owner program.
14+
/// 3: [writable] - PDA : Buffer account.
15+
/// 4: [writable] - PDA : Delegation record account.
16+
/// 5: [writable] - PDA : Delegation metadata account.
17+
/// 6: [] - Program : Delegation program.
18+
/// 7: [] - Builtin : System program.
19+
///
20+
/// Instruction Data: DelegateArgs
21+
///
622
pub fn process_delegate_ephemeral_ata(
723
accounts: &[AccountView],
824
instruction_data: &[u8],
925
) -> ProgramResult {
10-
// Expected accounts (in order used below):
11-
// 0. [signer] Payer (seed used to derive Ephemeral ATA PDA)
12-
// 1. [writable] Ephemeral ATA account (PDA derived from [payer, mint]) - signer via seeds
13-
// 2. [] Owner program (the program owning the delegated PDA)
14-
// 3. [writable] Buffer account (used by the delegation program)
15-
// 4. [writable] Delegation record account
16-
// 5. [writable] Delegation metadata account
17-
// 6. [] Delegation program
18-
// 7. [] System program
19-
2026
let args = DelegateArgs::try_from_bytes(instruction_data)?;
2127

2228
let [payer_info, ephemeral_ata_info, owner_program, buffer_acc, delegation_record, delegation_metadata, _delegation_program, system_program] =

e-token/src/processor/delegate_ephemeral_ata_permission.rs

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,29 @@ use pinocchio::{
99

1010
use crate::assert_signer;
1111

12+
///
13+
/// Executes on:
14+
///
15+
/// Accounts:
16+
///
17+
/// 0: [signer] - Keypair : Payer (authority).
18+
/// 1: [writable] - PDA : Ephemeral ATA account (permissioned account).
19+
/// 2: [] - Program : Permission program (ACL).
20+
/// 3: [writable] - PDA : Permission PDA (derived from ["permission:", ephemeral_ata]).
21+
/// 4: [] - Builtin : System program.
22+
/// 5: [writable] - PDA : Delegation buffer PDA.
23+
/// 6: [writable] - PDA : Delegation record PDA.
24+
/// 7: [writable] - PDA : Delegation metadata PDA.
25+
/// 8: [] - Program : Delegation program.
26+
/// 9: [] - Any : Validator.
27+
///
28+
/// Instruction Data: None
29+
///
1230
#[inline(always)]
1331
pub fn process_delegate_ephemeral_ata_permission(
1432
accounts: &[AccountView],
1533
_instruction_data: &[u8],
1634
) -> ProgramResult {
17-
// Expected accounts:
18-
// 0. [signer] Payer (also authority)
19-
// 1. [writable] Ephemeral ATA account (PDA derived from [owner, mint]) - signer via seeds
20-
// 2. [] Permission program (ACL)
21-
// 3. [writable] Permission PDA (derived from ["permission:", ephemeral_ata])
22-
// 4. [] System program
23-
// 5. [writable] Delegation buffer PDA (derived from [permission, permission_program])
24-
// 6. [writable] Delegation record PDA
25-
// 7. [writable] Delegation metadata PDA
26-
// 8. [] Delegation program
27-
// 9. [] Validator
28-
2935
let [payer_info, ephemeral_ata_info, permission_program, permission_info, system_program, delegation_buffer, delegation_record, delegation_metadata, delegation_program, validator, ..] =
3036
accounts
3137
else {

e-token/src/processor/delegate_shuttle_ephemeral_ata.rs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,27 @@ use pinocchio::{address::address_eq, error::ProgramError, AccountView, Address,
77

88
use crate::assert_owner;
99

10+
///
11+
/// Executes on:
12+
///
13+
/// Accounts:
14+
///
15+
/// 0: [signer] - Keypair : Payer.
16+
/// 1: [] - PDA : Shuttle metadata account (PDA derived from [owner, mint, shuttle_id]).
17+
/// 2: [writable] - PDA : Shuttle EATA account (PDA derived from [shuttle_metadata, mint]).
18+
/// 3: [] - Program : Owner program.
19+
/// 4: [writable] - PDA : Buffer account.
20+
/// 5: [writable] - PDA : Delegation record account.
21+
/// 6: [writable] - PDA : Delegation metadata account.
22+
/// 7: [] - Program : Delegation program.
23+
/// 8: [] - Builtin : System program.
24+
///
25+
/// Instruction Data: DelegateShuttleArgs
26+
///
1027
pub fn process_delegate_shuttle_ephemeral_ata(
1128
accounts: &[AccountView],
1229
instruction_data: &[u8],
1330
) -> ProgramResult {
14-
// Expected accounts (in order used below):
15-
// 0. [signer] Payer
16-
// 1. [] Shuttle metadata account (PDA [owner, mint, shuttle_id])
17-
// 2. [writable] Shuttle EATA account (PDA [shuttle_metadata, mint]) - signer via seeds
18-
// 3. [] Owner program (the program owning the delegated PDA)
19-
// 4. [writable] Buffer account (used by the delegation program)
20-
// 5. [writable] Delegation record account
21-
// 6. [writable] Delegation metadata account
22-
// 7. [] Delegation program
23-
// 8. [] System program
2431
let args = DelegateShuttleArgs::try_from_bytes(instruction_data)?;
2532

2633
let [payer_info, shuttle_info, ephemeral_ata_info, owner_program, buffer_acc, delegation_record, delegation_metadata, _delegation_program, system_program, ..] =

e-token/src/processor/delegate_transfer_queue.rs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,27 @@ use pinocchio::{address::address_eq, error::ProgramError, AccountView, ProgramRe
55

66
use crate::assert_signer;
77

8+
///
9+
/// Executes on:
10+
///
11+
/// Accounts:
12+
///
13+
/// 0: [signer] - Keypair : Payer.
14+
/// 1: [writable] - PDA : Transfer queue account (PDA derived from [QUEUE_SEED, mint, validator]).
15+
/// 2: [] - SPL : Mint account.
16+
/// 3: [] - Program : Owner program (this program).
17+
/// 4: [writable] - PDA : Buffer account.
18+
/// 5: [writable] - PDA : Delegation record account.
19+
/// 6: [writable] - PDA : Delegation metadata account.
20+
/// 7: [] - Program : Delegation program.
21+
/// 8: [] - Builtin : System program.
22+
///
23+
/// Instruction Data: None
24+
///
825
pub fn process_delegate_transfer_queue(
926
accounts: &[AccountView],
1027
instruction_data: &[u8],
1128
) -> ProgramResult {
12-
// Expected accounts:
13-
// 0. [signer] Payer
14-
// 1. [writable] Transfer queue PDA derived from [QUEUE_SEED, mint, validator]
15-
// 2. [] Mint account
16-
// 3. [] Owner program (this program)
17-
// 4. [writable] Buffer account
18-
// 5. [writable] Delegation record account
19-
// 6. [writable] Delegation metadata account
20-
// 7. [] Delegation program
21-
// 8. [] System program
2229
if !instruction_data.is_empty() {
2330
return Err(ProgramError::InvalidInstructionData);
2431
}

e-token/src/processor/deposit_and_delegate_shuttle_ephemeral_ata_with_merge.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,33 @@ struct DepositAndDelegateShuttleWithMergeAccounts<'a> {
1515
pub(crate) destination_token_info: &'a AccountView,
1616
}
1717

18+
///
19+
/// Executes on:
20+
///
21+
/// Accounts:
22+
///
23+
/// 0: [signer] - Keypair : Payer.
24+
/// 1: [writable] - PDA : Rent PDA account.
25+
/// 2: [writable] - PDA : Shuttle metadata account.
26+
/// 3: [writable] - PDA : Shuttle EATA account.
27+
/// 4: [writable] - SPL : Shuttle wallet ATA account.
28+
/// 5: [signer] - Keypair : Shuttle owner.
29+
/// 6: [] - Program : Owner program.
30+
/// 7: [writable] - PDA : Buffer account.
31+
/// 8: [writable] - PDA : Delegation record account.
32+
/// 9: [writable] - PDA : Delegation metadata account.
33+
/// 10: [] - Program : Delegation program.
34+
/// 11: [] - SPL : Associated token program.
35+
/// 12: [] - Builtin : System program.
36+
/// 13: [writable] - SPL : Destination token account.
37+
/// 14: [] - SPL : Mint account.
38+
/// 15: [] - SPL : Token program.
39+
/// 16: [] - PDA : Global vault account.
40+
/// 17: [writable] - SPL : Owner source token account.
41+
/// 18: [writable] - SPL : Vault token account.
42+
///
43+
/// Instruction Data: DepositAndDelegateShuttleArgs
44+
///
1845
#[inline(never)]
1946
pub fn process_deposit_and_delegate_shuttle_ephemeral_ata_with_merge(
2047
accounts: &[AccountView],

0 commit comments

Comments
 (0)